@font-face {
  font-family: "Departure Mono";
  src: url("assets/fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ---------- theme tokens ---------- */
:root {
  --bg: #202020;
  --ink: #f2f2f2;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --line: #3b3b3b;
  --line-hover: #666;
  --btn-hover: #262626;
  --accent: #d9b896;
  --accent-hover: #e6cbaf;
  --on-accent: #1a1a1a;
  --wave-off: #4a4a4a;
  --hint-bg: #2a2a2a;
  --hint-ink: #d9b896;
  --pxu: 1px;
  --px-corner: polygon(
    0 calc(5 * var(--pxu)),
    calc(1 * var(--pxu)) calc(5 * var(--pxu)),
    calc(1 * var(--pxu)) calc(3 * var(--pxu)),
    calc(2 * var(--pxu)) calc(3 * var(--pxu)),
    calc(2 * var(--pxu)) calc(2 * var(--pxu)),
    calc(3 * var(--pxu)) calc(2 * var(--pxu)),
    calc(3 * var(--pxu)) calc(1 * var(--pxu)),
    calc(4 * var(--pxu)) calc(1 * var(--pxu)),
    calc(5 * var(--pxu)) calc(1 * var(--pxu)),
    calc(5 * var(--pxu)) 0,
    calc(100% - 5 * var(--pxu)) 0,
    calc(100% - 5 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 4 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) calc(2 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(2 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(3 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(3 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(5 * var(--pxu)),
    100% calc(5 * var(--pxu)),
    100% calc(100% - 5 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(100% - 5 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(100% - 3 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(100% - 3 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 4 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 5 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 5 * var(--pxu)) 100%,
    calc(5 * var(--pxu)) 100%,
    calc(5 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(4 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(3 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(3 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    calc(2 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    calc(2 * var(--pxu)) calc(100% - 3 * var(--pxu)),
    calc(1 * var(--pxu)) calc(100% - 3 * var(--pxu)),
    calc(1 * var(--pxu)) calc(100% - 5 * var(--pxu)),
    0 calc(100% - 5 * var(--pxu)));
  --px-corner-sm: polygon(
    0 calc(3 * var(--pxu)),
    0 calc(2 * var(--pxu)),
    calc(1 * var(--pxu)) calc(2 * var(--pxu)),
    calc(1 * var(--pxu)) calc(1 * var(--pxu)),
    calc(2 * var(--pxu)) calc(1 * var(--pxu)),
    calc(3 * var(--pxu)) calc(1 * var(--pxu)),
    calc(3 * var(--pxu)) 0,
    calc(100% - 3 * var(--pxu)) 0,
    calc(100% - 3 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(1 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(2 * var(--pxu)),
    100% calc(2 * var(--pxu)),
    100% calc(3 * var(--pxu)),
    100% calc(100% - 3 * var(--pxu)),
    100% calc(100% - 2 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    calc(100% - 1 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 2 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(100% - 3 * var(--pxu)) 100%,
    calc(3 * var(--pxu)) 100%,
    calc(3 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(2 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(1 * var(--pxu)) calc(100% - 1 * var(--pxu)),
    calc(1 * var(--pxu)) calc(100% - 2 * var(--pxu)),
    0 calc(100% - 2 * var(--pxu)),
    0 calc(100% - 3 * var(--pxu)));
  --plinth-1: #232323;
  --plinth-2: #1d1d1d;
  --plinth-edge: rgba(255,255,255,.07);
  --plinth-bottom: rgba(0,0,0,.55);
  --plinth-shadow: 0 2px 0 #111, 0 30px 60px rgba(0,0,0,.55), 0 10px 20px rgba(0,0,0,.4);
  --plinth-tex: rgba(255,255,255,.018);
  --plinth-tex-blend: screen;
  --label-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='100' fill='%23E8D7C0'/%3E%3Cpath d='M42 100 A58 58 0 0 1 158 100 Z' fill='%23000'/%3E%3Ccircle cx='100' cy='100' r='20' fill='%23E8D7C0'/%3E%3Ccircle cx='100' cy='98' r='2.8' fill='%23000'/%3E%3Ctext x='100' y='140' text-anchor='middle' font-family='Inter,Helvetica,Arial,sans-serif' font-size='23' font-weight='900' fill='%23000' textLength='120' lengthAdjust='spacingAndGlyphs'%3EMYSTERY%3C/text%3E%3Ctext x='100' y='166' text-anchor='middle' font-family='Inter,Helvetica,Arial,sans-serif' font-size='23' font-weight='900' fill='%23000' textLength='76' lengthAdjust='spacingAndGlyphs'%3EVINYL%3C/text%3E%3C/svg%3E");
  --font: "Departure Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Departure Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-logo: "Bricolage Grotesque", "Instrument Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #FBF7F1;
  --ink: #1c1a17;
  --muted: #8a8177;
  --faint: #a49a8e;
  --line: #ddd3c5;
  --line-hover: #b8ab99;
  --btn-hover: #f1ebe1;
  --accent: #d9b896;
  --accent-hover: #cfa98a;
  --on-accent: #1c1a17;
  --wave-off: #ddd3c5;
  --hint-bg: #1c1a17;
  --hint-ink: #e8d7c0;
  /* the deck stays dark in the light theme; only its shadow softens */
  --plinth-1: #2e2e2e;
  --plinth-2: #262626;
  --plinth-edge: rgba(255,255,255,.09);
  --plinth-bottom: rgba(0,0,0,.5);
  --plinth-shadow: 0 2px 0 #161616, 0 30px 60px rgba(60,45,30,.26), 0 10px 20px rgba(60,45,30,.16);
  --plinth-tex: rgba(255,255,255,.02);
  --plinth-tex-blend: screen;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* ---------- pixel box: stepped corners, border and fill as clipped layers ---------- */
.px { position: relative; isolation: isolate; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important; }
.px::before, .px::after { content: ""; position: absolute; z-index: -1; clip-path: var(--px-corner); pointer-events: none; }
.px::before { inset: 0; background: var(--px-line, var(--line)); }
.px::after { inset: 1px; background: var(--px-fill, var(--bg)); }
.px-shadow { filter: drop-shadow(0 16px 24px rgba(0,0,0,.28)); }
.px-lg { --pxu: 2px; }
.px-sm, .amb-mute, .amb-tab { --pxu: 1px; --px-corner: var(--px-corner-sm); }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  display: grid;
  grid-template-rows: var(--band) 1fr var(--band);   /* equal header / footer bands so the stage is truly centred */
  --band: 128px;
  min-height: 100vh;
  transition: background .35s ease, color .35s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }

/* ---------- header ---------- */
.sleeve { position: relative; display: flex; align-items: center; justify-self: start; width: max-content; margin-left: 80px; z-index: 6; }
.logo { display: inline-flex; align-items: center; line-height: 0; padding: 0; }
.logo svg { height: 48px; width: auto; font-family: var(--font-logo); overflow: visible; }
/* the record slides out of the sleeve on hover, all the way when the liner notes are open */
.sleeve-disc { transform-box: view-box; transform-origin: 208px 155px; transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); }
.logo:hover .sleeve-disc, .logo:focus-visible .sleeve-disc { transform: translateY(-14px) rotate(-20deg); }
.sleeve.open .sleeve-disc { transform: translateY(-40px) rotate(-70deg); }
.sleeve.open .logo:hover .sleeve-disc { transform: translateY(-40px) rotate(-90deg); }

/* liner notes: the back of the sleeve */
.liner {
  position: absolute; left: 0; top: calc(100% + 12px); width: 340px;
  padding: 16px 18px 14px; border-radius: 0;
  background: #E8D7C0; color: #1c1a17; --px-fill: #E8D7C0; --px-line: #d3c1a6;
  font-family: var(--font); font-size: 12px; line-height: 1.6;
  box-shadow: none;
  transform-origin: 24px 0; animation: crate-in .2s ease both;
}
.liner[hidden] { display: none; }
.liner p { margin: 0 0 10px; }
.liner a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(0,0,0,.35); }
.liner a:hover { border-color: #1c1a17; }
.liner-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-family: var(--font-display); font-weight: 400; letter-spacing: .04em; font-size: 12px; }
.liner-side { font-weight: 400; letter-spacing: .08em; opacity: .7; }
.liner-keys { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 12px 0; padding: 10px 0; border-top: 1px dashed rgba(0,0,0,.3); border-bottom: 1px dashed rgba(0,0,0,.3); }
.liner-keys dt { font-weight: 700; }
.liner-keys dd { margin: 0; opacity: .8; }
.liner-foot { margin: 0; opacity: .85; }


.topnav {
  position: absolute; top: calc(var(--band) / 2 - 18px); right: 80px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
}
.nav-btn {
  width: 36px; height: 36px; border-radius: 0;
  display: grid; place-items: center; color: var(--muted);
  transition: color .2s, background .2s;
}
.nav-btn svg { width: 18px; height: 18px; fill: currentColor; }
.nav-btn:hover { color: var(--ink); background: var(--btn-hover); }
.nav-btn { position: relative; }
.nav-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); right: 0;
  padding: 6px 10px; border-radius: 0; white-space: nowrap; clip-path: var(--px-corner);
  background: var(--hint-bg); color: var(--hint-ink); font-size: 12px; letter-spacing: .01em;
  opacity: 0; translate: 0 -4px; pointer-events: none;
  transition: opacity .15s ease .05s, translate .15s ease .05s;
}
.nav-btn[data-tip]:hover::after, .nav-btn[data-tip]:focus-visible::after { opacity: 1; translate: 0 0; }
.nav-btn[aria-pressed="false"] { opacity: .38; }
.nav-btn[aria-pressed="false"]:hover { opacity: .7; }
.ic-moon, .ic-collapse { display: none; }
:root[data-theme="light"] .ic-sun { display: none; }
:root[data-theme="light"] .ic-moon { display: block; }
body.zen .ic-expand { display: none; }
body.zen .ic-collapse { display: block; }

/* ---------- stage ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 48px;
  padding: 0 80px;
}

.panel { max-width: 560px; }

.modes-wrap { position: relative; margin-bottom: 44px; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- "Yours" crate popover ---------- */
.crate {
  position: absolute; left: 0; top: calc(100% + 12px); z-index: 5;
  width: min(560px, calc(100vw - 48px));
  padding: 14px; border-radius: 0;
  background: var(--bg); border: 1px solid var(--line);
  transform-origin: 24px 0;
  animation: crate-in .18s ease both;
}
.crate[hidden] { display: none; }
@keyframes crate-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.crate-form { display: flex; gap: 8px; }
.crate-field { flex: 1; min-width: 0; display: flex; --px-fill: var(--btn-hover); }
.crate-field:focus-within { --px-line: var(--accent); }
.crate-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); font: inherit; font-size: 13px;
}
.crate-form input:focus { outline: none; }
.crate-add { padding: 0 16px; border-radius: 0; background: var(--accent); color: var(--on-accent); font-size: 13px; }
.crate-add { --px-line: var(--accent); --px-fill: var(--accent); }
.crate-add:hover { --px-line: var(--accent-hover); --px-fill: var(--accent-hover); }
.crate-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.crate-item { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.crate-kind { flex: none; width: 60px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.crate-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--ink); }
.crate-name:hover { color: var(--accent); }
.crate-item.is-playing .crate-name { color: var(--accent); }
.crate-item.is-playing .crate-kind { color: var(--accent); }
.crate-open { flex: none; width: 24px; height: 24px; border-radius: 0; display: grid; place-items: center; color: var(--faint); }
.crate-open svg { width: 14px; height: 14px; fill: currentColor; }
.crate-open:hover { background: var(--btn-hover); color: var(--ink); }
.crate-remove { flex: none; width: 24px; height: 24px; border-radius: 0; color: var(--muted); display: grid; place-items: center; }
.crate-remove svg { width: 14px; height: 14px; fill: currentColor; }
.crate-remove:hover { background: var(--btn-hover); color: var(--ink); }
.crate-empty { padding: 12px 4px 4px; font-size: 12px; color: var(--faint); }

/* ---------- ambience panel ---------- */
.amb {
  position: fixed; z-index: 7; right: 80px; top: calc(var(--band) / 2 + 26px);
  width: min(520px, calc(100vw - 32px)); padding: 12px 14px 10px; border-radius: 0;
  background: var(--bg); border: 1px solid var(--line);
  transform-origin: calc(100% - 24px) 0; animation: crate-in .18s ease both;
}
.amb[hidden] { display: none; }
.amb-head { display: flex; align-items: baseline; gap: 10px; padding: 2px 2px 8px; }
.amb-title { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.amb-count { font-size: 11px; color: var(--faint); flex: 1; }
.amb-mute { font-size: 11px; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line); border-radius: 0; }
.amb-mute:hover { color: var(--ink); --px-line: var(--line-hover); }
.amb-mute[hidden] { display: none; }
/* mixer: what's on right now, one row each */
.amb-mixer { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.amb-row { display: grid; grid-template-columns: 18px 1fr 120px 22px; align-items: center; gap: 10px; padding: 4px 2px; font-size: 12px; color: var(--ink); }
.amb-row svg { width: 16px; height: 16px; fill: currentColor; color: var(--accent); }
.amb-row .amb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* pixel slider: a segmented bar filled up to --p, a square block for the thumb */
.amb-level {
  -webkit-appearance: none; appearance: none; width: 120px; height: 14px; margin: 0; background: transparent; cursor: pointer;
  --p: 50%;
}
.amb-level::-webkit-slider-runnable-track {
  height: 8px; border: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, var(--bg) 5px 7px),
    linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p));
}
.amb-level::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 10px; height: 14px; margin-top: -3px; border-radius: 0;
  background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--ink);
}
.amb-level::-moz-range-track {
  height: 8px; border: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, var(--bg) 5px 7px),
    linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p));
}
.amb-level::-moz-range-thumb { width: 10px; height: 14px; border-radius: 0; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
.amb-level:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.amb-off { width: 22px; height: 22px; border-radius: 0; color: var(--muted); display: grid; place-items: center; }
.amb-off svg { width: 14px; height: 14px; fill: currentColor; color: inherit; }
.amb-off:hover { background: var(--btn-hover); color: var(--ink); }
.amb-row.is-music { padding-top: 0; }
.amb-row.is-off { color: var(--muted); }
.amb-row.is-off svg { color: var(--muted); }
.amb-note { color: var(--faint); font-size: 11px; }
.amb-level:disabled { opacity: .35; cursor: default; }
/* tabs */
.amb-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 8px; }
.amb-tab { font-size: 11px; padding: 4px 9px; border-radius: 0; border: 1px solid transparent; color: var(--muted); }
.amb-tab:hover { color: var(--ink); }
.amb-tab[aria-selected="true"] { color: var(--ink); --px-line: var(--line); --px-fill: var(--btn-hover); }
.amb-tab { --px-line: transparent; --px-fill: transparent; }
.amb-tab .n { color: var(--accent); margin-left: 4px; }
/* tiles: everything in the current group */
.amb-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.amb-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 0; border: 1px solid var(--line); color: var(--muted); font-size: 11px; transition: color .15s, border-color .15s, background .15s; }
.amb-tile svg { width: 22px; height: 22px; fill: currentColor; image-rendering: pixelated; }
.amb-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amb-tile:hover { color: var(--ink); --px-line: var(--line-hover); }
.amb-tile[aria-pressed="true"] { color: var(--accent); --px-line: var(--accent); --px-fill: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.amb-note { margin: 10px 2px 0; font-size: 11px; color: var(--faint); }
body.zen .amb { display: none; }
@media (max-width: 1100px) { .amb { right: 40px; } }
@media (max-width: 860px) { .amb { right: 16px; top: 64px; } .amb-tiles { grid-template-columns: repeat(3, 1fr); } .amb-row { grid-template-columns: 18px 1fr 90px 22px; } .amb-level { width: 90px; } }

/* hidden YouTube player: present in the viewport but invisible */
#yt-shell, #sp-shell { position: fixed; right: 0; bottom: 0; width: 300px; height: 200px; opacity: 0.001; pointer-events: none; overflow: hidden; z-index: -1; }
#yt-shell iframe { width: 200px; height: 200px; border: 0; }
#sp-shell iframe { width: 300px; height: 80px; border: 0; }
.mode {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 64px; padding: 10px 12px 8px;
  border-radius: 0;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  transition: color .2s, transform .2s;
}
.mode svg { width: 20px; height: 20px; fill: currentColor; }
.mode:hover { color: var(--ink); --px-line: var(--line-hover); }
.mode[aria-selected="true"] { color: var(--on-accent); --px-line: var(--accent); --px-fill: var(--accent); }
.mode:active { transform: scale(.97); }

.wave { display: block; width: 420px; height: 60px; }
.time { margin-top: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.title {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}
.artist { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.controls { display: flex; align-items: center; gap: 10px; margin-top: 40px; }
.btn {
  width: 44px; height: 44px; border-radius: 0;
  display: grid; place-items: center;
  color: var(--ink);
  border: 1px solid var(--line);
  transition: border-color .2s, background .2s, transform .15s;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn:hover { --px-line: var(--line-hover); --px-fill: var(--btn-hover); }
.btn:active { transform: scale(.94); }
.btn-main { width: 56px; height: 56px; color: var(--on-accent); --px-line: var(--accent); --px-fill: var(--accent); }
.btn-main:hover { --px-line: var(--accent-hover); --px-fill: var(--accent-hover); }
.btn-main .ic-pause { display: none; }
body.playing .btn-main .ic-play { display: none; }
body.playing .btn-main .ic-pause { display: block; }

.credit { margin-top: 36px; font-size: 11px; color: var(--faint); }
.credit a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.credit a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- turntable ---------- */
.deck { display: grid; place-items: center; }
.turntable {
  position: relative;
  width: 100%;
  /* never taller than the stage between the two bands */
  max-width: min(840px, calc((100vh - var(--band) * 2 - 48px) * 840 / 680));
  aspect-ratio: 840 / 680;
  container-type: inline-size;
  --u: 1cqw; /* 1 unit == 1/100 of turntable width; layout below is in 840-wide design px */
}
.turntable > * { position: absolute; }

.plinth {
  inset: 0;
  border-radius: calc(3.2 * var(--u));
  background:
    linear-gradient(160deg, rgba(255,255,255,.035), rgba(255,255,255,0) 40%),
    linear-gradient(var(--plinth-1), var(--plinth-2));
  box-shadow:
    inset 0 1px 0 var(--plinth-edge),
    inset 0 -1px 0 var(--plinth-bottom),
    var(--plinth-shadow);
  transition: background .35s ease, box-shadow .35s ease;
}
.plinth::after { /* faint brushed texture */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(90deg, var(--plinth-tex) 0 1px, transparent 1px 3px);
  mix-blend-mode: var(--plinth-tex-blend);
}

/* platter: center (340,350), r=300 in 840-wide design */
.platter {
  left: calc(40 / 840 * 100%); top: calc(50 / 680 * 100%);
  width: calc(600 / 840 * 100%); aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #1a1a1a 0 92%, #101010 92.5% 94%, #2a2a2a 94.5% 95.5%, #151515 96% 100%);
  box-shadow:
    0 0 0 1px #0a0a0a,
    0 6px 20px rgba(0,0,0,.38),
    inset 0 2px 4px rgba(255,255,255,.05);
}
/* fixed light on the platter: same geometry, does not rotate with it */
.platter-light {
  left: calc(40 / 840 * 100%); top: calc(50 / 680 * 100%);
  width: calc(600 / 840 * 100%); aspect-ratio: 1; border-radius: 50%;
  pointer-events: none;
  background:
    conic-gradient(from 0deg, transparent 0deg 18deg, rgba(255,255,255,.022) 40deg, transparent 62deg 198deg, rgba(255,255,255,.022) 220deg, transparent 242deg 360deg),
    radial-gradient(circle at 38% 32%, rgba(255,255,255,.025), transparent 55%);
}
.platter::before { /* rubber mat ribs */
  content: ""; position: absolute; inset: 3%; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(255,255,255,.012) 0 6px, transparent 6px 9px);
}
.platter::after { /* strobe dots on the rim */
  content: ""; position: absolute; inset: 1.4%; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #3a3a3a 0 .6deg, transparent .6deg 3deg);
  -webkit-mask: radial-gradient(circle, transparent 0 96%, #000 96.5% 100%);
          mask: radial-gradient(circle, transparent 0 96%, #000 96.5% 100%);
}

/* record: r=290. The record leaves the deck entirely when swapped (no clipping): it slides over the
   deck's edge and off the screen, and the next one slides back in the same way. */
.deck-clip { inset: 0; pointer-events: none; }
.record-slot {
  position: absolute;
  left: calc(50 / 840 * 100%); top: calc(60 / 680 * 100%);
  width: calc(580 / 840 * 100%); aspect-ratio: 1;
  border-radius: 50%;
}
.record-carrier {
  position: absolute; inset: 0; border-radius: 50%;
  transition: translate .6s cubic-bezier(.2, .7, .2, 1);
}
.record {
  position: absolute; inset: 0; border-radius: 50%;
  background: #121212;
  box-shadow: 0 2px 10px rgba(0,0,0,.3), inset 0 0 0 1px #050505;
  will-change: transform;
  transition: box-shadow .55s ease;
}
/* swapping records: desktop slides the record out through the bottom of the deck and the next one in the same way;
   phones (deck on top, page scrolls) slide through the left edge instead. The record stays solid; only its position changes. */
.record-carrier.out { translate: 0 100vh; transition-timing-function: cubic-bezier(.6, 0, .9, .5); }
.record-carrier.enter { transition: none; translate: 0 100vh; }
.record-carrier.out .record, .record-carrier.enter .record { box-shadow: 0 12px 28px rgba(0,0,0,.4), inset 0 0 0 1px #050505; }
.grooves {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    /* wide "track" bands like a real pressing */
    radial-gradient(circle,
      transparent 0 21%,
      rgba(0,0,0,.35) 21% 21.6%, transparent 21.6% 33%,
      rgba(0,0,0,.35) 33% 33.6%, transparent 33.6% 46%,
      rgba(0,0,0,.35) 46% 46.6%, transparent 46.6% 58%,
      rgba(0,0,0,.35) 58% 58.6%, transparent 58.6% 71%,
      rgba(0,0,0,.35) 71% 71.6%, transparent 71.6% 84%,
      rgba(0,0,0,.35) 84% 84.6%, transparent 84.6% 97%,
      rgba(0,0,0,.6) 97% 100%),
    repeating-radial-gradient(circle, #141414 0 1px, #1b1b1b 1px 2.4px);
}
.grooves::after { /* run-in / run-out smooth areas */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, transparent 0 19.5%, #141414 19.5% 21%, transparent 21% 97.4%, #101010 97.4% 100%);
}
.label {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 37%; aspect-ratio: 1; border-radius: 50%;
  background: #2b2623 center / cover no-repeat;
  background-image: var(--label-default);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 0 24px rgba(0,0,0,.45);
}
.label::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,.25), transparent 60%); }
.spindle {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 2.2%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #aaa 40%, #555 100%);
  box-shadow: 0 0 0 2px #0e0e0e, 0 1px 3px rgba(0,0,0,.8);
}
.sheen { /* fixed light source: does not rotate with the disc */
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  transition: opacity .2s ease;
  background:
    conic-gradient(from 0deg,
      transparent 0deg 18deg, rgba(255,255,255,.075) 40deg, transparent 62deg 198deg,
      rgba(255,255,255,.075) 220deg, transparent 242deg 360deg),
    radial-gradient(circle at 38% 32%, rgba(255,255,255,.06), transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 0 20%, #000 22% 97%, transparent 98%);
          mask: radial-gradient(circle, transparent 0 20%, #000 22% 97%, transparent 98%);
}

/* ---------- easter egg: the night cat ---------- */
.cat {
  left: calc(722 / 840 * 100%); top: calc(606 / 680 * 100%);
  width: calc(76 / 840 * 100%); height: auto; overflow: visible;
  shape-rendering: crispEdges; pointer-events: none;
  transform-origin: 50% 100%;
  animation: cat-breathe 4s ease-in-out infinite;
  /* only while a record plays: with the arm on its rest it would sit right under it */
  opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility .8s;
}
body.playing .cat { opacity: 1; visibility: visible; }
.cat[hidden] { display: none; }
.cat-body { fill: #E8D7C0; }
.cat-stripe { fill: #cdbba2; }
.cat-eye { fill: #1c1a17; }
.cat-tail { animation: cat-tail 3.2s steps(1) infinite; }
.cat-tail-b { animation-delay: -1.6s; }
body.playing .cat-tail { animation-duration: 1.1s; }
body.playing .cat-tail-b { animation-delay: -.55s; }
@keyframes cat-tail { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes cat-breathe { 50% { transform: scaleY(1.035); } }

.knob {
  left: calc(612 / 840 * 100%); top: calc(58 / 680 * 100%);
  width: calc(44 / 840 * 100%); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #333, #1a1a1a 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 3px 8px rgba(0,0,0,.35);
  font-size: calc(1.1 * var(--u)); color: #8a8a8a; display: grid; place-items: center;
}
.knob { cursor: pointer; transition: transform .1s; }
.knob:active { transform: scale(.96); }
.knob span { position: absolute; transition: color .25s; }
.knob span:first-child { left: -55%; top: 12%; }
.knob span:last-child { left: -55%; bottom: 12%; }
.knob[data-speed="33"] span:first-child, .knob[data-speed="45"] span:last-child { color: var(--accent); }
.knob i { position: absolute; left: 50%; top: 50%; width: 42%; height: 2px; background: #bbb; transform-origin: 0 50%;
  transform: rotate(-150deg); transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }  /* points at "33", upper-left */
.knob[data-speed="45"] i { transform: rotate(-210deg); }                                     /* points at "45", lower-left */
.power {
  left: calc(692 / 840 * 100%); top: calc(46 / 680 * 100%);
  width: calc(80 / 840 * 100%); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2e2e2e, #1a1a1a 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset 0 -2px 4px rgba(0,0,0,.5), 0 4px 10px rgba(0,0,0,.35);
  transition: transform .1s;
}
.power::after { content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 22%; aspect-ratio: 1; border-radius: 50%; background: #3a3a3a; box-shadow: inset 0 1px 2px #000; transition: background .3s, box-shadow .3s; }
body.playing .power::after { background: var(--accent); box-shadow: 0 0 10px rgba(217,184,150,.6); }
.power:active { transform: scale(.97); }

.tonearm-svg { inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.arm {
  transform-box: view-box;
  transform-origin: 700px 150px;
  transition: transform 1.1s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
/* Shadows are plain CSS drop-shadows so the lift can tween instead of snapping. */
.headshell { pointer-events: all; cursor: grab; touch-action: none; }
.arm.dragging .headshell { cursor: grabbing; }
.arm-tip {
  position: fixed; z-index: 6; margin: 0; padding: 5px 9px; border-radius: 8px;
  background: var(--hint-bg); color: var(--hint-ink); font-size: 12px; font-variant-numeric: tabular-nums;
  translate: -50% -140%; pointer-events: none; white-space: nowrap;
}
.arm-tip[hidden] { display: none; }
.arm-fixed { filter: drop-shadow(0 4px 4px rgba(0,0,0,.45)); }
.arm-lift { filter: drop-shadow(0 5px 5px rgba(0,0,0,.5)); transition: filter .45s ease; }
.arm.lifted .arm-lift { filter: drop-shadow(0 13px 9px rgba(0,0,0,.42)); }
.arm-wobble { transform-box: view-box; transform-origin: 700px 150px; } /* per-frame wobble, no transition */

/* ---------- footer, hint ---------- */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 80px;
  font-size: 11px; color: var(--faint);
}
.foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.foot a:hover { color: var(--accent); border-color: var(--accent); }

.hint {
  position: fixed; left: 50%; bottom: 84px; translate: -50% 0;
  margin: 0; padding: 10px 16px; border-radius: 0;
  background: var(--hint-bg); color: var(--hint-ink); font-size: 13px; letter-spacing: .02em;
  --px-fill: var(--hint-bg); --px-line: var(--hint-bg);
  animation: hint-in .5s ease both;
  pointer-events: none;
}
.hint[hidden] { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 84px; translate: -50% 0;
  margin: 0; padding: 9px 14px; border-radius: 0;
  background: var(--hint-bg); color: var(--hint-ink); font-size: 13px; letter-spacing: .02em;
  --px-fill: var(--hint-bg); --px-line: var(--hint-bg);
  animation: hint-in .25s ease both; pointer-events: none;
}
.toast[hidden] { display: none; }
.toast.leaving { animation: toast-out .3s ease both; }
@keyframes toast-out { to { opacity: 0; translate: -50% 6px; } }
@keyframes hint-in { from { opacity: 0; translate: -50% 8px; } }
body.armed .btn-main { animation: pulse-btn 1.6s ease-in-out infinite; }
@keyframes pulse-btn { 50% { filter: drop-shadow(0 0 6px rgba(217,184,150,.7)); } }

/* ---------- zen / full screen ---------- */
body.zen { grid-template-rows: 1fr; }
body.zen .sleeve, body.zen .foot, body.zen .credit, body.zen .modes-wrap { display: none; }
body.zen .topnav { top: 24px; right: 24px; }
body.zen .topnav > :not(#zen) { display: none; }
body.zen .stage { padding: 0 6vw; gap: 4vw; min-height: 100vh; }
body.zen .turntable { max-width: min(920px, 46vw, calc((100vh - 96px) * 840 / 680)); }
body.zen .topnav, body.zen .controls, body.zen .time { transition: opacity .5s ease; }
body.zen.idle .topnav, body.zen.idle .controls, body.zen.idle .time { opacity: 0; }
body.zen.idle { cursor: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  body { --band: 100px; }
  .sleeve { margin-left: 40px; }
  .topnav { right: 40px; }
  .stage { padding: 0 40px; gap: 32px; }
  .foot { padding: 0 40px; }
  .title { font-size: 24px; }
}
@media (max-width: 860px) {
  body { overflow: auto; grid-template-rows: auto 1fr auto; }
  .stage { grid-template-columns: 1fr; padding: 24px 24px 0; align-content: start; }
  .deck { order: -1; }
  .turntable { max-width: 520px; }
  body.zen .turntable { max-width: 520px; }
  .record-carrier.out, .record-carrier.enter { translate: -100vw 0; }
  .panel { max-width: none; }
  .wave { width: 100%; }
  .title { white-space: normal; }
  .sleeve { margin: 20px 0 0 24px; } .logo svg { height: 48px; }
  .liner { width: min(340px, calc(100vw - 48px)); }
  .topnav { right: 16px; top: 22px; }
  .foot { align-items: flex-start; }
  .foot { flex-direction: column; gap: 6px; padding: 32px 24px 24px; }
  body.zen .stage { grid-template-columns: 1fr; padding: 24px; min-height: 100dvh; align-content: center; }
  body.zen .turntable { max-width: 520px; }
}
@media (max-width: 520px) {
  body { --band: 72px; }
  .sleeve { margin: 16px 0 0 16px; } .logo svg { height: 40px; }
  .topnav { right: 10px; top: 16px; }
  .stage { padding: 20px 16px 0; gap: 22px; }
  .turntable, body.zen .turntable { max-width: 100%; }
  /* the panel sits under the deck and reads centred, like the deck above it */
  .panel { max-width: none; text-align: center; }
  .modes-wrap { margin-bottom: 22px; }
  .modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .mode { min-width: 0; padding: 9px 2px 7px; gap: 5px; font-size: 10px; }
  .mode svg { width: 18px; height: 18px; }
  .crate { width: calc(100vw - 32px); text-align: left; }
  .wave { width: 100%; height: auto; aspect-ratio: 7 / 1; }
  .time { margin-top: 10px; }
  .title { font-size: 18px; margin-top: 8px; }
  .artist { margin-top: 6px; }
  .controls { justify-content: center; margin-top: 22px; }
  .credit { margin-top: 20px; }
  .foot { align-items: center; text-align: center; gap: 4px; padding: 24px 16px calc(20px + env(safe-area-inset-bottom)); }
  .liner { width: calc(100vw - 32px); }
  .amb { left: 12px; right: 12px; width: auto; top: 60px; max-height: calc(100dvh - 76px); overflow: auto; }
  .amb-tiles { grid-template-columns: repeat(4, 1fr); }
  .hint, .toast { bottom: 20px; max-width: calc(100vw - 32px); text-align: center; }
  body.zen .stage { padding: 16px; gap: 20px; min-height: 100dvh; align-content: center; }
  body.zen .topnav { top: 12px; right: 10px; }
  body.zen .turntable { max-width: min(100%, calc((100dvh - 260px) * 840 / 680)); }
}
@media (hover: none) {
  body.zen.idle .topnav, body.zen.idle .controls, body.zen.idle .time { opacity: 1; }
  body.zen.idle { cursor: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .arm { transition-duration: .01s; }
  .cat, .cat-tail { animation: none; }
}
