/* style.css — Trample design system + game shell layout
 *
 * The palette, type scale and "chunky stone" button treatment mirror the
 * Trample landing page and launch checklist, so the game, the site and the
 * marketing material all read as one product.
 *
 * Colours are declared twice: a hex fallback first, then the oklch value the
 * brand is authored in. Browsers that can't parse oklch drop that declaration
 * and keep the hex.
 */

:root {
  --meadow:        #57B85A;
  --meadow:        oklch(72% 0.18 145);
  --meadow-light:  #7FD07A;
  --meadow-light:  oklch(80% 0.16 145);
  --meadow-dark:   #2F7A38;
  --meadow-dark:   oklch(50% 0.13 148);
  --forest:        #244B28;
  --forest:        oklch(32% 0.08 150);
  --forest-deep:   #16301A;
  --forest-deep:   oklch(22% 0.05 152);

  --parchment:     #F2EDE0;
  --parchment:     oklch(94% 0.025 88);
  --parchment-dim: #E6DECD;
  --parchment-dim: oklch(89% 0.03 86);
  --edge:          #D2C6AC;
  --edge:          oklch(82% 0.04 78);

  --mud:           #7A5731;
  --mud:           oklch(42% 0.07 55);
  --mud-deep:      #55371C;
  --mud-deep:      oklch(30% 0.05 50);
  /* The bridge's own wood, light enough to read on the dark HUD rows: the
     score floats and the row's bridge entries, gained or spent (issue #168). */
  --driftwood:     #C9A98A;
  --driftwood:     oklch(75.5% 0.057 66);

  --bounty:        #E8B84A;
  --bounty:        oklch(80% 0.16 85);
  /* The pale gold every sack's value is stamped in, on the board and on the
     chip (#3E2723 outline). The row's bounty entry and its float wear it too,
     so the +10 in the row is the colour of the 10 on the sack. */
  --bounty-figure: #FFE082;
  --bounty-deep:   #B07B22;
  --bounty-deep:   oklch(60% 0.16 65);

  --danger:        #C4462F;
  --danger:        oklch(55% 0.17 30);

  --ink:           #1E2A20;
  --ink:           oklch(22% 0.02 150);
  --ink-soft:      #4A554C;
  --ink-soft:      oklch(38% 0.02 150);

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body:    'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  /* The screen's own insets: the status bar a home-screen iOS app draws
     under (black-translucent, index.html) and the home indicator below. Both
     are 0 in a browser tab, on Android, on desktop and in an itch.io frame,
     so every rule that reads them is a no-op there and one layout serves the
     lot — nothing branches on device or context. Read through these rather
     than env() directly, so the fallback is written once. */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* A HUD pixel (see #ui-panel). 1px anywhere outside the panel. */
  --hud-px: 1px;
  /* The one column everything stands in on a wide window: the game shell,
     the world map's viewport and bar, and the map scene itself, which is
     authored 448 wide — a phone's width, so a desktop or a tablet plays the
     phone's view, letterboxed on the body's ground. It is the board's cap
     too: inside it no board's cell can outgrow a phone's, and the shell's own
     margins centre it once it is hit. */
  --column: 448px;
  /* How far the column's edge stands in from the viewport's on a window
     wider than it — 0 on a phone. The corner furniture (the version stamp,
     the speaker and its menu) measures from here, so on a desktop it sits in
     the game's own corners rather than out at the browser window's edges.
     A fixed element's percentages are the viewport's, so 100% is its width. */
  --column-gutter: max(0px, calc((100% - var(--column)) / 2));
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--forest-deep);
  font-family: var(--body);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
/* The status bar. Only a home-screen iOS app has one to clear (--safe-top is
   0 everywhere else), and it is cleared here, on the body, so the game shell
   below (height: 100%) fills what is left: the board starts under the clock
   rather than beneath it, and main.js's canvas maths, which reads the shell's
   clientHeight, needs no inset of its own. The fixed overlays ignore body
   padding and go on painting under the bar — the look black-translucent is
   for — and keep their cards clear of it themselves (.t-overlay). */
body { padding-top: var(--safe-top); }

/* ═══════════════════════════════════ GAME SHELL */

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-width: var(--column);
  margin: 0 auto;
  background: var(--forest);
  /* The containing block for the floating Undo / Confirm. `margin: 0 auto`
     centres the shell in anything wider than the column, and main.js measures the
     head tile against THIS box — so with nothing positioned here the absolute
     box resolved against the viewport instead and landed a whole left margin
     out over the desktop letterboxing. On a phone the margin is 0, which is
     why it only ever showed on a wide window.
     Relative with no z-index starts no stacking context, so #drag-confirm's
     60 still competes at the root against the overlays' 100+. */
  position: relative;
}

#game-canvas {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  touch-action: none;
}

/* UI Panel below the canvas. Hidden until there is a game to play — the player
   rows and the control strip are meaningless in the menus, and a panel that
   starts visible flashes the game shell before the main menu is built
   (issue #84). ui.showGameUI() sets the inline display either way. */
#ui-panel {
  width: 100%;
  background:
    radial-gradient(ellipse 80% 120% at 50% 100%, rgba(0,0,0,.28) 0%, transparent 70%),
    var(--forest);
  border-top: 2px solid var(--meadow-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 -8px 22px -14px rgba(0,0,0,.9);
  /* ONE dial sizes the whole panel. --hud-px is a pixel at the panel's floor
     and grows with the viewport, and everything in here that has to stay
     legible — the type, the icons, the rows, the strip, the chip — is written
     as a count of them. So the panel is exactly the design below on the phone
     it was tuned on (a 430x739 Safari viewport, where 13px is 1.76% of the
     height), up to 15% bigger where there is room, and never smaller: the
     board absorbs the variance and the HUD holds steady, because a board 8%
     smaller is barely noticed and an unreadable score is the whole game.
     Width is in the min() so the strip cannot outgrow a narrow phone, and
     svh rather than vh because vh is the viewport with the browser chrome
     collapsed — on iOS a hundred pixels more than a player ever sees, which
     would have grown the panel on the very phone it was tuned for. The
     @supports below is where the growth is switched on: a custom property
     cannot carry its own fallback (an unsupported unit only fails where it is
     used), so a browser without svh keeps the floor. */
  --hud-px: 1px;
  --hud-pad-y: 7px;
  --hud-pad-x: 9px;
  /* The home indicator's inset beyond the panel's own padding, ADDED to the
     height rather than taken from it. It used to come out of the fixed
     height, which on a home-screen iOS app (34px of inset) squeezed the
     2-player rows from 28px to 14px and left the strip standing a band above
     the bottom — the squashed scores every screenshot from the home screen
     showed. Zero wherever there is no inset. */
  --hud-safe: max(0px, var(--safe-bottom) - var(--hud-pad-y));
  padding: var(--hud-pad-y) var(--hud-pad-x) max(var(--hud-pad-y), var(--safe-bottom));
  display: none;         /* showGameUI(true) sets display:flex inline */
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  /* Pinned per player count. Player count is fixed for a game, so the board
     never resizes under anyone — the unit moves only with the viewport, which
     re-lays the board out anyway.

     The heights buy every count the SAME ~27px row, which is what lets all
     four share one type scale — four players used to be squeezed to a 10px
     font in an 18.75px row and read as a different, smaller panel.

     They cost almost nothing. The board takes min(width/cols, height/rows)
     and is width-bound on nearly every phone this ships to, so the height
     comes out of slack rather than out of cells. Measured at 165 against the
     old 131, per board:
       Large 12x16   free everywhere (holds its cell to a 176px panel even on
                     a 360x640, and past 300 on the bigger phones)
       Medium 10x14  free except 1px of cell on a 375x667 SE and a 360x640
       Small 8x12    the same two, 1px each — Small has the tallest aspect
                     ratio, so it is the one that binds first
     A 1px cell on the two smallest phones is the whole price. Anything past
     165 starts costing the mid-size phones too. */
  --hud-h: 165;
  height: calc(var(--hud-h) * var(--hud-px) + var(--hud-safe));
}
#ui-panel.players-2 { --hud-h: 110; }   /* 2 rows at 28.5px */
#ui-panel.players-3 { --hud-h: 138; }   /* 3 rows at 27.25px */
                                        /* 4 rows at 27.25px is the 165 above */
@supports (height: 1svh) {
  #ui-panel { --hud-px: calc(clamp(13px, min(1.76svh, 3.5vw), 15px) / 13); }
}

/* ── PLAYER ROWS
   The score chip and the turn log are one element: who, what they last
   scored, and what that leaves them on. Side-by-side chips could not hold
   four players on a phone without wrapping to a 2x2 grid, and that grid cost
   two rows of history; stacked rows hold four and have width to spare.

   The rows are sunk into the panel's own ground and the bounty chip below
   them takes the raised, pressable treatment, so weight sits on the elements
   that are actually controls. Gold means "bounty" here, not "your turn" —
   whose turn it is is a lit green row. */
#player-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-height: 0;
}
#player-rows.players-4 { gap: 2px; }

.player-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  flex: 1;
  min-height: 0;
  border-radius: 9px;
  background: rgba(0,0,0,.26);
  color: var(--parchment);
  font-size: calc(13 * var(--hud-px));
  font-weight: 600;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.09);
}
/* Active: lit, not recoloured. */
.player-row.active {
  background: var(--meadow-dark);
  box-shadow: inset 0 0 0 1px var(--meadow), 0 0 0 1px rgba(0,0,0,.25);
}
.player-row .player-dot { width: calc(11 * var(--hud-px)); height: calc(11 * var(--hud-px)); flex-shrink: 0; }

.player-row__name {
  font-family: var(--mono);
  font-size: calc(12 * var(--hud-px));
  letter-spacing: .5px;
  color: var(--parchment-dim);
  opacity: .85;
  flex-shrink: 0;
}
.player-row.active .player-row__name { color: var(--parchment); opacity: 1; }

/* The turn's deltas take the row's slack, which keeps the bridges and the
   boss mark in a left-hand group that lines up down the panel, after the
   name, and puts the last turn against the total it adds to. Its line is
   right-aligned (.t-delta-line), so the newest entries — the bounty last —
   sit beside the total and a short turn leaves no gap. */
.player-row__deltas {
  position: relative;
  align-self: stretch;      /* a definite box for the lines to scroll inside */
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  /* 14, up from 12 (issue #168): the turn's score is the line a player is
     reading for, and at 12 it was the smallest type on the panel. */
  font-size: calc(14 * var(--hud-px));
}
/* One turn's entry. Absolutely placed so the outgoing and incoming lines pass
   each other inside the clipped box rather than sitting side by side — two
   turns that earned the same thing are identical to read, and a straight text
   swap between them looks like nothing happened. */
.t-delta-line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  /* 10 between entries (issue #168): grass, bridge and bounty read as three
     things rather than one run. The worst line a turn can make, "+8 −10 +25"
     with a boss's mark reserved beside it, still fits a 360-wide phone. */
  gap: calc(10 * var(--hud-px));
  /* The arriving line waits for the leaving one to get clear. Without the
     delay both sit within a few px of centre at the midpoint and the frame
     reads as one smudged line rather than two passing. */
  justify-content: flex-end;
  animation: deltaLineIn 240ms cubic-bezier(.2,.85,.3,1) 90ms both;
}
.t-delta-line.is-leaving {
  animation: deltaLineOut 200ms cubic-bezier(.45,0,.75,.3) both;
}
/* The bridge mark is fixed-colour artwork drawn for parchment, so it cannot
   follow the row's text colour and goes muddy on a dark green row. Lifted
   rather than redrawn, so it stays the same bridge everywhere it appears. */
/* Sized with the row rather than under it. At 10px against a 14px total it
   read as a footnote, when it is one of the three numbers a player is here to
   check. The mark grows with it, being sized in em. */
.player-row__bridges {
  flex-shrink: 0;
  font-size: calc(13 * var(--hud-px));
  color: var(--parchment-dim);
  opacity: .85;
}
.player-row__bridges .t-bridge-icon { filter: brightness(1.45) saturate(.85); }
.player-row.active .player-row__bridges { opacity: 1; }
/* One tile a bridge (issue #168), so a spent one is an empty tile rather
   than a digit going down. Bare, two bridges on the row read as a pair of
   eyebrows to someone new; in a tile they read as items held. The tile is
   the boss chip's own shape — 20 HUD px tall, 5px corners, a 1px outline over
   a see-through fill — in parchment rather than the boss's red, so the two
   sit side by side as one family (a solid cream tile was tried first and
   shouted over the chip beside it). It is also the look a button would have,
   should the stock become one. A spent tile loses its fill and keeps a faint
   outline with a ghost of the bridge in it, so the row still reads "one of
   two left"; the opening's tiles start that way and fill as each +5 lands
   (.is-pending). A tile whose bridge is flying to the board is blank for the
   flight (.is-lifting). The bridge is 14 HUD px, the boss chip's mark size. */
.player-row__bridges { display: inline-flex; align-items: center; gap: calc(4 * var(--hud-px)); }
.t-bridge-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: calc(20 * var(--hud-px));
  padding: 0 calc(3 * var(--hud-px));
  border-radius: 5px;
  background: rgba(242, 237, 224, .16);
  box-shadow: inset 0 0 0 1px rgba(242, 237, 224, .50);
  transition: background 360ms ease-out, box-shadow 360ms ease-out;
}
.player-row__bridges .t-bridge-slot .t-bridge-icon {
  margin: 0;
  font-size: calc(14 * var(--hud-px));
  transition: opacity 360ms ease-out, filter 360ms ease-out;
}
.t-bridge-slot.is-spent,
.t-bridge-slot.is-pending { background: transparent; box-shadow: inset 0 0 0 1px rgba(242, 237, 224, .22); }
.t-bridge-slot.is-spent .t-bridge-icon,
.t-bridge-slot.is-pending .t-bridge-icon { opacity: .3; filter: grayscale(1) brightness(1.8); }
.t-bridge-slot.is-lifting .t-bridge-icon { opacity: 0; transition: none; }
.t-bridge-slot.is-landed { animation: deltaLand 320ms cubic-bezier(.2,.85,.3,1); }
/* The stock is a button (issue #170) — pressing it opens the bridge card.
   Reset here rather than on .player-row__bridges so the size and colour
   above still apply; the hit area takes the row's height, as the boss
   chip's does, and a press lifts every tile's fill at once. */
button.player-row__bridges {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
button.player-row__bridges::before { content: ''; position: absolute; inset: -5px -4px; }
button.player-row__bridges:active .t-bridge-slot { background: rgba(242, 237, 224, .34); }
/* Free Crossing has no stock, but holds one's width, invisibly, so a boss's
   marks stand in one column down the panel. */
.player-row__bridges.is-held { visibility: hidden; }

/* The opening total ticks up one component at a time (issue #90) and each
   arrival pops. The class rode through the HUD rewrite on the element; the
   rule that gave it an animation did not, because it was keyed on the old
   .score-value — so the pop was silently dead until this was put back. */
.player-row__total.is-bumped { animation: scorePop 360ms ease-out; }
.player-row__total {
  flex-shrink: 0;
  /* 17, up from 15 (issue #168), and its column widened with it. */
  min-width: calc(29 * var(--hud-px));
  text-align: right;
  font-weight: 700;
  font-size: calc(17 * var(--hud-px));
  font-variant-numeric: tabular-nums;
}

/* ONE type scale for every count. The panel used to hold 131px whatever the
   player count and step the type down to fit — four players landed on a 10px
   font in an 18.75px row, which read as a different, smaller panel rather than
   as the same one with more in it. Since the height is free (see #ui-panel),
   the rows get the height instead and the type stays put.
   Three and four still lose a little horizontal padding, because a shorter row
   wants less of it, and four tightens its gap to buy the 25px. */
#player-rows.players-3 .player-row { padding: 0 7px; }
#player-rows.players-4 .player-row { padding: 0 7px; border-radius: 8px; }

/* A turn's gain or loss, in the same icon vocabulary as the score floats. */
.t-delta { display: inline-flex; align-items: center; gap: 2px; }
.t-delta--gain { color: var(--meadow-light); }
.t-delta--bridge { color: var(--driftwood); }
.player-row.active .t-delta--gain { color: #C8F0BE; }
/* A bounty lands gold, the colour its float flew in (issue #168), so the
   turn's biggest number keeps its colour once it is in the row — the pale
   gold its sack is stamped in, not the brand gold it used to be. */
.t-delta--bounty { color: var(--bounty-figure); }
/* The marks as big as the row allows (issue #168). The grass and the sack sit
   in 24-unit boxes with a third of their height empty and their drawings low
   in it, so each is sized up and lifted, its empty sides taken back with a
   negative margin. The sack stands about 14px against the 10px digits,
   lifted a tenth of its box so its middle meets theirs; the grass a little
   smaller at 13px and lifted a little further, about 1px above that middle,
   so its stem stops near the baseline instead of hanging below it (all
   measured off the rendered pixels). The bridge is cropped to its drawing already, and matches the
   stock's bridges on the right of the row. */
.t-delta .t-svg-icon { width: 1.45em; height: 1.45em; margin: 0 -.16em; transform: translateY(-15%); }
.t-delta .t-sack-mark { width: 1.84em; height: 1.84em; margin: 0 -.32em; transform: translateY(-10%); }
.t-delta .t-bridge-icon { font-size: calc(14 * var(--hud-px)); }
/* A turn's entries are laid out at once but shown one by one, each as its
   score float lands on it (issue #116). Hidden rather than absent so the slots
   hold their places and the floats have somewhere to aim. */
.t-delta.is-pending { visibility: hidden; }
.t-delta.is-landed { animation: deltaLand 320ms cubic-bezier(.2,.85,.3,1); }
/* Sized wherever it lands, not just inside a row's delta. The SVG carries a
   viewBox but no width or height, so unsized it has no box to lay out with —
   as an inline element it fell back to a default one, but as a flex item in a
   score float it collapsed to 0x0 and the sack simply vanished. The bounty
   chip sizes its own (.t-rung svg, more specific), so that one is unaffected. */
.t-sack-mark { width: 1.15em; height: 1.15em; display: block; }

/* A boss's abilities, in the right-hand group just before the bridge count.
   Beside the name it pushed that one row's deltas out of line with everyone
   else's, and the column of what each player just scored is the thing being
   read down the panel. Rows without an ability hold the empty slot, but only
   on levels that have a boss at all.
   One mark per ability (issue #124), 13px each in a 17px chip, so a boss
   with two wears a 30px one — and every slot on the panel is sized by the
   widest chip (--boss-marks, set on #player-rows by initPlayerRows), which
   is what keeps the bridges and totals in one column. The boss's own chip is
   a button that opens the ability card; the empty slots are spans. The
   button reset is here rather than on button.t-boss-chip so the two are the
   same box. */
.t-boss-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: calc((var(--boss-marks, 1) * 15 + 5) * var(--hud-px));
  height: calc(20 * var(--hud-px));
  padding: 0;
  border: none;
  border-radius: 5px;
  flex-shrink: 0;
  font: inherit;
  color: #FF8A73;
  background: rgba(196,70,47,.26);
  box-shadow: inset 0 0 0 1px rgba(255,138,115,.45);
}
.t-boss-chip.is-empty { background: none; box-shadow: none; }
.t-boss-chip .t-svg-icon { width: calc(14 * var(--hud-px)); height: calc(14 * var(--hud-px)); flex-shrink: 0; }
button.t-boss-chip { cursor: pointer; }
/* The chip is 20px in a 27px row: the hit area takes the row's height
   without the mark growing to fill it. */
button.t-boss-chip::before { content: ''; position: absolute; inset: -5px -4px; }
button.t-boss-chip:active { background: rgba(196,70,47,.48); }
/* The player's own ability (issue #202) is gold rather than a boss's red. */
.t-boss-chip.is-own { color: var(--bounty); background: rgba(232,184,74,.2); box-shadow: inset 0 0 0 1px rgba(232,184,74,.55); }
button.t-boss-chip.is-own:active { background: rgba(232,184,74,.4); }

/* The bridge mark (ICONS.bridge) — the old How to Play illustration, cropped.
   Sized in em so the one drawing serves the score row and the 20-24px score
   floats; the ratio matches its cropped viewBox, so it never squashes. */
.t-bridge-icon { width: 1.687em; height: 1em; vertical-align: -.16em; }
.player-row__bridges .t-bridge-icon { margin-right: .05em; }
/* The row's gap spaces it now; this only tops it up to the bridge's old feel. */
.score-float .t-bridge-icon { margin-left: .08em; }

/* ── CONTROL STRIP
   Back, bounty, Skip. The two labelled controls sit at either end with the
   chip between them: they were a stacked pair of identical cream buttons in
   an earlier draft, and one forfeits a turn while the other leaves the level. */
#hud-controls {
  display: flex;
  align-items: stretch;
  gap: 7px;
  flex-shrink: 0;
  height: calc(32 * var(--hud-px));
}
.t-hud-mid {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
}

.t-hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
  padding: 0 12px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: calc(13 * var(--hud-px));
  letter-spacing: .2px;
  color: var(--mud-deep);
  background: var(--parchment-dim);
  box-shadow: 0 3px 0 var(--edge);
  transition: opacity .15s;
}
.t-hud-btn .t-svg-icon { width: calc(13 * var(--hud-px)); height: calc(13 * var(--hud-px)); }
.t-hud-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
/* Skip has two states and no third: active, or dimmed where it cannot act —
   mid-drag there is a path to finish, and on the rival's turn there is no
   turn of yours to skip. It stays in place and dims rather than leaving, so
   the strip is composed identically whichever it is and nothing flickers in
   and out beside a thumb that is already moving. */
.t-hud-btn:disabled { opacity: .34; cursor: default; }
/* A class rule outranks the browser's own [hidden], so the display above would
   keep a hidden button in the strip — Skip, while Share stands in its slot at
   the end of a game (issue #215). */
.t-hud-btn[hidden] { display: none; }

/* ── BOUNTY CHIP — the ladder, not a count
   A playtester played the best part of an hour without noticing the three
   sacks are worth different amounts, so the chip carries the whole ladder in
   the order it drops. Each sack shows the board's own coin pile for its value
   (js/art.js), which makes the chip a legend for the board art.
   It is a real button: pressing it re-opens the round-start popup. */
.t-bounty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  padding: 0 6px;
  min-width: calc(158 * var(--hud-px));
  border: none;
  border-radius: 9px;
  cursor: pointer;
  background: var(--parchment);
  box-shadow: 0 3px 0 var(--edge);
}
.t-bounty:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
/* Shut for the beat between the last claim and the results: it keeps its look. */
.t-bounty:disabled { cursor: default; }
/* A class rule outranks the browser's own [hidden], so the display above would
   otherwise keep the chip's 158px in the strip at game over and shunt the
   results ▲ over Menu and Skip. */
.t-bounty[hidden] { display: none; }

/* Each rung is the board's own sack, its value stamped on it the way the board
   stamps it (issue #173), so the chip and the grass read alike. The value used
   to sit beside the sack; inside it, the sack takes that room and fills the
   strip's height, its box cropped to the drawing (sackSVG). */
.t-rung { display: flex; align-items: center; gap: 0; flex-shrink: 0; position: relative; isolation: isolate; }
.t-rung svg { width: calc(28 * var(--hud-px)); height: calc(28 * var(--hud-px)); display: block; }
/* The sacks still to fall wait tied shut, and a sack opens and lights up when
   its light goes out to the board (riseLightFromChip), staying open and lit
   while its light or its zone is there — so the chip says which sacks the
   board is marking. Greyed out was tried first and read as "not available";
   a tied sack is still a full one, number and all, just not opened yet. */
.t-sack-closed { display: none; }
.t-rung:not(.is-spent):not(.is-lit) .t-sack-closed { display: inline; }
.t-rung:not(.is-spent):not(.is-lit) .t-sack-open { display: none; }
.t-rung:not(.is-spent) svg { transition: transform .3s; }
/* Opening: the coins spring up out of the mouth as the glow gathers. */
.t-rung.is-glowing .t-sack-open {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: t-sack-opens var(--gather, 450ms) cubic-bezier(.3, 1.5, .6, 1) both;
}
@keyframes t-sack-opens {
  from { transform: scale(.6, .2); }
  to   { transform: scale(1); }
}
/* Lit: a steady glow behind the sack, breathing like the board's light. Gold
   where the board's light is cream: cream on the cream chip does not show, so
   the light is warmer on the chip and cools to cream as it leaves
   (.t-light-flight::before). */
.t-rung.is-lit::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 135%;
  aspect-ratio: 1;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle closest-side,
    rgba(232, 184, 74, .6) 0%, rgba(232, 184, 74, .3) 55%, rgba(232, 184, 74, 0) 100%);
  transform: translate(-50%, -50%);
  animation: t-rung-breathe 1.6s ease-in-out infinite;
}
@keyframes t-rung-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(.95); }
  50%      { transform: translate(-50%, -50%) scale(1.05); }
}
/* Gathering: the light the sack is about to send out, swelling up over
   --gather to a bright glow with the gold ring inside its edge, the sack
   popping a little as it lights. When it is full the class goes and the
   flight takes off from this glow at this size (LIGHT_HALO, 190% of the
   sack), leaving the steady lit glow behind it. */
.t-rung.is-glowing svg { transform: scale(1.15); }
.t-rung.is-glowing::before {
  width: 190%;
  background:
    radial-gradient(circle closest-side, transparent 74%, rgba(232, 184, 74, .9) 77%, rgba(232, 184, 74, .9) 81%, transparent 84%),
    radial-gradient(circle closest-side,
      rgba(255, 214, 110, .85) 0%, rgba(232, 184, 74, .5) 55%, rgba(232, 184, 74, 0) 100%);
  animation: t-rung-glow var(--gather, 450ms) ease-out both;
}
@keyframes t-rung-glow {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Dropped: the rung is the hollow its sack left (issue #186, sackSlotSVG). It
   used to keep the sack, faded, which read as a sack already used up while it
   was still out on the board to be taken. The sack lifts out of the hollow on
   its way to the board (issue #116), its flight drawn over the slot it left. */
/* The sack in flight: a copy of the rung's own drawing, sized to the rung at
   take-off and transformed to the tile's size and place by the flight. */
.t-sack-flight {
  position: fixed;
  z-index: 310;   /* over the phase banner (300): it crosses the words mid-flight, and a
                     moving thing that vanishes behind text reads as lost */
  pointer-events: none;
  transform-origin: center;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.35));
}
.t-sack-flight svg { width: 100%; height: 100%; display: block; }

/* A drop's light rising out of the chip to its tile (riseLightFromChip): the
   board's own light (SHADOW_ART in js/renderer.js) — a cream glow brightest at
   its middle and gone at its edge, with the gold ring inside the edge — drawn
   in CSS so it can leave the HUD, which the canvas cannot reach. Under the
   coach (140+), so a lesson card's scrim dims it like the rest of the board,
   and under the phase banner: a light is quieter than a sack. */
.t-light-flight {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  transform-origin: center;
  border-radius: 50%;
  background: radial-gradient(circle closest-side,
    rgba(255, 246, 214, .5) 0%, rgba(255, 246, 214, .26) 55%, rgba(255, 246, 214, 0) 100%);
}
.t-light-flight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle closest-side,
    rgba(255, 214, 110, .85) 0%, rgba(232, 184, 74, .5) 55%, rgba(232, 184, 74, 0) 100%);
  opacity: 0;
}
/* Off a sack's glow: leaves gold, as it glowed on the chip, and cools to the
   board's cream over the first part of the trip. */
.t-light-flight.is-from-glow::before { animation: t-light-cool var(--cool, 400ms) ease-in both; }
@keyframes t-light-cool { from { opacity: 1; } to { opacity: 0; } }
.t-light-flight::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: var(--ring, 1.5px) solid rgba(232, 184, 74, .55);
  box-sizing: border-box;
}

/* The countdown sits immediately before the next sack to fall, so it always
   names a value. Once every sack has fallen there is nothing left to count
   and the clock goes: the last claim ends the game.
   The count rides the dial's shoulder: level with the values it sits between,
   it read as a fourth number in the ladder. */
.t-clock {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  color: var(--mud-deep);
  margin: 0 3px 0 2px;
}
.t-clock .t-svg-icon { width: calc(19 * var(--hud-px)); height: calc(19 * var(--hud-px)); }
.t-clock span {
  align-self: flex-start;
  margin: 0 0 0 1px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: calc(12 * var(--hud-px));
  line-height: 1;
}

/* ── FLOATING UNDO / CONFIRM
   Anchored to a corner of the last tile dragged and opening away from it, so
   it never covers the head — pressing the head is how a short path is
   continued. It carries its own dark ground rather than sitting bare on the
   grass: the board runs six shades of green and a cream button on the light
   ones has almost no edge. */
.t-dragbox {
  --dragbox-rim: rgba(16,29,19,.62);
  position: absolute;
  z-index: 60;
  display: flex;
  border-radius: 13px;
  box-shadow:
    0 0 0 2px var(--dragbox-rim),
    0 4px 0 rgba(16,29,19,.42),
    0 9px 18px -7px rgba(0,0,0,.7);
}
/* A class rule outranks the browser's own [hidden], so the display above would
   otherwise park the box over the main menu. */
.t-dragbox[hidden] { display: none; }

/* The tail names the tile the box is asking about — one capsule can be
   anchored to any of four corners, and without it the box is just a control
   that appeared somewhere. It grows from whichever edge faces the head, in
   the colour of the half it grows out of.
   Only its two OUTER edges carry the rim: a square rotated 45deg points its
   bottom-right corner straight down, so border-right and border-bottom are
   exactly the two that show. The other half of the diamond is inside the
   capsule, over a button of its own colour, where it cannot be seen.
   Its length is DRAG_GAP (js/ui.js) — it bridges the gap to the tile exactly,
   touching it without covering it, which is what the head must never be. */
.t-dragbox[data-arm]::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
}
.t-dragbox[data-arm^="up"]::after {
  bottom: -5px;
  border-right: 2px solid var(--dragbox-rim);
  border-bottom: 2px solid var(--dragbox-rim);
}
.t-dragbox[data-arm^="down"]::after {
  top: -5px;
  border-left: 2px solid var(--dragbox-rim);
  border-top: 2px solid var(--dragbox-rim);
}
/* Opened to the right of the head, so the head is off the box's left end —
   under Undo, which is the cream half. */
.t-dragbox[data-arm$="right"]::after { left: 14px; background: var(--parchment-dim); }
.t-dragbox[data-arm$="left"]::after { right: 14px; background: var(--bounty); }
/* The width is still a constraint, just a looser one: an edge-aligned box runs
   from one edge of the head tile to the board's, which from the CENTRE column
   caps it at (board / 2) + (cell / 2) — 200px on a 360px board at a 40px cell.
   Over that and both horizontal arms miss at the one position a player is most
   likely to be drawing in, and the clamp takes over. The capsule lands at
   142px, so there is room now for an icon (~19px) that the old corner-offset
   placement, capped at ~151px, had none for. */
.t-dragbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  padding: 0 12px;
  border: none;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .2px;
  color: var(--mud-deep);
}
/* The ends are rounded on the buttons themselves rather than clipped by the
   capsule: overflow:hidden would take the tail off with the corners. */
.t-dragbtn--undo {
  background: var(--parchment-dim);
  border-radius: 13px 0 0 13px;
  box-shadow: inset -1px 0 0 rgba(16,29,19,.28);
}
.t-dragbtn--confirm {
  background: var(--bounty);
  border-radius: 0 13px 13px 0;
}
/* Bigger than the 1em default: at the label's 12.5px a tick loses its corner. */
.t-dragbtn .t-svg-icon { width: 15px; height: 15px; }
/* One capsule, so a pressed half darkens where a separate button would sink —
   dropping one end of a joined pair pulls the shape apart. */
.t-dragbtn--undo:active { background: var(--edge); }
.t-dragbtn--confirm:active { background: var(--bounty-deep); }

/* Small raised button. Down to one user — the world map's back control — now
   that the campaign exit and the results restore have moved into the HUD's
   own control strip and wear .t-hud-btn. */
.t-stone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 9px 11px;
  border: none;
  border-radius: 12px;
  background: var(--parchment);
  color: var(--mud-deep);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--edge), 0 8px 16px -8px rgba(0,0,0,.6);
  transition: transform .1s, box-shadow .1s;
}
.t-stone-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.t-stone-btn .t-svg-icon { width: 18px; height: 18px; }

/* A stone button that names where it goes. The world map's back arrow used to
   be bare, which left the one control on that screen saying nothing — and an
   arrow alone is the same mark the in-game Undo wears. It matches the HUD's
   own back button, which is labelled for exactly that reason. */
.t-stone-btn--labelled {
  gap: 6px;
  padding: 9px 13px 9px 11px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
}


/* ═══════════════════════════════════ OVERLAYS & CARDS */

.t-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The insets: a card is centred in the safe area rather than the screen,
     and a scrolling overlay's content starts under the status bar's edge
     rather than beneath the clock. Both are 20px wherever there is none. */
  padding: max(20px, var(--safe-top)) 20px max(20px, var(--safe-bottom));
  font-family: var(--body);
}

/* The menu backdrop, worn by every screen that is not a board or the world
   map: the board's grass as big soft checks, four to the column's width and
   barely two shades apart, so it reads as texture rather than as a board.
   Centred, so the checks fall symmetrically about the title or the card.
   Gradients paint instantly and weigh nothing, which matters because the
   boot screen wears this too and is the game's very first frame. It replaced
   a meadow at dusk (issue #95), itself the replacement for a 2.2 MB painting. */
.t-overlay--map {
  --check: calc(min(100vw, var(--column)) / 4);
  background:
    repeating-conic-gradient(#58B95B 0 25%, #4DB050 0 50%)
    50% 50% / calc(var(--check) * 2) calc(var(--check) * 2);
  /* Never seen — the checks are opaque and tile the whole box — but it is the
     colour iOS Safari tints its status bar and toolbar from when a fixed
     element reaches the screen's edge. Light green here tinted them light on
     the menu, then dark once a game showed the body's ground; dark here keeps
     them the body's dark green throughout. */
  background-color: var(--forest-deep);
}
/* A shade behind whatever stands in the middle, and a darker edge. */
.t-overlay--map::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(18,48,22,.26) 0, rgba(18,48,22,0) 42vh),
    radial-gradient(circle at 50% 50%, rgba(12,36,16,0) 30vh, rgba(12,36,16,.35) 75vh);
}

/* The first frame, before js/main.js has run: the menu's backdrop with nothing
   on it yet. It covers the game shell, and sits below every overlay (lowest
   100) so that if it were ever left behind it would hide rather than block.
   pointer-events:none for the same reason — it can never swallow a tap. */
#boot-screen {
  z-index: 50;
  pointer-events: none;
}

.t-overlay--dim   { background: rgba(12,26,14,.72); }
.t-overlay--dimmer{ background: rgba(12,26,14,.85); }

/* Scrollable overlay that still centres its card. Auto margins beat
   align-items in the cross axis: centred when there's room, scrolling from
   the top edge when there isn't (align-items:center would clip the top). */
.t-overlay--scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}
.t-overlay--scroll > * {
  margin-top: auto;
  margin-bottom: auto;
}

/* Parchment card — the default surface for every menu and modal */
.t-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  max-height: 88svh;   /* the viewport a player sees, chrome and all — see #ui-panel */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--parchment);
  border-radius: 22px;
  /* Set through variables so the screen-size rules below move one side at a
     time, and the studs and the results card's ▼ can read where the content
     starts. */
  --card-pad-top: 30px;
  --card-pad-x: 22px;
  --card-pad-bottom: 24px;
  padding: var(--card-pad-top) var(--card-pad-x) var(--card-pad-bottom);
  text-align: center;
  color: var(--ink);
  box-shadow:
    0 4px 0 rgba(0,0,0,.10),
    0 30px 60px -20px rgba(0,0,0,.55),
    inset 0 0 0 1px var(--edge);
}

.t-card--wide { max-width: 420px; }

/* Two gold studs at the top corners — the landing page signup-card motif —
   on every card, so no menu is missing them (issue #235). They sit inside the
   padding box so a scrolling card never clips them. The lessons are not
   cards (.t-coach) and stay bare; a photo pinned over a card's corner simply
   covers its stud. */
.t-card::before,
.t-card::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: var(--bounty);
  border-radius: 50%;
  top: 13px;
  box-shadow: inset 0 -3px 0 var(--bounty-deep);
}
.t-card::before { left: 16px; }
.t-card::after  { right: 16px; }

/* The boss briefing has no card variant of its own: it is an ordinary
   parchment card, and the red warning sign in its heading carries the whole
   signal. It used to be a scorched dark card ringed in orange, which read as
   aggression rather than as a heads-up. */

/* Campaign complete — gilded variant */
.t-card--gold {
  background: linear-gradient(160deg, #2a5a2a 0%, #14330f 100%);
  color: var(--parchment);
  box-shadow:
    0 4px 0 rgba(0,0,0,.3),
    0 0 40px rgba(232,184,74,.28),
    0 30px 60px -20px rgba(0,0,0,.6),
    inset 0 0 0 2px var(--bounty);
}
.t-card--gold .t-title { color: var(--bounty); }
.t-card--gold .t-body,
.t-card--gold .t-note { color: var(--parchment-dim); }

/* Main menu — hero lockup on the map, no card (mirrors the landing hero) */
.t-menu-hero {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.t-menu-actions { margin-top: 30px; }

/* The lifetime trample count (issue #218): one quiet line under the menu's
   buttons, and the same line, same type, rolling over at the foot of the
   results screen. White at the version stamp's weight of quiet — it sits on
   the menu's checks and on a results card's scrim alike. */
.t-lifetime {
  margin: 18px 0 0;
  font-family: var(--body);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

/* On the results overlay, bottom centre. The card is capped at 88svh and
   centred, which leaves 6svh under it — 38px on a 360×640 — and this line
   takes about 26. It stands on the overlay rather than the screen, so it goes
   with the card and hides with it when the card is minimised. */
.t-lifetime--ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(8px, calc(var(--safe-bottom) - 14px));
  margin: 0;
  text-align: center;
  pointer-events: none;
}

.t-lifetime__line { white-space: nowrap; }
.t-lifetime__num { display: inline-flex; vertical-align: bottom; }

/* One wheel per digit: a strip of faces in a one-digit window, rolled up by
   --steps faces (set per wheel in attachTrampleTicker). Every wheel takes the
   same time, so they land together; the delay lets the card pop in first. */
.t-odo {
  display: inline-block;
  height: 1.3em;
  overflow: hidden;
}
.t-odo__strip {
  display: flex;
  flex-direction: column;
  animation: t-odo-roll 1400ms cubic-bezier(.2, .7, .2, 1) 500ms both;
}
.t-odo__strip > span { display: block; height: 1.3em; }
@keyframes t-odo-roll {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(var(--steps) * -1.3em)); }
}

/* A comma with no digit before it yet (999 → 1,012) arrives as the wheels land. */
.t-odo__sep.is-new { animation: t-fade-in 200ms ease-out 1700ms both; }
@keyframes t-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* A game that crosses a milestone turns the line gold as the wheels land,
   with a small pop, and it stays gold for the rest of the card. */
.t-lifetime.is-milestone .t-lifetime__line {
  display: inline-block;
  animation: t-milestone-gold 600ms ease-out 1850ms both;
}
@keyframes t-milestone-gold {
  0%   { color: inherit; transform: none; }
  40%  { color: var(--bounty); transform: scale(1.12); }
  100% { color: var(--bounty); transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .t-odo__strip,
  .t-odo__sep.is-new,
  .t-lifetime.is-milestone .t-lifetime__line { animation-duration: 1ms; animation-delay: 0ms; }
}

/* ═══════════════════════════════════ TYPE */

.t-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--forest);
  margin: 0 0 10px;
}

/* Heading with the warning sign in front of it — the boss briefing. The sign
   is the one red thing on the card; the words stay the ordinary title colour.
   Flex rather than an inline glyph because .t-svg-icon is a block. */
.t-title--warn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.t-warn-sign { display: inline-flex; color: var(--danger); }
.t-warn-sign .t-svg-icon { width: .92em; height: .92em; }

.t-title--hero {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(48px, 15vw, 78px);
  line-height: .9;
  letter-spacing: -.04em;
  color: #fff;
  margin: 0;
  text-shadow: 0 3px 0 var(--meadow-dark), 0 12px 26px rgba(0,0,0,.45);
}

.t-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

.t-body {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.t-body strong { color: var(--ink); font-weight: 600; }
/* A second, quieter line under a card's opening paragraph. */
.t-body--aside { font-size: 13px; }

.t-note {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .4px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}

/* ═══════════════════════════════════ BUTTONS */

.t-btn {
  display: block;
  width: 100%;
  margin: 9px 0 0;
  padding: 14px 22px;
  border: none;
  border-radius: 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
  color: var(--mud-deep);
  background: var(--parchment-dim);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--edge), 0 10px 20px -12px rgba(0,0,0,.5);
  transition: transform .1s, box-shadow .1s;
}
.t-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--edge);
}

/* Two answers side by side (a yes-or-no confirm). */
.t-btn-row { display: flex; gap: 10px; margin-top: 18px; }
.t-btn-row .t-btn { flex: 1; margin-top: 0; }

/* A results button split in two (issue #225): the face, and on its right a
   segment that opens the level's card first. One button's colour and emboss,
   cut by a hairline, so it reads as one control with a second door. */
.t-split { display: flex; margin: 9px 0 0; }
.t-split > .t-btn { margin: 0; }
.t-split__main { flex: 1; min-width: 0; border-radius: 14px 0 0 14px; }
.t-split > .t-split__more {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  padding: 0;
  border-radius: 0 14px 14px 0;
  border-left: 1px solid rgba(0,0,0,.16);
  display: flex;
  align-items: center;
  justify-content: center;
}
.t-split__more .t-svg-icon { width: 22px; height: 22px; }
/* A link dressed as a button (e.g. the sign-up on the castle menu) */
a.t-btn {
  box-sizing: border-box;
  text-decoration: none;
  text-align: center;
}

/* A link dressed as a button with a mark beside its label — the sign-up and
   the feedback link (issue #155), which sit one above the other at the foot
   of the cards that end a game. The shape is shared so the pair reads as one
   block under the buttons you came to press, and the mark beside each label
   is what tells them apart. */
.t-btn--iconlink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  padding: 11px 18px;
}
.t-btn--iconlink:active { transform: translateY(2px); }
.t-btn--iconlink .t-svg-icon { width: 16px; height: 16px; }

/* Sign-up CTA: an offer, so it shouldn't compete with the button you came to
   press — but it still has to be readable. The bounty-coloured ring gives it
   presence on both the parchment and the dark cards, while the text colour
   comes from whichever ghost variant the caller picked for that background.
   It reaches the button only where the caller picked a class that doesn't
   set one of its own — the castle card's gold — which is the one card where
   the sign-up is the thing you came to press. */
.t-btn--signup {
  box-shadow: inset 0 0 0 2px var(--bounty-deep);
}
.t-btn--signup:active {
  box-shadow: inset 0 0 0 2px var(--bounty-deep);
}

/* The in-game ✉ is a link, not a button, so it needs the same reset a.t-btn
   gets. */
a.t-stone-btn { text-decoration: none; }

/* ═══════════════════════════════════ BUILD STAMP */

/* Top-left on every screen. Above the overlays (max z-index 400) but
   pointer-events:none, so it can never intercept a tap. The shadow keeps it
   legible on the parchment cards as well as the dark backdrops. */
.t-version {
  position: fixed;
  top: max(5px, var(--safe-top));
  left: max(7px, env(safe-area-inset-left), calc(var(--column-gutter) + 7px));
  z-index: 500;
  pointer-events: none;
  user-select: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .5px;
  color: rgba(255, 255, 255, .8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* The mute toggle (issue #133) — the version stamp's opposite corner, and the
   same idea: pinned, outliving every screen. It is live everywhere the stamp
   is not, so it carries a real hit area (the icon is 18px; the padding takes
   the target past 40px) while staying quiet enough to ignore. Dimmed when
   muted, so the state reads at a glance from the weight rather than from
   reading the mark. It sits above the scenes it lives on (the menus and the
   map are 200) and under every card that can open over one (300 and up), so
   a boss warning or the scoreboard covers it as it covers the rest of the
   scene — unlike the stamp, which can float over them because it takes no
   taps. The one card it stands over is a confirm: see .is-raised below.
   It sits on a translucent dark disc (issue #232): a bare white mark with a
   drop shadow vanished on the pale checks of the menus and the map's sky, and
   a disc is the shape a volume control is expected to have. Its 40px is the
   tap target, and the muted states dim the mark, never the disc. */
.t-audio {
  position: fixed;
  top: max(5px, var(--safe-top));
  right: max(7px, env(safe-area-inset-right), calc(var(--column-gutter) + 7px));
  z-index: 250;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
  border: 0;
  border-radius: 50%;
  background: rgba(30, 36, 32, .38);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255, 255, 255, .18);
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

/* It is hidden for the whole of a game (see showAudioToggle), and a class rule
   outranks the browser's own [hidden] { display: none } — without this the
   button would sit over the top-right cell of every board. */
.t-audio[hidden] { display: none; }

/* Over a confirm card (see showAudioToggle) it is raised above the card's
   scrim (400) so it takes taps: the quit-game confirm is the one way to reach
   it during a game, and it stays in its usual corner so it is found where it
   always is. */
.t-audio.is-raised { z-index: 450; }

.t-audio .t-svg-icon { width: 18px; height: 18px; stroke-width: 2; }

.t-audio.is-muted { color: rgba(255, 255, 255, .5); }
.t-audio.is-partial { color: rgba(255, 255, 255, .6); }

.t-audio:active { transform: scale(.92); }

/* The sound menu under the speaker: a volume slider each for the music and
   the effects (issue #181). Placed from the same corner as the button, in the
   same band, and raised with it over a confirm. */
.t-audio-menu {
  position: fixed;
  top: calc(max(5px, var(--safe-top)) + 42px);
  right: max(7px, env(safe-area-inset-right), calc(var(--column-gutter) + 7px));
  z-index: 250;
  width: 208px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--parchment);
  color: var(--ink);
  box-shadow:
    0 4px 0 rgba(0,0,0,.10),
    0 18px 40px -14px rgba(0,0,0,.55),
    inset 0 0 0 1px var(--edge);
}
.t-audio-menu[hidden] { display: none; }
.t-audio-menu.is-raised { z-index: 450; }

.t-audio-menu__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}

.t-audio-menu__label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

/* The slider: a mud-filled track and a parchment thumb, the size of a
   fingertip. The height is the touch target; the track is drawn thin inside
   it. WebKit has no pseudo-element for the filled part, so it is a gradient
   stopped at --fill, set from the value (showAudioToggle) — it moves less
   than half a thumb from the thumb's centre, so the edge is always under it. */
.t-audio-menu__slider {
  --fill: 100%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  background: none;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.t-audio-menu__slider:focus { outline: none; }
.t-audio-menu__slider:focus-visible { outline: 2px solid var(--bounty); outline-offset: 2px; border-radius: 6px; }

.t-audio-menu__slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--mud) var(--fill), #fff var(--fill));
  box-shadow: inset 0 0 0 1px var(--edge);
}
.t-audio-menu__slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.t-audio-menu__slider::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--mud);
}
.t-audio-menu__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: var(--parchment);
  box-shadow: inset 0 0 0 2px var(--mud-deep), 0 2px 3px rgba(0, 0, 0, .3);
}
.t-audio-menu__slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--parchment);
  box-shadow: inset 0 0 0 2px var(--mud-deep), 0 2px 3px rgba(0, 0, 0, .3);
}
.t-audio-menu__slider:active::-webkit-slider-thumb { transform: scale(1.1); }
.t-audio-menu__slider:active::-moz-range-thumb { transform: scale(1.1); }

/* ?audio=debug only — never in an ordinary session. */
.t-audio-debug {
  position: fixed;
  left: max(6px, env(safe-area-inset-left));
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 600;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.4;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  padding: 3px 6px;
  border-radius: 4px;
}

.t-btn--gold {
  background: var(--bounty);
  color: var(--mud-deep);
  box-shadow: 0 4px 0 var(--bounty-deep), 0 10px 20px -12px rgba(0,0,0,.5);
}
.t-btn--gold:active { box-shadow: 0 1px 0 var(--bounty-deep); }

.t-btn--green {
  background: var(--meadow);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
  box-shadow: 0 4px 0 var(--meadow-dark), 0 10px 20px -12px rgba(0,0,0,.5);
}
.t-btn--green:active { box-shadow: 0 1px 0 var(--meadow-dark); }

.t-btn--mud {
  background: var(--mud);
  color: #fff;
  box-shadow: 0 4px 0 var(--mud-deep), 0 10px 20px -12px rgba(0,0,0,.5);
}
.t-btn--mud:active { box-shadow: 0 1px 0 var(--mud-deep); }

.t-btn--ember {
  background: #FF6B35;
  color: #2a1200;
  box-shadow: 0 4px 0 #A83E14, 0 10px 20px -12px rgba(0,0,0,.6);
}
.t-btn--ember:active { box-shadow: 0 1px 0 #A83E14; }

/* Quiet, secondary action on a parchment card */
.t-btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px var(--edge);
  font-size: 15px;
  padding: 11px 20px;
}
.t-btn--ghost:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--edge); }

/* Quiet, secondary action on a dark card */
.t-btn--ghost-dark {
  background: transparent;
  color: var(--parchment-dim);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.28);
  font-size: 15px;
  padding: 11px 20px;
}
.t-btn--ghost-dark:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.28); }

.t-btn--danger {
  background: transparent;
  color: var(--danger);
  box-shadow: inset 0 0 0 2px var(--danger);
  font-size: 15px;
  padding: 11px 20px;
}
.t-btn--danger:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--danger); }

/* Inline SVG icons — glyphs like ↩ get emoji presentation on iOS, so every
   piece of UI chrome that isn't deliberately an emoji uses a drawn icon. */
.t-svg-icon {
  width: 1em;
  height: 1em;
  display: block;
}
.t-minimise-btn .t-svg-icon { width: 16px; height: 16px; }
.t-minimise-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════ SEGMENTED OPTIONS ("paving stones") */

.t-field { margin-bottom: 16px; }

.t-seg {
  display: flex;
  gap: 7px;
  justify-content: center;
}

.t-opt {
  flex: 1;
  min-width: 0;
  padding: 12px 8px;
  border: none;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--edge), inset 0 0 0 1px var(--edge);
  transition: transform .1s, box-shadow .1s, background .12s, color .12s;
}
.t-opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge), inset 0 0 0 1px var(--edge); }

.t-opt.is-selected {
  background: var(--mud);
  color: #fff;
  box-shadow: 0 3px 0 var(--mud-deep), inset 0 0 0 1px var(--mud-deep);
}

.t-opt__sub {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 3px;
}
.t-opt.is-selected .t-opt__sub { color: var(--parchment-dim); }

/* ═══════════════════════════════════ SLIDERS */

.t-label--row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.t-slider__val {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: none;
  color: var(--mud);
  font-weight: 600;
}

.t-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 12px;
  margin: 0;
  padding: 0;
  background: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 2px 0 rgba(0,0,0,.07);
  outline: none;
  cursor: pointer;
}

/* Thumb repeated per engine — a combined selector list is dropped whole by
   browsers that don't recognise every prefix in it. */
.t-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--mud);
  box-shadow: 0 3px 0 var(--mud-deep), inset 0 0 0 1px var(--mud-deep);
  cursor: pointer;
}
.t-slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--mud);
  box-shadow: 0 3px 0 var(--mud-deep), inset 0 0 0 1px var(--mud-deep);
  cursor: pointer;
}
.t-slider::-moz-range-track { background: transparent; }

.t-slider:focus-visible { box-shadow: inset 0 0 0 2px var(--bounty); }

/* Per-player path style row */
.t-player-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
}
.t-player-row .player-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 -2px 0 rgba(0,0,0,.22), 0 0 0 1.5px rgba(0,0,0,.12); }
.t-player-row .t-player-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  min-width: 22px;
}
.t-player-row .t-pick { flex: 0 1 190px; }

/* ═══════════════════════════════════ RESULTS */

.t-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 30px;
  line-height: 1;
  margin: 0 0 14px;
}
.t-star--on  { color: var(--bounty); text-shadow: 0 2px 0 var(--bounty-deep); }
.t-star--off { color: var(--edge); }
.t-card--gold .t-star--off { color: rgba(255,255,255,.22); }
/* The star key under the stars themselves (issue #120): each star names what
   earns it, so a hollow one says what was missed. Columns, so the three
   captions sit under their stars whatever their width, and the row costs
   the card one line of small type rather than a key of its own. */
.t-stars--keyed { gap: 6px; align-items: flex-start; }
/* A star that was never on offer (issue #172): the ladder is cumulative, so
   once a star is missed every star after it is out of reach, and a hollow
   star there read as merely missed. A solid padlock in the hollow star's
   colour, in the star's own 30px box, so the row keeps its rhythm. */
.t-star--locked { display: block; width: 30px; height: 30px; color: var(--edge); }
.t-star-lock { display: block; width: 100%; height: 100%; }
.t-card--gold .t-star--locked { color: rgba(255,255,255,.22); }
/* The arrow between the stars (issue #172, a plus before it): each star
   needs the one before it, so the row reads "then", not "and". In the mud
   the card's buttons are lettered in, near full strength — the plus at half
   strength was too quiet to say the order was the rule. */
.t-star-step {
  display: flex;
  align-items: center;
  height: 30px;
  margin: 0 1px;
  color: var(--mud);
  opacity: .85;
}
/* 16px: the row is 280px wide at that, inside the 288px a 360 phone's card
   gives it. */
.t-star-step svg { display: block; width: 16px; height: 16px; }
.t-card--gold .t-star-step { color: #fff; opacity: .6; }
.t-star-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 72px;
}
.t-star-cap {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--mud);
  white-space: nowrap;
}
.t-star-col.is-off .t-star-cap { color: var(--ink-soft); opacity: .55; }
.t-star-col.is-locked .t-star-cap { opacity: .4; }

/* A results card's score row (issue #243): the player and their total, and
   their tallies only once it is pressed — a button, so the row drops down
   under the thumb the way a picker opens. The detail is a 0fr → 1fr grid row,
   which is what lets its height animate without a measured max-height. */
.t-result {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--edge);
  overflow: hidden;
}
.t-result--winner {
  background: var(--bounty);
  box-shadow: inset 0 0 0 1px var(--bounty-deep);
}
.t-result__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-weight: 600;
  font-size: 15px;
}
.t-result__score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
/* The chevron says the row opens; faint, so the total stays the thing read. */
.t-result__score .t-svg-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
  opacity: .45;
  transition: transform .2s ease;
}
.t-result.is-open .t-result__score .t-svg-icon { transform: rotate(180deg); }
.t-result__detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .2s ease;
}
.t-result.is-open .t-result__detail { grid-template-rows: 1fr; }
.t-result__tally {
  overflow: hidden;
  min-height: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .4px;
  color: var(--ink-soft);
  padding: 0 12px;
  text-align: right;
  transition: padding .2s ease;
}
.t-result.is-open .t-result__tally { padding-bottom: 8px; }
.t-result--winner .t-result__tally { color: var(--mud-deep); }

/* A campaign level's records, as a tagline at the card's foot (issue #243) —
   the daily card's streak line, with a record this run beat in gold. */
.t-best { margin: 14px 0 0; font: 600 13px var(--mono); color: var(--mud); }
.t-best__stars { letter-spacing: 1px; color: var(--bounty); text-shadow: 0 1px 0 var(--bounty-deep); }
.t-flag { font-weight: 800; color: var(--bounty-deep); }

/* Boss briefing */
.t-boss-crest {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}
/* Same white-on-parchment panel the results rows use, so an ability reads as
   one more piece of briefing rather than as an alarm. */
.t-ability {
  text-align: center;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--edge);
}
/* Stroked line art, not an emoji — so it takes a colour, and takes the
   heading's. See BOSS_ABILITIES in js/boss-abilities.js for why. */
/* Flex, not text-align: .t-svg-icon is a block, so the card centring the text
   around it leaves the mark itself sitting against the left edge. Same reason
   .t-title--warn is a flex row. */
.t-ability__icon {
  display: flex;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  color: var(--forest);
  margin-bottom: 3px;
}
.t-ability__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  color: var(--forest);
  margin: 5px 0 3px;
}
.t-ability__text { font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); }

/* ═══════════════════════════════════ LEVEL CARD (issue #225)
   The card before a level: its number and name, its bests, and the two
   choices it is played with. The head keeps clear of the journal frame in the
   corner on both sides, so the name stays centred on the card. */
.t-level-card__head { padding: 0 54px; }
.t-level-card__eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--mud);
  margin: 2px 0 4px;
}
.t-level-card__best {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mud);
  margin: 2px 0 14px;
}
.t-level-card__best b { font-family: var(--display); font-size: 15px; letter-spacing: 0; color: var(--ink); margin-left: 4px; }
/* The two choices as rows, the label beside its picker: side by side, a
   360-wide phone cut "Long Stride" to "Long Str…". */
.t-level-card__picks {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px 12px;
}
.t-level-card__field { display: contents; }
.t-level-card__field .t-label { margin: 0; text-align: left; }
.t-level-card__note {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bounty-deep);
  margin: 10px 0 4px;
  visibility: hidden;
}
.t-level-card__note.is-capped { visibility: visible; }

/* ═══════════════════════════════════ THE PICKER (issue #225)
   The game's own dropdown, for the level card and the ability offer: the
   choice on a white button with a chevron, opening a parchment list of rows
   — a mark and a name, the chosen one ticked. It replaced the system's own
   <select>, whose wheel on a phone looked out of place on the cards. */
.t-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px 9px 12px;
  border: none;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--edge), inset 0 0 0 1px var(--edge);
}
.t-pick[aria-expanded="true"] { box-shadow: 0 3px 0 var(--edge), inset 0 0 0 2px var(--mud); }
.t-pick__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-pick__chev { display: flex; color: var(--mud); }
.t-pick__chev .t-svg-icon { width: 16px; height: 16px; }
.t-pick[aria-expanded="true"] .t-pick__chev { transform: rotate(180deg); }
/* A trail's own colour as a small tile; Paved cut into its four slabs. */
.t-pick__swatch {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.t-pick__swatch.is-slabs {
  background:
    linear-gradient(var(--grout), var(--grout)) center / 100% 1.5px no-repeat,
    linear-gradient(var(--grout), var(--grout)) center / 1.5px 100% no-repeat,
    var(--swatch);
}
.t-pick__icon { flex: 0 0 auto; display: flex; color: var(--forest); }
.t-pick__icon .t-svg-icon { width: 18px; height: 18px; }
.t-pick__none {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px;
  border-radius: 50%;
  border: 1.5px dashed var(--edge);
}
/* Not seen yet: on the row, and on the button until its list is opened —
   there as a badge on the top edge, so it takes none of the name's room. */
.t-pick__new {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--mud-deep);
  background: var(--bounty);
  border-radius: 99px;
  padding: 2px 6px;
}
.t-pick > .t-pick__new {
  position: absolute;
  top: -8px;
  right: 10px;
  box-shadow: 0 0 0 2px var(--parchment);
}
.t-pick-list {
  position: fixed;
  max-width: calc(100vw - 16px);
  z-index: 460;
  display: flex;
  flex-direction: column;
  padding: 6px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--parchment);
  border-radius: 14px;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.55), inset 0 0 0 1px var(--edge);
  animation: t-pick-in .14s ease-out;
}
@keyframes t-pick-in { from { opacity: 0; transform: translateY(-4px); } }
.t-pick-list__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.t-pick-list__row:active { background: rgba(0,0,0,.06); }
.t-pick-list__row.is-chosen { background: #fff; box-shadow: inset 0 0 0 1px var(--edge); }
.t-pick__tick { display: flex; color: var(--meadow-dark); visibility: hidden; }
.t-pick__tick .t-svg-icon { width: 16px; height: 16px; }
.t-pick-list__row.is-chosen .t-pick__tick { visibility: visible; }

/* The ability offer on a second defeat (issue #225). */
.t-offer__pick { margin: 4px 0 6px; text-align: left; }
.t-offer__text { display: grid; }
.t-offer__text > .t-body { grid-area: 1 / 1; }
.t-offer__text > .t-body[aria-hidden] { visibility: hidden; }

/* The field journal's photo of the level (issue #216), hung over the card's
   top-left corner like the results card's, the same size and tilt. It sits
   in the card's pin (.t-card-pin--level) so the card's scrolling cannot clip
   it. Blank until the level is won. */
.t-card-pin--level { max-width: 380px; }
.t-journal-frame {
  position: absolute;
  z-index: 3;
  top: -30px;
  left: -10px;
  width: 72px;
  padding: 4px 4px 12px;
  border: none;
  border-radius: 2px;
  background: #fff;
  transform: rotate(-7deg);
  box-shadow: 0 3px 8px rgba(0,0,0,.28), inset 0 0 0 1px var(--edge);
  cursor: pointer;
}
.t-journal-frame:disabled { cursor: default; box-shadow: 0 2px 5px rgba(0,0,0,.18), inset 0 0 0 1px var(--edge); }
.t-journal-frame:active:not(:disabled) { transform: rotate(-7deg) translateY(2px); }
.t-journal-frame__photo {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  object-position: center 50%;
  background: var(--parchment-dim);
  box-shadow: inset 0 0 0 1px var(--edge);
}
/* The badge on the frame's outer corner, so the frame's right edge is all
   the name beside it has to clear. */
.t-journal-frame__badge {
  position: absolute;
  left: -9px;
  bottom: -7px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bounty);
  color: var(--mud-deep);
  box-shadow: 0 2px 0 var(--bounty-deep), 0 3px 6px rgba(0,0,0,.25);
  transform: rotate(7deg);
}
.t-journal-frame__badge .t-svg-icon { width: 14px; height: 14px; }

.t-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.t-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-soft);
  padding: 6px 8px;
  border-bottom: 2px solid var(--edge);
}
.t-table td { padding: 9px 8px; border-bottom: 1px solid var(--edge); }
.t-table tfoot td {
  border-top: 2px solid var(--edge);
  border-bottom: none;
  font-weight: 700;
  padding-top: 11px;
}
/* A TALL CARD ON A SHORT PHONE (issue #155). The campaign scoreboard is the
   tallest card in the game — five ranks, a total, a note and three buttons —
   and on a 360x640 it wanted 595px inside a card that caps at 88svh = 563.
   The overflow does not run off the screen, which is why it is easy to miss:
   `.t-card` scrolls, so the last call to action sat below the card's OWN
   fold, with nothing on screen to say it was there. Measure a card with
   `scrollHeight > clientHeight`, never against the viewport.

   What gives is the rhythm, never the type: a table row loses padding and
   the card loses some of its own, so nothing gets smaller to read. 45px,
   which clears the 640 with room and takes the 375x667 SE with it. */
@media (max-height: 700px) {
  /* The studs come up with the top padding, so the card's first line keeps
     clear of them. */
  .t-card { --card-pad-top: 24px; --card-pad-bottom: 18px; }
  .t-card::before, .t-card::after { top: 7px; }
  .t-table td { padding: 6px 8px; }
  .t-table tfoot td { padding-top: 8px; }
  /* Three full-width buttons stacked: 9px between them is generous on a
     screen this size, and the gaps are the last thing a player reads. */
  .t-btn { margin-top: 6px; }
  .t-split { margin-top: 6px; }
  .t-body { margin-bottom: 10px; }
  .t-boss-crest { font-size: 28px; margin-bottom: 6px; }
  /* A four-player daily result (issue #217) is the tallest results card: its
     head wraps to two lines beside the photo and its foot is a line more. */
  .t-result { margin-bottom: 6px; }
  .t-result__row { padding: 7px 12px; }
  .t-stars { margin-bottom: 10px; }
  .t-daily-foot, .t-best { margin-top: 8px; }
}

.t-table .col-rank  { text-align: left; font-weight: 600; }
.t-table .col-stars { text-align: center; color: var(--bounty); text-shadow: 0 1px 0 var(--bounty-deep); font-weight: 600; }
.t-table .col-score { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.t-table tr.is-locked { opacity: .4; }
.t-rank-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}
/* Dark-card variants of the table */
.t-card--gold .t-table th,
.t-card--gold .t-table td { border-color: rgba(255,255,255,.14); }
.t-card--gold .t-table th,
.t-card--gold .t-table .col-score { color: var(--parchment-dim); }
.t-card--gold .t-table .col-stars { color: var(--bounty); }

/* Minimise (▼) control pinned to the top-right of a results card. It takes
   the right stud's place (issue #235): the stud goes, and the button stands
   over where it was, 8px under the card's top edge and 12px in from its
   right — centred on the stud it was 4px and 7px, which read as crowding the
   card's edge. The bar stays at the content's top-right corner and the button is
   moved out of it, so nothing below shifts. A sticky top counts from inside
   the card's padding, so top 0 keeps it in the same spot as the card
   scrolls. */
.t-card.has-minimise::after { display: none; }
.t-minimise-bar {
  position: sticky;
  top: 0;
  height: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 2;
}
.t-minimise-bar .t-minimise-btn {
  transform: translate(calc(var(--card-pad-x) - 12px), calc(8px - var(--card-pad-top)));
}
.t-minimise-btn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--parchment-dim);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.t-card--gold .t-minimise-btn {
  background: rgba(255,255,255,.14);
  color: #fff;
  box-shadow: none;
}

/* ═══════════════════════════════════ THE FIELD'S PHOTO (issue #215) */

/* A results card and the photo pinned to it share this box, which the overlay
   centres where the card would stand: the photo hangs off the card's corner,
   and the card's own scrolling would clip it. */
.t-card-pin {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  max-width: 420px;
}
.t-card-pin > .t-card { max-width: none; }

/* The photo over the card's top-left corner, opposite the ▼, the same size
   and tilt as the journal's frame on the level card, its badge on the same
   outer corner, so it clears the first star under the title. */
.t-field-photo {
  position: absolute;
  z-index: 3;
  top: -30px;
  left: -10px;
  width: 72px;
  padding: 4px 4px 12px;
  border: none;
  border-radius: 2px;
  background: #fff;
  transform: rotate(-7deg);
  box-shadow: 0 3px 8px rgba(0,0,0,.28), inset 0 0 0 1px var(--edge);
  cursor: pointer;
}
.t-field-photo:active { transform: rotate(-7deg) translateY(2px); }
.t-field-photo img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  object-position: center 38%;
  background: var(--parchment-dim);
}
.t-field-photo__badge {
  position: absolute;
  left: -9px;
  bottom: -7px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bounty);
  color: var(--mud-deep);
  box-shadow: 0 2px 0 var(--bounty-deep), 0 3px 6px rgba(0,0,0,.25);
  transform: rotate(7deg);
}
.t-field-photo__badge .t-svg-icon { width: 14px; height: 14px; }

/* The journal's photo of the level, in the confirm that would replace it
   (issue #216): the same frame, standing in the card rather than over it. */
.t-field-photo--inline {
  position: relative;
  top: auto;
  left: auto;
  display: block;
  margin: 6px auto 18px;
}

/* The photo upright at full size, Share under it. */
.t-field-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
}
.t-field-view__photo {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  cursor: zoom-in;
}
.t-field-view__photo img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 210px);
  max-height: var(--photo-max, calc(100svh - 210px - var(--safe-top) - var(--safe-bottom)));
  border-radius: 2px;
}
.t-field-view .t-btn { margin-top: 12px; }
/* A button with its mark before its word (Share, Save to journal, Open journal). */
.t-btn--mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.t-btn--mark .t-svg-icon { width: 18px; height: 18px; }
.t-field-view .t-btn[hidden] { display: none; }
.t-field-view__photo + .t-btn, .t-field-view__journal + .t-btn { margin-top: 18px; }
/* What the field journal did with this photo (issue #216). */
.t-field-view__journal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 22px;
  margin-top: 12px;
  font: 600 14px var(--body);
  color: var(--parchment);
}
.t-field-view__journal:empty { display: none; }
.t-field-view__journal .t-svg-icon { width: 16px; height: 16px; color: var(--bounty); }
/* Flipping through the journal: ‹ 2 of 4 ›. */
.t-field-view__nav { display: flex; align-items: center; gap: 18px; margin-top: 12px; }
.t-field-view__nav .t-stone-btn .t-svg-icon { width: 18px; height: 18px; }
.t-field-view__count { min-width: 56px; text-align: center; font: 600 14px var(--mono); color: var(--parchment); }

/* ═══════════════════════════════════ THE DAILY FIELD (issue #217) */

/* The menu's way in: the streak beside a white sun on the left, today's box
   on the right, the label centred between them as on every other button. */
.t-daily-btn { position: relative; }
.t-daily-btn__streak {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
}
.t-daily-btn__streak .t-svg-icon { width: 22px; height: 22px; }
.t-daily-btn__streak b { font: 800 16px var(--display); }
.t-daily-btn__box {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.85);
}
.t-daily-btn__box.is-done { background: var(--parchment); box-shadow: none; color: var(--forest); }
.t-daily-btn__box .t-svg-icon { width: 16px; height: 16px; stroke-width: 3; }

/* The day's card and the daily results card share a head, kept clear of the
   photo in the corner once there is one, so the title stays centred on the
   card. */
.t-daily-head.has-photo { padding: 0 54px; }
/* The day's tagline (issue #248), a quiet line under its name, pulled up
   into the title's margin so the pair reads as one heading. It stands outside
   the head's padding: it is below the photo's frame, so it takes the card's
   full width and stays on one line on a 360 phone. */
.t-daily-tagline {
  margin: -6px 0 12px;
  font: 500 14.5px/1.3 var(--body);
  color: var(--ink-soft);
  text-wrap: balance;
}
.t-daily-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0 0 14px;
  /* The labels in the level card's small caps (issue #245), as its "Best
     score" reads, with the figure standing over each. */
  font: 600 10px var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mud);
}
.t-daily-stats b { display: block; font: 800 22px var(--display); letter-spacing: 0; color: var(--forest); margin-bottom: 2px; }
.t-daily-foot { margin: 14px 0 0; font: 600 13px var(--mono); color: var(--mud); }
/* A replay's stars are its own, but they count for nothing. */
.t-daily-replay-stars { opacity: .45; }

/* ═══════════════════════════════════ THE FIELD JOURNAL (issue #216) */

/* The set's photos as a scrapbook, over the map or the level card: a chapter
   a rank, two photos to a row, each tilted a little the opposite way to its
   neighbour, and a dashed blank frame for every level not yet won. */
.t-journal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  background: var(--forest-deep);
  font-family: var(--body);
}
.t-journal__shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--column);
  background: var(--parchment);
}
.t-journal__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, var(--safe-top)) 14px 12px;
  background: var(--forest-deep);
}
.t-journal__title {
  flex: 1;
  margin: 0;
  text-align: center;
  font: 800 19px var(--display);
  letter-spacing: -.01em;
  color: #fff;
}
.t-journal__spacer { width: 84px; }
.t-journal__bar .t-stone-btn { width: 84px; gap: 4px; }
.t-journal__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px max(30px, var(--safe-bottom));
}
.t-journal__hint {
  margin: 4px 0 14px;
  text-align: center;
  font: 500 14px var(--body);
  color: var(--ink-soft);
}
.t-journal__rank {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 14px;
  font: 600 11px var(--mono);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--mud);
}
.t-journal__rank b { margin-left: auto; font-weight: 600; }
.t-journal__pages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
  margin-bottom: 18px;
}
.t-journal__photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 7px 10px;
  border: none;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 3px 9px rgba(0,0,0,.22), inset 0 0 0 1px var(--edge);
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.t-journal__photo:nth-child(odd) { transform: rotate(-2.2deg); }
.t-journal__photo:nth-child(even) { transform: rotate(1.8deg) translateY(6px); }
.t-journal__img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 50%;
  background: var(--parchment-dim);
}
.t-journal__name { margin-top: 7px; font: 700 13px var(--display); color: var(--ink); }
.t-journal__meta { font: 500 11px var(--mono); letter-spacing: .6px; color: var(--mud); text-transform: uppercase; }
.t-journal__meta em { font-style: normal; letter-spacing: 1px; color: var(--bounty-deep); }
.t-journal__photo.is-empty {
  cursor: default;
  background: transparent;
  box-shadow: none;
  outline: 2px dashed var(--edge);
  outline-offset: -2px;
}
.t-journal__photo.is-empty .t-journal__img { background: transparent; }

/* The photo alone, filling the screen, on its own paper — over everything,
   the version stamp included, so a screenshot is the picture. */
.t-field-full {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) 0 var(--safe-bottom);
  background: #F2EDE0;
  cursor: zoom-out;
}
.t-field-full img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* ═══════════════════════════════════ WORLD MAP */

#campaign-map-overlay {
  position: fixed;
  inset: 0;
  /* The letterbox, the body's own ground, either side of the column below. */
  background: var(--forest-deep);
  overflow: hidden;
}
/* The column the map stands in: the one the game shell is capped at
   (--column), so the map's bar ends where the HUD's does (issue #153). It
   used to be the overlay itself, edge to edge: on a desktop window the scene
   stood 448px wide in the middle of it with Menu and the stars pill a screen
   apart at the far edges, while the game beside it kept to a column. The
   scene is authored at the column's width, so the bar is exactly as wide as
   the map. */
.t-map-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: var(--column);
  margin: 0 auto;
  background: var(--forest);
}

.t-map-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  /* The status bar: the scene scrolls under it, as a map should, and this is
     what lets its top — the castle's sky — still be brought fully into view.
     showWorldMap's scroll maths reads the scene's offset below it. */
  padding-top: var(--safe-top);
}
.t-map-container { position: relative; max-width: var(--column); margin: 0 auto; }
.t-map-scene-wrap { position: relative; }
/* The scene carries its 448x2319 size as attributes, so it has an intrinsic
   aspect ratio to scale by — the level nodes are positioned in percentages of
   exactly that box. */
.t-map-scene { width: 100%; height: auto; display: block; }
.t-map-layer { position: absolute; inset: 0; }
/* The trail is trodden only as far as the player has come (issue #100). The
   scene draws the whole road, a cell at a time, and the map puts every cell
   past the highest unlocked level back to grass — the ground is painted under
   the road, so hiding a cell is all it takes. The stretch just earned stomps
   in instead, one cell after another on its own delay: each comes down a
   little over size and settles, the way a foot does. */
.t-map-scene .is-grass { display: none; }
.t-map-scene .is-stomp {
  transform-box: fill-box;
  transform-origin: center;
  animation: mapStomp .28s cubic-bezier(.3, 1.4, .5, 1) both;
}

/* The rank pill (issue #216): the rank in view and its stars, top centre,
   pressed for Campaign Progress. */
.t-rank-label {
  position: fixed;
  top: calc(14px + var(--safe-top)); left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(12,26,14,.8);
  border: 2px solid rgba(255,255,255,.18);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .3s, border-color .3s;
}
.t-rank-label:empty { visibility: hidden; }
.t-rank-label:active { transform: translateX(-50%) translateY(2px); }
.t-rank-label__stars {
  padding-left: 10px;
  border-left: 1.5px solid rgba(255,255,255,.25);
  color: var(--bounty);
}

.t-level-node {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  font-family: var(--display);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
  cursor: pointer;
  transition: transform .1s;
}
.t-level-node.is-locked { cursor: default; }
/* A boss mark on a level node rides in the label's text flow: the base
   .t-svg-icon is a block, which would stack the icon above the number instead
   of beside it. Sized in em so it follows the node's own font-size, and given
   its shadow as a filter — text-shadow does not reach an SVG's strokes, and
   without one the mark washes out over the map's pale cells. */
.t-level-node .t-svg-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -.14em;
  stroke-width: 3;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.9));
}
/* Where a campaign begins (issue #210): a parchment tag and an arrow bobbing
   down onto level 1, stood just above the node. Positioned at the node's own
   centre and lifted by half the node and a gap, so it follows the node
   whatever its size. Fades in after the map has settled on it — on the
   inner box, since the pop-in's transform would replace the placing one. */
.t-map-start {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, calc(-100% - var(--node) / 2 - 2px));
  pointer-events: none;
}
.t-map-start__in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: coachIn 320ms cubic-bezier(.2,.85,.3,1) 600ms both;
}
.t-map-start__tag {
  padding: 10px 18px 11px;
  border-radius: 14px;
  background: var(--parchment);
  color: var(--forest);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--edge), 0 14px 30px -12px rgba(0,0,0,.7);
}
.t-map-start .t-svg-icon {
  width: 44px;
  height: 44px;
  color: var(--bounty);
  stroke-width: 3.2;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.7));
  animation: mapStartBob 1.1s ease-in-out infinite;
}
@keyframes mapStartBob {
  0%, 100% { transform: translateY(-4px); }
  50%      { transform: translateY(7px); }
}
.t-level-node__stars {
  font-size: 10px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--bounty);
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

.t-map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  padding-bottom: max(12px, var(--safe-bottom));
  flex-shrink: 0;
  background: var(--forest-deep);
  border-top: 2px solid var(--meadow-dark);
  box-shadow: 0 -8px 20px rgba(0,0,0,.6);
  min-height: 54px;
}
/* Menu and Journal (issue #216): one each side, the same size, so the bar
   reads as two answers rather than three things of three shapes. */
.t-map-footer .t-stone-btn { min-width: 108px; }

/* ═══════════════════════════════════ TRANSIENT LAYERS */

/* One card, whether it times out or waits to be dismissed — the two say the
   same sentence and must look the same saying it. The chevron is absolutely
   positioned, so it takes no width off a short line, and the min-width stops
   one shrink-wrapping to a sliver beside it. */
#turn-popup {
  position: fixed;
  top: 20%; left: 50%;
  transform: translateX(-50%);
  background: var(--parchment);
  color: var(--ink);
  padding: 22px 26px 15px;
  /* `left: 50%` leaves only half the viewport as available width, and a
     shrink-to-fit box takes that as its ceiling — which wrapped "The 6 point
     bounty" mid-line however much room was really there. max-content sizes to
     the longest line the copy asks for and max-width brings it back in. */
  width: max-content;
  min-width: 210px;
  max-width: min(78vw, 340px);
  border-radius: 16px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  text-align: center;
  /* The copy carries no breaks inside a sentence, so it wraps to the phone's
     own width; balance evens the lines out, so a wrap never leaves one word
     alone under a full line. A browser without it wraps as usual. */
  text-wrap: balance;
  /* The board underneath stays live, so the card must not intercept it: a
     stroke that begins under the card has to reach the canvas, and beginning
     it is what puts the card away. Only the chevron takes taps. */
  pointer-events: none;
  box-shadow: 0 4px 0 var(--edge), 0 20px 40px -18px rgba(0,0,0,.7);
  opacity: 1;
  transition: opacity .3s ease;
}
/* The one part of the card that takes a tap — the card itself is
   pointer-events: none so the live board underneath still gets its strokes. */
.t-popup-x {
  pointer-events: auto;
  position: absolute;
  top: 5px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.t-popup-x .t-svg-icon { width: 16px; height: 16px; }

#phase-banner {
  position: fixed;
  top: 42%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(40px, 12vw, 84px);
  letter-spacing: -.03em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 3px 0 var(--meadow-dark), 0 8px 30px rgba(0,0,0,.85);
}
/* The level's name over the kick-off headline (issue #120): "LEVEL 1 · FIRST
   STEPS", mono caps, the way the map's rank label and the chip's numbers
   speak — a label, so the headline stays the event. */
#phase-banner .t-banner-eyebrow {
  display: block;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(11px, 3.3vw, 13px);
  letter-spacing: 2.2px;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 0 var(--meadow-dark), 0 4px 14px rgba(0, 0, 0, .8);
}
/* The banner's one line of news, under the headline: what this moment did and
   what is coming, in the chip's own words (ui.bountyPopupText). It took over
   from the round-start card, which said the same thing in a second object on
   the same beat. Body type, so the headline stays the event and this stays
   the footnote to it. */
#phase-banner .t-banner-sub {
  display: block;
  margin-top: 8px;
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(15px, 4.4vw, 19px);
  letter-spacing: 0;
  line-height: 1.25;
  white-space: normal;
  max-width: 88vw;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 0 var(--meadow-dark), 0 4px 16px rgba(0,0,0,.8);
}

/* ═══════════════════════════════════ THE COACH (issue #120)
   Level 1's lesson cards (js/coach.js). A card of the round-start card's
   kind — the same parchment, the same face — with a tail to the thing it is
   about, and that thing lit by a spotlight: a hole in a dim scrim that
   slides from subject to subject as a tour steps on. The board under it all
   stays live: the scrim and the card take no taps, only the card's buttons
   do, and the first stroke puts the card away (main.js). */
.t-coach-scrim {
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  overflow: hidden;
  transition: opacity .3s;
}
.t-coach-scrim.is-off { opacity: 0; }
/* The hole IS the element: its shadow is the scrim, thrown past every edge,
   so moving the element moves the hole and the transition slides it from
   one subject to the next. */
.t-coach-spot {
  position: absolute;
  border-radius: 14px;
  box-shadow: 0 0 0 200vmax rgba(10, 22, 12, .46), inset 0 0 0 2px rgba(255, 255, 255, .5);
  transition: left .38s cubic-bezier(.2,.85,.3,1), top .38s cubic-bezier(.2,.85,.3,1),
              width .38s cubic-bezier(.2,.85,.3,1), height .38s cubic-bezier(.2,.85,.3,1);
}
/* A breathing gold rim, so the lit thing reads as chosen rather than merely
   left undimmed. */
.t-coach-spot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 17px;
  box-shadow: 0 0 0 2px rgba(232, 184, 74, .8), 0 0 22px 5px rgba(232, 184, 74, .38);
  animation: coachSpotBreathe 1.8s ease-in-out infinite;
}

.t-coach {
  position: fixed;
  z-index: 150;
  width: max-content;
  min-width: 220px;
  max-width: min(84vw, 320px);
  padding: 13px 18px 13px;
  border-radius: 16px;
  background: var(--parchment);
  color: var(--ink);
  text-align: left;
  pointer-events: none;
  box-shadow: 0 4px 0 var(--edge), 0 20px 40px -18px rgba(0,0,0,.7);
  transition: left .32s cubic-bezier(.2,.85,.3,1), top .32s cubic-bezier(.2,.85,.3,1);
}
.t-coach.is-in { animation: coachIn 260ms cubic-bezier(.2,.85,.3,1) both; }
.t-coach button { pointer-events: auto; }
/* The tail: a diamond on whichever edge faces the subject, at --tail-x —
   the subject's centre, not the card's, so a card clamped to the viewport
   edge still points at the right thing. Rotated 45deg, a shadow offset down
   its own axes lands under the tip, which is where the card's emboss is. */
.t-coach::after {
  content: '';
  position: absolute;
  left: var(--tail-x, 50%);
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: var(--parchment);
  transform: rotate(45deg);
}
.t-coach[data-arm="up"]::after { bottom: -6px; box-shadow: 3px 3px 0 -1px var(--edge); }
.t-coach[data-arm="down"]::after { top: -6px; }
.t-coach:not([data-arm])::after { display: none; }

.t-coach__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--forest);
  margin: 0 0 5px;
}
.t-coach__body {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0;
}
.t-coach__body strong { color: var(--ink); font-weight: 600; }
.t-coach__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 11px;
}
.t-coach__btn {
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  background: var(--bounty);
  color: var(--mud-deep);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--bounty-deep);
}
.t-coach__btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bounty-deep); }
/* More than one subject lit (issue #177): the spot's own shadow can cut one
   hole only, so the dim moves to a masked svg with a hole per subject, and
   every hole keeps the rim. */
.t-coach-mask { position: absolute; inset: 0; }
.t-coach-mask > rect { fill: rgba(10, 22, 12, .46); }
.t-coach-scrim.is-multi .t-coach-spot { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.t-coach-spot.is-extra { transition: none; }
/* Where the subject was a moment ago — the light's old place, dashed, and a
   dotted arrow from its centre to where it went. Over the scrim, under the
   card. The dots are zero-length dashes with round caps. */
.t-coach-trace {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 146;
  pointer-events: none;
  overflow: visible;
}
.t-coach-trace__was { fill: rgba(255, 248, 225, .1); stroke: #F5D17A; stroke-width: 2.5; stroke-dasharray: 6 6; }
.t-coach-trace__shade { fill: none; stroke: rgba(0, 0, 0, .35); stroke-width: 6.5; stroke-linecap: round; stroke-dasharray: 0 9; }
.t-coach-trace__arc { fill: none; stroke: #F5D17A; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 0 9; }
/* The arrowhead wears the dots' outline: a dark stroke painted under its
   fill (the marker's units are the line's, so 1.6 here is the dots' ring). */
.t-coach-trace marker path { fill: #F5D17A; stroke: rgba(0, 0, 0, .35); stroke-width: 1.6; stroke-linejoin: round; paint-order: stroke; }

/* A card's press hint (issue #201): on a card whose subject is a HUD
   control that explains itself when pressed — the countdown, the bridges —
   a quiet mono line at the other end of the row from Got it. It was the
   nudge's foot until the nudges became cards. */
.t-coach__more {
  margin-right: auto;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: .8;
}

/* The ghost finger: a fingertip's soft disc, sized to the tile, pressed
   (small, dense) while it draws and lifted (larger, fainter) between
   strokes. The wrapper carries the position and the disc the press, so
   the two transitions never fight over one transform. */
.t-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 145;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.4, 0, .5, 1);
}
.t-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, rgba(255,255,255,.96), rgba(255,255,255,.62) 52%, rgba(255,255,255,0) 72%);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 6px 14px rgba(0,0,0,.4);
  transform: scale(.78);
  opacity: .96;
  transition: transform .3s ease, opacity .3s ease;
}
.t-ghost.is-up::before { transform: scale(1.3); opacity: .3; }
/* The pulse on the path's dot while the finger is lifted: "press here". */
.t-ghost-ring {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 144;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 7px rgba(232,184,74,.55);
  animation: ghostRing 1s ease-out infinite;
}

/* A flex row, so the mark sits BESIDE the number whatever it is. The base
   .t-svg-icon is display:block — fine inside .t-delta, which is a flex row of
   its own, but in a plain block it dropped the grass blades onto a line under
   the +3. The bridge and the sack happened not to hit it (neither carries
   that class here), which is exactly why the row is the fix and not another
   per-icon display override. */
.score-float {
  position: fixed;
  display: flex;
  align-items: center;
  gap: .12em;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 8px rgba(0,0,0,.45);
  pointer-events: none;
  transform: translate(-50%, 0);
  animation: scoreFloatRise 1200ms ease-out both;
}
.score-float--gain { color: var(--meadow-light); }
.score-float--loss { color: #FF6B5C; }
/* What a float scores sets its size and colour (issue #168): grass green at
   the base, a bridge driftwood a step up — the same colour whether the
   bridge is earned at the start or spent on a crossing, the sign saying
   which — and a bounty gold a step up again — the
   order a turn's floats stack in, so the stack grows towards its biggest
   number. Each shrinks to the row's type size as it dives (ui._diveFloat),
   so the HUD's entries are the same size whichever float landed on them. */
.score-float--bridges { font-size: 22px; color: var(--driftwood); }
.score-float--bounty { font-size: 24px; color: var(--bounty-figure); }
/* A float with a row to land in is driven by the Web Animations API instead
   (ui._launchFloat): the rise is the same, but its end is a measured point in
   the panel rather than 52px up. */
.score-float--fly { animation: none; }

/* ═══════════════════════════════════ KEYFRAMES */

/* The log advancing: the finished turn drops out of the bottom while the new
   one comes down from above, both clipped by the row. Downwards because that
   is the way the score floats arrive (issue #116) — the panel sits under the
   board, so a float dives down into its row and the last turn has to give way
   in the same direction, or the two pass each other head-on. Past 105% so
   neither shows a sliver at the edge on a fractional row height. */
@keyframes deltaLineIn {
  from { transform: translateY(-105%); opacity: 0; }
  to   { transform: none;              opacity: 1; }
}
@keyframes deltaLineOut {
  from { transform: none;             opacity: 1; }
  to   { transform: translateY(105%); opacity: 0; }
}

@keyframes scoreFloatRise {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(0.7); }
  12%  { opacity: 1; transform: translate(-50%, -6px) scale(1.12); }
  24%  { transform: translate(-50%, -12px) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(1); }
}

/* An entry arriving under its float: a little too big, then settling. */
@keyframes deltaLand {
  0%   { transform: scale(1.4); }
  100% { transform: none; }
}

@keyframes scorePop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

@keyframes phaseBannerFlash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  24%  { transform: translate(-50%, -50%) scale(1); }
  78%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes bossGlow {
  0%, 100% { box-shadow: 0 0 8px 3px rgba(220, 40, 40, 0.6); }
  50%      { box-shadow: 0 0 16px 6px rgba(220, 40, 40, 0.9); }
}

@keyframes currentLevel {
  0%, 100% { box-shadow: 0 0 10px 4px rgba(232, 184, 74, 0.55); }
  50%      { box-shadow: 0 0 20px 8px rgba(232, 184, 74, 0.9); }
}

.t-level-node--boss    { animation: bossGlow 2s ease-in-out infinite; }
.t-level-node--current { animation: currentLevel 1.5s ease-in-out infinite; }

@keyframes coachIn {
  from { opacity: 0; transform: translateY(6px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes coachSpotBreathe {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
@keyframes ghostRing {
  0%   { transform: scale(.55); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes mapStomp {
  0%   { opacity: 0; transform: scale(.3); }
  55%  { opacity: 1; transform: scale(1.14); }
  100% { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════ RESPONSIVE */

@media (max-width: 400px) {
  /* The padding is set through its variables so the safe-area inset and the
     height's sum (see #ui-panel) follow it — a shorthand here once reset the
     inset padding to 6px on every phone under 400px wide. */
  #ui-panel { --hud-pad-y: 6px; --hud-pad-x: 7px; }
  /* The sides and the foot only: the top keeps the studs' room. */
  .t-card { --card-pad-x: 16px; --card-pad-bottom: 20px; }
  .t-btn { font-size: 16px; padding: 13px 18px; }
}

/* Narrow phones. The bounty chip is what gives first: it is the only element
   in the strip with slack, and the two labelled controls either side of it
   have to stay pressable. Plain px: at 360px wide the HUD unit is at its 1px
   floor (its width term, 3.5vw, is under the 13px the clamp starts from), so
   these are exact. */
@media (max-width: 360px) {
  #hud-controls { gap: 5px; }
  .t-hud-btn { padding: 0 9px; font-size: 12px; }
  .t-bounty { min-width: 0; gap: 2px; padding: 0 4px; }
  .t-rung svg { width: 26px; height: 26px; }
  /* The turn line's worst case, "+8 −10 +25", beside a two-mark boss slot
     and both bridge tiles, fills the row exactly at 10px gaps (issue #168). */
  .t-delta-line { gap: 7px; }
}

@media (max-height: 700px) {
  .t-title--hero { font-size: clamp(40px, 12vw, 60px); }
  .t-btn { margin-top: 7px; padding: 12px 20px; }
  .t-split { margin-top: 7px; }
}

/* Landscape warning */
@media (orientation: landscape) and (max-height: 500px) {
  #game-container::before {
    content: 'Please rotate to portrait mode';
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--forest-deep);
    color: var(--parchment-dim);
    font-family: var(--display);
    font-weight: 700;
    font-size: 18px;
    z-index: 1000;
  }
}

/* ═══════════════════════════════════ VERSUS SETUP (issue #69)
   One row a player: drag handle · P label · human/AI · trail · tier · remove.
   The three pickers show their mark alone (or E/M/H) until opened, so the
   row fits a 360px phone; the open list has the words. */
.t-card--versus { max-width: 400px; }
.t-label__hint {
  font-family: var(--body);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  margin-left: 4px;
}
.t-vlist { display: flex; flex-direction: column; gap: 6px; }
.t-vrow {
  display: grid;
  grid-template-columns: 22px 34px repeat(3, minmax(0, 1fr)) 26px;
  align-items: center;
  gap: 5px;
}
/* The other rows slide aside as the held one passes; the held one follows the
   finger exactly, lifted above them. */
.t-vlist .t-vrow { transition: transform .15s ease; }
/* The lift is two layers a little larger than the row, because the pickers'
   raised bottoms hang below it: the card and its shadow behind the row's
   contents, the frame over them, so no picker edge paints across the frame. */
.t-vrow.is-dragging { position: relative; z-index: 2; transition: none; }
.t-vrow.is-dragging::before,
.t-vrow.is-dragging::after {
  content: ''; position: absolute; inset: -5px -5px -8px; border-radius: 12px;
  pointer-events: none;
}
.t-vrow.is-dragging::before {
  z-index: -1; background: var(--parchment, #F5ECD7);
  box-shadow: 0 6px 16px rgba(0,0,0,.22);
}
.t-vrow.is-dragging::after { z-index: 1; border: 2px solid var(--mud, #7A4A21); }
.t-vrow.is-dragging .t-vrow__grip { cursor: grabbing; color: var(--mud, #7A4A21); }
.t-vrow__grip {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 34px; padding: 0;
  border: none; background: none; color: var(--ink-soft);
  cursor: grab; touch-action: none;
}
.t-vrow__grip .t-svg-icon { width: 18px; height: 18px; }
.t-vrow__tag {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .5px; color: var(--ink);
}
.t-vrow__tag .player-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 -2px 0 rgba(0,0,0,.22), 0 0 0 1.5px rgba(0,0,0,.12); }
.t-vrow__x {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: none; border-radius: 50%; background: none; color: var(--ink-soft); cursor: pointer;
}
.t-vrow__x[hidden] { display: block; visibility: hidden; }
.t-vrow__x .t-svg-icon { width: 14px; height: 14px; }
.t-vrow .t-pick--compact { padding: 7px 5px 7px 7px; gap: 4px; font-size: 13px; }
.t-vrow .t-pick--compact .t-pick__chev .t-svg-icon { width: 14px; height: 14px; }
.t-vrow .t-pick--compact .t-pick__label { flex: 1; text-align: center; }
.t-vrow--add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border: 2px dashed var(--edge); border-radius: 12px;
  background: none; color: var(--ink-soft);
  font-family: var(--body); font-weight: 600; font-size: 13px; cursor: pointer;
}
.t-vrow--add .t-svg-icon { width: 16px; height: 16px; }
.t-pick-list__row.is-disabled { opacity: .5; cursor: not-allowed; }
.t-pick__lock { display: flex; color: var(--ink-soft); }
.t-pick__lock .t-svg-icon { width: 15px; height: 15px; }
.t-card--versus .t-field { margin-bottom: 12px; }
.t-card--versus .t-opt { padding: 9px 4px; font-size: 12px; }
.t-card--versus .t-btn-row { margin-top: 14px; }
@media (max-height: 700px) {
  .t-card--versus .t-field { margin-bottom: 8px; }
  .t-card--versus .t-title { margin-bottom: 8px; }
  .t-card--versus .t-btn-row { margin-top: 10px; }
}
