:root {
  --glass: rgba(18, 16, 26, 0.42);
  --glass-hi: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --dim: rgba(255, 255, 255, 0.55);
  --accent: #ffd59a;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d0b14; color: var(--text); overflow: hidden;
  font: 500 14px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  object-fit: cover; image-rendering: pixelated; image-rendering: crisp-edges;
  transition: opacity .6s var(--ease);
}

/* Start overlay: one quiet play button, needed because browsers block autoplay. */
.start { position: fixed; inset: 0; border: 0; background: radial-gradient(transparent 40%, rgba(0,0,0,.35));
  display: grid; place-items: center; cursor: pointer; z-index: 5; transition: opacity .5s var(--ease); }
.start-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  animation: breathe 3.2s ease-in-out infinite; }
.start-icon svg { width: 30px; fill: #fff; margin-left: 4px; }
.start.gone { opacity: 0; pointer-events: none; }
@keyframes breathe { 50% { transform: scale(1.06); } }

.ui { position: fixed; inset: 0; pointer-events: none; z-index: 4; transition: opacity .8s var(--ease); }
.ui.idle { opacity: 0; }
body.idle { cursor: none; }
.ui > * { pointer-events: auto; }

.now { border: 0; background: none; padding: 0; text-align: left; color: inherit; cursor: pointer; pointer-events: auto; }
.now:hover .now-title { text-decoration: underline; text-underline-offset: 3px; }
.now { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom));
  text-shadow: 0 1px 12px rgba(0,0,0,.45); }
.now-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.now-artist { color: var(--dim); font-size: 12.5px; margin-top: 2px; }

.bar { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--text); transition: background .2s, color .2s, transform .15s; }
.btn:hover { background: var(--glass-hi); }
.btn:active { transform: scale(.92); }
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.tog svg, #scenes svg, #pick-prev svg, #pick-next svg, #tracklist svg { fill: none; }
#tracklist svg circle { fill: currentColor; }
#scenes svg rect { fill: none; stroke: currentColor; stroke-width: 1.8; }
.tog { color: var(--dim); }
.tog[aria-pressed="true"] { color: var(--accent); background: rgba(255, 213, 154, .12); }
.btn .i-pause, .btn .i-exit { display: none; }
body.is-fullscreen .btn .i-enter { display: none; }
body.is-fullscreen .btn .i-exit { display: block; }
#fullscreen svg { fill: none; }
.btn[hidden] { display: none; }
body.playing .btn .i-play { display: none; }
body.playing .btn .i-pause { display: block; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }

.vol { -webkit-appearance: none; appearance: none; width: 92px; height: 4px; margin: 0 10px; border-radius: 4px;
  background: linear-gradient(to right, rgba(255,255,255,.85) var(--v, 70%), rgba(255,255,255,.2) var(--v, 70%)); cursor: pointer; }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.vol::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.timer { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: calc(26px + env(safe-area-inset-bottom));
  text-align: right; text-shadow: 0 1px 12px rgba(0,0,0,.45); cursor: pointer; }
#timer-label { display: block; color: var(--dim); font-size: 12.5px; }
#timer-time { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.picker { position: absolute; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px)); padding: 14px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  animation: rise .35s var(--ease); }
.picker[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
.tracks { width: min(420px, calc(100vw - 32px)); }
.tracks-head { font-size: 12px; font-weight: 600; color: var(--dim); margin: 10px 10px 4px; text-transform: uppercase; letter-spacing: .06em; }
.tracks-head:first-child { margin-top: 2px; }
.track-list { max-height: min(50vh, 380px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.track { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border: 0; background: transparent; color: var(--text);
  text-align: left; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.track:hover { background: var(--glass-hi); }
.track .t-artist { color: var(--dim); font-size: 12px; white-space: nowrap; }
.track[aria-current="true"] { background: rgba(255,255,255,.14); }
.track[aria-current="true"] .t-title::before { content: '♪ '; color: var(--accent); }
.picker-vibes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.picker-vibes::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--dim); border-radius: 999px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: rgba(255,255,255,.9); color: #14121c; border-color: transparent; }
.thumb[hidden] { display: none; }
.thumb.in-season::after { content: 'Now'; position: absolute; top: 6px; right: 6px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,213,154,.9); color: #1a1408; font-size: 10.5px; font-weight: 700; }
.picker-grid { max-height: min(52vh, 420px); overflow-y: auto; padding: 4px; margin: -4px; scrollbar-width: thin; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.thumb { position: relative; border: 0; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
  aspect-ratio: 16 / 9; background: #000; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .2s, transform .2s var(--ease); }
.thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.thumb:hover { transform: translateY(-2px); }
.thumb[aria-current="true"] { outline-color: rgba(255,255,255,.9); }
.thumb span { position: absolute; left: 8px; bottom: 6px; font-size: 12px; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.picker-foot { display: flex; justify-content: flex-start; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--dim); font-size: 11.5px; }
.picker-foot a { color: var(--dim); margin-left: auto; }
.link-btn { margin-left: 0; border: 0; background: none; padding: 0; color: var(--dim); font-size: 11.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover, .picker-foot a:hover { color: var(--text); }
.toast { position: fixed; left: 50%; top: calc(20px + env(safe-area-inset-top)); transform: translate(-50%, -8px); z-index: 6;
  padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 13px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .now, .timer { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .now { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .timer { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .vol { display: none; }
  .picker-grid { grid-template-columns: repeat(2, 1fr); }
  .sep { display: none; }
  .btn { width: 32px; height: 32px; }
  .btn svg { width: 18px; height: 18px; }
  .bar { gap: 0; padding: 4px; }
  .picker { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .start-icon { animation: none; } }

/* Wallpaper mode: just the scene. */
body.wallpaper .ui, body.wallpaper .start, body.wallpaper .toast { display: none !important; }
body.wallpaper { cursor: none; }
