/*!
 * LC11 — Bundle of Ten (Wondermaths)
 * Sunny Savanna: cream / honey / wood, navy readable text.
 * Wooden controls + rune are reused from the shared Wondermaths UI kit when present.
 */

/* Delivery ships no webfont: system fonts only (see optimization/PHASE2.md). */
/* ---------------------------------------------------------------- tokens */
:root {
  --navy: #174A7E;
  --navy-soft: #2C6499;
  --cream: #FBF3E3;
  --cream-deep: #F3E4C6;
  --honey: #E8A33D;
  --honey-deep: #C57F22;
  --wood: #B07C43;
  --wood-deep: #8A5A2B;
  --wood-dark: #63401D;
  --ok: #16A34A;          /* the only vivid green in the whole interface */
  --ok-deep: #0E7A36;
  --paper: rgba(255, 250, 240, 0.94);

  --slot: clamp(48px, 9.6vmin, 92px);
  /* The board geometry below assumes the gap is a fixed share of the slot, so
     the ten-frame keeps the tray's cream proportions on every viewport. */
  --gap: calc(var(--slot) * .05);
  --pad: clamp(8px, 1.6vmin, 22px);
  --radius: clamp(8px, 1.4vmin, 18px);
  --ctrl: clamp(56px, 7.4vmin, 76px);
  --ease: cubic-bezier(.22,.61,.36,1);
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  color: var(--navy);
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* ------------------------------------------------------------ background */
.bg-layer { position: absolute; inset: 0; z-index: 0; }

.bg-layer picture { position: absolute; inset: 0; display: block; }

.bg-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  background:
    radial-gradient(120% 80% at 20% 10%, #FFF6E2 0%, rgba(255,246,226,0) 55%),
    linear-gradient(170deg, #F7E7C6 0%, #EED6A8 45%, #DEC08A 100%);
}

.bg-art[data-missing="1"] { opacity: 0; }

.bg-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255,250,238,.35) 0%, rgba(255,250,238,0) 60%),
    linear-gradient(180deg, rgba(255,248,232,.28) 0%, rgba(255,248,232,0) 30%, rgba(99,64,29,.20) 100%);
  pointer-events: none;
}

/* ----------------------------------------------------------------- rune */
.rune-badge {
  position: absolute;
  z-index: 60;
  bottom: max(var(--pad), env(safe-area-inset-bottom));
  left: max(var(--pad), env(safe-area-inset-left));
  width: clamp(44px, 5.4vmin, 62px);
  height: clamp(44px, 5.4vmin, 62px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(99,64,29,.35), 0 6px 14px rgba(99,64,29,.22);
  border: 2px solid rgba(138,90,43,.35);
  pointer-events: none;
}

.rune-img { width: 74%; height: 74%; object-fit: contain; }
.rune-img[data-missing="1"] { display: none; }
.rune-fallback { display: none; font-size: clamp(22px, 3vmin, 34px); color: var(--wood-deep); line-height: 1; }
.rune-img[data-missing="1"] + .rune-fallback { display: block; }

/* --------------------------------------------------------------- screens */
.screen { position: absolute; inset: 0; }
.opening { display: none; }
.stage { display: none; }

.app[data-screen="opening"] .opening { display: grid; }

.app[data-screen="demo"] .stage,
.app[data-screen="playing"] .stage,
.app[data-screen="resolving"] .stage,
.app[data-screen="reward"] .stage,
.app[data-screen="paused"] .stage,
.app[data-screen="help"] .stage { display: grid; }

/* ------------------------------------------------------------- opening */
.opening {
  z-index: 10;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-items: start;
  padding:
    max(clamp(10px, 2.6vh, 36px), env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    max(var(--pad), env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
  pointer-events: none;
}

.opening-title {
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 7.6vmin, 78px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.01em;
  color: #123C6B;
  text-shadow: 0 2px 0 rgba(255,255,255,.7), 0 10px 26px rgba(255,255,255,.55);
}

.opening .btn-start { pointer-events: auto; align-self: end; margin-bottom: clamp(14px, 9vh, 110px); }

/* ---------------------------------------------------------------- stage */
.stage {
  z-index: 10;
  /* The stage column must never be widened by its widest row: on a phone the
     level 5 action row (ten-frame + tie + OK) used to stretch the whole stage
     past the viewport. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(4px, 1vmin, 12px);
  padding:
    max(6px, env(safe-area-inset-top))
    max(6px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));
}

/* The play stage uses the approved Savanna world background (no baked-in
   characters); the dedicated opening art stays behind the opening screen. */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("assets/backgrounds/bg-sawanna-landscape.webp") center / cover no-repeat;
}

@media (orientation: portrait) {
  .stage::before { background-image: url("assets/backgrounds/bg-sawanna-portrait.webp"); }
}

/* ------------------------------------------------------------------ hud */
.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "props chips"
    "prompt prompt"
    "controls controls";
  gap: clamp(3px, .8vmin, 10px);
  align-items: flex-start;
}

.level-props {
  grid-area: props;
  align-self: center;
  justify-self: start;
  display: flex;
  gap: clamp(4px, .9vmin, 10px);
  align-items: center;
  padding: clamp(4px, .8vmin, 8px) clamp(6px, 1.1vmin, 12px);
  border-radius: 999px;
  background: rgba(255,250,240,.82);
  border: 2px solid rgba(138,90,43,.28);
  box-shadow: 0 3px 0 rgba(99,64,29,.20);
}

.prop {
  position: relative;
  width: clamp(30px, 3.8vmin, 46px);
  height: clamp(30px, 3.8vmin, 46px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(13px, 1.8vmin, 20px);
  font-weight: 700;
  color: var(--wood-deep);
  background:
    linear-gradient(180deg, #F0D9AE 0%, #DCBB84 60%, #C79C60 100%);
  border: 2px solid rgba(99,64,29,.35);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 2px 0 rgba(99,64,29,.28);
  filter: saturate(.5) brightness(.96);
  transition: transform .22s var(--ease), filter .22s var(--ease);
}

.prop img {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: contain;
  z-index: 0;
}

.prop-num { position: relative; z-index: 1; color: #5A3A12; text-shadow: 0 1px 0 rgba(255,255,255,.7); }
.prop img[data-missing="1"] { display: none; }

.prop[data-current="1"] {
  filter: none;
  transform: translateY(-3px) scale(1.08);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 0 0 3px rgba(232,163,61,.55), 0 4px 10px rgba(99,64,29,.3);
}

.prop[data-earned="1"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px solid var(--honey);
  box-shadow: 0 0 10px rgba(232,163,61,.75);
}

.chips { grid-area: chips; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

/* Visible, short task prompt: what exactly this task asks for. */
.task-prompt {
  grid-area: prompt;
  justify-self: center;
  margin: 0;
  max-width: min(94vw, 760px);
  text-align: center;
  font-size: clamp(12px, 1.9vmin, 20px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy);
  background: rgba(255,250,240,.92);
  border: 2px solid rgba(138,90,43,.32);
  border-radius: 999px;
  padding: clamp(3px, .55vmin, 7px) clamp(12px, 1.8vmin, 22px);
  box-shadow: 0 2px 0 rgba(99,64,29,.16);
}

/* The little picture goal beside the sentence: the real ten, loose, or the
   same ten with the cord when the wanted level-5 shape is a bundle. It is a
   picture, never a target — non-interactive and hidden from screen readers,
   because the sentence beside it already says the same thing in words. */
.prompt-goal {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-right: .55em;
  vertical-align: middle;
  pointer-events: none;
}

/* The ten real sprites sit in one row of their own. The packed shape ties that
   very same row with two horizontal cord passes — never an eleventh rod — and
   the rods are big enough to name the ten on a small phone: roughly 100px of
   row at a readable ~28px height. */
.prompt-goal .goal-rods {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
}

.prompt-goal .goal-stem {
  width: clamp(9px, 1.15vmin, 13px);
  height: clamp(28px, 3.4vmin, 40px);
  object-fit: contain;
}

.prompt-goal .goal-stem[data-missing="1"] {
  display: block;
  border-radius: 999px;
  border: 1px dashed rgba(99,64,29,.5);
  background: rgba(255,255,255,.6);
}

.prompt-goal .goal-cord {
  position: absolute;
  left: -3px;
  right: -3px;
  top: 22%;
  bottom: 28%;
  border-top: 2px solid var(--wood-deep);
  border-bottom: 2px solid var(--wood-deep);
  border-radius: 2px;
}

.prompt-goal .goal-cap {
  margin-left: 3px;
  font-size: clamp(9px, 1.3vmin, 14px);
  font-weight: 800;
  color: var(--wood-deep);
}

.chip {
  padding: clamp(4px, .8vmin, 8px) clamp(8px, 1.4vmin, 16px);
  border-radius: 999px;
  background: rgba(255,250,240,.9);
  border: 2px solid rgba(138,90,43,.3);
  font-size: clamp(11px, 1.6vmin, 17px);
  font-weight: 700;
  white-space: nowrap;
  color: var(--navy);
}

.chip-stars { display: flex; align-items: center; gap: .26em; }

.star-img {
  width: clamp(18px, 2.6vmin, 28px);
  height: clamp(18px, 2.6vmin, 28px);
  object-fit: contain;
}

.star-img[data-earned="0"] { filter: saturate(.2) brightness(1.06); opacity: .5; }

/* --------------------------------------------------------- controls row */
.controls {
  grid-area: controls;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(4px, 1vmin, 12px);
  align-items: flex-start;
}

.ctrl {
  min-width: var(--ctrl);
  min-height: var(--ctrl);
  width: var(--ctrl);
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 1px;
  padding: 0;
  border: 0;
  color: var(--navy);
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  transition: transform .12s var(--ease), filter .12s var(--ease);
}

.ctrl-art {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, #F0CE93 0%, #D9A963 52%, #B07C43 100%);
  box-shadow: 0 3px 0 rgba(99,64,29,.45), 0 6px 12px rgba(99,64,29,.32);
  user-select: none;
  -webkit-user-drag: none;
}

.ctrl-art[data-missing="1"] { opacity: .96; }

.ctrl:active { transform: translateY(3px); }
.ctrl:active .ctrl-art { box-shadow: 0 1px 0 rgba(99,64,29,.45); }
.ctrl:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
.ctrl[aria-pressed="false"] .ctrl-art { filter: saturate(.35) brightness(.9); }

.ctrl-lbl {
  font-size: clamp(9px, 1.15vmin, 12px);
  letter-spacing: .02em;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,250,240,.82);
  border: 1px solid rgba(138,90,43,.3);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- scene */
.scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(64px, .78fr) minmax(0, 3.3fr) minmax(120px, 1.45fr);
  align-items: center;
  gap: clamp(4px, 1.2vmin, 16px);
  min-height: 0;
  padding: 0 clamp(4px, 1.2vmin, 18px);
}

.actor { display: block; }
.actor-img { width: 100%; height: auto; max-height: 46vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }

/* The three native loops sit in exactly the same box as the still art they
   stand in for: the canonical still is the poster and the fallback, and only
   one of the two is ever on screen, so no character is ever doubled. */
.actor-loop { display: none; }
.has-loop .actor-loop { display: block; }
.has-loop .actor-img:not(.actor-loop) { display: none; }

.reward-loop { display: none; }
.has-loop .reward-loop { display: block; }
.has-loop .reward-img:not(.reward-loop) { display: none; }

.actor-elephant { grid-column: 1; align-self: end; justify-self: center; max-width: 100%; }
.actor-elephant .actor-img { max-height: clamp(110px, 34vh, 320px); }

.actor-plate {
  display: none;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 2px solid rgba(138,90,43,.3);
  font-size: clamp(10px, 1.3vmin, 14px);
  font-weight: 700;
  text-align: center;
  color: var(--wood-deep);
}

.actor-elephant .actor-img[data-missing="1"] + .actor-plate { display: block; }

.supply-col {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(2px, .8vmin, 10px);
  min-width: 0;
}

.actor-rhino .actor-img { max-height: clamp(80px, 24vh, 240px); }

/* ------------------------------------------------------------ work mat */
/* One board geometry: the trimmed tray bitmap IS the board, and the 5x2
   ten-frame is sized from --slot so it always lands on the tray's cream
   surface (73.12% x 65.57% of the bitmap, centred). */
.mat-wrap {
  grid-column: 2;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  border-radius: calc(var(--radius) * 1.4);
}

.mat-board {
  position: relative;
  width: calc((5 * var(--slot) + 4 * var(--gap)) / 0.7312);
  height: calc((2 * var(--slot) + var(--gap)) / 0.6557);
}

.mat-tray {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.tray-img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

/* Without the bitmap the board is still a clear cream working surface. */
.tray-img[data-missing="1"] {
  display: block;
  border: 3px solid rgba(99,64,29,.42);
  border-radius: calc(var(--radius) * 1.4);
  background: linear-gradient(180deg, #FBF3E3 0%, #EFDFC0 100%);
  box-shadow: 0 6px 14px rgba(99,64,29,.24);
}

/* Every representation lives on the same cream surface. */
.mat-frame, .mat-free, .mat-bundle {
  position: absolute;
  z-index: 2;
  left: 13.74%;
  top: 17.37%;
  width: 73.12%;
  height: 65.57%;
}

.mat-frame {
  display: grid;
  /* Bounded tracks, exactly one slot each. A bare 1fr takes its automatic
     minimum from the slot's content — the 48px stem plus its 4px dashed border
     — so every track grew 4px past its share and pushed the whole ten about
     11px right of the tray's cream centre. minmax(0, --slot) keeps each track a
     full 48px tap target and never wider than the ten-frame itself. */
  grid-template-columns: repeat(5, minmax(0, var(--slot)));
  grid-template-rows: repeat(2, minmax(0, var(--slot)));
  gap: var(--gap);
}

.slot {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: calc(var(--radius) * .8);
  border: 2px dashed rgba(99,64,29,.42);
  background: rgba(255,250,238,.26);
  box-shadow: inset 0 2px 6px rgba(99,64,29,.14);
}

.slot:has(.stem) { border-color: transparent; background: transparent; box-shadow: none; }

.mat-free {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: clamp(1px, .4vmin, 6px);
}

.mat-free .stem { transform: rotate(var(--rot, 0deg)) translateY(var(--dy, 0px)); }

/* Rods 11 and 12 do not fit the ten-frame: they wait in a strip that is
   still on screen, still tappable, and never hidden behind the frame. */
.mat-board.is-overflow .mat-free {
  left: 0;
  top: 100%;
  width: 100%;
  height: auto;
  padding-top: 4px;
}

/* More than ten rods on the mat: the ten-frame cannot hold them and wrapping
   them inside the two-row cream pushed the last rows off the tray. They take
   the whole tray bitmap instead — six to a row at every slot size, three rows
   at most, every rod still a full 48px tap target and still inside the
   bitmap. No rotation here: the hit centres must stay exactly countable. */
.mat-board.is-overfull .mat-free {
  display: grid;
  grid-template-columns: repeat(6, var(--slot));
  grid-auto-rows: var(--slot);
  align-content: center;
  justify-content: center;
  gap: var(--gap);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}

.mat-board.is-overfull .mat-free .stem { transform: none; }

/* ------------------------------------------------------------- the stem */
.stem {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--slot);
  height: var(--slot);
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  transition: transform .16s var(--ease), filter .16s var(--ease);
  -webkit-user-drag: none;
}

.stem:focus-visible { outline: 3px solid var(--honey); outline-offset: -2px; border-radius: 10px; }
.stem.is-dragging { opacity: .38; }

/* Absolute positioning is what keeps every rod inside its own square: a
   percentage height on a grid item of an auto-sized row resolves to auto,
   which is what used to let the rods grow over the rows above them. */
.stem-img {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 92%;
  width: auto;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(90,60,20,.28));
  user-select: none;
  -webkit-user-drag: none;
}

/* static fallback while the raster stem prop is still being generated */
.stem-img[data-missing="1"] {
  display: block;
  width: 26%;
  height: 78%;
  border-radius: 999px;
  border: 2px dashed rgba(99,64,29,.55);
  background: linear-gradient(180deg, #E4C489 0%, #CBA463 100%);
  filter: none;
}

.mat-wrap[data-drop="1"] .mat-board { outline: 4px solid var(--honey); outline-offset: 3px; }
.supply-wrap[data-drop="1"] { box-shadow: inset 0 0 0 4px var(--honey); }

/* -------------------------------------------------------- grass supply */
.supply-wrap {
  width: 100%;
  max-width: 100%;
  padding: clamp(4px, 1vmin, 12px);
  border-radius: calc(var(--radius) * 1.2);
  background: linear-gradient(180deg, rgba(246,226,188,.78) 0%, rgba(232,203,150,.72) 100%);
  border: 3px solid rgba(99,64,29,.34);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 6px 14px rgba(99,64,29,.22);
}

.supply {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-end;
  gap: 2px;
  max-height: clamp(120px, 34vh, 320px);
  overflow: hidden;
}

.supply .stem {
  width: max(48px, calc(var(--slot) * .5));
  height: max(52px, calc(var(--slot) * .72));
  transform: rotate(var(--rot, 0deg));
}

.supply .stem-img { height: 80%; }

.supply { align-content: center; }

/* --------------------------------------------------------- bundle view */
/* The packed ten gathers the very same ten rods inside the cream surface. */
.mat-bundle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, .7vmin, 8px);
}

.bundle-stage { position: relative; display: grid; place-items: center; width: 100%; }

.bundle-row { display: flex; align-items: flex-end; justify-content: center; width: 100%; }

.bundle-row .stem {
  width: calc(var(--slot) * .62);
  /* Packed rods stay countable and keep a full 48px tap target; the negative
     margin pulls each rod over its neighbour so the ten of them end up exactly
     as wide as the cream (5.2 * --slot) and the cord can wrap them all. The
     first term is exact for the small slots, where a rod is pinned at its 48px
     minimum; the min() holds for the large slots as well. */
  min-width: 48px;
  height: calc(var(--slot) * .8);
  min-height: 48px;
  margin-left: min(0px, calc(var(--slot) * .578 - 53px), calc(var(--slot) * -0.1111));
}

.bundle-row .stem:first-child { margin-left: 0; }
.bundle-row .stem-img { height: 96%; }

/* The cord is painted by one stretched SVG, so it must take the stage box
   exactly. Pinned out of flow: as a grid item its percentage height could not
   resolve and the SVG fell back to its intrinsic 1:1 ratio, overflowing the
   stage and dropping both stripes below the rods. */
.cord { position: absolute; inset: 0; pointer-events: none; }
.cord svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.bundle-marks { display: flex; gap: clamp(1px, .4vmin, 5px); justify-content: center; }
.bundle-marks .mark { width: calc(var(--slot) * .13); height: calc(var(--slot) * .22); object-fit: contain; }
.bundle-marks .mark[data-missing="1"] {
  border-radius: 999px;
  border: 1.5px dashed rgba(99,64,29,.6);
  background: linear-gradient(180deg, #E4C489 0%, #CBA463 100%);
}

.bundle-caption { font-weight: 700; font-size: calc(var(--slot) * .25); line-height: 1.1; color: var(--navy); }

/* ------------------------------------------------------------- actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vmin, 20px);
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.mini-btn, .tie-btn {
  min-height: 64px;
  min-width: 168px;
  padding: 10px 20px;
  border-radius: calc(var(--radius) * 1.1);
  border: 3px solid var(--wood-dark);
  color: #FFF8EA;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(12px, 1.7vmin, 18px);
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(99,64,29,.75);
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(99,64,29,.16) 0 3px, rgba(255,255,255,.06) 3px 7px),
    linear-gradient(180deg, #C9924F 0%, #B07C43 55%, #8A5A2B 100%);
  background-size: auto, cover;
  box-shadow: 0 4px 0 var(--wood-dark), 0 6px 12px rgba(99,64,29,.3);
}

.mini-btn:active, .tie-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--wood-dark); }
.mini-btn:focus-visible, .tie-btn:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
.tie-btn[data-nudge="1"] { animation: nudge .9s var(--ease) 2; }

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

.ok-btn {
  min-height: 84px;
  min-width: clamp(132px, 17vmin, 210px);
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 2px;
  align-items: center;
  justify-content: center;
  padding: 4px 10px 6px;
  border: 0;
  border-radius: calc(var(--radius) * 1.3);
  color: #0E5C2C;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(22px, 3.4vmin, 34px);
  letter-spacing: .04em;
  cursor: pointer;
  background: transparent;
  transition: transform .12s var(--ease), filter .12s var(--ease);
}

.ok-art {
  width: clamp(64px, 9.2vmin, 104px);
  height: clamp(64px, 9.2vmin, 104px);
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, #6FE08F 0%, var(--ok) 55%, var(--ok-deep) 100%);
  box-shadow: 0 5px 0 #0A5C28, 0 8px 18px rgba(14,122,54,.4);
}

.ok-btn .ok-label {
  padding: 1px 14px 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  border: 2px solid var(--ok-deep);
  color: #0E5C2C;
  text-shadow: none;
  line-height: 1.05;
}

.ok-btn:active { transform: translateY(3px); }
.ok-btn:active .ok-art { box-shadow: 0 2px 0 #0A5C28; }
.ok-btn:focus-visible { outline: 4px solid var(--honey); outline-offset: 3px; }
.ok-btn.is-pressed { animation: okpress .5s var(--ease); }

@keyframes okpress {
  0% { transform: scale(1); }
  45% { transform: scale(.93); }
  100% { transform: scale(1); }
}

/* OK is hidden whenever an overlay owns the screen */
.app[data-overlay="1"] .actions { visibility: hidden; }

/* ------------------------------------------------------------ feedback */
/* The status banner is a grid item in the hud's own prompt row, so the row
   owns its height and the wooden control row below can never be painted over.
   It shares the cell with the task prompt and replaces it while it shows. */
.feedback {
  grid-area: prompt;
  position: static;
  transform: none;
  justify-self: center;
  width: min(560px, 88vw);
  padding: clamp(8px, 1.4vmin, 16px) clamp(12px, 2vmin, 24px);
  border-radius: calc(var(--radius) * 1.2);
  background: var(--paper);
  border: 3px solid rgba(138,90,43,.34);
  box-shadow: 0 6px 18px rgba(99,64,29,.3);
  text-align: center;
  /* A status message must never swallow a tap meant for the controls under it. */
  pointer-events: none;
}

.hud:has(.feedback:not([hidden])) .task-prompt { display: none; }

/* The correct-OK consequence uses honey, never a second green. */
.feedback[data-kind="ok"] { border-color: rgba(232,163,61,.85); }

.feedback-text { font-size: clamp(13px, 2vmin, 20px); font-weight: 700; color: var(--navy); }
.feedback-model { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin-top: 6px; }

.feedback-model .mod {
  width: clamp(9px, 1.4vmin, 15px);
  height: clamp(14px, 2.2vmin, 24px);
  border-radius: 999px;
  background: linear-gradient(180deg, #E4C489 0%, #CBA463 100%);
  border: 1.5px solid rgba(99,64,29,.5);
}

.feedback-model .mod.ghost { background: transparent; border-style: dashed; }
.feedback-model .mod.over { background: linear-gradient(180deg, #F3B0A0 0%, #DE7A63 100%); border-color: #A8452E; }

/* --------------------------------------------------------- demo banner */
/* Neither a panel nor a second row: the demonstration borrows the existing
   bottom control row, so Continue and Skip line up beside OK instead of
   sitting on the sticks. display:contents keeps the [hidden] rule working. */
.demo-banner { display: contents; }

.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: clamp(4px, .8vmin, 10px);
  min-height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  border: 3px solid var(--wood-dark);
  background-image:
    repeating-linear-gradient(90deg, rgba(99,64,29,.15) 0 3px, rgba(255,255,255,.08) 3px 7px),
    linear-gradient(180deg, #E2AC54 0%, #C98A38 58%, #9C6522 100%);
  color: #3B2408;
  font-weight: 800;
  font-family: inherit;
  font-size: clamp(14px, 1.9vmin, 19px);
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255,243,220,.55);
  box-shadow: 0 3px 0 var(--wood-dark);
}

/* The play picture rides inside the big Continue button, so the picture — not
   the word alone — says "press this one", and the demonstration hand presses
   the button itself. */
.continue-art {
  width: clamp(26px, 3.4vmin, 38px);
  height: clamp(26px, 3.4vmin, 38px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* A child can leave the demonstration at any time; the skip is a full 48px
   target inside this one banner, never a second row of controls. */
.btn-skip {
  min-height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid rgba(99,64,29,.45);
  background: rgba(255,250,240,.92);
  color: var(--wood-deep);
  font-family: inherit;
  font-size: clamp(12px, 1.6vmin, 16px);
  font-weight: 800;
  cursor: pointer;
}

.btn-skip:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }

/* ------------------------------------------------- demonstration flight */
/* A ghost of the very same sprite travels from the source to the goal, so a
   demonstration never teleports a stem. The real stem hides only while its
   ghost is in the air. */
.stem-ghost.fly {
  position: fixed;
  z-index: 55;
  pointer-events: none;
  opacity: .96;
  filter: drop-shadow(0 6px 10px rgba(60,35,10,.35));
}

.stem.is-flying { visibility: hidden; }

/* ---------------------------------------------------------------- hand */
.hand {
  --hand: clamp(58px, 8vmin, 96px);
  position: absolute;
  z-index: 30;
  left: 0; top: 0;
  width: var(--hand);
  height: var(--hand);
  pointer-events: none;
  transform: translate3d(-200px, -200px, 0);
  transition: transform .55s var(--ease);
  filter: drop-shadow(0 6px 8px rgba(60,35,10,.4));
  will-change: transform;
  /* anchored at the fingertip, not at the sprite's top-left corner */
  margin-left: calc(var(--hand) * -0.22);
  margin-top: calc(var(--hand) * -0.15);
}

.hand-img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }

.hand[data-step="press"] { transform-origin: 50% 0; }
.app[data-motion="reduced"] .hand { transition: none; }

/* ------------------------------------------------------------- overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: radial-gradient(120% 90% at 50% 10%, rgba(43,26,8,.34) 0%, rgba(43,26,8,.62) 100%);
  backdrop-filter: blur(2px);
}

.dialog {
  width: min(680px, 92vw);
  max-height: 92vh;
  overflow: auto;
  padding: clamp(16px, 2.6vmin, 34px);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--paper);
  border: 3px solid rgba(138,90,43,.34);
  box-shadow: 0 10px 0 rgba(99,64,29,.26), 0 26px 50px rgba(40,22,4,.45);
  text-align: center;
}

.dialog h2 { margin: 0 0 .2em; font-size: clamp(22px, 3.6vmin, 40px); color: var(--navy); }
.dialog-sub { margin: 0 0 1em; font-size: clamp(12px, 1.8vmin, 18px); color: var(--navy-soft); font-weight: 700; }

.dialog-row {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.4vmin, 16px);
  justify-content: center;
  margin-top: clamp(10px, 1.6vmin, 20px);
}

.btn {
  min-height: 56px;
  min-width: 148px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 3px solid var(--wood-dark);
  color: #FFF8EA;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(13px, 1.7vmin, 18px);
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(99,64,29,.7);
  background-color: var(--wood);
  background-image:
    linear-gradient(180deg, #C9924F 0%, #B07C43 55%, #8A5A2B 100%);
  background-size: cover;
  box-shadow: 0 3px 0 var(--wood-dark);
}

.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--wood-dark); }
.btn:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }

.btn-primary {
  border-color: var(--wood-dark);
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(99,64,29,.15) 0 3px, rgba(255,255,255,.08) 3px 7px),
    linear-gradient(180deg, #E2AC54 0%, #C98A38 58%, #9C6522 100%);
  box-shadow: 0 4px 0 var(--wood-dark);
  color: #3B2408;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255,243,220,.55);
}

.btn-start {
  min-height: 76px;
  min-width: clamp(190px, 26vmin, 300px);
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vmin, 18px);
  padding: 10px 28px;
  border-radius: 999px;
  border: 4px solid var(--wood-dark);
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(99,64,29,.16) 0 3px, rgba(255,255,255,.09) 3px 7px),
    linear-gradient(180deg, #E2AC54 0%, #C98A38 58%, #9C6522 100%);
  color: #3B2408;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(20px, 3vmin, 30px);
  letter-spacing: .03em;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255,243,220,.6);
  box-shadow: 0 5px 0 var(--wood-dark), 0 10px 20px rgba(99,64,29,.36);
}

.start-art { width: clamp(34px, 5vmin, 54px); height: clamp(34px, 5vmin, 54px); object-fit: contain; }

.btn-start:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--wood-dark); }
.btn-start:focus-visible { outline: 4px solid var(--honey); outline-offset: 3px; }

/* --------------------------------------------------------- level select */
.level-select {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.4vmin, 16px);
  justify-content: center;
}

.lvl {
  min-width: 132px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: calc(var(--radius) * 1.1);
  border: 3px solid rgba(99,64,29,.4);
  background: linear-gradient(180deg, #F6E6C6 0%, #E6CD9C 100%);
  color: var(--navy);
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(12px, 1.6vmin, 17px);
  cursor: pointer;
}

.lvl small { font-weight: 700; font-size: .82em; color: var(--wood-deep); }
.lvl[data-earned="1"] { box-shadow: inset 0 0 0 3px var(--honey); }
.lvl[data-current="1"] { border-color: var(--honey-deep); box-shadow: 0 0 0 3px rgba(232,163,61,.5); }
.lvl:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }

/* --------------------------------------------------------------- help */
.help-steps {
  list-style: none;
  margin: 0 0 1em;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: clamp(8px, 1.4vmin, 18px);
}

.help-steps li {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: clamp(6px, 1vmin, 12px);
  border-radius: calc(var(--radius) * 1.1);
  background: linear-gradient(180deg, rgba(246,230,198,.9) 0%, rgba(230,205,156,.9) 100%);
  border: 2px solid rgba(99,64,29,.28);
}

.help-art { display: grid; place-items: center; min-height: 74px; }
.help-img { max-width: 58px; max-height: 70px; object-fit: contain; }
.help-img[data-missing="1"] {
  width: 24px; height: 62px;
  border-radius: 999px;
  border: 2px dashed rgba(99,64,29,.55);
  background: linear-gradient(180deg, #E4C489 0%, #CBA463 100%);
}

.help-bundle { display: flex; align-items: flex-end; position: relative; }
.help-bundle .mini-stem { width: 11px; height: 60px; object-fit: contain; margin-left: -3px; }
.help-bundle .mini-stem:first-child { margin-left: 0; }
.help-bundle .mini-stem[data-missing="1"] {
  border-radius: 999px; border: 1px solid rgba(99,64,29,.45);
  background: linear-gradient(180deg, #E4C489 0%, #CBA463 100%);
}
.help-bundle .tie {
  position: absolute;
  left: -3px;
  right: -3px;
  top: 22%;
  bottom: 28%;
  border-top: 2px solid var(--wood-deep);
  border-bottom: 2px solid var(--wood-deep);
  border-radius: 2px;
}

.help-ok-img {
  width: 62px; height: 62px;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, #6FE08F 0%, var(--ok) 55%, var(--ok-deep) 100%);
}

.help-cap { font-size: clamp(11px, 1.5vmin, 15px); font-weight: 700; color: var(--navy); }

.parent-text {
  margin: 0 0 1em;
  padding: clamp(8px, 1.2vmin, 14px);
  border-radius: calc(var(--radius) * 1.1);
  background: rgba(232,163,61,.14);
  border: 2px dashed rgba(138,90,43,.4);
  font-size: clamp(11px, 1.5vmin, 15px);
  line-height: 1.5;
  text-align: left;
  color: #3E4C5C;
}

/* The exact words the recorded instruction speaks, attributed to the
   off-screen narrator Ori — never to the visible elephant guide. */
.help-narration {
  margin: 0 0 1em;
  padding: clamp(8px, 1.2vmin, 14px);
  border-radius: calc(var(--radius) * 1.1);
  background: rgba(23,74,126,.07);
  border: 2px solid rgba(23,74,126,.22);
  font-size: clamp(11px, 1.5vmin, 15px);
  line-height: 1.5;
  text-align: left;
  color: var(--navy);
}

.help-narration-tag { display: block; font-weight: 800; color: var(--navy-soft); margin-bottom: .25em; }

.help-audio { display: flex; flex-wrap: wrap; gap: clamp(6px, 1.2vmin, 14px); justify-content: center; }

/* ------------------------------------------------------------- rewards */
.reward-art { position: relative; height: clamp(120px, 22vh, 220px); display: grid; place-items: center; margin-bottom: 6px; }
.reward-img { max-height: clamp(120px, 22vh, 220px); max-width: 100%; object-fit: contain; }
.reward-img[data-missing="1"] { display: none; }
.reward-fallback { display: none; max-height: clamp(120px, 22vh, 220px); max-width: 100%; object-fit: contain; }
.reward-img[data-missing="1"] + .reward-fallback { display: block; }

.reward-sparkle {
  position: absolute;
  inset: -6% -10%;
  width: 120%;
  height: 112%;
  object-fit: contain;
  opacity: .55;
  z-index: -1;
  pointer-events: none;
}

.reward-sparkle[data-missing="1"] { display: none; }
/* Decoration never owns a tap: the reward art must not cover Next / Play again. */
.reward-art { z-index: 0; pointer-events: none; }

.token-row { display: flex; flex-wrap: wrap; gap: clamp(6px, 1.1vmin, 12px); justify-content: center; margin-bottom: .6em; }
.token {
  width: clamp(34px, 4.6vmin, 54px);
  height: clamp(34px, 4.6vmin, 54px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  font-weight: 800;
  font-size: clamp(14px, 2vmin, 22px);
  color: var(--wood-deep);
  background: linear-gradient(180deg, #F6E6C6 0%, #E6CD9C 100%);
  border: 2px solid rgba(99,64,29,.35);
  filter: saturate(.45) brightness(.95);
}

.token img {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: contain;
  z-index: 0;
}

.token span { position: relative; z-index: 1; }

.token img[data-missing="1"] { display: none; }

.token[data-earned="1"] {
  filter: none;
  color: #6B4419;
  background: linear-gradient(180deg, #FFDD9A 0%, var(--honey) 100%);
  box-shadow: 0 0 12px rgba(232,163,61,.8);
}

.finale .btn { margin: 0 4px 8px; }

/* ------------------------------------------------------- portrait stage */
@media (orientation: portrait) {
  .scene {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "elephant"
      "mat"
      "supply";
    align-items: stretch;
    gap: clamp(4px, .9vmin, 14px);
  }

  .actor-elephant { grid-area: elephant; justify-self: start; align-self: end; }
  .actor-elephant .actor-img { max-height: clamp(70px, 17vh, 190px); }
  .mat-wrap { grid-area: mat; }

  .supply-col {
    grid-area: supply;
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(6px, 1.4vmin, 18px);
  }

  .supply-wrap { flex: 1 1 auto; }
  .supply { max-height: clamp(110px, 22vh, 260px); }
  .actor-rhino { flex: 0 0 auto; }
  .actor-rhino .actor-img { max-height: clamp(64px, 14vh, 170px); }
}

/* ------------------------------------------------------ compact shapes */
@media (max-height: 660px) {
  :root { --slot: clamp(48px, 10.4vmin, 74px); --ctrl: 56px; }
  .chip { padding: 3px 10px; }
  .task-prompt { font-size: 13px; padding: 2px 12px; }
  .ok-btn { min-height: 68px; }
  .dialog { padding: 14px; }
}

@media (max-width: 430px) {
  .hud { gap: 3px; }
  .level-props { gap: 3px; padding: 3px 6px; }
  .prop { width: 22px; height: 22px; font-size: 11px; }
  .prop img { inset: -4%; width: 108%; height: 108%; }
  .chip { font-size: 11px; padding: 3px 8px; }
  .task-prompt { font-size: 12px; padding: 2px 10px; }
  .ctrl-lbl { display: none; }
  .ctrl { grid-template-rows: 1fr; }
  .controls { gap: 3px; }
  .mini-btn, .tie-btn { min-width: 132px; font-size: 12px; padding: 8px 12px; }
}

/* Very short landscape phones (640x360 and friends). The tray bitmap is 150px
   tall at the 48px slot floor, so the board can only live here if the scene row
   really owns that height and the whole OK button — green bitmap and label —
   sits in its own row below the board instead of under it. The scene gives the
   mat and the grass supply one column each, so the largest candidate (14 stems
   waiting, or 10 on the mat plus the extras) stays on screen with full 48px
   tap targets; the decorative characters step aside rather than squeeze the
   board off a 360px-tall screen. */
@media (max-height: 430px) and (orientation: landscape) {
  .stage { gap: 3px; padding: 4px; }

  .hud {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "props chips" "prompt controls";
    gap: 2px;
    align-items: center;
  }
  .chip { display: none; }
  .chip:first-child { display: block; font-size: 10px; padding: 2px 8px; }
  .level-props { padding: 2px 6px; gap: 3px; }
  .prop { width: 20px; height: 20px; font-size: 10px; }
  .prop img { inset: -2%; width: 104%; height: 104%; }
  .prop[data-earned="1"]::after { inset: -3px; border-width: 2px; }
  .task-prompt { font-size: 11px; padding: 1px 8px; }
  .ctrl-lbl { display: none; }
  .ctrl { grid-template-rows: 1fr; }

  .actor-elephant, .actor-rhino { display: none; }
  .scene { grid-template-columns: minmax(0, 1fr) minmax(206px, 44%); gap: 4px; align-items: start; }
  .mat-wrap { grid-column: 1; }
  .supply-col { grid-column: 2; }
  .supply-wrap { padding: 3px; border-width: 2px; }
  .supply { max-height: none; }
  .supply .stem { width: 48px; height: 48px; }
  /* Rods that do not fit the ten-frame wait on the tray's lower rim, so the
     eleventh and twelfth rod never fall off the bottom of a short screen. */
  .mat-board.is-overflow .mat-free { left: auto; right: 0; top: 84%; width: auto; height: auto; padding: 0; gap: 2px; }

  .actions { gap: 6px; padding-bottom: 0; }
  .mini-btn, .tie-btn { min-height: 48px; min-width: 112px; padding: 6px 10px; font-size: 11px; }
  .ok-btn { min-height: 50px; padding: 2px 8px 4px; gap: 1px; }
  .ok-art { width: 44px; height: 44px; }
  .ok-btn .ok-label { font-size: 16px; padding: 0 10px 1px; }

  /* A compact one-line strip — the count beside the sentence — inside the hud's
     own prompt row, which owns its height and keeps the banner off the rods and
     off the wooden control row below it. */
  .feedback {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    max-width: min(92vw, 560px);
    padding: 3px 12px;
    border-width: 2px;
    border-radius: 999px;
  }
  .feedback-text { font-size: 11px; line-height: 1.15; }
  .feedback-model { flex: 0 0 auto; flex-wrap: nowrap; margin-top: 0; gap: 2px; }
  .feedback-model .mod { width: 6px; height: 12px; border-width: 1px; }
}

/* Short portrait phones (360x640 and friends). Here the grass supply has to
   show the largest candidate — fourteen rods — as full 48px tap targets at
   once, and the tray bitmap needs its whole 150px so its ten-frame never
   leaves the cream. The rows above and below the tray therefore give up their
   spare height: the guide and the worker shrink to small standing figures and
   the action row stays on one line. Nothing is clipped off the right edge and
   no rod is ever centred-overflowed under the tray's rim. */
@media (orientation: portrait) and (max-height: 720px) {
  .stage { gap: 3px; padding: 4px; }
  .scene { gap: 4px; }

  .actor-elephant .actor-img { max-height: 58px; }
  .actor-rhino .actor-img { max-height: 50px; }

  /* A slimmer grass panel keeps the three rows of rods inside the height the
     tray row can spare without any rod touching the tray's wooden rim. */
  .supply-wrap { padding: 2px; border-width: 2px; }

  /* The supply is a fixed 5-across field of 48px rods: thirteen or fourteen
     of them fit in three rows instead of growing a row that the tray row
     cannot spare, and the panel never has to clip (or centre-overflow) a
     rod out of reach. */
  .supply {
    max-height: none;
    align-content: flex-start;
    gap: 2px;
  }
  .supply .stem { width: 48px; height: 48px; }
  .supply .stem-img { height: 90%; }

  .actions { flex-wrap: nowrap; gap: 6px; }
  .mini-btn, .tie-btn { min-width: 116px; padding: 8px 10px; font-size: 12px; }
  /* Two 116px wooden buttons plus the base 132px OK minimum overran the 352px
     inner width at 360x640 and clipped both ends of the row; the OK only has to
     hold its 54px bitmap and the short label, so a bounded minimum keeps the
     whole row centred on screen with no change to the bitmap. */
  .ok-btn { min-height: 60px; min-width: 88px; padding: 2px 10px 4px; }
  .ok-art { width: 54px; height: 54px; }
  .ok-btn .ok-label { font-size: 18px; padding: 0 10px 1px; }
}

/* Portrait phones up to 430px: the rune badge already owns the bottom-left
   corner, so the action row reserves 52px for it instead of running under the
   paper disc. The two wooden buttons give up their spare minimum — the labels
   wrap to two lines — the OK keeps its 54px bitmap, and 100+100+88+12+52 fits
   the 352px inner width of a 360px phone on one line. */
@media (orientation: portrait) and (max-width: 430px) {
  .actions { flex-wrap: nowrap; gap: 6px; padding-left: 52px; }
  .mini-btn, .tie-btn { min-width: 80px; max-width: 100px; padding: 8px 6px; font-size: 12px; }
  .ok-btn { min-width: 88px; }
}

/* -------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .hand, .stem, .prop, .ctrl, .btn, .ok-btn { transition-duration: .001ms !important; }
}

.app[data-motion="reduced"] * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
.app[data-motion="reduced"] .hand,
.app[data-motion="reduced"] .stem,
.app[data-motion="reduced"] .prop,
.app[data-motion="reduced"] .stem-ghost.fly { transition-duration: .001ms !important; }

/* --------------------------------------------------- hand / drag accents */
.is-hot {
  outline: 4px solid var(--honey) !important;
  outline-offset: 2px;
  border-radius: 12px;
  box-shadow: 0 0 0 6px rgba(232,163,61,.28), 0 0 16px rgba(232,163,61,.55);
}

.ok-btn.is-hot { outline-color: #FFFFFF; box-shadow: 0 5px 0 #0A5C28, 0 0 0 8px rgba(232,163,61,.5); }

.ctrl.is-muted .ctrl-ico { opacity: .4; text-decoration: line-through; }
.ctrl.is-muted { filter: saturate(.3) brightness(.88); }

.slot.is-hot { border-color: var(--honey); background: rgba(232,163,61,.28); }
