/*!
 * Fluid Sonata — stage styling.
 * Aesthetic: concert hall, lights down. The fluid is the performer; the
 * chrome is an usher — present when you need it, gone when you don't.
 * System type stack only: the app fetches no fonts at runtime.
 *
 * © 2026 djEnterprises · Daniel J. Ehrlich
 */

:root {
  --bg: #05060a;
  --text: #e8e6f2;
  --dim: rgba(232, 230, 242, 0.52);
  --dimmer: rgba(232, 230, 242, 0.34);
  --hair: rgba(255, 255, 255, 0.15);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.12);
  --gold: #d9a441;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* motion tokens — every duration/easing below comes from here */
  --quick: 0.18s;
  --settle: 0.6s;
  --ease-out: cubic-bezier(0.22, 0.9, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.44, 1);
  --press: scale(0.965);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* the stage eases in on load instead of popping (reduced motion: instant) */
@keyframes stageIn { from { opacity: 0; } }
#orrery, canvas#stage { animation: stageIn 0.9s var(--ease-out) both; }

/* Layer order: orrery (0) → fluid (1) → chrome (5+) → gate (10) → sheet (20) */
#orrery {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  transition: opacity 0.9s ease;
}
#orrery.off { opacity: 0 !important; }

canvas#stage {
  position: fixed; inset: 0; z-index: 1;
  display: block; width: 100vw; height: 100vh;
  touch-action: none; cursor: crosshair;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

/* ── chrome: fades out when the audience goes still ─────────────────── */
.chrome { position: fixed; z-index: 5; transition: opacity 0.7s ease; }
body.idle .chrome { opacity: 0; }
body:not(.started) #hud,
body:not(.started) #dock { opacity: 0; pointer-events: none; }
body.started #hud,
body.started #dock { opacity: 1; }

/* top rail */
#top {
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px;
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
  background: linear-gradient(180deg, rgba(3, 4, 8, 0.55), transparent);
  pointer-events: none;
}
#top { flex-wrap: nowrap; }
#top .mark, #top nav a { white-space: nowrap; }
#top .mark { font-weight: 300; letter-spacing: 0.22em; }
#top .mark em { font-style: italic; color: var(--text); opacity: 0.9; }
#top nav { display: flex; align-items: center; gap: 18px; pointer-events: auto; }
#top nav a { transition: color 0.2s ease; }
#top nav a:hover { color: var(--text); }
#top nav .home { display: inline-flex; align-items: center; gap: 7px; }
#top nav .home img { width: 20px; height: 20px; opacity: 0.85; }
#top nav .home:hover img { opacity: 1; }

/* the settings gear + its popover */
#top nav .gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--glass);
  color: var(--dim);
  transition: color 0.2s ease, background 0.2s ease, transform 0.5s var(--ease-out);
}
#top nav .gear:hover { color: var(--text); background: var(--glass-2); transform: rotate(40deg); }
#top nav .gear.on { color: var(--gold); border-color: rgba(217, 164, 65, 0.5); transform: rotate(90deg); }

#settings {
  top: 56px; right: 16px; z-index: 9; width: 250px;
  padding: 16px 18px 14px; border-radius: 16px;
  border: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(16, 18, 30, 0.95), rgba(8, 9, 16, 0.96));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#settings[hidden] { display: none; }
#settings .set-k {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--dimmer); margin-bottom: 9px;
}
#settings .set-row { display: flex; gap: 7px; }
#settings .set-row.wrap { flex-wrap: wrap; }
#settings .set-row.wrap button { flex: 1 1 calc(50% - 4px); }
#settings .set-k + .set-k, #settings .set-note + .set-k { margin-top: 14px; }
#settings .set-note + .set-k { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 13px; }
#settings .set-row button {
  flex: 1; padding: 8px 10px; border-radius: 11px;
  border: 1px solid var(--hair); background: var(--glass);
  color: var(--dim); font-size: 12px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform var(--quick) var(--spring);
}
#settings .set-row button:hover { color: var(--text); background: var(--glass-2); }
#settings .set-row button:active { transform: var(--press); }
#settings .set-row button.on { color: var(--gold); border-color: rgba(217, 164, 65, 0.55); background: rgba(217, 164, 65, 0.1); }
#settings .set-note { margin-top: 11px; font-size: 11px; line-height: 1.6; color: var(--dimmer); }
#settings .set-col { display: flex; flex-direction: column; gap: 6px; }
#settings .set-col button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 11px; text-align: left;
  border: 1px solid var(--hair); background: var(--glass);
  color: var(--dim); font-size: 12px;
  transition: color 0.15s ease, background 0.15s ease, transform var(--quick) var(--spring);
}
#settings .set-col button:hover { color: var(--text); background: var(--glass-2); }
#settings .set-col button:active { transform: var(--press); }
#top nav .gear.rec { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.55); }
#top nav .gear.rec svg { animation: blink 1s steps(2, end) infinite; }
#settings .set-note kbd {
  font-family: var(--mono); font-size: 9.5px; padding: 1px 5px;
  border: 1px solid var(--hair); border-radius: 4px; color: var(--dim);
}

/* HUD, bottom-left */
/* Deliberately NOT uppercased: catalogue numbers carry their own casing
   ("WoO 59" is Werke ohne Opuszahl — "WOO 59" would be wrong). */
#hud {
  left: 20px; bottom: 18px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.14em;
  color: var(--dim); pointer-events: none; line-height: 1.7;
}
#hudSub { color: var(--dimmer); text-transform: none; letter-spacing: 0.06em; }
@keyframes hudSwap { from { opacity: 0.15; } to { opacity: 1; } }
#hudLine.swap, #hudSub.swap { animation: hudSwap 0.5s var(--ease-out); }
/* the LOOK pill nods when the rotation hands it a new palette */
@keyframes pillNod { 35% { transform: scale(1.06); } }
.ctl.nod { animation: pillNod 0.4s var(--spring); }

/* the one-line "what is this" caption, sitting above the control bar */
#dock {
  right: 20px; bottom: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  max-width: min(620px, calc(100vw - 40px));
}
#blurb {
  max-width: 430px; text-align: right;
  font-size: 10.5px; line-height: 1.75; letter-spacing: 0.03em;
  color: var(--dimmer); pointer-events: none;
}
#blurb b { font-weight: 500; color: var(--dim); }
#blurb .blurb-short { display: none; }
#blurb button {
  pointer-events: auto; color: var(--dim); font-size: 10.5px;
  letter-spacing: 0.06em; border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  transition: color 0.2s ease, border-color 0.2s ease;
}
#blurb button:hover { color: var(--text); border-color: var(--gold); }

/* control bar, bottom-right */
#controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end;
}
#controls .ctl { flex-shrink: 0; }
.ctl {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--hair); border-radius: 17px;
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--dim);
  font-size: 11px; letter-spacing: 0.12em;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}
.ctl:hover { color: var(--text); background: var(--glass-2); border-color: rgba(255, 255, 255, 0.28); }
.ctl:active { transform: var(--press); transition-duration: 0.06s; }
.ctl .k { color: var(--dimmer); font-size: 10px; letter-spacing: 0.16em; }
.ctl .v { color: var(--text); text-transform: none; letter-spacing: 0.02em; }
/* the orrery pod: two steppers (zoom, speed) inside one glass pill */
.ctl.pod { gap: 4px; padding: 0 8px; cursor: default; }
.ctl.pod.hide { display: none; }
.ctl.pod button {
  width: 22px; height: 24px; border-radius: 8px; color: var(--dim);
  font-size: 13px; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.ctl.pod button:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.ctl.pod button:active { transform: scale(0.9); }
.ctl.pod button { transition: color 0.15s ease, background 0.15s ease, transform var(--quick) var(--spring); }
.ctl.pod .v { min-width: 42px; text-align: center; font-family: var(--mono); font-size: 10px; }
.ctl.pod .sep { width: 1px; height: 16px; background: var(--hair); margin: 0 4px; }
.ctl.pod .pod-k { margin-right: 2px; }
.ctl.pod .names {
  padding: 3px 9px; border-radius: 9px; font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--dim);
  transition: color 0.15s ease, background 0.15s ease;
}
.ctl.pod .names:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.ctl.pod .names.on { color: var(--gold); background: rgba(217, 164, 65, 0.14); }

/* the zoom slider — logarithmic AU, gold-lit track */
#zoomSlider { -webkit-appearance: none; appearance: none; width: 116px; height: 24px; background: transparent; cursor: pointer; }
#zoomSlider::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(217, 164, 65, 0.75), rgba(255, 255, 255, 0.16));
}
#zoomSlider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); margin-top: -5.5px;
  box-shadow: 0 0 8px rgba(217, 164, 65, 0.55);
  transition: transform var(--quick) var(--spring);
}
#zoomSlider:active::-webkit-slider-thumb { transform: scale(1.3); }
#zoomSlider::-moz-range-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(217, 164, 65, 0.75), rgba(255, 255, 255, 0.16));
}
#zoomSlider::-moz-range-thumb {
  width: 14px; height: 14px; border: 0; border-radius: 50%;
  background: var(--text); box-shadow: 0 0 8px rgba(217, 164, 65, 0.55);
}

#hudEpoch { color: var(--dimmer); font-size: 10px; }

/* the drag coach: one gentle banner until the first real stir */
#dragHint {
  position: fixed; left: 50%; bottom: 118px; z-index: 6;
  transform: translate(-50%, 10px);
  padding: 10px 18px; border-radius: 21px;
  border: 1px solid var(--hair); background: rgba(10, 12, 20, 0.78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 12px; letter-spacing: 0.08em; color: var(--dim);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s var(--ease-out);
}
#dragHint.show { opacity: 1; transform: translate(-50%, 0); }
#dragHint .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); margin-right: 9px; vertical-align: 1px;
  animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse { 50% { transform: scale(1.55); opacity: 0.45; } }

.ctl.rec.on { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.12); }
.ctl.rec.on svg { animation: blink 1s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ── the title gate ────────────────────────────────────────────────── */
#overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 88px 20px 96px;
  /* Light enough that the prelude swirls read through it, dark enough that
     the title copy stays legible over whatever the fluid is doing. */
  background: radial-gradient(ellipse at center, rgba(8, 10, 18, 0.62), rgba(3, 4, 8, 0.88));
  cursor: pointer; user-select: none;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
#overlay::-webkit-scrollbar { width: 8px; }
#overlay::-webkit-scrollbar-track { background: transparent; }
#overlay::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 4px; }
#overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
/* Reading the About sheet from the title screen: pull the title copy right
   down so it can't compete with the text on top of it. */
body.sheet-open #overlay { opacity: 0.1; pointer-events: none; }

.ov-in { text-align: center; max-width: 940px; width: 100%; }
/* staggered entrance: eyebrow → title → sub → scores → play → hints */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.ov-in > * { animation: rise var(--settle) var(--ease-out) both; }
.ov-in .eyebrow { animation-delay: 0.05s; }
.ov-in h1 { animation-delay: 0.14s; }
.ov-in .sub { animation-delay: 0.26s; }
.ov-in #scores { animation-delay: 0.38s; }
.ov-in .play { animation-delay: 0.52s; }
.ov-in .hint { animation-delay: 0.62s; }
.ov-in .ov-more { animation-delay: 0.68s; }
.ov-in .eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--gold); opacity: 0.85; margin-bottom: 18px;
}
.ov-in h1 {
  font-weight: 250; font-size: clamp(30px, 5.4vw, 58px);
  letter-spacing: 0.14em; line-height: 1.05;
}
.ov-in h1 em { font-style: italic; opacity: 0.82; }
.ov-in .sub {
  margin-top: 14px; font-size: 13px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--dim);
}

/* score picker */
#scores {
  margin: 34px auto 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  max-width: 780px; text-align: left;
}
.score {
  display: block; padding: 15px 16px 16px;
  border: 1px solid var(--hair); border-radius: 14px;
  background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, background 0.2s ease, transform var(--quick) var(--spring);
}
.score:active { transform: var(--press); }
.score:hover { transform: translateY(-2px); background: var(--glass-2); border-color: rgba(255, 255, 255, 0.3); }
.score.on { border-color: rgba(217, 164, 65, 0.6); background: rgba(217, 164, 65, 0.09); }
.score-composer {
  display: block; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold);
  opacity: 0.8; margin-bottom: 5px;
}
.score-n { display: block; font-size: 16px; font-weight: 400; letter-spacing: 0.03em; }
.score-w { display: block; margin-top: 5px; font-size: 12px; color: var(--dim); }
.score-c { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dimmer); }
.score-b { display: block; margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--dim); }

/* play */
.play {
  margin: 30px auto 0; width: 84px; height: 84px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform 0.2s ease, background 0.2s ease;
}
#overlay:hover .play, .play:hover { transform: scale(1.08); background: var(--glass-2); }
.play:active { transform: scale(0.98); }
.play { transition: transform var(--quick) var(--spring), background 0.2s ease; }
.play svg { margin-left: 6px; }

.ov-in .hint { margin-top: 20px; font-size: 11px; letter-spacing: 0.12em; color: var(--dimmer); }
.ov-in .hint b { font-weight: 400; color: var(--dim); }
.ov-more { margin-top: 14px; }
.ov-more button {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim); border-bottom: 1px solid rgba(255, 255, 255, 0.22); padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ov-more button:hover { color: var(--text); border-color: var(--gold); }

/* ── the About sheet ───────────────────────────────────────────────── */
#about {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity 0.26s ease;
}
/* An author `display` rule beats the UA's [hidden] rule — without this the
   closed sheet stays in the hit-test layer and eats every click. */
#about[hidden] { display: none; }
#about.in { opacity: 1; }
.sheet-in {
  position: relative; width: 100%; max-width: 720px; max-height: calc(100vh - 48px);
  overflow-y: auto; overscroll-behavior: contain; padding: 30px 32px 34px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  border: 1px solid var(--hair); border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 18, 30, 0.96), rgba(7, 8, 14, 0.97));
  transform: translateY(12px); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
}
#about.in .sheet-in { transform: none; }
.sheet-in::-webkit-scrollbar { width: 8px; }
.sheet-in::-webkit-scrollbar-track { background: transparent; }
.sheet-in::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; }
.sheet-in::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }
.sheet-close {
  position: absolute; top: 14px; right: 16px; width: 32px; height: 32px;
  border-radius: 50%; border: 1px solid var(--hair); color: var(--dim);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.sheet-close:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.35); }
.sheet-in h2 {
  font-size: 21px; font-weight: 300; letter-spacing: 0.06em; margin-bottom: 4px;
}
.sheet-in h2 em { font-style: italic; }
.sheet-in .kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 16px;
}
.sheet-in h3 {
  margin: 24px 0 8px; font-size: 11px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim);
}
.sheet-in p, .sheet-in li { font-size: 13.5px; line-height: 1.72; color: rgba(232, 230, 242, 0.82); }
.sheet-in p + p { margin-top: 10px; }
.sheet-in ul { margin: 6px 0 0 18px; }
.sheet-in li { margin-top: 5px; }
.sheet-in a { color: var(--gold); border-bottom: 1px solid rgba(217, 164, 65, 0.4); }
.sheet-in a:hover { border-color: var(--gold); }
.sheet-in code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(255, 255, 255, 0.07); padding: 1px 5px; border-radius: 4px;
}
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 18px; margin-top: 8px; }
.keys div { font-size: 12.5px; color: rgba(232, 230, 242, 0.78); }
.keys kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; margin-right: 8px;
  border: 1px solid var(--hair); border-radius: 5px; color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.sheet-foot {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--dimmer);
}
.sheet-foot .foot-brand { display: inline-flex; align-items: center; gap: 9px; }
.sheet-foot .foot-brand img { width: 22px; height: 22px; opacity: 0.9; }
.sheet-foot .foot-brand em { font-style: italic; }

/* graceful audio failure: the visuals still run, and we say so */
#noaudio {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 8; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--hair); background: rgba(10, 12, 20, 0.85);
  font-size: 11.5px; letter-spacing: 0.06em; color: var(--dim);
  opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
#noaudio.show { opacity: 1; }

/* ── no-WebGL fallback ─────────────────────────────────────────────── */
#nogl { display: none; }
body.no-gl #nogl {
  display: flex; position: fixed; inset: 0; z-index: 30;
  align-items: center; justify-content: center; padding: 28px; text-align: center;
}
body.no-gl #nogl p { max-width: 460px; font-size: 14px; line-height: 1.7; color: var(--dim); }
body.no-gl #nogl a { color: var(--gold); }

/* ── safe areas (notched iPhones) ──────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  #dock { bottom: calc(16px + env(safe-area-inset-bottom)); }
  #hud { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* ── touch: bigger targets, bigger thumb ───────────────────────────── */
@media (pointer: coarse) {
  .ctl { min-height: 42px; border-radius: 21px; padding: 0 14px; }
  .ctl.pod button { width: 30px; height: 34px; }
  #zoomSlider { height: 34px; }
  #zoomSlider::-webkit-slider-thumb { width: 19px; height: 19px; margin-top: -8px; }
  #zoomSlider::-moz-range-thumb { width: 19px; height: 19px; }
}

/* ── mobile ────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #top { padding: 12px 12px; font-size: 9px; gap: 10px; }
  #top .mark { letter-spacing: 0.14em; }
  #top nav { gap: 10px; flex-shrink: 0; }
  #top nav .home img { width: 16px; height: 16px; }
  #overlay { padding: 76px 16px 92px; }
  #scores { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 460px; }
  .score { padding: 12px 12px 13px; text-align: center; }
  .score-b { display: none; }
  .score-n { font-size: 14px; }
  .score-w { font-size: 11px; }
  .play { width: 72px; height: 72px; margin-top: 24px; }
  /* HUD sits ABOVE the whole dock on a phone — side by side they collide */
  #hud {
    left: 0; right: 0; bottom: 212px; text-align: center;
    font-size: 10px; letter-spacing: 0.12em;
  }
  #hudSub, #hudEpoch { display: none; }
  #dock { right: 10px; left: 10px; bottom: 12px; align-items: center; gap: 8px; max-width: none; }
  /* the description STAYS visible on a phone — the SHORT variant, so it
     never truncates mid-sentence (the clamp is only a safety net) */
  #blurb {
    max-width: none; text-align: center; font-size: 10px; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  #blurb .blurb-full { display: none; }
  #blurb .blurb-short { display: inline; }
  #blurb button { display: inline; }
  #controls { gap: 6px; justify-content: center; }
  .ctl .k { display: none; }
  /* the orrery pod becomes its own full row, slider stretched */
  .ctl.pod { flex: 1 1 100%; order: 2; justify-content: center; gap: 6px; padding: 0 10px; }
  .ctl.pod .pod-k, .ctl.pod .sep, #ctlSpeed { display: none; }
  #zoomSlider { flex: 1; max-width: 40vw; }
  #dragHint { bottom: 226px; }
  #settings { right: 10px; left: auto; top: 52px; }
  /* Recording and the Fullscreen API are desktop-grade features; iOS Safari
     has no element fullscreen and a WebM download is a dead end there. */
  #settings [data-app="rec"], #settings [data-app="full"] { display: none; }
  .sheet-in { padding: 26px 20px 28px; }
}

/* ── reduced motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation: none !important; }
  .score:hover, .play:hover, #overlay:hover .play { transform: none; }
}
