@import url('https://fonts.googleapis.com/css2?family=Besley:ital,wght@0,400..900;1,400..900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(ellipse at 30% 40%, #3a3a3a, #1a1a1a);
    font-family: 'Barlow Condensed', sans-serif;
}

/* Outer column: label → player → tray */
.scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* =========================================
   TRACK LABEL
   ========================================= */
.track-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #1a1a1a, #252525 50%, #1a1a1a);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 6px 16px;
    min-width: 230px;
    max-width: 300px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
}
.track-label::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(to right, transparent, rgba(192,57,43,0.6), transparent);
}
.track-label-pip {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #c0392b;
    box-shadow: 0 0 5px #c0392b;
    flex-shrink: 0;
    opacity: 0.7;
}
.track-label-text {
    flex: 1;
    text-align: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 2.5px;
    color: #ded8c8;
    text-shadow: 0 0 8px rgba(210,190,140,0.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================
   PLAYER WRAP
   ========================================= */
.player-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

/* =========================================
   MAIN BODY
   ========================================= */
.player-body {
    width: 200px;
    height: 400px;
    background: linear-gradient(115deg,
        #dcdcde 0%, #c8c8cc 15%, #d8d8dc 30%,
        #c0c0c4 50%, #d4d4d8 70%, #c4c4c8 85%, #d0d0d4 100%);
    border-radius: 14px 14px 18px 18px;
    box-shadow:
        inset 2px 0 4px rgba(255,255,255,0.6),
        inset -2px 0 4px rgba(0,0,0,0.15),
        inset 0 2px 3px rgba(255,255,255,0.7),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        4px 8px 24px rgba(0,0,0,0.6),
        1px 2px 4px rgba(0,0,0,0.4);
    padding: 14px 12px 16px;
    position: relative;
    overflow: hidden;
    user-select: none;
}
.player-body::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(180deg,
        transparent 0px, transparent 2px,
        rgba(255,255,255,0.04) 2px, rgba(255,255,255,0.04) 3px);
    pointer-events: none;
    border-radius: inherit;
}
.player-body::after {
    content: '';
    position: absolute; top: 0; right: 0; bottom: 0; width: 8px;
    background: linear-gradient(to right, rgba(0,0,0,0.03), rgba(0,0,0,0.18));
    pointer-events: none;
}

/* =========================================
   TOP ROW
   ========================================= */
.top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 9px;
}
.brand {
    margin: 0 10px 0;
    font-family: 'Besley', sans-serif;
    font-weight: 700;
    font-size: 20px;
    transform: scale(1.25, 1);
    letter-spacing: 1.5px;
    color: #575757;
    text-shadow: 0 2px 0 rgba(255,255,255,0.5), 0 -1px 0 rgba(0,0,0,0.1);
    line-height: 1;
}
.rec-batt { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rec-batt-lbl { font-size: 7px; line-height: 1.15; color: #555; text-align: center; letter-spacing: 0.3px; }
.led-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #c04040, #7a0000);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4), 0 0 3px rgba(150,0,0,0.3);
    transition: all 0.12s;
}
.led-dot.on {
    background: radial-gradient(circle at 38% 35%, #ff5050, #cc0000);
    box-shadow: 0 0 8px #ff1111, 0 0 16px rgba(255,0,0,0.25);
    animation: blink 0.9s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* =========================================
   CONTENT ROW
   ========================================= */
.content-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}
.info-col {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 12px;
}
.cass-window {
    background: #000;
    border-radius: 5px;
    padding: 5px;
    flex-shrink: 0;
    width: 72px;
    box-shadow:
        inset 0 3px 10px rgba(0,0,0,0.9),
        inset 0 1px 3px rgba(0,0,0,0.6),
        0 1px 0 rgba(255,255,255,0.25);
    position: relative; overflow: hidden;
}
.cass-window::after {
    content: '';
    position: absolute; top: 5px; left: 5px; right: 5px; height: 28%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.06), transparent);
    pointer-events: none;
    border-radius: 3px 3px 0 0;
}
.cass-inner {
    background: linear-gradient(170deg, #1e1e2e 0%, #101018 60%, #1a1a24 100%);
    border-radius: 3px;
    padding: 5px 4px;
    border: 1px solid #252535;
    display: flex; flex-direction: row; align-items: stretch; gap: 4px;
}
.reels { display: flex; flex-direction: column; align-items: center; }
.reel { width: 52px; height: 52px; flex-shrink: 0; }
.reel svg { width: 100%; height: 100%; }
.tape-bridge {
    width: 5px; height: 18px;
    background: linear-gradient(to right, #0d0d0d, #252525, #0d0d0d);
    border-radius: 1px;
}
@keyframes cw  { to { transform: rotate( 360deg); } }
@keyframes ccw { to { transform: rotate(-360deg); } }
.state-play .reel-l svg { animation: cw  2.4s linear infinite; transform-origin: 50% 50%; }
.state-play .reel-r svg { animation: cw  3.6s linear infinite; transform-origin: 50% 50%; }
.state-rew  .reel-l svg { animation: ccw 0.45s linear infinite; transform-origin: 50% 50%; }
.state-rew  .reel-r svg { animation: ccw 0.65s linear infinite; transform-origin: 50% 50%; }
.state-ffwd .reel-l svg { animation: cw  0.65s linear infinite; transform-origin: 50% 50%; }
.state-ffwd .reel-r svg { animation: cw  0.45s linear infinite; transform-origin: 50% 50%; }

/* =========================================
   COUNTER STRIP
   ========================================= */
.counter-strip {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 3px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 5px;
}
.counter-box {
    background: #181818;
    border-radius: 3px; padding: 2px 4px;
    display: flex; align-items: center; gap: 1px;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.08);
}
.cdig {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 12px; font-weight: 700; color: #ded8c8;
    line-height: 1; min-width: 9px; text-align: center;
    text-shadow: 0 0 6px rgba(210,190,140,0.5);
}
.csep { color: #666; font-size: 10px; }
.rst-btn {
    font-size: 12px; letter-spacing: 0.5px; color: #555;
    background: linear-gradient(180deg, #c8c8c8, #aaa);
    border: none; border-radius: 2px; padding: 2px 4px;
    cursor: pointer;
    box-shadow: 0 1px 0 #888, inset 0 1px 0 rgba(255,255,255,0.4);
    font-family: 'Barlow Condensed', sans-serif;
}
.rst-btn:active { transform: translateY(1px); box-shadow: none; }

/* =========================================
   PROGRESS
   ========================================= */
.progress-area { padding: 0; margin-bottom: 6px; }
.prog-track {
    height: 3px; background: #9a9a9a; border-radius: 2px;
    cursor: pointer; position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.3);
}
.prog-fill {
    height: 100%; background: #c0392b; border-radius: 2px;
    width: 0%; transition: width 0.1s linear;
}
.prog-thumb {
    position: absolute; top: 50%;
    transform: translate(-50%, -50%);
    width: 9px; height: 9px;
    background: radial-gradient(circle at 35% 35%, #eee, #aaa);
    border-radius: 50%; left: 0%;
    transition: left 0.1s linear;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* =========================================
   CVP / LABELS
   ========================================= */
.cvp-text {
    font-size: 12px; letter-spacing: 1px; color: #c0392b;
    font-weight: 700; font-family: 'Barlow Condensed', sans-serif;
    margin-bottom: 3px; margin-top: 72px;
    transform: rotate(270deg) translate(45px, -45px);
}

/* =========================================
   SPEAKER GRILLE
   ========================================= */
.speaker { margin: 20px -2px 4px; height: 150px; width: 140px; }
.grille {
    width: 100%; height: 100%;
    background-color: #b8b8bc;
    background-image: radial-gradient(circle, #aaa 1.2px, transparent 1.2px);
    background-size: 5px 5px;
    border-radius: 6px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.22), inset 0 -1px 3px rgba(0,0,0,0.1);
}
.model-lbl {
    text-align: left; font-size: 6px; letter-spacing: 2px; color: #888;
    font-family: 'Barlow Condensed', sans-serif; font-weight: 300;
}
.bottom-strip {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 2px; padding: 0 2px;
}
.vor-lbl {
    font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
    font-size: 20px; letter-spacing: 2px; margin-top: 6px; color: #c0392b;
    transform: rotate(270deg) translate(60px, 20px);
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

/* =========================================
   SIDE CONTROL PANEL
   ========================================= */
.side-panel {
    width: 30px; display: flex; flex-direction: column;
    align-items: center; padding: 14px 0 16px; gap: 5px; margin-left: 4px;
}
.s-btn {
    width: 24px; border: none; cursor: pointer; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.06s;
    font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
    position: relative; overflow: hidden;
}
.s-btn:active { transform: translateX(1px) translateY(1px) !important; }
.s-btn-xl {
    height: 42px; font-size: 17px;
    background: linear-gradient(160deg, #606060 0%, #3a3a3a 60%, #484848 100%);
    color: #fff;
    box-shadow: 3px 0 0 #111, 0 3px 0 #111,
        inset 1px 0 0 rgba(255,255,255,0.12), inset 0 1px 0 rgba(255,255,255,0.18);
}
.s-btn-lg {
    height: 34px; font-size: 13px;
    background: linear-gradient(180deg, #585858 0%, #383838 100%);
    color: #ddd;
    box-shadow: 3px 0 0 #111, 0 2px 0 #111,
        inset 1px 0 0 rgba(255,255,255,0.1), inset 0 1px 0 rgba(255,255,255,0.15);
}
.s-btn-sm {
    height: 26px; font-size: 11px;
    background: linear-gradient(180deg, #686868 0%, #484848 100%);
    color: #ccc;
    box-shadow: 3px 0 0 #111, 0 2px 0 #111,
        inset 1px 0 0 rgba(255,255,255,0.1), inset 0 1px 0 rgba(255,255,255,0.12);
}
.eject-wrap {
    width: 24px; height: 24px;
    position: relative; overflow: hidden; border-radius: 4px;
    background: linear-gradient(180deg, #888, #666);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #ddd; cursor: pointer;
    box-shadow: 3px 0 0 #333, 0 2px 0 #333, inset 0 1px 0 rgba(255,255,255,0.2);
    margin-bottom: 4px; flex-shrink: 0;
}
.eject-wrap input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.eject-wrap:active { transform: translateX(1px) translateY(1px); box-shadow: none; }
.vol-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.vol-lbl { font-size: 7px; letter-spacing: 1px; color: #888; }
input[type=range].vol-v {
    -webkit-appearance: none;
    writing-mode: vertical-lr; direction: rtl;
    width: 22px; height: 64px;
    background: #4a4a4a; border-radius: 3px; outline: none; cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.6), 3px 0 0 #111;
}
input[type=range].vol-v::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 14px;
    background: linear-gradient(to bottom, #999, #666);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
    cursor: pointer;
}
.model-tag {
    writing-mode: vertical-rl; font-size: 7px; letter-spacing: 1.5px;
    color: #666; font-family: 'Barlow Condensed', sans-serif;
    font-weight: 300; margin-top: auto;
}

/* =========================================
   CASSETTE TRAY  (always present)
   ========================================= */
.tray {
    width: 280px;
    background: linear-gradient(170deg, #222 0%, #181818 60%, #1e1e1e 100%);
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    padding: 10px 10px 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.04);
    position: relative;
}
.tray::before {
    content: '';
    position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
    background: linear-gradient(to right, transparent, rgba(192,57,43,0.4), transparent);
}
.tray-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700; font-size: 9px;
    letter-spacing: 3px; color: #555;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2a2a;
}

/* 3×3 grid of slots */
.tray-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ── Individual cassette slot ── */
.tray-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    /* opacity controlled externally via JS */
    transition: opacity 0.4s ease, transform 0.2s ease;
}
.tray-slot:hover {
    transform: translateY(-2px);
}
.tray-slot.active .slot-body {
    box-shadow: 0 0 12px rgba(192,57,43,0.5), inset 0 0 0 1px #c0392b;
}

/* Cassette body illustration */
.slot-body {
    width: 100%;
    aspect-ratio: 1.55;
    border-radius: 4px;
    border: 1px solid #3a3a3a;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

/* Top clear strip */
.slot-top {
    position: absolute; top: 0; left: 0; right: 0;
    height: 28%;
    background: linear-gradient(180deg, #d4d4d4, #c8c8c8);
    border-bottom: 1px solid rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
}
.slot-top-line {
    width: 75%; height: 1px;
    background: rgba(0,0,0,0.12);
}

/* Coloured label area */
.slot-label {
    position: absolute;
    top: 28%; left: 0; right: 0; bottom: 20%;
    display: flex; align-items: center; justify-content: center;
}

/* Bottom strip */
.slot-bottom {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 20%;
}

/* Reel pair */
.slot-reels {
    position: absolute;
    top: 28%; left: 0; right: 0; bottom: 20%;
    display: flex; align-items: center; justify-content: space-around;
    padding: 0 10%;
}
.slot-reel { width: 30%; aspect-ratio: 1; }
.slot-reel svg { width: 100%; height: 100%; }

/* Tape bridge across reels */
.slot-bridge {
    position: absolute;
    top: 50%; left: 26%; right: 26%;
    height: 2px; margin-top: -1px;
    background: #1a1a1a;
    border-radius: 1px;
}

/* Song name on label */
.slot-title {
    position: absolute;
    bottom: 22%; left: 0; right: 0;
    text-align: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 6px;
    letter-spacing: 0.4px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 4px;
    pointer-events: none;
}

/* Artist name below body */
.slot-artist {
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-size: 7px;
    color: #555;
    text-align: center;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    width: 100%;
    padding: 0 2px;
}

/* Active playing dot */
.slot-pip {
    position: absolute; top: 4px; right: 5px;
    width: 5px; height: 5px; border-radius: 50%;
    background: #c0392b;
    box-shadow: 0 0 6px #c0392b;
    opacity: 0;
    transition: opacity 0.2s;
    animation: blink 0.9s infinite;
}
.tray-slot.active .slot-pip { opacity: 1; }
