/*
 * Tiny Tempo marketing site.
 *
 * The palette is the game's own (src/config/theme.ts), and so is the treatment:
 * one warm key light from the upper left, thick ink outlines, and objects with
 * real thickness — a block shadow straight down for the edge, a soft one for the
 * air under it. Every surface on this page is built from those three things, so
 * a new card never needs a new shadow recipe.
 */
:root {
  /* The four the game is keyed to. */
  --paper: #eee8d8;
  --ink: #243e35;
  --muted: #4e5a52;
  --coral: #cf5134;

  /* Workshop surfaces. */
  --cream: #fff4dc;
  --coral-deep: #a33c26;
  --coral-lit: #e06a4c;
  --wood: #d98a48;
  --wood-dark: #936542;
  --rope: #6b4a2e;
  --sun: #dfc37f;
  --puck: #f6ead0;
  --brass: #e0b34a;
  --handle: #f4ead2;
  --iron: #24362f;
  --sand: #e6dcc4;
  --shade: #dfd6be;

  /* Judgement, and nothing else. Reserved the way the game reserves them. */
  --perfect: #2f9e6a;
  --good: #c8951f;
  --miss: #a85446;

  /* Surface tokens. A band re-points these and everything inside follows. */
  --surface: var(--cream);
  --surface-sunk: #e7dcc4;
  --text: var(--ink);
  --text-dim: var(--muted);
  --rule: rgba(36, 62, 53, 0.16);
  --outline: var(--ink);

  /* An object's thickness, then the air under it. */
  --lift-1: 0 4px 0 rgba(36, 62, 53, 0.18), 0 8px 16px rgba(36, 62, 53, 0.08);
  --lift-2: 0 7px 0 rgba(36, 62, 53, 0.2), 0 16px 30px rgba(36, 62, 53, 0.1);
  --lift-3: 0 12px 0 rgba(36, 62, 53, 0.22), 0 26px 46px rgba(36, 62, 53, 0.12);

  --edge: 4px;
  --r-sm: 0.8rem;
  --r-md: 1.2rem;
  --r-lg: 1.6rem;
  --r-xl: 2.2rem;

  --beat: 0.5s;
  --bar: 2s;
  --gutter: clamp(1rem, 4vw, 2rem);
  --page: 1160px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --header-h: 4.6rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1400px 700px at 18% -220px, rgba(223, 195, 127, 0.5), transparent 68%),
    radial-gradient(900px 520px at 92% 4%, rgba(207, 81, 52, 0.09), transparent 70%),
    var(--paper);
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--coral);
  text-underline-offset: 0.18em;
}

button,
a.cta {
  font: inherit;
}

:focus-visible {
  outline: 4px solid var(--coral);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 40;
  padding: 0.5rem 0.9rem;
  background: var(--cream);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* The paper's tooth. Multiplied over everything, including the dark bands. */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: 0.075;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

/* Typographic furniture, shared by every section and by 404.html. */
.kicker {
  margin: 0 0 0.5rem;
  color: var(--coral);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.whisper {
  margin: 0;
  max-width: 54ch;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 1.02rem;
}

.soon {
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
  padding: 0.38rem 0.9rem 0.38rem 0.7rem;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--lift-1);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 0 rgba(207, 81, 52, 0.5);
  animation: badge-ping var(--bar) ease-out infinite;
}

@keyframes badge-ping {
  0% { box-shadow: 0 0 0 0 rgba(207, 81, 52, 0.55); }
  30%, 100% { box-shadow: 0 0 0 9px rgba(207, 81, 52, 0); }
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.7rem max(var(--gutter), var(--safe-right)) 0.7rem max(var(--gutter), var(--safe-left));
  padding-top: calc(0.7rem + var(--safe-top));
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 3px solid transparent;
  transition: background 200ms ease, border-color 200ms ease;
}

.site-header.is-stuck {
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom-color: var(--ink);
  box-shadow: 0 10px 24px rgba(36, 62, 53, 0.07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.85rem;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 rgba(36, 62, 53, 0.2);
  transition: transform 80ms linear;
}

/* The wordmark keeps the 120 BPM pulse market.js writes onto the root. */
html[data-beat="0"] .brand img {
  transform: scale(0.93);
}

.brand-name {
  display: block;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.brand-tag {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.nav-links a {
  padding: 0.45rem 0.8rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: rgba(207, 81, 52, 0.12);
  color: var(--coral);
}

.nav-cta {
  flex: 0 0 auto;
  padding: 0.55rem 1.05rem;
  background: var(--coral);
  color: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--coral-deep);
  transition: transform 90ms ease, box-shadow 90ms ease, background 150ms ease;
}

.nav-cta:hover,
.nav-cta:focus-visible {
  background: var(--coral-deep);
  color: var(--cream);
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--coral-deep);
}

/* ------------------------------------------------------------------ hero */

main {
  position: relative;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: clamp(1.2rem, 3vw, 2.6rem);
  align-items: center;
  width: min(var(--page), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.6rem) 0 clamp(3rem, 7vw, 5rem);
}

/* The key light, and the shelf the whole hero sits on. */
.hero-light {
  position: absolute;
  inset: -6rem 0 auto;
  height: 140%;
  pointer-events: none;
  background:
    radial-gradient(48% 52% at 34% 30%, rgba(255, 246, 222, 0.85), transparent 72%),
    radial-gradient(38% 44% at 72% 58%, rgba(223, 195, 127, 0.4), transparent 74%);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

/*
 * The title screen's sign (`MenuScene`): a timber board on two ropes, a painted brass
 * line inside its face, and the four tempo beads. market.js swings it the way the game
 * does — it drops in, swings itself quiet, and drifts — so it has no animation here.
 */
.sign {
  width: min(100%, 480px);
  margin-bottom: 1.5rem;
  transform-origin: 50% -40px;
  will-change: transform;
}

.ropes {
  display: flex;
  justify-content: space-between;
  padding: 0 18%;
  height: 40px;
}

.ropes span {
  width: 9px;
  border-radius: 8px;
  background: linear-gradient(90deg, #8a6240, var(--rope) 40%, #4a301c);
  box-shadow: 2px 0 0 rgba(0, 0, 0, 0.12);
}

.board {
  position: relative;
  padding: 1.35rem 1.3rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.18), transparent 40%),
    repeating-linear-gradient(0deg, rgba(147, 101, 66, 0.1) 0 2px, transparent 2px 23px),
    var(--wood);
  border: 4px solid #57371d;
  border-radius: 1.2rem;
  /* The slab's side wall under its face, then the cast shadow off the one light. */
  box-shadow: 0 14px 0 #9c6334, 7px 26px 0 rgba(26, 20, 16, 0.14), 0 30px 46px rgba(36, 62, 53, 0.16);
}

/* The painted frame a hero panel carries inside its face (`drawPanel`, hero). */
.board::before {
  content: "";
  position: absolute;
  inset: 0.45rem;
  border: 2px solid rgba(212, 165, 74, 0.6);
  border-radius: 0.8rem;
  pointer-events: none;
}

.board h1 {
  margin: 0;
  color: var(--cream);
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(2.7rem, 8.5vw, 4.6rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-align: center;
  /* Cream on timber carries the ink outline and drops dark, as `ui/type.ts` dresses it. */
  -webkit-text-stroke: 0.15em #1c3029;
  paint-order: stroke fill;
  text-shadow: 0 0.07em 0 #1b2f28;
}

.beads {
  display: flex;
  justify-content: center;
  gap: 1.35rem;
  margin-top: 1rem;
}

/* A bead is a small solid: an edge under it, a face, and a catch of light. */
.bead {
  position: relative;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #a3683a;
  box-shadow: 0 2.5px 0 #77492b;
  transition: none;
}

.bead::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 1.5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 244, 220, 0.55);
}

.bead.lit {
  background: var(--coral);
  box-shadow: 0 2.5px 0 #72291a;
}

.lede {
  margin: 0 0 0.75rem;
  max-width: 24ch;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0 0 1.6rem;
  max-width: 48ch;
  color: var(--text-dim);
  font-weight: 600;
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.3rem;
  padding: 0.7rem 1.45rem;
  border: 4px solid var(--ink);
  border-radius: 1.05rem;
  background: var(--coral);
  color: var(--cream);
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 7px 0 rgba(36, 62, 53, 0.28);
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.cta:hover,
.cta:focus-visible {
  color: var(--cream);
  transform: translateY(3px);
  box-shadow: 0 4px 0 rgba(36, 62, 53, 0.28);
}

.cta:active {
  transform: translateY(6px);
  box-shadow: 0 1px 0 rgba(36, 62, 53, 0.28);
}

.cta.ghost {
  background: var(--cream);
  color: var(--ink);
}

.cta.ghost:hover,
.cta.ghost:focus-visible {
  color: var(--ink);
  background: var(--puck);
}

.cta .play-glyph {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent var(--cream);
}

/* The four numbers worth knowing before anything is read. */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0;
  margin: 1.9rem 0 0;
  padding: 0;
  list-style: none;
}

.stat-strip li {
  padding: 0 clamp(0.7rem, 2vw, 1.15rem);
  border-left: 3px solid var(--rule);
}

.stat-strip li:first-child {
  padding-left: 0;
  border-left: 0;
}

.stat-strip b {
  display: block;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.stat-strip b i {
  font-style: normal;
  font-size: 0.62em;
  color: var(--text-dim);
}

.stat-strip span {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* The Better Launch listing badge: their artwork at its own size, under the numbers. */
.launch-badge {
  margin: 1.6rem 0 0;
}

.launch-badge a {
  display: inline-block;
  border-radius: 0.6rem;
}

.launch-badge img {
  width: 200px;
  height: 56px;
}

/* ----------------------------------------------------------- hero device */

.phone-wrap {
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.phone {
  position: relative;
  width: min(100%, 320px);
  padding: 12px 10px 14px;
  background: linear-gradient(160deg, #2d4039, #17241f 60%);
  border: 5px solid var(--ink);
  border-radius: 2.4rem;
  box-shadow:
    0 18px 0 rgba(36, 62, 53, 0.16),
    0 40px 60px rgba(36, 62, 53, 0.2);
  transform: rotate(-2.5deg);
}

.phone::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 64px;
  height: 8px;
  border-radius: 999px;
  background: #101a16;
  transform: translateX(-50%);
  z-index: 2;
}

.phone-shadow {
  position: absolute;
  left: 50%;
  bottom: -46px;
  width: 78%;
  height: 34px;
  border-radius: 50%;
  background: rgba(36, 62, 53, 0.16);
  filter: blur(9px);
  transform: translateX(-50%);
}

/*
 * The screen is level 1 recorded from the game (scripts/capture-acts.mjs) at the
 * 390x844 handset the game is laid out for, so its aspect is that handset's.
 */
.screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 390 / 844;
  border-radius: 1.75rem;
  background: var(--paper) url("./acts/screen.jpg") center / cover no-repeat;
}

.screen-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -------------------------------------------------------------- sections */

.section {
  width: min(var(--page), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 4rem) 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
}

.section h2 {
  margin: 0;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.015em;
}

/*
 * A band re-points the surface tokens rather than restating colours, so a card
 * dropped into one picks up the right ink without knowing where it landed.
 */
.band {
  position: relative;
  margin: clamp(2rem, 5vw, 3.5rem) 0;
}

.band-ink {
  --surface: #23382f;
  --surface-sunk: #1a2b24;
  --text: #f6eeda;
  --text-dim: #a8bdb1;
  --rule: rgba(246, 238, 218, 0.2);
  --outline: #16241e;
  --lift-1: 0 4px 0 rgba(10, 20, 16, 0.5);
  --lift-2: 0 7px 0 rgba(10, 20, 16, 0.5);
  color: var(--text);
  background:
    radial-gradient(70% 120% at 20% 0%, rgba(223, 195, 127, 0.16), transparent 60%),
    linear-gradient(180deg, #1d3029, #16251f);
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
}

.band-ink .kicker {
  color: var(--brass);
}

.band-coral {
  --text: #fff4dc;
  --text-dim: rgba(255, 244, 220, 0.82);
  color: var(--text);
  background:
    radial-gradient(60% 90% at 50% -10%, #e2694a, transparent 65%),
    linear-gradient(180deg, var(--coral), #b8462c);
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
}

.band-coral .kicker {
  color: var(--cream);
}

/* ------------------------------------------------------------- play card */

#play-a-beat .section-head {
  align-items: center;
  text-align: center;
}

#play-a-beat .whisper {
  margin-inline: auto;
}

/*
 * The card is the lower part of the game's screen — the act on its bench and the turn
 * block on the timber — drawn by stage.js on a canvas, with the tutorial's words beside it.
 */
.play-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(0.8rem, 2vw, 1.2rem);
  background: var(--cream);
  border: 5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-3);
}

.play-stage {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: var(--r-md);
  /* Without the script the canvas stays clear, and the game's own screen shows through it. */
  background: var(--paper) url("./acts/screen.jpg") center 92% / cover no-repeat;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.play-stage canvas {
  display: block;
  width: 100%;
  aspect-ratio: 720 / 880;
}

.play-side {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 0.4rem 0.4rem 0.6rem 0;
}

.coach {
  min-height: 6.6rem;
}

.coach-title {
  margin: 0 0 0.3rem;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.05;
}

.hint {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  font-size: 1rem;
}

.rows-key {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0.9rem 0 0;
  border-top: 3px solid var(--rule);
  list-style: none;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.rows-key li {
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
}

.rows-key b {
  color: var(--ink);
}

/* The two owner slots, as the block draws them: the hammer's on the shelf, yours on the face. */
.key-slot {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 1.4rem;
}

.key-slot.theirs {
  background-color: #7a4c2c;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -16 32 32'%3E%3Cg fill='%23fff4dc' transform='rotate(-36)'%3E%3Crect x='-8.9' y='-7' width='9.9' height='14' rx='2.5'/%3E%3Crect x='-2.4' y='-2.45' width='14' height='4.9' rx='2.45'/%3E%3C/g%3E%3C/svg%3E");
}

.key-slot.yours {
  background-color: #e3957f;
  box-shadow: inset 0 3px 0 rgba(90, 66, 48, 0.35), 0 0 0 2px rgba(207, 81, 52, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -16 32 32'%3E%3Cg fill='none' stroke='%23fff4dc' stroke-width='2.8'%3E%3Ccircle cx='0' cy='3.9' r='5.9' fill='%23fff4dc' stroke='none'/%3E%3Cpath d='M-8.1 -1.6A9.8 9.8 0 0 1 8.1 -1.5'/%3E%3Cpath d='M-11 -5.8A14.7 14.7 0 0 1 11 -5.8' opacity='.6'/%3E%3C/g%3E%3C/svg%3E");
}

.hud-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
}

/* Identity is the dot; the number keeps the page's ink so it stays readable. */
.counts {
  display: flex;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.counts span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(36, 62, 53, 0.07);
  color: var(--muted);
}

.counts span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid rgba(36, 62, 53, 0.45);
}

.counts .p::before { background: var(--perfect); }
.counts .g::before { background: var(--brass); }
.counts .m::before { background: var(--miss); }

.counts b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.sound-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.3rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--puck);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(36, 62, 53, 0.18);
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.sound-toggle:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(36, 62, 53, 0.18);
}

/* One 24px box: the cone is a clipped silhouette, the wave the right half of a ring. */
.speaker {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 14px;
}

.speaker::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  height: 14px;
  background: var(--ink);
  clip-path: polygon(0 28%, 42% 28%, 100% 0, 100% 100%, 42% 72%, 0 72%);
}

.speaker::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  clip-path: inset(0 0 0 54%);
  transform: translateY(-50%);
}

.sound-toggle[aria-pressed="true"] {
  background: var(--shade);
  color: var(--muted);
}

.sound-toggle[aria-pressed="true"] .speaker::before {
  background: var(--muted);
}

.sound-toggle[aria-pressed="true"] .speaker::after {
  border-color: var(--muted);
}

.sound-toggle[aria-pressed="true"] .speaker::after {
  opacity: 0.25;
}

/* --------------------------------------------------------------- feature */

.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}

.feature {
  padding: 1.15rem 1.1rem 1.3rem;
  background: var(--cream);
  border: var(--edge) solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--lift-2);
  text-align: center;
}

.feature h3 {
  margin: 0.8rem 0 0.35rem;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

.feature .viz {
  height: 84px;
  display: grid;
  place-items: center;
}

/*
 * The four cards borrow the turn block's own pieces, and move on its beat: the shelf
 * lighting a bead per demonstrated beat, the baton pressed on "tap, tap, rest, tap",
 * a socket struck Perfect, and the road's token. One bar is 2 s at 120 BPM.
 */
.mini-shelf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7a4c2c 0 55%, #8f5b35 55%);
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.3), inset 0 -2px 0 rgba(255, 244, 220, 0.14);
}

.mini-shelf i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26);
  animation: shelf-bead var(--bar) steps(1, end) infinite;
}

.mini-shelf i:nth-child(3) { animation-name: shelf-bead-2; }
.mini-shelf i:nth-child(4) { animation-name: shelf-bead-3; }

.mini-shelf .slot {
  width: 34px;
  height: 34px;
  animation: none;
  background: rgba(0, 0, 0, 0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -16 32 32'%3E%3Cg fill='%23fff4dc' transform='rotate(-36)'%3E%3Crect x='-8.9' y='-7' width='9.9' height='14' rx='2.5'/%3E%3Crect x='-2.4' y='-2.45' width='14' height='4.9' rx='2.45'/%3E%3C/g%3E%3C/svg%3E") center / 20px no-repeat;
}

@keyframes shelf-bead {
  0% { background: var(--cream); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22); }
  88% { background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26); }
}

@keyframes shelf-bead-2 {
  0% { background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26); }
  25% { background: var(--cream); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22); }
  88% { background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26); }
}

@keyframes shelf-bead-3 {
  0% { background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26); }
  75% { background: var(--cream); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22); }
  88% { background: rgba(0, 0, 0, 0.32); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.26); }
}

/* The baton, carrying the player's glyph, pressed on the pattern and ringing as it lands. */
.mini-baton {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -16 32 32'%3E%3Cg fill='none' stroke='%23fff4dc' stroke-width='2.8'%3E%3Ccircle cx='0' cy='3.9' r='5.9' fill='%23fff4dc' stroke='none'/%3E%3Cpath d='M-8.1 -1.6A9.8 9.8 0 0 1 8.1 -1.5'/%3E%3Cpath d='M-11 -5.8A14.7 14.7 0 0 1 11 -5.8' opacity='.6'/%3E%3C/g%3E%3C/svg%3E") center / 26px no-repeat;
  box-shadow: 0 3px 0 #7c3b2c, 0 0 0 10px rgba(207, 81, 52, 0.12);
  animation: baton-press var(--bar) linear infinite;
}

.mini-baton::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 4px solid var(--coral);
  border-radius: 50%;
  opacity: 0;
  animation: baton-ring var(--bar) linear infinite;
}

/* Presses on beats 1, 2 and 4: a squash that is wider than tall for an instant. */
@keyframes baton-press {
  0%, 9%, 25%, 34%, 75%, 84%, 100% { transform: none; }
  3%, 28%, 78% { transform: scale(1.18, 0.8); }
}

@keyframes baton-ring {
  0% { opacity: 0.7; transform: scale(1); }
  22% { opacity: 0; transform: scale(2.3); }
  25% { opacity: 0.7; transform: scale(1); }
  47% { opacity: 0; transform: scale(2.3); }
  75% { opacity: 0.7; transform: scale(1); }
  97% { opacity: 0; transform: scale(2.3); }
  100% { opacity: 0; }
}

/* A socket struck Perfect: the terracotta ring, a cream disc, and the glint off it. */
.mini-socket {
  position: relative;
  width: 50px;
  height: 50px;
  border: 5px solid #8f3620;
  border-radius: 50%;
  background: #cf8a78;
  box-shadow: inset 0 3px 0 rgba(90, 66, 48, 0.3);
}

.mini-socket i {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 2px 0 rgba(36, 62, 53, 0.35);
  animation: socket-strike var(--bar) linear infinite;
}

.mini-socket::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 5px solid #ffe7a0;
  border-radius: 50%;
  opacity: 0;
  animation: socket-glint var(--bar) linear infinite;
}

@keyframes socket-strike {
  0%, 10% { transform: scale(0); }
  12% { transform: scale(1.45); }
  20%, 90% { transform: scale(1); }
  100% { transform: scale(0); }
}

@keyframes socket-glint {
  0%, 11% { opacity: 0; transform: scale(1); }
  12% { opacity: 0.85; transform: scale(1); }
  32% { opacity: 0; transform: scale(2.2); }
  100% { opacity: 0; }
}

.path-loop {
  width: 86%;
  height: 12px;
  border-radius: 999px;
  background: #cbd8ba;
  border: 3px solid rgba(36, 62, 53, 0.2);
  position: relative;
}

.path-loop::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid var(--ink);
  animation: travel calc(var(--bar) * 2) linear infinite;
}

@keyframes travel {
  from { left: -14px; }
  to { left: 100%; }
}

/* ---------------------------------------------------------------- ticker */

.ticker {
  overflow: hidden;
  background: linear-gradient(180deg, #1d3029, #16251f);
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
}

.ticker-track {
  display: flex;
  width: max-content;
  /* Twenty-eight names at the pace twenty had over 40 s. */
  animation: ticker 56s linear infinite;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.1rem;
  white-space: nowrap;
  color: #f6eeda;
}

.ticker-track span {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.75rem 0 0.75rem 1.1rem;
}

.ticker-track span::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
  opacity: 0.6;
}

.ticker-track span:nth-child(odd) { color: #f0a48c; }

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ------------------------------------------------------------------ acts */

.acts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.7rem, 1.6vw, 1rem);
}

.act {
  overflow: hidden;
  background: var(--cream);
  border: var(--edge) solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--lift-2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.act:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 0 rgba(36, 62, 53, 0.2), 0 22px 34px rgba(36, 62, 53, 0.14);
}

.act h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.6rem 0.7rem 0.7rem;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 0.98rem;
  font-weight: 500;
}

.act h3 b {
  flex: 0 0 auto;
  padding: 0.1rem 0.4rem;
  border-radius: 0.45rem;
  background: rgba(36, 62, 53, 0.09);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/*
 * Each tile is its act recorded from the game: one whole task at 120 BPM, from the
 * demonstration's downbeat to the next task's, so the loop has no seam. The poster is the
 * first contact, which is what shows before a tile scrolls in and under reduced motion.
 */
.clip {
  position: relative;
  aspect-ratio: 432 / 532;
  overflow: hidden;
  background: var(--paper);
  border-bottom: var(--edge) solid var(--ink);
}

.clip video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ----------------------------------------------------- windows and climb */

.heads {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr 1fr;
  gap: clamp(0.8rem, 2vw, 1.1rem);
  align-items: stretch;
}

.head-card {
  padding: 1.25rem 1.2rem 1.3rem;
  background: var(--surface);
  border: var(--edge) solid var(--outline);
  border-radius: var(--r-md);
  box-shadow: var(--lift-2);
}

.head-card h3 {
  margin: 0 0 1rem;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
}

.head-card .note {
  margin: 1rem 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
}

/*
 * The judge, on one axis: early on the left, late on the right, the target in
 * the middle, and the two windows drawn to scale against each other.
 */
.ruler {
  position: relative;
  height: 118px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  border: 3px solid var(--outline);
  overflow: hidden;
}

.ruler .w-good,
.ruler .w-perfect {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 4px;
}

.ruler .w-good {
  width: 60%;
  background: rgba(224, 179, 74, 0.22);
  border-left: 2px dashed rgba(224, 179, 74, 0.7);
  border-right: 2px dashed rgba(224, 179, 74, 0.7);
}

.ruler .w-perfect {
  width: 25.4%;
  background: rgba(47, 158, 106, 0.3);
  border-left: 2px solid rgba(72, 196, 137, 0.85);
  border-right: 2px solid rgba(72, 196, 137, 0.85);
}

.ruler .target {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: var(--text);
  opacity: 0.85;
}

.ruler .tick {
  position: absolute;
  bottom: 6px;
  color: var(--text-dim);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ruler .tick.early { left: 10px; }
.ruler .tick.late { right: 10px; }

/* Three taps, placed where they landed. */
.ruler .tap {
  position: absolute;
  top: 34px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  border: 3px solid var(--outline);
}

.ruler .tap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 34px;
  margin-left: -1px;
  background: currentColor;
  opacity: 0.45;
}

.ruler .t1 { left: 46%; background: var(--perfect); color: var(--perfect); }
.ruler .t2 { left: 63%; top: 58px; background: var(--brass); color: var(--brass); }
.ruler .t2::after { height: 10px; }
.ruler .t3 { left: 9%; top: 20px; background: var(--miss); color: var(--miss); }
.ruler .t3::after { height: 48px; }

.legend {
  display: grid;
  gap: 0.4rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.legend b {
  margin-left: auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--outline);
}

.legend .swatch.perfect { background: var(--perfect); }
.legend .swatch.good { background: var(--brass); }
.legend .swatch.miss { background: var(--miss); }

/* The climb. */
.tempo {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 160px;
}

.dial {
  position: relative;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  border: 5px solid var(--outline);
  background: conic-gradient(from 214deg, var(--coral) 0 92deg, var(--brass) 92deg 132deg, rgba(120, 120, 120, 0.22) 132deg 360deg);
  box-shadow: var(--lift-1);
}

.dial::after {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--outline);
}

.dial .needle {
  position: absolute;
  left: 50%;
  bottom: 50%;
  z-index: 1;
  width: 5px;
  height: 58px;
  margin-left: -2.5px;
  border-radius: 3px;
  background: var(--coral);
  transform-origin: 50% 100%;
  animation: needle-climb calc(var(--bar) * 4) linear infinite;
}

/* No hub: at the dial's centre it collided with the reading printed there. */
.dial .needle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--coral);
}

/*
 * The tempo steps up task by task rather than gliding, so the needle notches up on each
 * bar line with a spring's overshoot, and drops back to 120 where the next level opens.
 */
@keyframes needle-climb {
  0%, 22% { transform: rotate(-58deg); }
  25% { transform: rotate(-19deg); }
  28%, 47% { transform: rotate(-25deg); }
  50% { transform: rotate(14deg); }
  53%, 72% { transform: rotate(8deg); }
  75% { transform: rotate(48deg); }
  78%, 96% { transform: rotate(42deg); }
  100% { transform: rotate(-58deg); }
}

.bpm {
  position: absolute;
  inset: 0;
  padding: 0 1.4rem;
  display: grid;
  grid-auto-flow: column;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
  z-index: 2;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  font-weight: 600;
  pointer-events: none;
}

.bpm i {
  font-style: normal;
  color: var(--text-dim);
}

/* The grid the patterns are drawn on. */
.grid-viz {
  display: grid;
  gap: 0.55rem;
}

.grid-row {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
}

.grid-row .lab {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid-row .cells {
  display: grid;
  gap: 3px;
  height: 22px;
}

.cells.q, .cells.e, .cells.s { grid-template-columns: repeat(16, minmax(0, 1fr)); }
.cells.t { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.cells i {
  border-radius: 3px;
  background: rgba(168, 189, 177, 0.18);
}

.cells i.on {
  background: var(--brass);
  box-shadow: 0 0 0 1px rgba(20, 34, 28, 0.35);
}

.cells i:first-child.on {
  background: var(--coral-lit);
}

/* -------------------------------------------------------------- the road */

.road {
  position: relative;
  overflow: hidden;
  height: clamp(200px, 26vw, 250px);
  border: var(--edge) solid var(--ink);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #d8e6c2, #bfd0a2 52%, #cdbd97);
  box-shadow: var(--lift-2);
}

.road-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.road-bed {
  fill: none;
  stroke: #e2d2ab;
  stroke-width: 30;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.road-dash {
  fill: none;
  stroke: rgba(255, 244, 220, 0.9);
  stroke-width: 4;
  stroke-dasharray: 16 20;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  animation: dash-run var(--bar) linear infinite;
}

@keyframes dash-run {
  to { stroke-dashoffset: -36; }
}

.road-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hill {
  position: absolute;
  bottom: 44%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #a9c08c;
  opacity: 0.75;
}

.hill.h1 { left: 4%; width: 26%; height: 26%; }
.hill.h2 { left: 38%; width: 34%; height: 34%; background: #9bb480; }
.hill.h3 { right: 2%; width: 24%; height: 22%; }

.tree {
  position: absolute;
  width: 16px;
  height: 26px;
  border-radius: 50% 50% 40% 40%;
  background: #5b8f5e;
  box-shadow: 0 3px 0 rgba(36, 62, 53, 0.2);
}

.tree::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  background: #6b4a2e;
}

.tree.t1 { left: 8%; top: 22%; }
.tree.t2 { left: 30%; top: 62%; }
.tree.t3 { left: 62%; top: 20%; }
.tree.t4 { left: 88%; top: 66%; }

.road-nodes {
  position: absolute;
  inset: 0;
}

.rnode {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: #eef0e2;
  border: 3px solid #9aa596;
  box-shadow: 0 4px 0 rgba(36, 62, 53, 0.22);
  color: #6f7a6c;
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.rnode b {
  font-weight: inherit;
}

/* The map's pucks: finished levels in the ink, numbered in cream. */
.rnode.done {
  background: var(--ink);
  border-color: #3d5a4f;
  color: var(--cream);
  box-shadow: 0 4px 0 #15241e;
}

/* One coral marker, the way the map has one, with its ring going out on the beat. */
.rnode.now {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: var(--coral);
  border: 4px solid #e9876e;
  color: var(--cream);
  font-size: 1rem;
  box-shadow: 0 5px 0 #8f3620, 0 0 0 0 rgba(207, 81, 52, 0.4);
  animation: node-ping var(--bar) ease-out infinite;
}

@keyframes node-ping {
  0% { box-shadow: 0 5px 0 #8f3620, 0 0 0 0 rgba(207, 81, 52, 0.45); }
  40%, 100% { box-shadow: 0 5px 0 #8f3620, 0 0 0 16px rgba(207, 81, 52, 0); }
}

/* A level not yet open carries a small padlock badge under its puck. */
.rnode.lock::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  width: 13px;
  height: 11px;
  margin-left: -6.5px;
  border-radius: 3px;
  background: var(--ink);
  box-shadow: inset 0 0 0 3.5px var(--ink), inset 0 0 0 5px rgba(255, 244, 220, 0.75);
}

.rnode.lock::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 1px);
  width: 7px;
  height: 7px;
  margin-left: -5.5px;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.rnode.far {
  opacity: 0.5;
}

.road-flag {
  position: absolute;
  padding: 0.25rem 0.6rem;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(36, 62, 53, 0.2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.road-flag.area-1 { left: 5%; bottom: 10%; }
.road-flag.area-2 { right: 6%; top: 12%; }

.road-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.road-facts b {
  font-family: Fredoka, system-ui, sans-serif;
  font-size: 1.15rem;
  color: var(--ink);
}

/* ---------------------------------------------------- finale and footer */

/* 404.html carries both classes on one element, so match either shape. */
.finale,
.finale .section {
  text-align: center;
  padding-top: clamp(2.6rem, 6vw, 4rem);
  padding-bottom: clamp(2.6rem, 6vw, 4rem);
}

.plaque {
  --surface: var(--cream);
  --text: var(--ink);
  --text-dim: var(--muted);
  --rule: rgba(36, 62, 53, 0.16);
  position: relative;
  display: inline-block;
  max-width: 32rem;
  margin-top: 2.2rem;
  padding: 1.6rem 1.8rem 1.5rem;
  background: var(--cream);
  border: 5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 0 rgba(36, 62, 53, 0.24), 0 30px 50px rgba(36, 62, 53, 0.2);
  color: var(--text);
  transform-origin: 50% -34px;
}

/* Waiting to be seen: market.js swings it in and seats the medals when it is. */
.plaque.is-waiting {
  opacity: 0;
}

.plaque.is-waiting .star {
  opacity: 0;
}

/* The ropes hang above the plaque, the way the title hangs in the game. */
.plaque .ropes {
  position: absolute;
  left: 16%;
  right: 16%;
  top: -34px;
  height: 34px;
  margin: 0;
  padding: 0;
}

.plaque h2 {
  margin: 0 0 0.5rem;
}

.plaque .whisper {
  margin: 0 auto 1.3rem;
  color: var(--muted);
}

.plaque .soon {
  margin: 0.9rem 0 0;
}

.plaque .kicker {
  margin-bottom: 0.3rem;
}

.stars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.7rem;
  margin: 0 0 0.9rem;
}

.star {
  width: 44px;
  height: 44px;
  background: #e0b34a;
  clip-path: polygon(50% 2%, 63% 35%, 98% 38%, 71% 60%, 79% 96%, 50% 76%, 21% 96%, 29% 60%, 2% 38%, 37% 35%);
  filter: drop-shadow(0 3px 0 rgba(122, 82, 20, 0.55));
  will-change: transform;
}

/* The middle medal is the larger one, seated a little higher, as the result tray has it. */
.star:nth-child(2) {
  width: 54px;
  height: 54px;
  margin-top: -8px;
}

.site-footer {
  border-top: 3px solid var(--rule);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.6rem;
  width: min(var(--page), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: 2rem 0 calc(2.4rem + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.footer-brand img {
  border-radius: 0.8rem;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(36, 62, 53, 0.18);
}

.footer-brand p {
  margin: 0.3rem 0 0;
  max-width: 28ch;
}

.footer-brand .credit {
  margin-top: 0.55rem;
}

.footer-brand .brand-name {
  color: var(--ink);
  font-size: 1.05rem;
}

.foot-head {
  margin: 0 0 0.5rem;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-footer nav,
.footer-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.site-footer a {
  color: var(--muted);
  font-weight: 700;
  text-decoration-color: rgba(78, 90, 82, 0.4);
}

.site-footer a:hover {
  color: var(--coral);
}

.footer-contact .copy {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  opacity: 0.8;
}

/* ----------------------------------------------------- reveal on scroll */

/*
 * Only hide what will be revealed if the script that reveals it is running,
 * so a blocked or failed market.js leaves the page readable rather than blank.
 */
html.js .reveal {
  opacity: 0;
  transform: translateY(20px);
}

html.js .reveal.in {
  opacity: 1;
  transform: none;
  /* The game's `arrive`: up from below with a small overshoot, the fade ahead of the rise. */
  transition: opacity 280ms ease-out, transform 450ms cubic-bezier(0.34, 1.32, 0.64, 1);
  transition-delay: var(--stagger, 0ms);
}

/* A printed page has no scroll to reveal anything on. */
@media print {
  html.js .reveal,
  .plaque.is-waiting,
  .plaque.is-waiting .star {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .heads {
    grid-template-columns: 1fr 1fr;
  }

  .head-card.wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  /*
   * The columns stack, but they must still stretch: a shrink-to-fit track
   * collapses the handset, whose width is a percentage of the track it is in.
   */
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: clamp(3.5rem, 9vw, 5rem);
  }

  .phone-wrap {
    margin-top: 1.6rem;
  }

  /* A whole handset screen is tall; on a handset it would be most of a scroll. */
  .phone {
    width: min(72%, 270px);
  }

  .features,
  .acts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* The stage keeps a handset's width; the words go under it rather than beside it. */
  .play-card {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
  }

  .play-side {
    padding: 0 0.2rem 0.3rem;
  }

  .coach {
    min-height: 5.4rem;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 4.2rem;
  }

  /* The links stay reachable; they scroll instead of disappearing. */
  .site-header {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
  }

  .nav-links {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-cta {
    order: 2;
    margin-left: auto;
  }

  .hud-right {
    width: 100%;
    justify-content: space-between;
  }

  .heads,
  .grid-row {
    grid-template-columns: 1fr;
  }

  .grid-row .lab {
    margin-bottom: -0.2rem;
  }

  /* The road compresses but the markers do not, so they are scaled down too. */
  .rnode {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-width: 2px;
    font-size: 0.62rem;
  }

  .rnode.now {
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border-width: 3px;
    font-size: 0.8rem;
  }

  .rnode.lock::before,
  .rnode.lock::after {
    display: none;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 460px) {
  .features {
    grid-template-columns: 1fr;
  }

  .stat-strip li {
    padding: 0 0.7rem;
  }

  .counts {
    font-size: 0.76rem;
  }

  .sound-word {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html.js .reveal {
    opacity: 1;
    transform: none;
  }

  .sign,
  .plaque,
  .phone,
  .dial {
    transform: none;
  }
}
