@import url('/fonts/font-face.css');

:root {
  color-scheme: light;
  --paper: #f2f2f2;
  --ink: #181818;
  --sans: 'Li2go Sans', 'Noto Sans SC', 'PingFang SC', sans-serif;
  --serif: 'Li2go Serif', 'Noto Serif SC', 'Songti SC', serif;
  --mono: 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
button, a { touch-action: manipulation; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.symbols, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.listen-room, .listen-status { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
.listen-room { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; min-height: 664px; }
.instrument { width: min(100%, 400px); min-width: 0; display: flex; flex-direction: column; }
.instrument[hidden] { display: none; }
.player-switcher { display: flex; justify-content: center; gap: 0; margin: 20px auto 24px; }
.player-switcher button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: #999; }
.player-switcher button::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; transition: transform 160ms, background-color 160ms; }
.player-switcher button:hover { color: #555; }
.player-switcher button[aria-pressed='true'] { color: var(--ink); }
.player-switcher button[aria-pressed='true']::before { transform: scale(1.3333); }
.player-switcher button:focus-visible { outline-color: var(--ink); outline-offset: 0; }
.instrument-caption { display: flex; align-items: baseline; justify-content: space-between; padding: 0 1px 16px; }
.instrument-caption h2 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: .14em; }
.instrument-caption > span { color: #666; font: 11px/1 var(--mono); }
.record-deck, .tape-deck { position: relative; flex: 1; padding: 24px 32px 28px; border: 1px solid; border-radius: 5px; }
.record-deck { --device-ink: #202020; --device-muted: #686868; --track: #b8b8b8; --control-hover: #d0d0d0; color: var(--device-ink); background: #e3e3e3; border-color: #cecece; box-shadow: inset 0 1px 0 #f7f7f7; }
.tape-deck { --device-ink: #f0f0f0; --device-muted: #b6b6b6; --track: #555; --control-hover: #414141; color: var(--device-ink); background: #252525; border-color: #171717; box-shadow: inset 0 1px 0 #484848; }
.deck-top, .tape-brand, .track-line, .tape-display, .scope-top, .scope-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 11px/1.5 var(--mono); letter-spacing: .08em; }
.deck-top, .tape-brand { min-height: 20px; }

/* The grooves and mechanical details belong to the instruments themselves. */
.turntable-art, .cassette-bay { position: relative; width: 100%; aspect-ratio: 1.2; margin-block: 24px; }
.platter { position: absolute; width: 80%; aspect-ratio: 1; left: 0; top: 3%; padding: 5px; border: 1px solid #ababab; border-radius: 50%; background: #bebebe; box-shadow: 0 2px 0 #aaa; }
.vinyl { position: relative; width: 100%; height: 100%; border: 2px solid #1a1a1a; border-radius: 50%; background: repeating-radial-gradient(circle at center, #171717 0 1px, #292929 1px 2px, #181818 2px 4px); animation: record-turn 8s linear infinite; animation-play-state: paused; }
.vinyl::before { content: ''; position: absolute; inset: 13%; border: 1px solid #494949; border-radius: 50%; }
.vinyl-label { position: absolute; inset: 33%; display: flex; flex-direction: column; align-items: center; justify-content: space-around; padding: 8% 0; border-radius: 50%; background: #eaeaea; color: #1b1b1b; }
.vinyl-label > span { font: 600 clamp(18px, 2.4vw, 28px)/1 var(--serif); }
.vinyl-label small { font: 7px/1 var(--mono); letter-spacing: .18em; }
.spindle { position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; transform: translate(-50%, -50%); border: 1px solid #8a8a8a; border-radius: 50%; background: #373737; }
.tonearm { position: absolute; right: 1%; top: 3%; width: 64px; height: 79%; transform: rotate(-4deg); transform-origin: 32px 22px; transition: transform 650ms cubic-bezier(.25, .8, .3, 1); }
.arm-pivot { position: absolute; left: 10px; top: 0; width: 44px; height: 44px; border: 7px solid #a8a8a8; border-radius: 50%; background: #383838; box-shadow: 0 0 0 1px #8d8d8d, inset 0 0 0 2px #ccc; }
.arm-shaft { position: absolute; left: 29px; top: 17px; width: 7px; height: calc(100% - 41px); border-left: 2px solid #f6f6f6; border-right: 2px solid #888; background: #c0c0c0; }
.cartridge { position: absolute; bottom: 0; left: 20px; width: 25px; height: 35px; border: 1px solid #292929; border-radius: 2px; background: #404040; transform: rotate(-12deg); }
.cartridge::after { content: ''; position: absolute; left: 7px; right: 7px; bottom: -6px; height: 6px; background: #949494; }
.speed-mark { position: absolute; right: 3%; bottom: 0; color: #747474; font: 9px/1 var(--mono); letter-spacing: .1em; }
.playing .vinyl, .playing .reel { animation-play-state: running; }
.playing .tonearm { transform: rotate(23deg); }
.track-line, .tape-display { min-height: 24px; margin-bottom: 12px; }
.track-line > :last-child { color: #737373; font-size: 10px; }

.cassette-bay { display: flex; align-items: center; justify-content: center; border: 1px solid #424242; border-radius: 3px; background: #181818; box-shadow: inset 0 1px 0 #080808; }
.cassette { position: relative; width: 92%; aspect-ratio: 1.62; border: 1px solid #737373; border-radius: 7px; background: #3a3a3a; }
.cassette::before, .cassette::after { content: '+'; position: absolute; bottom: 5px; color: #9b9b9b; font: 13px/1 var(--mono); }
.cassette::before { left: 7px; }
.cassette::after { right: 7px; }
.cassette-label { position: absolute; inset: 8% 5% auto; display: flex; align-items: center; justify-content: space-between; height: 25%; padding: 0 12px; background: #d9d9d9; color: #272727; border-radius: 2px 2px 0 0; }
.cassette-label b { font: 700 17px/1 var(--mono); }
.cassette-label > span { font: 600 19px/1 var(--serif); }
.cassette-label small { font: 9px/1 var(--mono); }
.tape-window { position: absolute; top: 39%; left: 11%; right: 11%; height: 31%; display: flex; justify-content: space-between; align-items: center; padding: 4px 7px; border: 1px solid #737373; border-radius: 32px; background: #171717; }
.reel { position: relative; z-index: 1; display: block; height: 100%; aspect-ratio: 1; border: 5px solid #4d4d4d; border-radius: 50%; background: #a1a1a1; animation: record-turn 4s linear infinite; animation-play-state: paused; }
.reel::before { content: ''; position: absolute; inset: 3px; border: 5px dashed #272727; border-radius: 50%; }
.reel > i { position: absolute; inset: 36%; border-radius: 50%; background: #252525; }
.reel-right { animation-duration: 5.5s; }
.tape-bridge { position: absolute; inset: 21% 24%; border-block: 2px solid #676767; background: #363636; }
.cassette-rule { position: absolute; top: 76%; left: 7%; right: 7%; height: 1px; background: #707070; }
.cassette-bottom { position: absolute; bottom: 0; left: 22%; right: 22%; height: 17%; display: flex; justify-content: space-around; align-items: center; border: 1px solid #626262; border-bottom: 0; border-radius: 6px 6px 0 0; background: #454545; }
.cassette-bottom i { width: 7px; height: 7px; border-radius: 50%; background: #171717; }
.cassette-bottom span { width: 40%; height: 7px; border: 1px solid #777; background: #232323; }
.tape-meter { display: flex; align-items: center; gap: 3px; height: 12px; }
.tape-meter i { display: block; width: 3px; height: 8px; background: #666; }
.playing .tape-meter i:nth-child(-n+6) { background: #d4d4d4; }
.speaker-grille { position: absolute; bottom: 10px; left: 50%; width: 64px; height: 4px; transform: translateX(-50%); background: repeating-linear-gradient(90deg, #0f0f0f 0 2px, transparent 2px 5px); }

.timeline { margin-bottom: 16px; }
input[type='range'] { --fill: 0%; display: block; width: 100%; height: 24px; margin: 0; padding: 0; appearance: none; -webkit-appearance: none; border: 0; border-radius: 0; outline-offset: 2px; background: transparent; color: inherit; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--device-ink) 0 var(--fill), var(--track) var(--fill) 100%); }
input[type='range']::-moz-range-track { height: 2px; background: linear-gradient(to right, var(--device-ink) 0 var(--fill), var(--track) var(--fill) 100%); }
input[type='range']::-webkit-slider-thumb { width: 8px; height: 8px; margin-top: -3px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 50%; background: var(--device-ink); }
input[type='range']::-moz-range-thumb { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--device-ink); }
input[type='range']:disabled { opacity: .45; cursor: default; }
input[data-volume] { --fill: 75%; }
.time-labels { display: flex; justify-content: space-between; color: var(--device-muted); font: 10px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.transport { display: flex; align-items: center; justify-content: center; gap: 24px; }
.control { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 2px; background: transparent; color: inherit; transition: background-color 160ms, color 160ms, transform 160ms; }
.control:hover { background: var(--control-hover); }
.control:focus-visible { outline-color: var(--device-ink); }
.control:active { transform: translateY(1px); }
.play-control { width: 64px; height: 64px; border-radius: 50%; background: var(--device-ink); color: #e3e3e3; }
.play-control svg { width: 23px; height: 23px; }
.play-control:hover { background: #444; }
.settings { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.mode-controls, .volume-control { display: flex; align-items: center; }
.mode-controls { gap: 4px; }
.mode-control { color: var(--device-muted); }
.mode-control[aria-pressed='true'], .mode-control.active, .control[data-action='mute'][aria-pressed='true'] { color: var(--device-ink); background: var(--control-hover); }
.volume-control { width: 43%; max-width: 156px; gap: 4px; }
.volume-control input { min-width: 0; }
.volume-control svg { width: 19px; height: 19px; }
.tape-deck .transport { gap: 3px; }
.tape-deck .transport .control { width: 68px; height: 52px; border: 1px solid #545454; border-radius: 2px; background: #383838; box-shadow: inset 0 1px 0 #606060, 0 3px 0 #111; }
.tape-deck .transport .play-control { background: #d6d6d6; color: #222; border-color: #dfdfdf; box-shadow: inset 0 1px 0 #fff, 0 3px 0 #111; }
.tape-deck .transport .control:hover { background: #4a4a4a; }
.tape-deck .transport .play-control:hover { background: #eee; }
.tape-deck .transport .control:active, .tape-deck .play-control[aria-pressed='true'] { transform: translateY(2px); box-shadow: inset 0 1px 0 #999; }
.tape-deck .settings { margin-top: 32px; }

.instrument-digital { width: min(100%, 900px); }
.digital-deck { --device-ink: #202020; --device-muted: #686868; --track: #aaa; --control-hover: #ccc; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 32px; padding: 12px 32px 12px 12px; border: 1px solid #c9c9c9; border-radius: 4px; background: #dedede; box-shadow: inset 0 1px 0 #f8f8f8; }
.digital-screen { --device-ink: #eee; --device-muted: #9a9a9a; position: relative; display: flex; flex-direction: column; min-width: 0; padding: 20px 24px; overflow: hidden; border: 1px solid #080808; border-radius: 2px; background: #111; color: #e5e5e5; }
.scope-top, .scope-bottom { position: relative; z-index: 1; font-size: 10px; }
.scope-top { min-height: 18px; }
#scope-canvas { display: block; width: 100%; height: 156px; margin-block: 8px; }
.scope-bottom { color: #999; font-variant-numeric: tabular-nums; }
.scope-bottom > span:first-child { font-size: 8px; letter-spacing: .16em; }
.scope-bottom i { margin-inline: 6px; font-style: normal; color: #555; }
.digital-controls { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding-block: 16px; }
.digital-seek { margin-bottom: 20px !important; }
.digital-controls .transport { gap: 16px; }
.digital-controls .play-control { width: 56px; height: 56px; border-radius: 2px; }
.digital-controls .settings { margin-top: 16px; gap: 8px; }
.digital-controls .mode-controls { gap: 0; }
.digital-controls .volume-control { width: 44%; }
.listen-status { min-height: 20px; margin-block: 0 40px; color: #666; font-size: 12px; line-height: 1.7; text-align: center; }
.listen-status:empty { min-height: 0; }

@keyframes record-turn { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .listen-room, .listen-status { width: calc(100% - 64px); }
  .record-deck, .tape-deck { padding: 20px 24px 28px; }
  .turntable-art, .cassette-bay { margin-block: 20px; }
  .tonearm { right: -3%; width: 56px; transform-origin: 28px 22px; }
  .arm-pivot { left: 6px; }
  .arm-shaft { left: 25px; }
  .cartridge { left: 16px; }
  .settings { gap: 8px; }
  .volume-control { width: 42%; }
  .digital-deck { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; padding-right: 24px; }
  .digital-screen { padding: 16px; }
}

@media (max-width: 720px) {
  .listen-room, .listen-status { width: min(480px, calc(100% - 40px)); }
  .listen-room { min-height: 640px; }
  .instrument-caption { padding-bottom: 12px; }
  .record-deck, .tape-deck { padding: 20px 28px 28px; }
  .tonearm { right: 1%; }
  .vinyl-label > span { font-size: 24px; }
  .digital-deck { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 0; }
  .digital-screen { padding: 16px 20px; }
  #scope-canvas { height: 136px; }
  .digital-controls { padding: 16px 16px 8px; }
  .digital-seek { margin-bottom: 16px !important; }
  .digital-controls .settings { margin-top: 16px; }
  .listen-status { margin-bottom: 24px; }
}

@media (max-width: 360px) {
  .listen-room, .listen-status { width: calc(100% - 32px); }
  .record-deck, .tape-deck { padding-inline: 18px; }
  .tape-brand { font-size: 9px; letter-spacing: .02em; }
  .tonearm { right: -5%; }
  .vinyl-label > span { font-size: 18px; }
  .vinyl-label small { font-size: 5px; }
  .cassette-label { padding-inline: 8px; }
  .cassette-label > span { font-size: 16px; }
  .cassette-label small { font-size: 8px; }
  .reel { border-width: 3px; }
  .reel::before { inset: 2px; border-width: 3px; }
  .settings { gap: 0; }
  .mode-controls { gap: 0; }
  .listen-room { min-height: 600px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
