/* The Listening Room — warm walnut and brass over an animated backdrop. Tokens per theme; auto follows the device. */
:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --radius: 18px;
  /* dark (default) */
  --bg: #120c08;
  --ink: #f6ead6;
  --ink-2: #d9c6a8;
  --muted: #b29f84;
  --panel: rgba(28, 18, 11, .62);
  --panel-solid: #22160d;
  --panel-line: rgba(255, 220, 170, .14);
  --chip: rgba(255, 236, 205, .08);
  --chip-on: #e7b660;
  --chip-on-ink: #2a1708;
  --accent: #e7a74a;
  --shade: linear-gradient(180deg, rgba(8, 5, 3, .55) 0%, rgba(8, 5, 3, .05) 22%, rgba(8, 5, 3, .05) 70%, rgba(8, 5, 3, .6) 100%);
  --label-l: 40%;
  --glass: rgba(34, 22, 13, .34); --glass-dense: rgba(30, 19, 11, .7); --glass-edge: rgba(255, 236, 205, .16); --glass-hi: rgba(255, 240, 215, .34); --glass-sheen: rgba(255, 240, 220, .12);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #efe5d4;
  --ink: #2a1a0e;
  --ink-2: #4a3420;
  --muted: #6e5843;
  --panel: rgba(255, 249, 238, .72);
  --panel-solid: #fbf3e5;
  --panel-line: rgba(90, 55, 20, .16);
  --chip: rgba(90, 55, 20, .07);
  --chip-on: #5a3416;
  --chip-on-ink: #fbf0dc;
  --accent: #a8631a;
  --shade: linear-gradient(180deg, rgba(255, 248, 235, .45) 0%, rgba(255, 248, 235, 0) 22%, rgba(255, 248, 235, 0) 70%, rgba(255, 248, 235, .5) 100%);
  --label-l: 46%;
  --glass: rgba(255, 251, 244, .4); --glass-dense: rgba(255, 249, 238, .8); --glass-edge: rgba(255, 255, 255, .6); --glass-hi: rgba(255, 255, 255, .95); --glass-sheen: rgba(255, 255, 255, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #efe5d4; --ink: #2a1a0e; --ink-2: #4a3420; --muted: #6e5843;
    --panel: rgba(255, 249, 238, .72); --panel-solid: #fbf3e5; --panel-line: rgba(90, 55, 20, .16);
    --chip: rgba(90, 55, 20, .07); --chip-on: #5a3416; --chip-on-ink: #fbf0dc; --accent: #a8631a;
    --shade: linear-gradient(180deg, rgba(255, 248, 235, .45) 0%, rgba(255, 248, 235, 0) 22%, rgba(255, 248, 235, 0) 70%, rgba(255, 248, 235, .5) 100%);
    --label-l: 46%;
    --glass: rgba(255, 251, 244, .4); --glass-dense: rgba(255, 249, 238, .8); --glass-edge: rgba(255, 255, 255, .6); --glass-hi: rgba(255, 255, 255, .95); --glass-sheen: rgba(255, 255, 255, .35);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { overflow-x: clip; } /* the off-screen drawer and tab must never widen the page */
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--sans);
  overflow: hidden; overflow: clip; -webkit-tap-highlight-color: transparent; /* clip: nothing (focus included) can scroll the page sideways */
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
svg { display: block; }

#backdrop { position: fixed; inset: 0; z-index: 0; }
.shade { position: fixed; inset: 0; z-index: 1; background: var(--shade); pointer-events: none; transition: opacity .6s var(--ease); }

/* ---------- layout ---------- */
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "stage" "transport";
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  gap: 12px;
}
.top, .stage, .transport, .credit { position: relative; z-index: 2; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.panel, .crate, .transport, .menu-list, .toast { background: var(--panel); border: 1px solid var(--panel-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); }

.top { z-index: 6; grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.35rem/1 var(--serif); letter-spacing: .01em; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand svg circle:first-child { fill: #151515; stroke: rgba(255,255,255,.25); }
.brand-label { fill: var(--accent); }
.home-link { display: inline-flex; align-items: center; gap: 4px; align-self: center; height: 30px; padding: 0 12px 0 8px; border-radius: 999px;
  border: 1px solid var(--panel-line); background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font: 600 .8rem var(--sans); color: var(--ink-2); text-decoration: none; transition: background .2s, color .2s; }
.home-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home-link:hover { color: var(--ink); background: var(--chip); }
.top-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--panel-line); background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-weight: 600; font-size: .9rem; transition: transform .16s var(--ease), background .2s; }
.pill:active { transform: scale(.97); }
.pill svg, .seg svg, .icon-btn svg, .search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill.icon { width: 38px; padding: 0; justify-content: center; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; border-radius: 14px;
  min-width: 220px; z-index: 20; box-shadow: 0 18px 50px -12px rgba(0,0,0,.5); background: var(--panel-solid); }
.menu-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: left; font-weight: 500; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--chip); }
.menu-list button[aria-checked="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.menu-heading { margin: 8px 10px 4px; padding-top: 8px; border-top: 1px solid var(--panel-line); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.menu-list { max-height: calc(100vh - 90px); overflow: auto; }
.menu-list .swatch { width: 28px; height: 20px; border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--panel-line); background: var(--panel);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 999px; background: none; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.seg:not(.open) button[aria-checked="false"] { display: none; } /* tap the current theme to see the others */
.seg button span { display: none; } /* icons only; each button's title names it */
.seg .fill { fill: currentColor; stroke: none; }

.stage { --cw: clamp(340px, 44vw, 700px); grid-area: stage; display: grid; grid-template-columns: minmax(0, 1fr) var(--cw); column-gap: 20px; min-height: 0; align-items: stretch; }
.deck { display: grid; place-items: center; min-height: 0; position: relative; }
.gramophone-host { width: 100%; height: 100%; display: grid; place-items: center; }
.gramophone { width: min(100%, 720px); max-height: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(0,0,0,.35)); cursor: pointer; }
.gramophone .g-label-paper { fill: hsl(var(--h, 30) 55% var(--label-l)); }
.gramophone .g-label-ring { stroke: rgba(255, 244, 220, .55); stroke-width: 1; fill: none; }
.gramophone text { fill: #fff6e4; text-anchor: middle; font-family: var(--serif); }
.gramophone .g-label-name { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.gramophone .g-label-small { font-size: 7.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-family: var(--sans); }

/* ---------- crate ---------- */
.crate { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius); padding: 14px; box-shadow: 0 20px 60px -24px rgba(0,0,0,.55);
  width: var(--cw); justify-self: start;
  transition: transform .6s var(--ease), opacity .45s var(--ease), display .6s allow-discrete; }
/* the crate slides out to the right once a record is playing; the tab on the edge brings it back */
.stage.tucked .crate { transform: translateX(calc(100% + 40px)); opacity: 0; display: none; }
@starting-style { .stage:not(.tucked) .crate { transform: translateX(calc(100% + 40px)); opacity: 0; } }
.crate-tab { position: absolute; right: calc(-1 * max(16px, env(safe-area-inset-right))); top: 50%; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 10px 18px; border: 1px solid var(--panel-line); border-right: 0; border-radius: 16px 0 0 16px; background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 16px 40px -16px rgba(0,0,0,.6);
  font-weight: 700; font-size: .85rem; letter-spacing: .04em; color: var(--ink-2);
  opacity: 0; visibility: hidden; transform: translate(100%, -50%);
  transition: transform .45s var(--ease), opacity .3s, visibility 0s .45s, color .2s; }
.crate-tab span { writing-mode: vertical-rl; }
.crate-tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.crate-tab .fill { fill: var(--accent); stroke: none; }
.crate-tab:hover { color: var(--ink); }
.stage.tucked .crate-tab { opacity: 1; visibility: visible; transform: translate(0, -50%); transition: transform .5s var(--ease) .3s, opacity .3s .3s, visibility 0s, color .2s; }
.crate-head { display: grid; gap: 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--panel-line); background: var(--chip); font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--chip-on); color: var(--chip-on-ink); border-color: transparent; }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--panel-line); background: var(--chip); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: .95rem; }
.search input::placeholder { color: var(--muted); }
.places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 92px; overflow: auto; }
.place { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--panel-line); background: none; font-size: .8rem; font-weight: 500; color: var(--ink-2); }
.place[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.place.near { font-weight: 700; }
.crate-note { margin: 10px 2px 0; min-height: 1.2em; font-size: .85rem; color: var(--muted); }
.sleeves { list-style: none; margin: 8px 0 0; padding: 4px 4px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px;
  overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; }

.sleeve { position: relative; width: 100%; border: 0; padding: 0; background: none; text-align: left; display: grid; gap: 7px; }
.sleeve-art { position: relative; aspect-ratio: 1.16; isolation: isolate; }
.sleeve-art::before { /* the record, half out of its sleeve */
  content: ""; position: absolute; top: 4%; bottom: 4%; left: 2%; aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background:
    conic-gradient(from 30deg, rgba(255,255,255,0) 0 10%, rgba(255,255,255,.16) 14%, rgba(255,255,255,0) 20% 60%, rgba(255,255,255,.12) 64%, rgba(255,255,255,0) 70%),
    repeating-radial-gradient(circle, rgba(255,255,255,.05) 0 1px, transparent 1px 3px),
    radial-gradient(circle, hsl(var(--h) 55% var(--label-l)) 0 17%, #0d0d0d 18% 19%, #1d1d1f 20% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 6px 14px -6px rgba(0,0,0,.6);
  transform: translateX(0); transition: transform .45s var(--ease);
}
.sleeve.colour .sleeve-art::before { background: radial-gradient(circle, hsl(var(--h) 55% var(--label-l)) 0 17%, hsl(var(--h) 40% 18%) 18% 100%); }
.sleeve-art::before { transform: translateX(5%); }
.sleeve:hover .sleeve-art::before, .sleeve:focus-visible .sleeve-art::before { transform: translateX(14%); }
.sleeve[aria-current="true"] .sleeve-art::before { transform: translateX(16%) rotate(40deg); }
.sleeve-cover { position: absolute; inset: 0 14% 0 0; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 22px -10px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform .3s var(--ease); display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 10px; color: #fff8ea; }
.sleeve:active .sleeve-cover { transform: scale(.97); }
.sleeve-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,0) 40%, rgba(0,0,0,.18)); pointer-events: none; }
.sleeve-freq { font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; opacity: .9; position: relative; z-index: 1; }
.sleeve-title { font: 700 1.05rem/1.05 var(--serif); position: relative; z-index: 1; text-wrap: balance; text-shadow: 0 1px 8px rgba(0,0,0,.35);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sleeve-name { font-weight: 600; font-size: .86rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sleeve-place { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -5px; }
.sleeve[aria-current="true"] .sleeve-name::before { content: "▶ "; color: var(--accent); }
.sleeve-live { position: absolute; z-index: 2; top: 8px; right: 8px; font: 700 .6rem var(--sans); letter-spacing: .1em; padding: 3px 6px; border-radius: 4px; background: rgba(0,0,0,.45); color: #fff; }
.sleeve-live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #ff5a4a; margin-right: 5px; vertical-align: 1px; }

/* sleeve art patterns, chosen per record */
.art-0 { background: radial-gradient(circle at 30% 20%, hsl(var(--h) 75% 62%), transparent 60%), linear-gradient(160deg, hsl(var(--h) 55% 38%), hsl(calc(var(--h) + 40) 50% 20%)); }
.art-1 { background: repeating-linear-gradient(135deg, hsl(var(--h) 55% 42%) 0 14px, hsl(var(--h) 55% 34%) 14px 28px); }
.art-2 { background: radial-gradient(circle at 70% 75%, hsl(calc(var(--h) + 30) 80% 60%) 0 18%, transparent 19%), linear-gradient(200deg, hsl(var(--h) 45% 25%), hsl(var(--h) 60% 45%)); }
.art-3 { background: repeating-radial-gradient(circle at 100% 100%, hsl(var(--h) 55% 40%) 0 10px, hsl(var(--h) 55% 30%) 10px 20px); }
.art-4 { background: linear-gradient(0deg, hsl(var(--h) 60% 30%) 0 33%, hsl(calc(var(--h) + 25) 65% 45%) 33% 66%, hsl(calc(var(--h) + 50) 70% 60%) 66%); }
.art-5 { background: conic-gradient(from 200deg at 50% 110%, hsl(var(--h) 60% 45%), hsl(calc(var(--h) + 60) 60% 40%), hsl(var(--h) 60% 25%), hsl(var(--h) 60% 45%)); }

/* ---------- transport ---------- */
.transport { --bar-full: 100%; grid-area: transport; display: flex; align-items: center; gap: 16px; padding: 6px 14px 6px 6px; border-radius: 999px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
  /* compact until clicked, tapped or reached by keyboard; then it slides out to full width */
  justify-self: center; width: min(360px, var(--bar-full)); cursor: pointer;
  transition: opacity .5s var(--ease), transform .5s var(--ease), width .5s var(--ease); }
.transport.open, .transport:has(:focus-visible) { width: var(--bar-full); cursor: auto; }
.transport #share, .transport #report, .transport #cast, .transport #mix-btn, .transport .sound-btn, .transport .sound { max-width: 0; opacity: 0; visibility: hidden; overflow: hidden; flex-shrink: 0;
  transition: max-width .5s var(--ease), opacity .2s, visibility 0s .5s; }
.transport:is(.open, :has(:focus-visible)) :is(#share, #report, #cast, #mix-btn, .sound-btn, .sound) { max-width: 460px; opacity: 1; visibility: visible; transition: max-width .5s var(--ease), opacity .35s .15s, visibility 0s; }
.transport:not(.open):not(:has(:focus-visible)) { gap: 12px; }
.play { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: #1e1004;
  box-shadow: 0 6px 18px -6px rgba(231, 167, 74, .7); transition: transform .16s var(--ease); }
.play:active { transform: scale(.94); }
.play svg { width: 24px; height: 24px; fill: currentColor; grid-area: 1 / 1; transition: opacity .2s, transform .25s var(--ease); }
.play .i-pause { opacity: 0; transform: scale(.6); }
.play[aria-pressed="true"] .i-play { opacity: 0; transform: scale(.6); }
.play[aria-pressed="true"] .i-pause { opacity: 1; transform: none; }
.play:disabled { opacity: .5; cursor: default; }
.now { flex: 1; min-width: 0; }
.now p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-name { font: 700 1.05rem var(--serif); }
.now-meta { font-size: .84rem; color: var(--muted); }
.now-meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff5a4a; margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.crackle { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); white-space: nowrap; }
#crackle { width: 80px; accent-color: var(--accent); }
.sound { display: flex; align-items: center; gap: 16px; }
.sound-title, .transport .sound-btn { display: none; }
.volume { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; }
.icon-btn .fill { fill: currentColor; }
.icon-btn .x { display: none; }
.icon-btn[aria-pressed="true"] .waves { display: none; }
.icon-btn[aria-pressed="true"] .x { display: block; }
#volume { width: 140px; accent-color: var(--accent); }
.volume.locked #volume { display: none; }
.volume.locked::after { content: "Use your device’s volume buttons"; font-size: .78rem; color: var(--muted); }

/* Mix: a slider for each part of a sound made here, in a panel over the player */
.transport { position: relative; }
#mix-btn.changed { color: var(--accent); } /* the listener's own mix is on */
.transport:has(#mixer:not([hidden])) { z-index: 8; } /* over the record crate while mixing */
.mixer { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(340px, calc(100vw - 32px)); max-height: min(60vh, 440px); overflow: auto;
  padding: 14px 16px; border-radius: 18px; border: 1px solid var(--panel-line); cursor: auto; background: var(--panel-solid); box-shadow: 0 18px 40px -14px rgba(0,0,0,.6); }
.mixer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mixer-title { margin: 0; font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mixer-reset { border: 1px solid var(--panel-line); background: none; color: var(--ink-2); border-radius: 999px; padding: 4px 12px; font-size: .8rem; }
.mix-row { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 10px; padding: 6px 0; font-size: .9rem; color: var(--ink-2); }
.mix-row input { width: 100%; accent-color: var(--accent); }

.credit { margin: 8px 2px 0; font-size: .72rem; color: var(--muted); }
.credit a { color: inherit; }

.visit-ask { position: fixed; z-index: 31; left: 16px; bottom: 110px; width: min(calc(100vw - 32px), 400px); margin: 0; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--panel-line); background: var(--panel-solid); box-shadow: 0 16px 40px -14px rgba(0,0,0,.6); font-size: .88rem; color: var(--ink-2); }
.visit-ask p { margin: 0 0 10px; }
.visit-ask a { color: inherit; }
.visit-btns { display: flex; gap: 8px; justify-content: flex-end; }
.visit-btns button { flex: 1; border: 1px solid var(--panel-line); background: none; color: inherit; border-radius: 999px; padding: 7px 12px; font: inherit; font-weight: 600; }
.scene-only .visit-ask { display: none; } /* the live stream and screenshots stay clean */
.toast { position: fixed; z-index: 30; left: 50%; bottom: 110px; transform: translateX(-50%); margin: 0; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; max-width: min(90vw, 520px); text-align: center; box-shadow: 0 16px 40px -14px rgba(0,0,0,.6); background: var(--panel-solid); }

.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--chip); }
.tap { position: fixed; inset: 0; z-index: 25; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center;
  background: radial-gradient(circle at 50% 55%, rgba(0,0,0,.15), rgba(0,0,0,.55)); cursor: pointer; padding: 24px; }
.tap p { margin: 0; font: 600 1.05rem var(--serif); color: #fff6e4; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.tap-btn { height: 52px; padding: 0 24px; border-radius: 999px; border: 0; background: var(--accent); color: #1e1004; font-weight: 700; font-size: 1rem;
  box-shadow: 0 10px 30px -8px rgba(231,167,74,.8); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }
.back-ui { position: fixed; z-index: 3; right: 20px; bottom: 20px; }

/* scene-only mode */
body.scene-only .top, body.scene-only .stage, body.scene-only .transport, body.scene-only .credit { opacity: 0; pointer-events: none; transform: translateY(8px); }
body.scene-only .shade { opacity: 0; }
body.scene-only #backdrop { z-index: 2; }

/* ---------- small screens: gramophone on top, crate below, everything scrolls ---------- */
@media (max-width: 900px) {
  body { overflow: auto; display: block; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .top { margin-bottom: 8px; }
  .seg button span { display: none; }
  .stage { grid-template-columns: 1fr; gap: 12px; }
  .deck { height: auto; }
  .gramophone { width: min(100%, 520px); }
  .crate { min-height: 60vh; width: auto; }
  body { overflow-x: hidden; overflow-x: clip; }
  .crate-tab { position: fixed; top: auto; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); flex-direction: row; gap: 8px; padding: 0 16px 0 12px; height: 42px;
    border-right: 1px solid var(--panel-line); border-radius: 999px; transform: translateY(12px); }
  .crate-tab span { writing-mode: horizontal-tb; }
  .stage.tucked .crate-tab { transform: none; }
  .sleeves { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); overflow: visible; }
  .transport { --bar-full: calc(100% - 20px); position: fixed; left: 10px; right: 10px; margin-inline: auto; bottom: max(10px, env(safe-area-inset-bottom)); gap: 10px; border-radius: 22px; }
  .transport:not(.open):not(:has(:focus-visible)) { width: min(250px, var(--bar-full)); }
  .transport .sound { max-width: none; opacity: 1; visibility: visible; overflow: visible; transition: none; } /* the speaker button's popup */
  .menu-list { position: fixed; left: 12px; right: 12px; top: auto; margin-top: 8px; min-width: 0; }
  .transport .sound-btn { display: grid; }
  .sound { display: none; position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); flex-direction: column; align-items: stretch; gap: 14px;
    padding: 14px 16px; border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--panel-line); box-shadow: 0 18px 40px -14px rgba(0,0,0,.6); }
  .sound.open { display: flex; }
  .sound-title { display: block; margin: 0; font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .sound .crackle { font-size: .95rem; gap: 12px; }
  #crackle { flex: 1; width: auto; }
  #volume { flex: 1; width: auto; }
  .back-ui { bottom: 16px; right: 16px; }
}
@media (max-width: 520px) {
  .brand span { font-size: 1.1rem; }
}

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

/* ---------- glass: see-through panels with a lit top edge and a soft sheen ---------- */
.crate, .transport, .pill, .seg, .home-link, .crate-tab, .search, .tab:not([aria-selected="true"]) {
  background: linear-gradient(140deg, var(--glass-sheen), transparent 42%), var(--glass);
  border-color: var(--glass-edge);
  -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8);
}
.crate, .transport, .pill, .seg, .home-link, .crate-tab {
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 -1px 0 rgba(255, 255, 255, .05), inset 0 0 30px rgba(255, 255, 255, .03), 0 22px 50px -22px rgba(0, 0, 0, .55);
}
.search, .tab:not([aria-selected="true"]) { -webkit-backdrop-filter: none; backdrop-filter: none; } /* already behind the crate's glass */
.menu-list, .toast, .sound.open {
  background: linear-gradient(140deg, var(--glass-sheen), transparent 42%), var(--glass-dense);
  border-color: var(--glass-edge);
  -webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 22px 50px -18px rgba(0, 0, 0, .6);
}
:root[data-quality="low"] :is(.crate, .transport, .pill, .seg, .home-link, .crate-tab, .menu-list, .toast, .sound.open) {
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
/* "reduce transparency" (Windows: Transparency effects off): keep the frosted look, just much less see-through */
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-theme] { --glass: var(--glass-dense); }
}

/* ---------- your weather: location consent ---------- */
.where { width: min(460px, calc(100vw - 32px)); border: 1px solid var(--glass-edge); border-radius: 22px; padding: 22px 22px 16px; color: var(--ink);
  background: linear-gradient(140deg, var(--glass-sheen), transparent 42%), var(--glass-dense);
  -webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 30px 80px -20px rgba(0, 0, 0, .6); }
.where::backdrop { background: rgba(0, 0, 0, .35); }
.where h2 { margin: 0 0 8px; font: 700 1.3rem var(--serif); }
.where p, .where li { font-size: .92rem; color: var(--ink-2); }
.where ul { margin: 10px 0 16px; padding-left: 18px; display: grid; gap: 6px; }
.where a { color: inherit; }
.where-actions, .where-city, .where-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.where-primary, .where-secondary { height: 42px; padding: 0 16px; border-radius: 999px; font-weight: 700; border: 1px solid var(--glass-edge); }
.where-primary { background: var(--accent); color: #1e1004; border-color: transparent; }
.where-secondary { background: var(--chip); }
.where-city { margin-top: 12px; }
.where-city input { flex: 1; min-width: 160px; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--panel-line); background: var(--chip); }
.where-error { min-height: 1.3em; margin: 10px 0 4px; font-size: .85rem; }
.where-foot { justify-content: space-between; }
.where-link { border: 0; background: none; padding: 6px 0; font-size: .85rem; color: var(--muted); text-decoration: underline; }

/* About: the answers behind the FAQ data, readable by people too */
.about { width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 720px); overflow: auto; }
.about h3 { margin: 16px 0 4px; font: 700 1rem var(--serif); color: var(--ink); }
.about p { margin: 0; }
.about-by { margin-top: 18px !important; padding-top: 12px; border-top: 1px solid var(--panel-line); }
.about .where-foot { margin-top: 14px; justify-content: flex-end; }
.link-btn { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* listening now (js/presence.js) */
.listeners { margin: 8px 2px 0; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.listeners .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4cd27a; margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 0 3px rgba(76, 210, 122, .18); animation: pulse 2.4s infinite; }
.sleeve-ears { position: absolute; z-index: 2; left: 8px; top: 8px; font: 700 .6rem var(--sans); letter-spacing: .04em; padding: 3px 6px; border-radius: 4px; background: rgba(0, 0, 0, .5); color: #d9ffe6; }

/* close the records: a round glass button on the crate's left edge (desktop), a handle with a chevron on top (phones) */
.crate { position: relative; }
.crate-close { position: absolute; z-index: 3; left: -19px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--glass-edge);
  background: linear-gradient(140deg, var(--glass-sheen), transparent 42%), var(--glass-dense);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: inset 0 1px 0 var(--glass-hi), 0 8px 20px -8px rgba(0,0,0,.5); }
.crate-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.crate-close:hover { color: var(--ink); }

@media (max-width: 900px) {
  /* phones: the crate is a drawer that slides up over the scene and scrolls inside, instead of a section below it */
  .crate { position: fixed; z-index: 7; left: 8px; right: 8px; width: auto; top: max(8px, env(safe-area-inset-top));
    bottom: calc(84px + env(safe-area-inset-bottom)); height: auto; min-height: 0; /* full height, over the top bar, down to the player */
    padding-top: 30px; border-radius: 22px; }
  .sleeves { overflow-y: auto; }
  .stage:not(.tucked) { z-index: 7; } /* the open drawer covers the top bar (.top is z-index 6) */
  .stage.tucked .crate { transform: translateY(calc(100% + 120px)); }
  @starting-style { .stage:not(.tucked) .crate { transform: translateY(calc(100% + 120px)); opacity: 0; } }
  .crate-close { left: 50%; top: 4px; transform: translateX(-50%); width: 56px; height: 24px; border-radius: 999px; box-shadow: none; }
  .crate-close svg { transform: rotate(90deg); }
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Open-Meteo credit, shown with Your weather */
.wx-credit { margin: 0; position: fixed; z-index: 3; left: max(16px, env(safe-area-inset-left)); bottom: 6px; font-size: .68rem; color: var(--muted); text-decoration: none; opacity: .85; }
.wx-now { display: none; position: fixed; z-index: 3; left: max(16px, env(safe-area-inset-left)); bottom: 26px; margin: 0; font-size: 1.05rem; font-weight: 600; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
body.scene-only .wx-now:not([hidden]) { display: block; } /* the top bar is hidden then, so the weather shows over the scene */
.wx-credit a { color: inherit; text-decoration: none; }
.wx-credit a:hover { text-decoration: underline; }
@media (max-width: 900px) { .wx-credit { bottom: max(2px, calc(env(safe-area-inset-bottom) - 14px)); left: 0; right: 0; text-align: center; }
  body:has(#wx-credit:not([hidden])) .transport { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 10px); } /* room for the credit under it */ }

/* Support the room (js/support.js): Ko-fi's own panel inside a glass dialog */
.support { width: min(460px, calc(100vw - 24px)); }
.support iframe { display: block; width: 100%; height: min(640px, 62vh); border: 0; border-radius: 14px; background: #fff; margin: 12px 0; }
.support .where-foot { align-items: center; }
.support .link { color: var(--ink-2); font-size: .85rem; }
.support-thanks { margin: 10px 0 0 !important; font-weight: 600; color: var(--ink) !important; }

/* the crate's header rows (tabs, search, chips, note) keep their full height; only the records list gives way and scrolls */
.crate > :not(.sleeves) { flex-shrink: 0; }
.sleeves { flex: 1 1 auto; min-height: 0; }

#cast[aria-pressed="true"] { color: var(--accent); }

/* feedback form (js/feedback.js) */
.feedback { width: min(520px, calc(100vw - 24px)); max-height: min(92vh, 860px); overflow: auto; }
.fb-kinds { border: 0; padding: 0; margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.fb-kinds label { cursor: pointer; }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--panel-line); background: var(--chip); font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.fb-kinds input:checked + span { background: var(--chip-on); color: var(--chip-on-ink); border-color: transparent; }
.fb-kinds input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-field { display: grid; gap: 4px; margin: 0 0 10px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.fb-field small { font-weight: 400; color: var(--muted); }
.fb-field textarea, .fb-field input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--panel-line); background: var(--chip); font: inherit; font-weight: 400; color: var(--ink); }
.fb-field textarea:focus, .fb-field input:focus { outline: none; border-color: var(--accent); }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .fb-row { grid-template-columns: 1fr; } }
.fb-check { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; color: var(--muted); margin: 2px 0 10px; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#feedback .where-foot { justify-content: space-between; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.about-stats { margin-top: 14px !important; font-weight: 600; color: var(--ink) !important; }
.brand-home { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-home:hover span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* phones on their side: too short for a bottom drawer, so the records slide in from the right at full height,
   the gramophone keeps the left half, and the player sits bottom-left out of the drawer's way */
/* any short landscape screen (phones on their side, whatever their width) */
@media (orientation: landscape) and (max-height: 560px) {
  body { padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); padding-bottom: 6px; }
  .top { margin-bottom: 4px; gap: 6px; }
  .brand { font-size: 1.05rem; }
  .pill, .seg button { height: 32px; }
  .pill.icon { width: 32px; }
  .stage { grid-template-columns: 1fr; }
  .deck { width: 46vw; }
  .gramophone { width: min(100%, 46vw); }
  .top { flex-wrap: nowrap; }
  .top-controls { flex-wrap: nowrap; }
  .seg button span, .home-link { white-space: nowrap; }
  .seg button span { display: none; }
  .crate { position: fixed; z-index: 7; min-height: 0; top: 50px; bottom: 8px; right: max(8px, env(safe-area-inset-right)); left: auto; width: min(560px, 52vw); height: auto; /* below the top bar */
    padding: 10px 12px 8px 22px; border-radius: 18px; }
  .stage.tucked .crate { transform: translateX(calc(100% + 30px)); }
  @starting-style { .stage:not(.tucked) .crate { transform: translateX(calc(100% + 30px)); opacity: 0; } }
  .crate-close { left: -16px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; }
  .crate-close svg { transform: none; }
  .crate-head { gap: 6px; }
  .tab { height: 28px; padding: 0 10px; font-size: .8rem; }
  .search { height: 34px; }
  .crate-note, .credit { display: none; }
  .listeners { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sleeves { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .transport { position: fixed; z-index: 6; --bar-full: calc(46vw - 10px); right: auto; left: max(10px, env(safe-area-inset-left)); margin: 0; bottom: max(8px, env(safe-area-inset-bottom)); padding: 6px 12px 6px 6px; }
  .transport:not(.open):not(:has(:focus-visible)) { width: min(240px, var(--bar-full)); }
  .play { width: 44px; height: 44px; }
  .crate-tab { position: fixed; top: auto; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); flex-direction: row; gap: 8px; padding: 0 14px 0 10px; height: 38px;
    border-right: 1px solid var(--panel-line); border-radius: 999px; transform: translateY(12px); }
  .crate-tab span { writing-mode: horizontal-tb; }
  .stage.tucked .crate-tab { transform: none; }
  body { display: block; }
  .stage { height: calc(100dvh - 60px); }
}

/* iOS Safari zooms in on any field under 16px when it's tapped, and stays zoomed, so the page pans sideways */
@media (pointer: coarse) { input, textarea, select { font-size: 16px !important; } }
.tabs, .places { overscroll-behavior-x: contain; } /* a swipe past the end of the chips doesn't carry on to the page */
