/* Each instrument owns its room, materials and light. */
html { min-height: 100%; }
body {
  --paper: #03070c;
  --ink: #e6f3f5;
  --room-muted: #91a6af;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  color-scheme: dark;
  isolation: isolate;
  transition: background-color 400ms ease, color 300ms ease;
}
body[data-player-skin='orbit'] {
  --paper: #03070c;
  --ink: #e6f3f5;
  background: #03070c;
}
body[data-player-skin='speaker'] {
  --paper: #c6c1b8;
  --ink: #292a2b;
  --room-muted: #655f59;
  color-scheme: light;
  background: #c6c1b8;
}
body[data-player-skin='reel'] {
  --paper: #151514;
  --ink: #e2ded4;
  --room-muted: #969186;
  background: #151514;
}
body[data-player-skin='cd'] {
  --paper: #d9dcda;
  --ink: #303735;
  --room-muted: #65706b;
  color-scheme: light;
  background: #d9dcda;
}
body[data-player-skin='record'] {
  --paper: #eee7da;
  --ink: #332b24;
  --room-muted: #756d60;
  color-scheme: light;
  background: radial-gradient(ellipse at 50% 30%, #faf5eb, transparent 72%), #eee7da;
}
body[data-player-skin='tape'] {
  --paper: #141414;
  --ink: #efdfc2;
  --room-muted: #b0a794;
  background: radial-gradient(ellipse at 50% 40%, #39332e, transparent 65%), #141414;
}
body[data-player-skin='digital'] {
  --paper: #0b1119;
  --ink: #c8e9ed;
  --room-muted: #87a7ac;
  background: radial-gradient(ellipse at 50% 45%, #17303d, transparent 65%), #0b1119;
}
.listen-room {
  width: 100%;
  min-height: 100dvh;
  padding: max(32px, env(safe-area-inset-top)) 32px calc(112px + env(safe-area-inset-bottom));
  align-content: center;
  overflow: clip;
}
.instrument { position: relative; }
.instrument[hidden] { display: none !important; }
.instrument-caption { display: none; }
.experimental-player { width: min(100%, 860px); }
.instrument:not([hidden]) { animation: room-arrive 460ms ease both; }
.skin-shell { position: relative; width: 100%; color: var(--device-ink); }
.skin-console { position: relative; z-index: 1; }
.skin-shell .timeline { margin-bottom: 12px; }
.skin-shell .transport { gap: 24px; }
.skin-shell .settings { margin-top: 12px; }
.skin-shell .control { border-radius: 0; }
.skin-shell .play-control { width: 64px; height: 64px; }
.skin-shell .control:focus-visible { outline-width: 2px; outline-offset: 5px; }
.skin-shell .control svg { position: relative; z-index: 1; }
.skin-shell input[type='range'] { height: 28px; }
.skin-shell .time-labels { letter-spacing: .08em; }

/* ORBIT lives across the viewport; only the controls belong to the layout. */
#orbit-canvas {
  position: fixed;
  z-index: 0;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
  pointer-events: none;
}
body[data-player-skin='orbit'] #orbit-canvas { display: block; }
.listen-room[data-active-player='orbit'] {
  position: relative;
  z-index: 1;
  min-height: max(480px, 100dvh);
  padding: 24px 24px calc(94px + env(safe-area-inset-bottom));
  align-content: end;
  pointer-events: none;
}
.listen-room[data-active-player='orbit']::before {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 290px;
  background: linear-gradient(transparent, #03070c99 40%, #03070ce6);
  pointer-events: none;
}
.instrument-orbit {
  z-index: 1;
  width: min(100%, 360px);
  pointer-events: auto;
}
.orbit-shell {
  --device-ink: #e6f3f5;
  --device-muted: #a1b3bc;
  --track: #57717d66;
  --control-hover: #d0efff12;
}
.orbit-shell .timeline { margin-bottom: 16px; }
.orbit-shell .time-labels { font-size: 10px; }
.orbit-shell .transport { gap: 28px; }
.orbit-shell .control { border-radius: 50%; }
.orbit-shell .play-control {
  width: 68px;
  height: 68px;
  border: 1px solid #e6f3f570;
  background: #09131cb3;
  color: #f1fcff;
}
.orbit-shell .play-control:hover { background: #e6f3f5; color: #03070c; border-color: #e6f3f5; }
.orbit-shell .mode-control[aria-pressed='true'] { color: #f0c692; background: transparent; }
.orbit-shell .settings { margin-top: 12px; }
.orbit-shell input[type='range']::-webkit-slider-thumb { background: #e6f3f5; }
.orbit-shell input[type='range']::-moz-range-thumb { background: #e6f3f5; }
body[data-player-skin='orbit'] .player-switcher { background: transparent; box-shadow: none; }
body[data-player-skin='orbit'].orbit-unavailable #orbit-canvas { display: none; }
body[data-player-skin='orbit'].orbit-unavailable::before {
  content: '';
  position: fixed;
  top: 8%;
  left: 50%;
  width: min(1000px, 110vw);
  aspect-ratio: 1;
  border: 1px solid #90c4d657;
  border-radius: 50%;
  box-shadow: 0 0 0 30px #90c4d608, 0 0 0 90px #90c4d604;
  transform: translateX(-50%) perspective(800px) rotateX(68deg) rotateZ(-20deg);
  pointer-events: none;
}

/* A lit studio for the physical speaker. */
#speaker-canvas {
  position: fixed;
  z-index: 0;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
  touch-action: none;
}
body[data-player-skin='speaker'] #speaker-canvas { display: block; }
.listen-room[data-active-player='speaker'] {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 0;
  align-content: center;
  pointer-events: none;
}
.instrument.instrument-speaker {
  width: min(100%, 336px);
  pointer-events: auto;
}
.speaker-shell {
  --device-ink: #292a2b;
  --device-muted: #655f59;
  --track: #292a2b40;
  --control-hover: #292a2b0d;
}
.speaker-shell .timeline { margin-bottom: 16px; }
.speaker-shell .transport { gap: 28px; }
.speaker-shell .control { border-radius: 50%; }
.speaker-shell .play-control { color: #ebe7df; background: #292a2b; }
.speaker-shell .play-control:hover { background: #484745; }
.speaker-shell .mode-control[aria-pressed='true'] { color: #292a2b; background: transparent; }
.speaker-shell input[type='range']::-webkit-slider-runnable-track { height: 1px; }
.speaker-shell input[type='range']::-moz-range-track { height: 1px; }
.speaker-shell input[type='range']::-webkit-slider-thumb { width: 5px; height: 5px; margin-top: -2px; }
.speaker-shell input[type='range']::-moz-range-thumb { width: 5px; height: 5px; }
body[data-player-skin='speaker'] .player-switcher { background: transparent; box-shadow: none; }
body[data-player-skin='speaker'].speaker-unavailable #speaker-canvas { display: none; }

/* Open reels and illuminated meters sit in a dark recording room. */
#reel-canvas {
  position: fixed;
  z-index: 0;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
  touch-action: none;
}
body[data-player-skin='reel'] #reel-canvas { display: block; }
.listen-room[data-active-player='reel'] {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 0;
  align-content: center;
  pointer-events: none;
}
.instrument.instrument-reel {
  width: min(100%, 336px);
  pointer-events: auto;
}
.reel-shell {
  --device-ink: #e2ded4;
  --device-muted: #969186;
  --track: #e2ded435;
  --control-hover: #e2ded40c;
}
.reel-shell .timeline { margin-bottom: 12px; }
.reel-shell .transport { gap: 28px; }
.reel-shell .control { border-radius: 50%; }
.reel-shell .play-control { color: #e2ded4; background: transparent; border: 1px solid #e2ded470; }
.reel-shell .play-control:hover { color: #151514; background: #e2ded4; border-color: #e2ded4; }
.reel-shell .mode-control[aria-pressed='true'] { color: #cfb184; background: transparent; }
.reel-shell input[type='range']::-webkit-slider-runnable-track { height: 1px; }
.reel-shell input[type='range']::-moz-range-track { height: 1px; }
.reel-shell input[type='range']::-webkit-slider-thumb { width: 5px; height: 5px; margin-top: -2px; }
.reel-shell input[type='range']::-moz-range-thumb { width: 5px; height: 5px; }
body[data-player-skin='reel'] .player-switcher { background: transparent; box-shadow: none; }
body[data-player-skin='reel'].reel-unavailable #reel-canvas { display: none; }

/* Clear acrylic and silver live in a soft, pale studio. */
#cd-canvas {
  position: fixed;
  z-index: 0;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
  touch-action: none;
}
body[data-player-skin='cd'] #cd-canvas { display: block; }
.listen-room[data-active-player='cd'] {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: 0;
  align-content: center;
  pointer-events: none;
}
.instrument.instrument-cd {
  width: min(100%, 336px);
  pointer-events: auto;
}
.cd-shell {
  --device-ink: #303735;
  --device-muted: #65706b;
  --track: #30373535;
  --control-hover: #3037350d;
}
.cd-shell .timeline { margin-bottom: 12px; }
.cd-shell .transport { gap: 28px; }
.cd-shell .control { border-radius: 50%; }
.cd-shell .play-control { color: #f2f4f2; background: #303735; }
.cd-shell .play-control:hover { background: #515a55; }
.cd-shell .mode-control[aria-pressed='true'] { color: #303735; background: transparent; }
.cd-shell .control[data-action='eject'][aria-pressed='true'] { background: #30373510; }
.cd-shell input[type='range']::-webkit-slider-runnable-track { height: 1px; }
.cd-shell input[type='range']::-moz-range-track { height: 1px; }
.cd-shell input[type='range']::-webkit-slider-thumb { width: 5px; height: 5px; margin-top: -2px; }
.cd-shell input[type='range']::-moz-range-thumb { width: 5px; height: 5px; }
body[data-player-skin='cd'] .player-switcher { background: transparent; box-shadow: none; }
body[data-player-skin='cd'].cd-unavailable #cd-canvas { display: none; }

/* Physical instruments use their own buttons; only scene dots stay on screen. */
:is(.instrument-speaker, .instrument-reel, .instrument-cd) .skin-console { display: none; }

/* Keep playback available if a device cannot render its 3D instrument. */
body:is([data-player-skin='speaker'].speaker-unavailable, [data-player-skin='reel'].reel-unavailable, [data-player-skin='cd'].cd-unavailable) .listen-room {
  min-height: max(480px, 100dvh);
  padding: 24px 24px calc(94px + env(safe-area-inset-bottom));
  align-content: end;
}
body:is([data-player-skin='speaker'].speaker-unavailable, [data-player-skin='reel'].reel-unavailable, [data-player-skin='cd'].cd-unavailable) .skin-console { display: block; }

/* The original machines keep their own quieter physical materials. */
.record-deck {
  --device-ink: #3c3026;
  --device-muted: #786e62;
  --track: #c1b3a1;
  --control-hover: #e3d6c3;
  background: #f4ebdc;
  border-color: #c5b59e;
  box-shadow: inset 0 1px 0 #fff9ef, 0 24px 50px #5b442c16, 0 5px 0 #baac95;
}
.record-deck .vinyl-label { background: #e2a970; }
.record-deck .play-control { color: #f4ebdc; }
.tape-deck { box-shadow: inset 0 1px 0 #514b44, 0 20px 55px #0008, 0 5px 0 #080808; }
.tape-deck .cassette-label { background: #df9f53; color: #332418; }
.tape-deck .transport .play-control { background: #e4ae62; border-color: #f4c98c; box-shadow: inset 0 1px 0 #ffdfa9, 0 3px 0 #111; }
.tape-deck .transport .play-control:hover { background: #f6cd92; }
.instrument-digital { width: min(100%, 900px); }
.digital-deck {
  --device-ink: #d7f6f5;
  --device-muted: #8bb0b5;
  --track: #3b5c67;
  --control-hover: #2b424d;
  color: var(--device-ink);
  background: #1c2a34;
  border-color: #3c535e;
  box-shadow: inset 0 1px 0 #5b7180, 0 24px 55px #0007;
}
.digital-screen { background: #070e15; border-color: #030608; }
.digital-controls .play-control { color: #122c32; background: #adf0ec; }
.digital-controls .play-control:hover { background: #e0fffc; }

.player-switcher {
  position: fixed;
  z-index: 5;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0;
  transform: translateX(-50%);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: 0 0 24px 12px var(--paper);
}
.player-switcher button { width: 44px; height: 44px; color: var(--ink); opacity: .35; }
.player-switcher button::before { width: 5px; height: 5px; transition: transform 200ms ease, box-shadow 200ms ease; }
.player-switcher button:hover { color: var(--ink); opacity: .8; }
.player-switcher button[aria-pressed='true'] { opacity: 1; }
.player-switcher button[aria-pressed='true']::before { transform: scale(1.2); box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px currentColor; }
.player-switcher button:focus-visible { border-radius: 50%; }
.listen-status {
  position: fixed;
  z-index: 6;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 50%;
  width: min(620px, calc(100% - 40px));
  min-height: 0;
  margin: 0;
  padding: 8px 12px;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
}
.listen-status:empty { display: none; }

body[data-player-skin='orbit'].orbit-ui-hidden :is(#player-orbit, .player-switcher, .listen-status) {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
body[data-player-skin='orbit'].orbit-ui-hidden .listen-room::before { opacity: 0; }

@keyframes room-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
  .listen-room { padding: max(24px, env(safe-area-inset-top)) 20px calc(108px + env(safe-area-inset-bottom)); }
  .experimental-player { width: min(100%, 560px); }
  .instrument-orbit { width: min(100%, 336px); }
  .instrument-digital { width: min(100%, 480px); }
}

@media (max-width: 380px) {
  .listen-room { padding-inline: 16px; }
  .skin-shell .settings { gap: 4px; }
  .skin-shell .volume-control { width: 104px; }
  .skin-shell .mode-controls { gap: 0; }
}

@media (max-height: 740px) and (min-width: 721px) {
  .listen-room { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  body, .instrument, .player-switcher button::before, .skin-shell *, .skin-shell *::before, .skin-shell *::after { animation: none !important; transition: none !important; }
}


