/* styles.css */
/* ------------------------------------------------------------------------
   The Perfect Hamburger — interface
   ------------------------------------------------------------------------
   A control surface laid over a food commercial. Dark, warm, precise and
   restrained: the film is the subject, the chrome is the instrument.

   Everything is sized in rem so a phone gets the same hierarchy at a smaller
   scale rather than a squeezed desktop layout, and every interactive surface
   carries a hover, focus-visible, active and disabled state.
   ---------------------------------------------------------------------- */

:root {
  /* -- ink ------------------------------------------------------------- */
  --ink: #f7efe4;
  --ink-dim: #bcab99;
  --ink-faint: #86776a;
  --ink-ghost: #5c5148;

  /* -- ground ---------------------------------------------------------- */
  --bg: #0a0807;
  --bg-deep: #060504;
  --panel: rgba(20, 16, 13, 0.72);
  --panel-lift: rgba(255, 238, 217, 0.045);
  --panel-lift-hi: rgba(255, 238, 217, 0.085);
  --sheet: rgba(15, 12, 10, 0.955);

  /* -- warm metal ------------------------------------------------------ */
  --gold: #f0a327;
  --gold-hi: #ffc35c;
  --gold-soft: rgba(240, 163, 39, 0.14);
  --gold-wash: rgba(240, 163, 39, 0.075);
  --ember: #e0642f;
  --leaf: #8fbe45;

  /* -- lines ----------------------------------------------------------- */
  --hairline: rgba(240, 163, 39, 0.24);
  --hairline-soft: rgba(247, 239, 228, 0.085);
  --hairline-hard: rgba(247, 239, 228, 0.16);

  /* -- geometry -------------------------------------------------------- */
  --radius-sm: 0.5rem;
  --radius: 0.7rem;
  --radius-lg: 1.05rem;
  --radius-xl: 1.35rem;

  /* -- depth ----------------------------------------------------------- */
  --shadow-sm: 0 0.35rem 1rem rgba(0, 0, 0, 0.45);
  --shadow: 0 1.4rem 3.2rem rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 2.2rem 5rem rgba(0, 0, 0, 0.72);

  /* -- motion ---------------------------------------------------------- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 130ms;
  --mid: 240ms;
  --slow: 420ms;

  /* -- type ------------------------------------------------------------ */
  --sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --label: 0.585rem;

  /* -- safe areas ------------------------------------------------------ */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* -- rhythm ---------------------------------------------------------- */
  --gutter: 1.75rem;
  --tap: 2.75rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body { touch-action: none; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  z-index: 1;
}
#stage:active { cursor: grabbing; }

/* A soft optical vignette over the render, plus a barely-there sheen so the
   black never reads as flat CSS. Multiply keeps it out of the highlights. */
#grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 44%, transparent 50%, rgba(0, 0, 0, 0.34) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.26) 0%, transparent 17%, transparent 62%, rgba(0, 0, 0, 0.46) 100%);
  mix-blend-mode: multiply;
  z-index: 2;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* One focus treatment, everywhere. Gold ring, dark spacer, never clipped. */
:where(button, [tabindex], [role="slider"]):focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ================================================================ title */

.titlecard {
  position: absolute;
  top: calc(var(--gutter) + var(--safe-t) - 0.25rem);
  left: calc(var(--gutter) + var(--safe-l));
  z-index: 4;
  max-width: min(25rem, 62vw);
  pointer-events: none;
  transition: opacity 1.1s var(--ease-soft), transform 1.1s var(--ease-soft), filter 1.1s var(--ease-soft);
}
#app[data-intro="done"] .titlecard {
  opacity: 0.32;
  transform: translateY(-0.4rem) scale(0.962);
}
#app[data-inspecting="true"] .titlecard,
#app[data-exploded="true"] .titlecard { opacity: 0.14; }

.titlecard__kicker {
  margin: 0 0 0.55rem;
  font-size: var(--label);
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 650;
}
.titlecard__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.0;
  font-weight: 400;
  letter-spacing: -0.018em;
  color: #fff7ea;
  text-shadow: 0 0.15rem 2.4rem rgba(0, 0, 0, 0.85);
}
.titlecard__sub {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-dim);
  max-width: 20rem;
}
.titlecard__cue {
  margin: 0.95rem 0 0;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  opacity: 1;
  transition: opacity var(--slow) var(--ease-soft);
}
.titlecard__cue kbd { margin-right: 0.2rem; }
#app[data-intro="done"] .titlecard__cue { opacity: 0; }

/* ================================================================ panels */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  padding: 0.8rem 0.9rem 0.9rem;
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}
/* A single lit hairline along the top edge — the key light finding the metal. */
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 170, 0.28), transparent);
  pointer-events: none;
}
.panel + .panel { margin-top: 0.55rem; }

.panel__title {
  margin: 0 0 0.62rem;
  font-size: var(--label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

.hud {
  position: absolute;
  top: calc(var(--gutter) + var(--safe-t) - 0.35rem);
  right: calc(var(--gutter) + var(--safe-r) - 0.35rem);
  z-index: 5;
  width: 16rem;
  max-height: calc(100dvh - 16rem - var(--safe-t));
  overflow-y: auto;
  overscroll-behavior: contain;
  /* the last panel fades rather than being guillotined mid-word */
  padding-bottom: 1.5rem;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 1.5rem), transparent);
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 163, 39, 0.3) transparent;
  transition: opacity var(--mid) var(--ease-soft);
}
.hud::-webkit-scrollbar { width: 5px; }
.hud::-webkit-scrollbar-thumb { background: rgba(240, 163, 39, 0.28); border-radius: 999px; }
#app[data-inspecting="true"] .hud { opacity: 0.45; }
#app[data-inspecting="true"] .hud:hover,
#app[data-inspecting="true"] .hud:focus-within { opacity: 1; }

.hud__head { display: none; }

/* ============================================================ camera pad */

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: ". up ." "left reset right" "out down in";
  gap: 0.28rem;
  margin-bottom: 0.55rem;
}
.pad__btn {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  min-height: 2.6rem;
  padding: 0.3rem 0.2rem;
  border-radius: 0.55rem;
  border: 1px solid var(--hairline-soft);
  background: var(--panel-lift);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: background var(--fast) var(--ease-soft), border-color var(--fast) var(--ease-soft),
    transform 90ms var(--ease-out), color var(--fast) var(--ease-soft);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.pad__btn span {
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 700;
  transition: color var(--fast) var(--ease-soft);
}
.pad__btn svg { width: 0.95rem; height: 0.95rem; fill: currentColor; }
.pad__btn:hover { background: var(--gold-soft); border-color: var(--hairline); }
.pad__btn:hover span { color: var(--gold); }
.pad__btn:active {
  transform: translateY(1px);
  background: rgba(240, 163, 39, 0.28);
  border-color: rgba(240, 163, 39, 0.55);
  color: #fff3df;
}
/* Touch has no :hover and loses :active the moment the finger stops moving,
   so a held button says so with a class instead. */
.pad__btn.is-holding {
  background: rgba(240, 163, 39, 0.3);
  border-color: rgba(240, 163, 39, 0.6);
  color: #fff3df;
  transform: translateY(1px);
}
.pad__btn.is-holding span { color: rgba(255, 243, 223, 0.8); }
.chip.is-holding {
  background: rgba(240, 163, 39, 0.28);
  border-color: rgba(240, 163, 39, 0.55);
  color: #fff3df;
}
.pad__btn--up { grid-area: up; }
.pad__btn--left { grid-area: left; }
.pad__btn--right { grid-area: right; }
.pad__btn--down { grid-area: down; }
.pad__btn--reset { grid-area: reset; color: var(--ink-dim); }
.pad__btn--out { grid-area: out; color: var(--ink-dim); }
.pad__btn--in { grid-area: in; color: var(--ink-dim); }
.pad__btn--out svg, .pad__btn--in svg { width: 0.9rem; height: 0.9rem; }
.pad__btn--reset svg { width: 0.85rem; height: 0.85rem; }

.pad__legend {
  margin: 0 0 0.6rem;
  font-size: 0.64rem;
  line-height: 1.55;
  color: var(--ink-faint);
}
.pad__legend b { color: var(--ink-dim); font-weight: 750; }
.pad__legend em {
  display: block;
  margin-top: 0.3rem;
  font-style: normal;
  color: var(--ink-ghost);
}


/* ================================================================= chips */

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--hairline-soft);
  background: var(--panel-lift);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 0.48rem 0.7rem;
  font: inherit;
  font-size: 0.695rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  cursor: pointer;
  min-height: 2.15rem;
  white-space: nowrap;
  transition: background var(--fast) var(--ease-soft), color var(--fast) var(--ease-soft),
    border-color var(--fast) var(--ease-soft), transform 90ms var(--ease-out);
}
.chip:hover { background: var(--gold-soft); color: var(--ink); border-color: var(--hairline); }
.chip:active { transform: translateY(1px); }
.chip.is-on,
.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(240, 163, 39, 0.32), rgba(224, 100, 47, 0.2));
  border-color: rgba(240, 163, 39, 0.55);
  color: #fff4e2;
  box-shadow: inset 0 1px 0 rgba(255, 225, 180, 0.25);
}
.chip[aria-disabled="true"], .chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
}
/* A tiny lit pip on anything that is currently on. */
.chip__pip {
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.28;
  transition: opacity var(--fast) var(--ease-soft), box-shadow var(--fast) var(--ease-soft);
}
.chip.is-on .chip__pip,
.chip[aria-pressed="true"] .chip__pip {
  opacity: 1;
  background: var(--gold-hi);
  box-shadow: 0 0 0.45rem rgba(255, 195, 92, 0.9);
}

/* ============================================================= transport */

.transport {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  padding:
    1.5rem
    calc(var(--gutter) + var(--safe-r))
    calc(0.95rem + var(--safe-b))
    calc(var(--gutter) + var(--safe-l));
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(6, 5, 4, 0.55) 26%,
    rgba(6, 5, 4, 0.88) 58%,
    rgba(4, 3, 3, 0.97) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 100%;
  animation: transportIn 900ms var(--ease-out) both;
}
@keyframes transportIn {
  from { opacity: 0; transform: translateY(1.2rem); }
  to { opacity: 1; transform: none; }
}

/* -- status line ------------------------------------------------------- */

.status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.7rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  min-height: 1.1rem;
}
.status__lamp {
  position: relative;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ink-ghost);
  transition: background var(--mid) var(--ease-soft), box-shadow var(--mid) var(--ease-soft);
}
.transport[data-state="playing"] .status__lamp {
  background: var(--gold);
  box-shadow: 0 0 0.6rem rgba(240, 163, 39, 0.85);
  animation: lamp 2.6s var(--ease-soft) infinite;
}
.transport[data-at-end="true"] .status__lamp {
  background: var(--leaf);
  box-shadow: 0 0 0.6rem rgba(143, 190, 69, 0.6);
  animation: none;
}
@keyframes lamp {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}
.status__state {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: var(--label);
  white-space: nowrap;
}
.transport[data-state="paused"] .status__state { color: var(--ink-dim); }
.transport[data-at-end="true"] .status__state { color: var(--leaf); }
.transport[data-scrubbing="true"] .status__state { color: var(--gold-hi); }

/* The chapter readout doubles as the way in to the chapter menu, so the word
   "Cheese" is one tap away at every width. */
.status__chapter {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 42vw;
  padding: 0.3rem 0.5rem 0.3rem 0.6rem;
  margin: -0.3rem 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast) var(--ease-soft), border-color var(--fast) var(--ease-soft);
}
.status__chapter > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status__chapter svg {
  width: 0.6rem;
  height: 0.6rem;
  fill: var(--ink-faint);
  flex: 0 0 auto;
  transition: transform var(--fast) var(--ease-out), fill var(--fast) var(--ease-soft);
}
.status__chapter:hover { background: var(--panel-lift-hi); border-color: var(--hairline-soft); }
.status__chapter:hover svg { fill: var(--gold); }
.status__chapter[aria-expanded="true"] {
  background: var(--gold-soft);
  border-color: var(--hairline);
}
.status__chapter[aria-expanded="true"] svg { transform: rotate(180deg); fill: var(--gold); }

.chapters {
  position: absolute;
  z-index: 7;
  bottom: calc(100% - 2.4rem);
  left: calc(var(--gutter) + var(--safe-l));
  width: min(27rem, calc(100vw - 2 * var(--gutter) - var(--safe-l) - var(--safe-r)));
  max-height: min(21rem, 50dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: sheetIn 200ms var(--ease-out);
}
.chapters__title {
  margin: 0 0 0.6rem;
  font-size: var(--label);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}
.chapters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr));
  gap: 0.3rem;
}
.chapter {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.1rem;
  min-height: var(--tap);
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-lift);
  color: var(--ink-dim);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--fast) var(--ease-soft), border-color var(--fast) var(--ease-soft),
    color var(--fast) var(--ease-soft);
}
.chapter b { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.01em; }
.chapter span { font-size: 0.58rem; color: var(--ink-ghost); font-variant-numeric: tabular-nums; }
.chapter:hover { background: var(--gold-soft); border-color: var(--hairline); color: var(--ink); }
.chapter--hero b { color: var(--gold); }
.chapter.is-active {
  background: linear-gradient(180deg, rgba(240, 163, 39, 0.3), rgba(224, 100, 47, 0.2));
  border-color: rgba(240, 163, 39, 0.55);
  color: #fff4e2;
}
.chapter.is-active b, .chapter.is-active span { color: inherit; }
.status__time {
  white-space: nowrap;
  color: var(--ink-ghost);
  letter-spacing: 0.02em;
}
.status__time::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.72rem;
  margin-right: 0.65rem;
  vertical-align: -0.12rem;
  background: var(--hairline-hard);
}
.status__hint {
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-ghost);
  font-size: 0.645rem;
  letter-spacing: 0.03em;
  opacity: 0.9;
  transition: opacity var(--mid) var(--ease-soft);
}
.transport[data-state="playing"] .status__hint { opacity: 0; }
.status__time b { color: var(--ink); font-weight: 650; }
.status__time i { font-style: normal; padding: 0 0.28rem; opacity: 0.5; }

/* -- the rail ---------------------------------------------------------- */

.scrub { position: relative; }

.scrub__rail {
  position: relative;
  padding: 0.55rem 0;
  touch-action: none;
}

.scrub__track {
  position: relative;
  height: 0.34rem;
  border-radius: 999px;
  background: rgba(247, 239, 228, 0.11);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  touch-action: none;
  transition: height var(--mid) var(--ease-out), background var(--mid) var(--ease-soft);
}
/* A generous invisible hit area so a thumb finds the rail without aiming. */
.scrub__track::before {
  content: "";
  position: absolute;
  inset: -1.15rem 0;
}
.scrub__rail:hover .scrub__track,
.transport[data-scrubbing="true"] .scrub__track { height: 0.55rem; }
.scrub__track:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 6px; }

.scrub__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #c9501f, var(--ember) 42%, var(--gold) 100%);
  box-shadow: 0 0 1.4rem rgba(240, 163, 39, 0.42);
  transition: box-shadow var(--mid) var(--ease-soft);
}
.transport[data-state="paused"] .scrub__fill { box-shadow: 0 0 0.7rem rgba(240, 163, 39, 0.22); }
.transport[data-at-end="true"] .scrub__fill { box-shadow: 0 0 1.8rem rgba(240, 163, 39, 0.55); }

/* Hover preview: a ghost playhead under the cursor. */
.scrub__ghost {
  position: absolute;
  top: -0.28rem;
  bottom: -0.28rem;
  left: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 999px;
  background: rgba(255, 244, 226, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fast) var(--ease-soft);
}
.scrub__rail[data-hovering="true"] .scrub__ghost { opacity: 1; }

.scrub__head {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.95rem;
  height: 0.95rem;
  margin-left: -0.475rem;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #fff6e8;
  box-shadow:
    0 0 0 0.26rem rgba(240, 163, 39, 0.2),
    0 0.2rem 0.8rem rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: box-shadow var(--mid) var(--ease-out), width var(--mid) var(--ease-out),
    height var(--mid) var(--ease-out), margin-left var(--mid) var(--ease-out);
}
.transport[data-scrubbing="true"] .scrub__head {
  width: 1.2rem; height: 1.2rem; margin-left: -0.6rem;
  box-shadow: 0 0 0 0.4rem rgba(240, 163, 39, 0.28), 0 0.3rem 1rem rgba(0, 0, 0, 0.85);
}

/* The floating chip that reads the time under the cursor, or the playhead. */
.scrub__preview {
  position: absolute;
  bottom: calc(100% - 0.1rem);
  left: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(10, 8, 7, 0.95);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fast) var(--ease-soft), transform var(--fast) var(--ease-out);
  z-index: 3;
}
.scrub__rail[data-hovering="true"] .scrub__preview,
.transport[data-scrubbing="true"] .scrub__preview { opacity: 1; }
.scrub__preview b { font-weight: 650; }
.scrub__preview span {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.54rem;
  font-weight: 700;
}

/* -- chapter markers --------------------------------------------------- */

.scrub__markers {
  position: relative;
  height: 1.75rem;
  margin-top: 0.15rem;
  max-width: 100%;
}
.marker {
  position: absolute;
  top: 0;
  left: var(--at, 0%);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.32rem;
  cursor: pointer;
  color: var(--ink-ghost);
  font-family: var(--sans);
  font-size: 0.555rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  transition: color var(--fast) var(--ease-soft);
}
.marker::before {
  /* thumb-sized hit area without a thumb-sized footprint */
  content: "";
  position: absolute;
  inset: -0.5rem -0.4rem;
}
.marker__tick {
  width: 1px;
  height: 0.4rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
  transition: height var(--fast) var(--ease-out), opacity var(--fast) var(--ease-soft),
    background var(--fast) var(--ease-soft), width var(--fast) var(--ease-out);
}
.marker--hero { color: var(--ink-faint); }
.marker--hero .marker__tick { width: 2px; height: 0.55rem; opacity: 0.9; background: var(--gold); }
.marker--hero .marker__label { color: var(--ink-dim); }
.marker:hover { color: var(--ink); }
.marker:hover .marker__tick { opacity: 1; height: 0.6rem; }
.marker.is-active { color: var(--gold-hi); }
.marker.is-active .marker__tick {
  background: var(--gold-hi);
  opacity: 1;
  width: 2px;
  height: 0.7rem;
  box-shadow: 0 0 0.5rem rgba(255, 195, 92, 0.8);
}
.marker.is-active .marker__label { color: var(--gold-hi); }
.marker__label { transition: color var(--fast) var(--ease-soft); }

/* -- control row ------------------------------------------------------- */

.transport__row {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.5rem);
  flex-wrap: wrap;
  max-width: 100%;
}
.transport__cluster { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.transport__cluster--speed { gap: 0.5rem; margin-left: auto; }
.transport__split {
  width: 1px;
  height: 1.6rem;
  margin: 0 0.35rem;
  background: var(--hairline-hard);
  flex: 0 0 auto;
}

.tbtn {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  background: var(--panel-lift);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: background var(--fast) var(--ease-soft), color var(--fast) var(--ease-soft),
    border-color var(--fast) var(--ease-soft), transform 90ms var(--ease-out),
    opacity var(--fast) var(--ease-soft);
}
.tbtn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; flex: 0 0 auto; }
.tbtn__icon { display: inline-flex; }
.tbtn__key {
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--ink-ghost);
  font-weight: 800;
  transition: color var(--fast) var(--ease-soft);
}
.tbtn:hover { background: var(--gold-soft); border-color: var(--hairline); }
.tbtn:hover .tbtn__key { color: var(--gold); }
.tbtn:active { transform: translateY(1px); background: rgba(240, 163, 39, 0.26); }
.tbtn[aria-disabled="true"] {
  opacity: 0.28;
  cursor: default;
  background: transparent;
}
.tbtn[aria-disabled="true"]:hover { background: transparent; border-color: transparent; }
.tbtn[aria-disabled="true"]:active { transform: none; }

.tbtn--primary {
  min-width: 3.6rem;
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 45%, var(--ember) 100%);
  color: #1c1006;
  border-color: rgba(255, 210, 140, 0.45);
  box-shadow: 0 0.4rem 1.5rem rgba(224, 100, 47, 0.34), inset 0 1px 0 rgba(255, 240, 214, 0.5);
}
.tbtn--primary .tbtn__key { color: rgba(28, 16, 6, 0.6); }
.tbtn--primary:hover {
  filter: brightness(1.09);
  border-color: rgba(255, 226, 180, 0.7);
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 45%, var(--ember) 100%);
}
.tbtn--primary:hover .tbtn__key { color: rgba(28, 16, 6, 0.75); }
.tbtn--primary:active { transform: translateY(1px); filter: brightness(0.97); }
/* At the end of the sequence the play button is an invitation to run it again. */
.transport[data-at-end="true"] .tbtn--primary {
  box-shadow: 0 0.4rem 1.5rem rgba(224, 100, 47, 0.34), inset 0 1px 0 rgba(255, 240, 214, 0.5),
    0 0 0 0.28rem rgba(240, 163, 39, 0.16);
}

.tbtn--wide {
  min-width: auto;
  padding: 0 0.8rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-dim);
}
.tbtn--wide svg { width: 0.9rem; height: 0.9rem; }
.tbtn--wide.is-on {
  background: var(--gold-soft);
  color: var(--gold-hi);
  border-color: rgba(240, 163, 39, 0.45);
}

.speeds {
  display: flex;
  gap: 0.12rem;
  background: rgba(247, 239, 228, 0.05);
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
  padding: 0.2rem;
  min-width: 0;
}
.speed {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: 0.655rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.36rem 0.52rem;
  min-height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast) var(--ease-soft), color var(--fast) var(--ease-soft);
}
.speed__x { font-style: normal; opacity: 0.6; font-size: 0.85em; }
.speed:hover { color: var(--ink); background: var(--gold-wash); }
.speed.is-on {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  color: #1c1006;
  box-shadow: inset 0 1px 0 rgba(255, 245, 225, 0.6);
}
.speed.is-on .speed__x { opacity: 0.75; }

/* ================================================================ inspect */

.inspect-host {
  position: absolute;
  left: calc(var(--gutter) + var(--safe-l));
  bottom: 11rem;
  z-index: 5;
  max-width: min(24rem, calc(100vw - 4rem));
}
.inspect {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.35rem 1.3rem;
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cardIn 420ms var(--ease-out);
}
/* A lit rule down the leading edge, like a light box seam. */
.inspect::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--gold) 22%, var(--ember) 78%, transparent);
  opacity: 0.85;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(0.9rem) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.inspect__close {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
  width: var(--tap); height: var(--tap);
  display: grid;
  place-items: center;
  border: 0; background: none;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--fast) var(--ease-soft), background var(--fast) var(--ease-soft);
}
.inspect__close svg { width: 0.8rem; height: 0.8rem; fill: currentColor; }
.inspect__close:hover { color: var(--ink); background: var(--panel-lift-hi); }
.inspect__close:active { background: rgba(240, 163, 39, 0.2); }

.inspect__eyebrow {
  margin: 0 0 0.4rem;
  font-size: var(--label);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 2.2rem;
}
.inspect__badge {
  letter-spacing: 0.14em;
  color: #1c1006;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.5rem;
}
.inspect__title {
  margin: 0 0 0.65rem;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #fff5e8;
  padding-right: 1.6rem;
}
.inspect__body {
  margin: 0 0 1rem;
  font-size: 0.835rem;
  line-height: 1.62;
  color: var(--ink-dim);
}
.inspect__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin: 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--hairline-soft);
}
.inspect__facts dt {
  font-size: 0.53rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-ghost);
  font-weight: 750;
  margin-bottom: 0.16rem;
}
.inspect__facts dd { margin: 0; font-size: 0.78rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.inspect__hint {
  margin: 0.85rem 0 0;
  font-size: 0.62rem;
  color: var(--ink-ghost);
  line-height: 1.5;
}
.inspect__hint kbd { font-size: 0.55rem; min-width: 1.1rem; }

/* =================================================================== help */

.help-toggle {
  position: absolute;
  right: calc(var(--gutter) + var(--safe-r) - 0.35rem);
  bottom: calc(11.4rem + var(--safe-b));
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--hairline-soft);
  background: var(--panel);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 0.5rem 0.95rem 0.5rem 0.55rem;
  min-height: var(--tap);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  transition: color var(--fast) var(--ease-soft), border-color var(--fast) var(--ease-soft),
    background var(--fast) var(--ease-soft);
}
.help-toggle__glyph {
  display: grid;
  place-items: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: var(--panel-lift-hi);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}
.help-toggle:hover { color: var(--ink); border-color: var(--hairline); background: rgba(24, 18, 14, 0.85); }
.help-toggle[aria-expanded="true"] { color: var(--gold-hi); border-color: var(--hairline); }

.scrim {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(4, 3, 3, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mid) var(--ease-soft);
}
.scrim[data-on="help"] { opacity: 1; pointer-events: auto; }

.help {
  position: absolute;
  right: calc(var(--gutter) + var(--safe-r) - 0.35rem);
  bottom: calc(15.2rem + var(--safe-b));
  z-index: 10;
  width: min(52rem, calc(100vw - 3rem));
  max-height: calc(100dvh - 19rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.6rem 1.6rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  animation: sheetIn 320ms var(--ease-out);
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(1rem) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.help__kicker {
  margin: 0 0 0.4rem;
  font-size: var(--label);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.help__title {
  margin: 0 0 1.4rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fff5e8;
  padding-right: 2.5rem;
}
.sheet__close {
  position: absolute;
  top: 0.6rem; right: 0.7rem;
  width: var(--tap); height: var(--tap);
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--fast) var(--ease-soft), background var(--fast) var(--ease-soft);
}
.sheet__close svg { width: 0.8rem; height: 0.8rem; fill: currentColor; }
.sheet__close:hover { color: var(--ink); background: var(--panel-lift-hi); }

.help__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 1.5rem 1.9rem;
}
.help__col h3 {
  margin: 0 0 0.8rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 0.54rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 750;
}
.keylist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.keylist li {
  display: grid;
  grid-template-columns: 5rem 1fr;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.715rem;
  color: var(--ink-dim);
  line-height: 1.42;
}
.keys { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.help__note {
  margin: 0.95rem 0 0;
  font-size: 0.665rem;
  line-height: 1.55;
  color: var(--ink-ghost);
  border-left: 1px solid var(--hairline-soft);
  padding-left: 0.7rem;
}

kbd {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.18rem 0.34rem;
  border-radius: 0.3rem;
  background: linear-gradient(180deg, rgba(255, 238, 217, 0.11), rgba(255, 238, 217, 0.05));
  border: 1px solid var(--hairline-soft);
  border-bottom-color: rgba(0, 0, 0, 0.55);
  border-bottom-width: 2px;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
}

/* =============================================================== fallback */

.fallback {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.7rem;
  padding: 2rem;
  text-align: center;
  background: rgba(10, 8, 7, 0.96);
}
.fallback__kicker {
  margin: 0;
  font-size: var(--label);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.fallback h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin: 0; color: #fff5e8; }
.fallback__body { margin: 0; max-width: 30rem; color: var(--ink-dim); line-height: 1.6; font-size: 0.85rem; }

/* ============================================================== drawer UI */

.panel-toggle {
  display: none;
  position: absolute;
  top: calc(1.15rem + var(--safe-t));
  right: calc(1rem + var(--safe-r));
  z-index: 9;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--hairline-soft);
  background: rgba(18, 14, 11, 0.88);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1rem 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  min-height: var(--tap);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast) var(--ease-soft), background var(--fast) var(--ease-soft);
}
.panel-toggle:hover, .panel-toggle[aria-expanded="true"] { border-color: var(--hairline); }
.panel-toggle__bars { display: inline-flex; flex-direction: column; gap: 3px; width: 0.85rem; }
.panel-toggle__bars i {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--mid) var(--ease-out), opacity var(--fast) var(--ease-soft);
}
#app[data-panel="open"] .panel-toggle__bars i:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
#app[data-panel="open"] .panel-toggle__bars i:nth-child(2) { opacity: 0; }
#app[data-panel="open"] .panel-toggle__bars i:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

/* ============================================================= responsive */

@media (max-width: 1080px) {
  :root { --gutter: 1.3rem; }
  .hud { width: 14.5rem; }
  .inspect-host { max-width: min(20rem, calc(100vw - 3rem)); }
}

/* Below roughly a laptop the twelve chapter names start colliding on the rail.
   The rail condenses to ticks — hero ticks still stand out, every tick keeps
   its accessible name and its tooltip — and the chapter menu carries the
   words. Nothing about the timeline becomes unnameable. */
@media (max-width: 1060px) {
  .scrub__markers { height: 1.15rem; }
  .marker__label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .marker { padding: 0.15rem 0.45rem; }
  .marker::before { inset: -0.55rem -0.5rem; }
  .marker__tick { height: 0.62rem; width: 2px; }
  .marker--hero .marker__tick { height: 0.8rem; width: 2.5px; }
  .marker.is-active .marker__tick { height: 0.95rem; width: 2.5px; }
}

@media (max-width: 860px) {
  .titlecard__sub { display: none; }
  .inspect-host { bottom: 12rem; }
}

/* -- phone and short-landscape ----------------------------------------- */

@media (max-width: 760px), (max-height: 560px) {
  :root { --gutter: 0.85rem; }

  .panel-toggle { display: inline-flex; }

  .titlecard {
    top: calc(4.7rem + var(--safe-t));
    left: calc(1rem + var(--safe-l));
    max-width: min(19rem, 68vw);
  }
  #app[data-inspecting="true"] .titlecard { opacity: 0; }
  .titlecard__sub { display: none; }
  .titlecard__cue { margin-top: 0.6rem; font-size: 0.6rem; }

  /* the drawer */
  .hud {
    position: absolute;
    inset: auto 0 0 0;
    top: auto;
    width: 100%;
    max-width: none;
    max-height: min(72dvh, 32rem);
    padding: 0.15rem calc(0.9rem + var(--safe-r)) calc(1.1rem + var(--safe-b)) calc(0.9rem + var(--safe-l));
    background: rgba(11, 9, 7, 0.975);
    border-top: 1px solid var(--hairline);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -1.5rem 3.5rem rgba(0, 0, 0, 0.7);
    transform: translateY(102%);
    transition: transform var(--slow) var(--ease-out);
    z-index: 9;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app[data-panel="open"] .hud { transform: none; }
  #app[data-panel="open"] .scrim { opacity: 1; pointer-events: auto; }
  #app[data-inspecting="true"] .hud { opacity: 1; }

  .hud__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 -0.15rem 0.35rem;
    padding: 0.85rem 0.15rem 0.7rem;
    background: linear-gradient(180deg, rgba(11, 9, 7, 0.99) 62%, rgba(11, 9, 7, 0));
  }
  .hud__grip {
    position: absolute;
    top: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.4rem;
    height: 0.22rem;
    border-radius: 999px;
    background: var(--hairline-hard);
  }
  .hud__title {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 400;
    color: #fff5e8;
  }
  .hud__done {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--hairline);
    background: var(--gold-soft);
    color: var(--gold-hi);
    border-radius: 999px;
    padding: 0 1rem;
    min-height: var(--tap);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .hud__done:active { background: rgba(240, 163, 39, 0.3); }

  .panel {
    background: rgba(255, 238, 217, 0.035);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    padding: 0.85rem 0.9rem 0.95rem;
  }
  .panel::before { display: none; }

  /* transport */
  .transport {
    padding: 1.1rem calc(0.7rem + var(--safe-r)) calc(0.6rem + var(--safe-b)) calc(0.7rem + var(--safe-l));
    gap: 0.5rem;
  }
  .status { font-size: 0.66rem; gap: 0.5rem; }
  .status__time::before { margin-right: 0.5rem; }
  .status__hint { display: none; }

  .transport__row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .transport__cluster { gap: 0.28rem; justify-content: space-between; }
  .transport__cluster--play > .tbtn { flex: 1 1 0; }
  .transport__cluster--speed { margin-left: 0; gap: 0.35rem; }
  .tbtn { padding: 0 0.3rem; }
  .tbtn__key { display: none; }
  .tbtn--primary { flex: 1.35 1 0; }
  .tbtn--wide { flex: 0 0 auto; min-width: var(--tap); padding: 0; }
  .tbtn--wide span:not(.tbtn__key) { display: none; }
  .speeds { flex: 1 1 auto; justify-content: space-between; padding: 0.16rem; }
  .speed { flex: 1 1 0; text-align: center; padding: 0.4rem 0.2rem; min-height: 2.3rem; }

  .chapters {
    left: calc(0.7rem + var(--safe-l));
    right: calc(0.7rem + var(--safe-r));
    width: auto;
    bottom: calc(100% - 2.2rem);
  }
  .chapters__grid { grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); }

  /* inspect card rides at the top, out of the way of the thumb */
  .inspect-host {
    left: 0; right: 0; bottom: auto;
    top: calc(4.6rem + var(--safe-t));
    max-width: none;
    padding: 0 0.8rem;
  }
  .inspect { padding: 1rem 1.05rem 1.1rem; }
  .inspect__title { font-size: 1.3rem; }
  .inspect__body { font-size: 0.79rem; margin-bottom: 0.85rem; }

  /* help lives bottom-left, the sheet becomes a full-width bottom sheet */
  .help-toggle {
    bottom: auto;
    top: calc(1.15rem + var(--safe-t));
    right: auto;
    left: calc(1rem + var(--safe-l));
    padding: 0.5rem 0.85rem 0.5rem 0.5rem;
    font-size: 0.62rem;
  }
  .help {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 84dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.3rem 1.1rem calc(1.5rem + var(--safe-b));
  }
  .help__grid { gap: 1.35rem; }
  .keylist li { grid-template-columns: 5.2rem 1fr; font-size: 0.7rem; }
}

/* Landscape phones: vertical space is the scarce resource. */
@media (max-height: 480px) and (orientation: landscape) {
  .titlecard__title { font-size: 1.35rem; }
  .titlecard__kicker { margin-bottom: 0.3rem; font-size: 0.5rem; letter-spacing: 0.28em; }
  .titlecard__cue { display: none; }

  .transport { padding-top: 0.75rem; gap: 0.35rem; }
  .transport__row { flex-direction: row; align-items: center; gap: 0.45rem; }
  .transport__cluster--play { flex: 1 1 auto; }
  .transport__cluster--speed { flex: 1 1 auto; margin-left: 0; }
  .status { font-size: 0.6rem; min-height: 0.9rem; }
  .scrub__rail { padding: 0.4rem 0; }
  .scrub__markers { margin-top: 0.05rem; }
  .marker { min-height: 2.4rem; }
  .hud { max-height: 88dvh; }
  .titlecard { top: calc(4.1rem + var(--safe-t)); }
  /* Vertical space is the scarce resource: the card is capped and scrolls
     rather than sliding under the transport. */
  .inspect-host {
    top: calc(3.8rem + var(--safe-t));
    max-width: 23rem;
    right: auto;
    padding-left: calc(0.8rem + var(--safe-l));
  }
  .inspect {
    max-height: calc(100dvh - 12.5rem - var(--safe-t));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.8rem 0.95rem 0.9rem;
  }
  .inspect__title { font-size: 1.15rem; margin-bottom: 0.45rem; }
  /* Four lines of copy, then the facts — the card never scrolls away from the
     numbers in a viewport this short. */
  .inspect__body {
    font-size: 0.74rem;
    line-height: 1.5;
    margin-bottom: 0.7rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
  }
  .inspect__facts { padding-top: 0.6rem; gap: 0.4rem 1rem; }
  .inspect__hint { display: none; }
  .help { max-height: 92dvh; padding-top: 1rem; }
  .help__title { margin-bottom: 0.9rem; font-size: 1.25rem; }
}

/* On a phone the shuttle cannot hold eight 44px targets on one line. The two
   edge jumps step aside; Home / End, the first and last chapter, and the ends
   of the rail all do exactly the same job. Nothing shrinks below the thumb
   minimum to make room. */
@media (max-width: 420px) {
  .tbtn--edge { display: none; }
  .transport__split { display: none; }
}

@media (max-width: 380px) {
  .transport { padding-left: calc(0.55rem + var(--safe-l)); padding-right: calc(0.55rem + var(--safe-r)); }
  .speed { padding: 0.4rem 0.15rem; font-size: 0.62rem; }
  .status { gap: 0.4rem; font-size: 0.62rem; }
  .status__chapter { padding: 0.3rem 0.35rem 0.3rem 0.45rem; font-size: 0.66rem; max-width: 38vw; }
  .titlecard { max-width: 52vw; }
  .chapters { left: calc(0.55rem + var(--safe-l)); right: calc(0.55rem + var(--safe-r)); }
}

/* Coarse pointers get thumb-sized targets everywhere, not just the transport. */
@media (pointer: coarse) {
  .chip { min-height: var(--tap); padding: 0.7rem 0.95rem; font-size: 0.72rem; }
  .speed { min-height: 2.6rem; min-width: 2.6rem; }
  .pad__btn { min-height: 3.1rem; }
  .chapter { min-height: 2.9rem; }
  .status__chapter { min-height: 2.5rem; margin: -0.5rem 0; }
  .help-toggle, .panel-toggle { min-height: var(--tap); }
  /* The rail is a read-out on touch; the chapter menu is the target. */
  .marker { cursor: default; }
}

/* ======================================================= reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* labels.css */
/* Exploded-view labels: projected from the real world position of each layer,
   then separated so no two collide, with an elbow leader drawn back to the
   layer each one names. */

.labels {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms ease;
}
.labels.is-on { opacity: 1; }

/* The item is anchored ON the layer; only its text moves to make room. */
.labels__item {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform: translate3d(-999px, -999px, 0);
  will-change: transform;
  opacity: 0;
  transition: opacity 200ms ease;
}

.labels__dot {
  position: absolute;
  left: -0.15rem;
  top: -0.15rem;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--gold, #f0a327);
}

/* Vertical leg: from the anchor up or down to the text's line. */
.labels__stem {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  background: rgba(240, 163, 39, 0.5);
}

/* Horizontal leg: across to the text. */
.labels__arm {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, rgba(240, 163, 39, 0.35), rgba(240, 163, 39, 0.8));
}

.labels__text {
  position: absolute;
  left: 32px;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  white-space: nowrap;
  text-shadow: 0 0.1rem 0.9rem rgba(0, 0, 0, 0.95);
}
.labels__text b {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: #fff2df;
}
.labels__text i {
  font-style: normal;
  font-size: 0.54rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(240, 163, 39, 0.85);
  font-weight: 700;
}

@media (max-width: 720px) {
  .labels__arm { width: 16px; }
  .labels__text { left: 22px; }
  .labels__text b { font-size: 0.68rem; }
  .labels__text i { font-size: 0.48rem; letter-spacing: 0.18em; }
}

/* ------------------------------------------------------------------------
   Control column: budget against the measured transport, not a constant.
   `--transport-h` is published by ChromeMetrics from the real element, so the
   column gets exactly the room that actually exists at this viewport instead
   of a guess that slices a button in half when the transport grows.
   ---------------------------------------------------------------------- */

.hud {
  max-height: calc(100dvh - var(--transport-h, 9rem) - 2.4rem - var(--safe-t));
}

/* Only advertise a scroll when there is genuinely more below. */
.hud[data-overflow="true"] {
  scrollbar-gutter: stable;
  scrollbar-color: rgba(240, 163, 39, 0.55) rgba(255, 236, 214, 0.06);
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 2.6rem), rgba(0, 0, 0, 0.35) calc(100% - 0.4rem), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 2.6rem), rgba(0, 0, 0, 0.35) calc(100% - 0.4rem), transparent);
}
.hud[data-overflow="true"]::-webkit-scrollbar { width: 7px; }
.hud[data-overflow="true"]::-webkit-scrollbar-track {
  background: rgba(255, 236, 214, 0.06);
  border-radius: 999px;
}
.hud[data-overflow="true"]::-webkit-scrollbar-thumb {
  background: rgba(240, 163, 39, 0.55);
  border-radius: 999px;
}
.hud[data-overflow="false"] {
  -webkit-mask-image: none;
  mask-image: none;
}

/* A control must never be sliced by the column's own edge: the last panel can
   always scroll clear of the fade. */
.hud[data-overflow="true"] > :last-child {
  margin-bottom: 2.2rem;
}
