:root { color-scheme:dark; --bg:#09090b; --raise:rgba(255,255,255,.08); --raise-hi:rgba(255,255,255,.14); --line:rgba(255,255,255,.09);
  --ink:#f2f2f4; --dim:#a6a6ad; --green:#1ed760; --ink-on-green:#06120a;
  --glass:rgba(20,20,23,.55); --glass-strong:rgba(24,24,28,.86); --blur:blur(24px) saturate(140%);
  --ease:cubic-bezier(.2,.8,.2,1); --r-sm:8px; --r-md:12px; --r-lg:18px;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; color:var(--ink); background:var(--bg) }
* { box-sizing:border-box }
html,body { height:100%; margin:0; overflow:hidden }
body { display:grid; grid-template-rows:auto auto 1fr; height:100dvh; padding:0 env(safe-area-inset-right) 0 env(safe-area-inset-left) }
header { grid-row:1 } #offline { grid-row:2 } main { grid-row:3 }
button,input { font:inherit; color:inherit }
button { cursor:pointer; min-height:48px; min-width:48px; background:var(--raise); border:0; border-radius:var(--r-md); padding:0 18px; font-weight:600;
  font-size:16px; line-height:1.2; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  transition:background-color .15s, transform .12s var(--ease), opacity .15s; -webkit-tap-highlight-color:transparent }
button:not(:disabled):hover { background:var(--raise-hi) }
button:not(:disabled):active { transform:scale(.95) }
button svg { width:20px; height:20px; fill:currentColor; flex:none }
button:disabled { opacity:.4; cursor:default }
button:focus-visible,#wave:focus-visible { outline:2px solid rgba(255,255,255,.75); outline-offset:3px }
input:focus-visible { outline:none }
.accent, .accent:not(:disabled):hover { background:var(--green); color:var(--ink-on-green); font-weight:700 }
[hidden] { display:none!important }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%) }

/* The cover art, blurred, lights the whole screen behind the glass. */
#ambient { position:fixed; inset:-80px; z-index:-1; filter:blur(70px) saturate(160%); opacity:0; transition:opacity .8s ease }
#ambient.on { opacity:.42 }
/* Two layers: a new cover fades in over the old one, which goes only once it is covered. */
#ambient i { position:absolute; inset:0; background:center/cover no-repeat; opacity:0; transition:opacity .8s ease }
#ambient i.show { opacity:1 }

/* The frosted bar is its own layer: lift it above the panels so its menu opens on top. */
/* No bar behind the header: its row sits 16px from the top, the same 16px as the panels below it.
   (position + z-index keep the mode menu above the panels.) */
header { position:relative; z-index:20; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 22px 0 16px }
.state { display:flex; align-items:center; gap:12px; min-width:0; font-size:18px; font-weight:600; padding-left:18px }
#status { white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#status.swap { animation:fade .3s ease both }
.tools { display:flex; align-items:center; gap:12px }
.spotify { width:96px; height:auto; display:block }
#dark { background:transparent; padding:0 12px }
/* The explicit filter, a chip like the mode chip that says what it does: "Explicit Off" with a grey E
   while explicit songs are kept out; amber "Explicit On" and the minutes left while allowed. */
#clean { gap:8px; padding:0 16px }
#clean svg { width:22px; height:22px; color:var(--dim) }
#clean.allowed { color:#f0b44c; border-color:rgba(240,180,76,.45) }
#clean.allowed svg { color:#f0b44c }
#clean span { font-variant-numeric:tabular-nums }
.e-badge { display:inline-grid; place-items:center; width:16px; height:16px; margin-left:8px; border-radius:3px; vertical-align:2px;
  background:rgba(255,255,255,.55); color:#121214; font:700 10px/1 system-ui, sans-serif; font-style:normal }
#deck.explicit #title::after { content:"E"; display:inline-grid; place-items:center; width:22px; height:22px; margin-left:10px;
  border-radius:4px; vertical-align:6px; background:rgba(255,255,255,.55); color:#121214; font:700 13px/1 system-ui, sans-serif }
/* (The row's own opacity is held by its entrance animation: its contents dim instead.) */
#queue .row.skips > :not(.tag) { opacity:.38 }
.results-note { color:var(--dim); font-size:14px; padding:10px 4px; list-style:none }
#dark svg { width:24px; height:24px }
/* Screen dark: everything covered in black; the music and polling go on underneath. */
#blackout { position:fixed; inset:0; z-index:100; background:#000; cursor:none; animation:fade .5s ease both }
.chip-wrap { position:relative }
.glass { background:var(--glass-strong); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur);
  border:1px solid var(--line); box-shadow:0 18px 50px rgba(0,0,0,.55) }
#mode-menu { position:absolute; right:0; top:calc(100% + 8px); z-index:20; display:flex; flex-direction:column; gap:6px; padding:8px;
  border-radius:var(--r-lg); min-width:260px; animation:drop .18s var(--ease) both }
#mode-menu.glass { background:rgba(26,26,30,.97) } /* no blur inside the frosted bar */
#mode-menu button { justify-content:flex-start; border-radius:var(--r-sm); background:transparent }
#mode-menu button:hover { background:var(--raise) }
#offline { background:rgba(66,51,33,.85); color:#ffdcac; padding:8px 20px }
/* Radio mode: the stations as a 4 x 4 grid of their logos where Up Next was. */
#station-box { flex:1 1 0; min-height:0; display:grid; place-items:center; padding-top:4px }
#station-grid { display:grid; grid-template-columns:repeat(var(--cols, 4), var(--tile, 72px)); grid-auto-rows:var(--tile, 72px); gap:10px }
.station-tile { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:calc(var(--tile, 72px) * .08); min-height:0; padding:calc(var(--tile, 72px) * .09); border-radius:var(--r-md);
  background:rgba(255,255,255,.04); border:1px solid var(--line); overflow:hidden }
/* Every logo in the same square, centred above its language: the same size whatever its drawing. */
.station-tile img { flex:none; width:calc(var(--tile, 72px) * .5); height:calc(var(--tile, 72px) * .5); object-fit:contain;
  border-radius:var(--r-sm); box-sizing:border-box }
.station-tile img.light { background:#d6d6dc; padding:calc(var(--tile, 72px) * .045) }
.station-tile img.boxed { object-fit:cover; filter:brightness(.86) }
.station-tile span { font-weight:650; font-size:15px; text-align:center }
.station-tile small { font-size:clamp(11px, calc(var(--tile, 72px) * .14), 14px); line-height:1.1; font-weight:600;
  letter-spacing:.02em; color:var(--dim); white-space:nowrap }
.station-tile.on { border-color:var(--green); box-shadow:inset 0 0 0 1px var(--green); background:rgba(30,215,96,.08) }
.station-tile.on small { color:var(--green) }
/* The trip card from the owner's phone: always there, its own 100 px under the Now Playing card (in
   the card's own glass), so nothing ever moves; a moment fills it, and it stays a blank holding card
   otherwise. A new moment's words fade in. */
#trip { grid-column:1; grid-row:2; height:100px; margin-top:16px; display:flex; align-items:center; gap:16px; padding:0 20px 0 18px;
  overflow:hidden; border-radius:var(--r-lg); background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur);
  border:1px solid var(--line) }
#trip::before { content:""; align-self:stretch; margin:18px 0; width:4px; border-radius:2px; background:var(--green); flex:none }
#trip.blank::before, #trip.blank > * { visibility:hidden }
#trip.new .trip-text, #trip.new #trip-stars { animation:fade .4s ease both }
.trip-text { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px }
#trip-title { font-size:21px }
#trip-line { color:var(--dim); font-size:15px; line-height:1.35; white-space:pre-line }
#trip-stars { color:#f5c451; font-size:20px; letter-spacing:1px; flex:none }

main { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto; column-gap:16px;
  padding:16px; min-height:0 }
#deck { grid-column:1; grid-row:1 }
.side { grid-column:2; grid-row:1 / span 2 }
#deck,#up-next { background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border:1px solid var(--line);
  border-radius:var(--r-lg); min-height:0; min-width:0 }
#deck { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:16px 24px; position:relative }
/* Sized for the Now Playing card above the trip card's row. */
.sleeve { display:grid; place-items:center; height:min(26vh,28vw,340px); aspect-ratio:1; min-height:120px; background:rgba(255,255,255,.05);
  border-radius:var(--r-md); overflow:hidden; flex:0 1 auto; box-shadow:0 16px 40px rgba(0,0,0,.45) }
#deck > :not(.sleeve), .deck-body > * { flex-shrink:0 }
/* The song's details: part of the deck's column on a tablet; beside the cover on a phone in landscape. */
.deck-body { display:contents }
#art { display:block; width:100%; height:100%; object-fit:contain; transition:opacity .35s ease }
#art.loading { opacity:0 }

/* Local radio: the frequency where the cover goes, with a live level meter. */
#radio-art { width:100%; height:100%; display:grid; place-content:center; justify-items:center; gap:6px; border-radius:var(--r-lg);
  background:radial-gradient(circle at 30% 20%, rgba(255,255,255,.14), transparent 55%), linear-gradient(150deg,#2a2a33,#0e0e12);
  animation:fade .3s ease both }
#radio-art b { font-size:clamp(44px, 9vw, 96px); font-weight:800; letter-spacing:-.02em; font-variant-numeric:tabular-nums; line-height:1 }
#radio-art span { color:var(--dim); font-weight:700; letter-spacing:.2em }
/* The logo sits in the exact middle of the tile (cropped to its drawing first, so its own margins do not shift it). */
#radio-art img { display:none; position:absolute; inset:0; margin:auto; width:66%; height:66%; object-fit:contain }
#radio-art.logo.light { background:#d6d6dc }
/* A logo with its own white background: a smaller, rounded, dimmed icon, not a bright white panel. */
#radio-art.logo.boxed img { width:52%; height:52%; border-radius:var(--r-lg); object-fit:cover; filter:brightness(.82) }
#radio-art.logo img { display:block }
#radio-art.logo b, #radio-art.logo span { display:none }
.chips.stations button { display:inline-flex; align-items:center; gap:10px; padding:0 16px 0 8px }
.chips.stations img { width:34px; height:34px; border-radius:var(--r-sm); object-fit:contain; padding:2px }
.chips.stations img.light { background:#d6d6dc }
.chips.stations img.boxed { padding:0; object-fit:cover; filter:brightness(.82) }
#radio-art { position:relative }
/* The level meter sits on its own at the bottom, so the logo (or frequency) is centred in the tile. */
#radio-art .eq { position:absolute; left:0; right:0; bottom:6%; display:flex; justify-content:center; align-items:flex-end; gap:4px; height:24px }
#radio-art .eq i { width:6px; height:30%; border-radius:3px; background:var(--green); opacity:.4; transition:opacity .3s }
#radio-art.live .eq i { opacity:1; animation:level 1.1s ease-in-out infinite alternate }
#radio-art.live .eq i:nth-child(2) { animation-duration:.8s } #radio-art.live .eq i:nth-child(3) { animation-duration:1.3s }
#radio-art.live .eq i:nth-child(4) { animation-duration:.95s } #radio-art.live .eq i:nth-child(5) { animation-duration:1.2s }
@keyframes level { from { height:20% } to { height:100% } }
#deck.radio #wave, #deck.radio .timing, #deck.radio .save-wrap { display:none }
/* Without the song bar, the song's name sits in the middle of the space between the tile and the
   controls: 28px above it and 28px below it (the deck's own 8px gap included). */
#deck.radio #title { margin-top:20px }
#deck.radio #controls { margin-top:20px }
#radio-off { margin-top:8px; animation:rise .2s var(--ease) both }
#disc { width:76%; aspect-ratio:1; border-radius:50%; background:radial-gradient(circle,#161618 0 6%,#9a9aa2 6.5% 16%,transparent 17%),
  repeating-radial-gradient(circle,#34343a 0 2px,#27272c 3px 5px) }
h1 { font-size:clamp(22px,3.4vh,34px); line-height:1.3; margin:6px 0 0; width:100%; text-align:center; letter-spacing:-.02em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#artist { margin:0; line-height:1.4; color:var(--dim); width:100%; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:18px }
.swap { animation:fade .35s ease both }
#wave { width:92%; height:52px; touch-action:none; cursor:pointer; flex:none }
#wave canvas { width:100%; height:100%; display:block }
.timing { display:flex; justify-content:space-between; width:92%; color:var(--dim); font-size:15px; font-variant-numeric:tabular-nums }
#controls { display:flex; align-items:center; gap:24px }
#controls button { width:64px; height:64px; border-radius:50%; padding:0 }
#controls button svg { width:28px; height:28px }
#controls .play, #controls .play:not(:disabled):hover { width:84px; height:84px; background:var(--green); color:var(--ink-on-green);
  box-shadow:0 10px 30px rgba(30,215,96,.25) }
#controls .play svg { width:38px; height:38px }
#recover { text-align:center; animation:rise .25s var(--ease) both } #recover p { margin:4px 0; color:#ffdcac; font-weight:600 }
#recover-actions { display:flex; gap:10px; justify-content:center; flex-wrap:wrap }
.save-wrap { position:relative; margin-top:28px }
#save { gap:10px; padding:0 22px } #save .spotify { width:84px }

/* The QR card: glass like the rest, the code itself on white so any phone can scan it. */
#qr-pop { position:absolute; left:50%; bottom:calc(100% + 16px); z-index:10; width:280px; padding:16px; border-radius:var(--r-lg);
  text-align:center; display:flex; flex-direction:column; align-items:center; gap:8px; transform:translateX(-50%);
  animation:pop .22s var(--ease) both }
#qr-pop::after { content:""; position:absolute; left:50%; bottom:-9px; width:16px; height:16px; margin-left:-8px; transform:rotate(45deg);
  background:var(--glass-strong); border-right:1px solid var(--line); border-bottom:1px solid var(--line) }
.qr-tile { background:#fff; border-radius:var(--r-md); padding:10px; line-height:0 }
#qr-canvas { width:156px; height:156px; image-rendering:pixelated }
#qr-pop strong { font-size:17px }
#qr-title { color:var(--dim); font-size:14px; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; overflow-wrap:anywhere }
#qr-done, #qr-done:not(:disabled):hover { background:var(--green); color:var(--ink-on-green); min-height:48px; min-width:120px; margin-top:4px }

#up-next { display:flex; flex-direction:column; padding:16px 18px }
.side { display:flex; flex-direction:column; gap:16px; min-height:0; min-width:0 }
.side #up-next { flex:1 1 0 }

/* The live map. */
#map-panel { position:relative; flex:0 0 46%; border-radius:var(--r-lg); overflow:hidden; border:1px solid var(--line); background:#0b0b10 }
#map-panel .map { position:absolute; inset:0 }
.map-status { position:absolute; inset:0; z-index:3; display:grid; place-items:center; margin:0; padding:24px; text-align:center;
  color:var(--dim); background:rgba(10,10,14,.72); animation:fade .3s ease both }
.map-recenter { position:absolute; right:12px; bottom:34px; z-index:2; background:var(--glass-strong); backdrop-filter:var(--blur);
  -webkit-backdrop-filter:var(--blur); animation:rise .2s var(--ease) both; transition:right .5s var(--ease) }
.map-credit { position:absolute; right:10px; bottom:8px; z-index:2; font-size:11px; color:rgba(255,255,255,.55); pointer-events:none;
  transition:right .5s var(--ease) }

/* A landmark: the card slides over the right half; the view shifts left (camera padding) to keep the car in sight. */
#map-panel.split .map-recenter { right:calc(50% + 12px) }
#map-panel.split .map-credit { right:calc(50% + 10px); max-width:calc(50% - 20px); text-align:right; font-size:10px }
/* The card slides over the right half; everything stays inside it, behind a clean edge. */
.map-card { position:absolute; top:0; right:0; bottom:0; width:50%; z-index:3; display:flex; flex-direction:column; overflow:hidden;
  background:linear-gradient(180deg, rgba(28,28,34,.97), rgba(12,12,16,.99)); border-left:1px solid var(--line);
  transform:translateX(101%); transition:transform .5s var(--ease); cursor:pointer }
#map-panel.split .map-card { transform:none }
.map-card .photo { width:100%; height:46%; flex:none; object-fit:cover; background:rgba(255,255,255,.06);
  mask-image:linear-gradient(180deg, #000 70%, transparent); -webkit-mask-image:linear-gradient(180deg, #000 70%, transparent) }
.map-card .photo.none { display:grid; place-items:center; mask-image:none; -webkit-mask-image:none;
  background:radial-gradient(circle at 30% 30%, rgba(184,146,90,.28), transparent 60%), linear-gradient(160deg, #2a2620, #141418) }
.map-card .photo.none svg { width:56px; height:56px; color:rgba(230,211,172,.45) }
.map-card .text { min-height:0; padding:12px 16px 16px; display:flex; flex-direction:column; overflow:hidden }
.map-card b { font-size:19px; line-height:1.2; color:#e6d3ac }
.map-card small { color:var(--dim); margin:4px 0 8px; font-size:13px }
.map-card p { margin:0; font-size:14px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:5; -webkit-box-orient:vertical; overflow:hidden }
/* Read more: a QR for the whole article, always in view, over the photo's corner (never the text). */
.map-card .read { position:absolute; right:12px; top:12px; display:grid; padding:6px;
  border-radius:var(--r-md); background:rgba(20,20,26,.92); border:1px solid var(--line); overflow:visible }
.map-card .read canvas { width:84px; height:84px; border-radius:6px; image-rendering:pixelated }

/* The car: one white shape (a dot, pointed once the heading is known) in a green glow, with a pulse. */
.you { width:60px; height:60px; position:relative }
.you .puck { position:absolute; inset:0; width:100%; height:100%; overflow:visible;
  filter:drop-shadow(0 1px 3px rgba(0,0,0,.6)) drop-shadow(0 0 7px rgba(30,215,96,.3)) }
.you .puck path { fill:#fff; stroke:#9a9aa3; stroke-width:2.5; stroke-linejoin:round }
.you .ping { position:absolute; left:50%; top:50%; width:20px; height:20px; margin:-10px; border-radius:50%;
  border:1.5px solid rgba(30,215,96,.7); animation:ping 2.4s ease-out infinite }
@keyframes ping { from { transform:scale(1); opacity:.9 } to { transform:scale(2.8); opacity:0 } }

/* The drive preview (?drive): one slim bar across the top of the map. */
.drive-bar { position:absolute; top:0; left:0; right:0; z-index:5; display:flex; gap:6px; align-items:center; padding:6px 8px;
  background:var(--glass-strong); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border-bottom:1px solid var(--line) }
.drive-bar select { flex:1; min-width:0; min-height:32px; padding:0 10px; border-radius:var(--r-sm); border:1px solid var(--line);
  background:rgba(255,255,255,.08); color:inherit; font:inherit; font-size:13px }
.drive-bar select option { background:#1b1b20 }
.drive-bar button { min-height:32px; padding:0 10px; font-size:12px; border-radius:var(--r-sm) }
.drive-bar button.on { background:var(--green); color:#000 }
#map-panel.previewing .map-card { top:45px }
h2 { margin:0 0 8px; font-size:22px; display:flex; justify-content:space-between; align-items:baseline }
h2 small { color:var(--dim); font-weight:400; font-size:15px }
.list { list-style:none; margin:0 -10px; padding:0 10px; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; flex:1; min-height:0 }
.row { position:relative; display:flex; gap:12px; align-items:center; padding:8px 10px; margin:0 -10px; border-radius:var(--r-md); min-height:64px;
  transition:background-color .15s }
/* Straight dividers, inset: they do not follow the rows' rounded corners. */
/* Up Next while a new playlist's songs are on their way: the old list, dimmed. */
#queue { transition:opacity .2s ease }
#queue.updating { opacity:.3; pointer-events:none }
.row + .row::before { content:""; position:absolute; left:10px; right:10px; top:0; height:1px; background:var(--line); pointer-events:none }
.row.enter { animation:rise .26s var(--ease) both; animation-delay:calc(var(--i,0) * 35ms) }
.row img,.row .noart { width:48px; height:48px; border-radius:var(--r-sm); flex:none; object-fit:cover; background:rgba(255,255,255,.06) }
.row .meta { flex:1; min-width:0 }
.row .meta b,.row .meta span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.row .meta span { color:var(--dim); font-size:15px }
.tag { color:var(--green); font-size:13px; white-space:nowrap }
.note { color:var(--dim); font-size:14px; margin:8px 0 0 }
.empty { margin:auto; padding:24px; text-align:center; color:var(--dim); animation:fade .3s ease both }

#search-sheet { position:fixed; inset:0; z-index:30; background:rgba(0,0,0,.4); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
  display:grid; place-items:center; animation:fade .18s ease both }
.sheet { width:min(92vw,1200px); height:min(86vh,980px); border-radius:var(--r-lg); padding:20px; display:flex; flex-direction:column;
  animation:rise .24s var(--ease) both }
#search-form { display:flex; gap:12px; align-items:center }
.field { position:relative; flex:1; display:flex }
#query { flex:1; min-height:56px; padding:0 104px 0 18px; border-radius:var(--r-md); border:1px solid var(--line); background:rgba(0,0,0,.35);
  font-size:20px; transition:border-color .15s, background-color .15s, box-shadow .15s }
#query:hover { border-color:rgba(255,255,255,.18) }
#query:focus { border-color:rgba(255,255,255,.38); background:rgba(0,0,0,.45); box-shadow:0 0 0 4px rgba(255,255,255,.08) }
.spin { position:absolute; right:18px; top:50%; width:22px; height:22px; margin-top:-11px; border-radius:50%;
  border:3px solid rgba(255,255,255,.15); border-top-color:var(--green); animation:spin .7s linear infinite;
  opacity:0; transform:scale(.6); transition:opacity .2s, transform .2s var(--ease); pointer-events:none }
.field.busy .spin { opacity:1; transform:none }
/* The browser's own clear cross is replaced by ours: where the spinner sits, sliding left while it spins. */
#query::-webkit-search-cancel-button { -webkit-appearance:none; appearance:none; display:none }
#clear { position:absolute; right:4px; top:4px; background:transparent; opacity:0; pointer-events:none;
  transition:right .25s var(--ease), opacity .15s }
.field.filled #clear { opacity:.8; pointer-events:auto } .field.filled #clear:hover { opacity:1 }
.field.busy #clear { right:44px }
#search-form > button { min-height:56px }
#search-info { margin:16px 0 0; min-height:0 }
#search-info:empty { display:none }
.notice { display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:var(--r-md); background:rgba(255,190,90,.12); color:#ffdcac;
  animation:rise .2s var(--ease) both }
#results { margin-top:16px; transition:opacity .2s }
#results.stale { opacity:.45 }
#results .row:hover { background:rgba(255,255,255,.04) }
#results .row button { white-space:nowrap } #results .row button:last-child { min-width:124px }
#results .now, #results .now:not(:disabled):hover { background:var(--green); color:var(--ink-on-green) }
#results .done { background:transparent; color:var(--green) } #results .done:disabled { opacity:1 }
#results .done svg { animation:pop-in .25s var(--ease) both }
.skeleton .bone { display:block; border-radius:4px; background:linear-gradient(90deg,rgba(255,255,255,.05) 25%,rgba(255,255,255,.12) 37%,rgba(255,255,255,.05) 63%);
  background-size:400% 100%; animation:shimmer 1.2s ease infinite }
.skeleton .art { width:48px; height:48px; border-radius:var(--r-sm); flex:none }
.skeleton .line { height:14px; margin:6px 0 }

#lamp { width:10px; height:10px; border-radius:50%; background:var(--dim); flex:none; transition:background-color .3s, box-shadow .3s }
#lamp.on { background:var(--green); box-shadow:0 0 10px rgba(30,215,96,.8) }

/* The browser wants a tap before the tablet may make sound (after a refresh). */
#resume { position:fixed; inset:0; z-index:80; display:grid; place-items:center; background:rgba(0,0,0,.5);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); animation:fade .2s ease both }
#resume-button { min-height:72px; padding:0 36px; font-size:22px; border-radius:var(--r-lg) }

/* Activation: the only thing a page without a session shows. */
/* Reconnect Spotify: a QR for the owner's phone, over everything but the passcode screen. */
#reconnect-pop, #ask-pop, #admin-pop { position:fixed; inset:0; z-index:85; display:grid; place-items:center; background:rgba(0,0,0,.55);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); animation:fade .2s ease both }
#reconnect-pop .card, #ask-pop .card, #admin-pop .card { align-items:center }
#admin-pass { width:min(320px, 70vw); min-height:52px; font-size:20px; text-align:center }
/* The chip is only a label for passengers: the owner opens the controls from their phone, or by
   holding it for 3 s and giving the car's passcode. */
#mode-chip.passive { cursor:default; background:transparent; border-color:transparent; -webkit-user-select:none; user-select:none;
  -webkit-touch-callout:none; touch-action:manipulation }
#reconnect-canvas { width:180px; height:180px; image-rendering:pixelated; transition:opacity .2s }
#reconnect-pop.expired #reconnect-canvas { opacity:.12 }
#reconnect-tick { width:96px; height:96px; border-radius:50%; display:grid; place-items:center; background:var(--green); color:var(--ink-on-green);
  animation:pop-in .3s var(--ease) both }
#reconnect-tick svg { width:52px; height:52px }
#reconnect-pop.done .qr-tile, #reconnect-pop.done .row-buttons #reconnect-new { display:none }
#reconnect-pop .row-buttons, #ask-pop .row-buttons, #admin-pop .row-buttons { display:flex; gap:12px; justify-content:center }
#reconnect-pop .row-buttons button, #ask-pop .row-buttons button, #admin-pop .row-buttons button { min-height:52px; min-width:130px }
#activate { position:fixed; inset:0; z-index:90; display:grid; place-items:center; background:rgba(0,0,0,.55);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); animation:fade .2s ease both }
.card { width:min(92vw,440px); padding:28px; border-radius:var(--r-lg); display:flex; flex-direction:column; gap:14px; text-align:center;
  animation:rise .25s var(--ease) both }
.card h2 { justify-content:center; margin:0 }
.card p { margin:0; color:var(--dim) }
#passcode { min-height:56px; padding:0 18px; border-radius:var(--r-md); border:1px solid var(--line); background:rgba(0,0,0,.35); font-size:20px; text-align:center;
  transition:border-color .15s, box-shadow .15s }
#passcode:focus { border-color:rgba(255,255,255,.38); box-shadow:0 0 0 4px rgba(255,255,255,.08) }
#activate-info:empty { display:none } #activate-info { color:#ffdcac }

#results .list-title { list-style:none; margin:4px 0 8px; font-size:17px; font-weight:600; color:var(--dim) }
#genres h3 { margin:20px 0 12px; font-size:17px; font-weight:600; color:var(--dim) }
.chips { display:flex; flex-wrap:wrap; gap:10px; animation:fade .25s ease both }
.chips button { padding:0 20px }
.row .skip { background:transparent; opacity:.75 } .row .skip:not(:disabled):hover { opacity:1; background:var(--raise) }

/* Glass scrollbars. */
* { scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.22) transparent }
::-webkit-scrollbar { width:10px; height:10px }
::-webkit-scrollbar-track { background:transparent }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,.18); border-radius:10px; border:3px solid transparent; background-clip:padding-box }
::-webkit-scrollbar-thumb:hover { background-color:rgba(255,255,255,.3) }

@keyframes fade { from { opacity:0 } to { opacity:1 } }
@keyframes rise { from { opacity:0; transform:translateY(10px) scale(.985) } to { opacity:1; transform:none } }
@keyframes drop { from { opacity:0; transform:translateY(-6px) } to { opacity:1; transform:none } }
@keyframes pop { from { opacity:0; transform:translate(-50%,8px) scale(.94) } to { opacity:1; transform:translate(-50%,0) scale(1) } }
@keyframes pop-in { from { transform:scale(.4) } to { transform:none } }
@keyframes spin { to { transform:rotate(360deg) } }
@keyframes shimmer { from { background-position:100% 50% } to { background-position:0 50% } }
/* A phone. The tablet's layout (everything on one fixed screen) does not fit, so the page scrolls. */
@media (max-width:760px), (max-height:520px) {
  html, body { height:auto; overflow:visible }
  body { display:block; min-height:100dvh }
  main { display:flex; flex-direction:column; gap:12px; padding:12px }
  .side { display:contents }
  #trip { margin-top:0; height:auto; min-height:84px; padding-top:14px; padding-bottom:14px }
  /* The tablet keeps the empty trip card so nothing moves; on a phone it shows only with a moment. */
  #trip.blank { display:none }
  #trip-title { font-size:18px } #trip-line { font-size:14px }
  .side #up-next { flex:none; height:min(440px, 70dvh) }
  #map-panel { flex:none; height:min(440px, 70dvh) }
  #controls { gap:20px }
  /* Search: the whole sheet scrolls (genres, stations and results), with the search bar pinned on top. */
  .sheet { width:calc(100vw - 24px); height:auto; max-height:calc(100dvh - 24px); padding:14px; overflow-y:auto; overscroll-behavior:contain }
  #search-form { position:sticky; top:-14px; z-index:2; margin:-14px -14px 0; padding:14px; background:rgb(24,24,28);
    border-radius:var(--r-lg) var(--r-lg) 0 0 }
  .field, #query { min-width:0 }
  #results { flex:none; overflow:visible }
}
/* A phone held upright: one column; the header in two rows (state, Explicit and the moon; then Search
   and where it plays). */
@media (max-width:760px) {
  /* Upright, the radio card is as tall as its 4-across grid (app.js fitStationGrid). */
  .side #up-next.radio { height:auto }
  #up-next.radio #station-box { flex:none }
  header { display:grid; grid-template-columns:minmax(0,1fr) auto auto; grid-template-areas:"state clean dark" "search mode mode";
    gap:10px 8px; padding:12px 12px 0 }
  .tools { display:contents }
  .state { grid-area:state; padding-left:6px; font-size:16px }
  #clean { grid-area:clean; padding:0 12px } #dark { grid-area:dark }
  #open-search { grid-area:search } .chip-wrap { grid-area:mode; min-width:0 }
  #mode-chip { max-width:100% }
  #deck { padding:20px 16px 22px }
  .sleeve { height:min(64vw, 300px) }
  .save-wrap { margin-top:16px }
  #controls button { width:58px; height:58px }
  #controls .play, #controls .play:not(:disabled):hover { width:76px; height:76px }
  /* Search and Close as icons (their words stay for screen readers), so the field keeps its room. */
  #find, #close-search { font-size:0; gap:0; width:56px; padding:0; flex:none }
  /* A song's Play Now and Queue go on a line of their own under its name. */
  #results .row:has(button + button) { flex-wrap:wrap; row-gap:10px }
  #results .row:has(button + button) .meta { flex:1 1 calc(100% - 64px) }
  #results .row:has(button + button) > button:nth-child(n) { flex:1 1 0; min-width:0 }
}
/* A phone on its side: the cover beside the song and its controls, with Up Next, fill the first screen;
   the trip card and the map follow below. */
@media (max-height:520px) and (min-width:761px) {
  header { padding:10px 14px 0 }
  main { display:grid; grid-template-columns:minmax(0,1.45fr) minmax(0,1fr); grid-template-rows:calc(100dvh - 76px) auto auto;
    gap:12px; padding:10px 14px 14px }
  #deck { grid-column:1; grid-row:1; flex-direction:row; gap:18px; padding:12px 14px }
  .deck-body { display:flex; flex-direction:column; align-items:center; gap:4px; flex:1; min-width:0 }
  .sleeve { height:min(calc(100dvh - 130px), 22vw); min-height:0 }
  h1 { font-size:22px; margin-top:0 }
  #artist { font-size:16px }
  #wave { height:40px }
  .timing { font-size:13px }
  #controls { gap:14px }
  #controls button { width:50px; height:50px }
  #controls .play, #controls .play:not(:disabled):hover { width:64px; height:64px }
  #controls .play svg { width:30px; height:30px }
  .save-wrap { margin-top:6px }
  #deck.radio #title, #deck.radio #controls { margin-top:10px }
  .side #up-next { grid-column:2; grid-row:1; height:auto }
  #trip { grid-column:1 / -1; grid-row:2 }
  #map-panel { grid-column:1 / -1; grid-row:3; height:min(360px, 90dvh) }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none!important; animation:none!important } }
