/* The table (port-spec §5). Every colour is a token from the active brand:
   brand/<id>.json, "colours", served as /brand.css (server/branding.js) and
   linked before this sheet. No stylesheet here holds a colour of its own, and
   test/brand-colours.test.js fails on one.

   Under the neutral brand: an aubergine table, cream cards, a copper accent.
   Every text pair clears WCAG AA (4.5:1), every meter and icon 3:1, except
   --accentOnPaper, the accent dark enough to read on the cream paper (4.2:1).

   --lamp        the warm light of a side being chosen: on the arrow, on that
                 edge of the card, round the keys' hint. A token, not on the
                 controls, because the card and the hint are not inside them.
   --verdictGood, --verdictBad   paler than the app's hsb(0.36, 0.55, 0.97) and
                 hsb(0.02, 0.55, 1.0) so the verdict reads on the table: 9.0:1
                 and 7.3:1 on --canvas.
   --money, --loss   a meter getting better or worse, on the Banker's pills
                 and the price on a ticket: white on either clears 5:1, and the
                 red reads on the paper.
   --moneyOnPaper  a gain written in green on the paper: --money is for white
                 on it, and as text there it is 4.3:1; this is 5.6:1 (the
                 desk's and the fund's figures).
   --tint-*      the advisors' own colours (PowerUp.swift tint), ours: copper,
                 green and indigo for the app's three, a deep teal-blue for the
                 Time Traveller and a berry for the Coach. White glyphs on each
                 clear 5:1 (the teal-blue 5.6:1, the berry 7.0:1). --disc-off
                 is the grey for one not brought or already spent.
   --said, --did   the profile's two marks, on the paper: what you said (a ring)
                 and what you did (a dot). Validated with the dataviz guide's
                 validator against --paper (light): both in the lightness band,
                 chroma ≥ 0.1, colour-blind ΔE 21.4, normal-vision ΔE 22.9,
                 each ≥ 3:1 on the paper. --did is the accent the paper
                 already uses.
   --light, --shade   white and black where a sheet needs them as such: a lift
                 towards white, a mask, a blend that must add nothing.
   --*Rgb        the same colours as three channels, for an alpha:
                 rgba(var(--shadeRgb), 0.3).
   --onColour    glyphs and words on a coloured disc, pill or button.
   --accentText  words in the accent on the table: the accent itself where
                 that reads, a lighter shade where it would not. */
:root {
  /* Corners: one small scale, in rem like every length here (4, 6, 8 and
     12px on a phone), shared by holo.css, album.css and arena.css.
     xs: hairlines, a bar, a pip, a focus ring.
     s: a chip, a tag, a small badge or tile, a key.
     m: a button, a field, a segmented control, the code's boxes, the
        picture tile over a dialog. A segment inside a control takes the
        step below its track's, so the corners nest.
     l: a panel, a sheet, a dialog, a card of content, a toast, a bubble.
     A disc keeps its 50%, a switch's track its pill, and the playing card
     its own corner (4.5% of its width, below). */
  --radius-xs: 0.25rem;
  --radius-s: 0.375rem;
  --radius-m: 0.5rem;
  --radius-l: 0.75rem;

  /* A real playing card: 63 by 88 (poker size), its corners rounded by
     4.5% of its width (3 mm on 63 mm). table.js sets both per screen. */
  --card-w: 18.75rem;
  --card-h: calc(var(--card-w) * 88 / 63);
  --spring-back: cubic-bezier(0.34, 1.4, 0.64, 1);
  --spring-soft: cubic-bezier(0.25, 1.12, 0.5, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* ---- Size classes ------------------------------------------------------

   Every length in this file is in rem, and the root is 16px on a phone, so
   a phone draws exactly what it always drew. From a tablet up the root
   grows with the shorter side of the window (min(vw, vh)): the same
   composition at 1080p and at 4K, never tiny, and capped so a laptop is
   not shouting.

   phone            < 600px wide: one column, the thumb's row at the foot
   phone landscape  ≤ 500px tall, landscape: the table spread sideways
   tablet           600–1099px: the column, wider and centred
   desktop          1100–1799px: the table as a scene, the screens composed
   large            ≥ 1800px: the same scene, with room to breathe

   --table-layout tells table.js which arrangement the CSS chose ("column"
   or "side"), so the card is sized for the room it actually has. */
html { font-size: 16px; --table-layout: column; }
@media (min-width: 600px) and (min-height: 501px) {
  /* 16px up to a 1080-tall window, then 1.2px more per 100px of the
     shorter side: 20px at 1440, 29px at 2160 (4K), 30px at most. */
  html { font-size: clamp(16px, 1.2vmin + 3px, 30px); }
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
body { font: 1.0625rem/1.35 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* Nothing on the table scrolls, so nothing should rubber-band on iOS. */
html, body { overflow: hidden; overscroll-behavior: none; }

button { font: inherit; color: inherit; }

/* One phone-wide column on a phone; the whole window from a tablet up,
   where each screen composes itself (the end of this file). */
#app {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  margin: 0 auto;
  /* A card dragged or thrown off the column stays visible on a desktop;
     the body clips it at the window instead. Below, the rim around the
     bottom card reaches past the screen's edge; clip it here, or it makes
     the page taller than the window and the page scrolls. */
  overflow-x: visible;
  overflow-y: clip;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  user-select: none;
  -webkit-user-select: none;
}

.boot {
  margin: auto;
  padding: 0 1rem;
  text-align: center;
  color: var(--inkMuted);
}

/* ---- Top bar: a way back, and the language switch --------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem 0;
  min-height: 3.25rem;
}

.icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  margin-left: -0.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 1.5rem; height: 1.5rem; }
.icon-btn:active { background: var(--surfacePressed); }
.icon-btn:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; }

/* A segmented control: two buttons, the pressed one filled. */
.lang {
  display: flex;
  padding: 0.125rem;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 0.0625rem solid var(--surfaceStroke);
}
.lang button {
  min-width: 2.75rem;
  height: 1.75rem;
  padding: 0 0.625rem;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--inkMuted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.0375rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--deep); }
.lang button:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; }

/* ---- Meters ---------------------------------------------------------- */

.meters {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 0.625rem 1.625rem 0;
  transition: opacity 0.3s ease;
}
.meters[hidden] { display: grid; opacity: 0; visibility: hidden; }

.meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  transition: filter 0.4s ease-out;
}
.meters.blind .meter { filter: blur(0.375rem); }

.meter .dot-slot { height: 0.8125rem; display: flex; align-items: center; justify-content: center; }
.meter .dot {
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--paper);
  transition: width 0.15s ease-out, height 0.15s ease-out;
}
.meter svg { width: 1.875rem; height: 1.875rem; padding: 0.28125rem; }
/* The Coach at work: the nerve's symbol on their colour, a calm disc that
   stays while no card can take nerve away. White on it is 7.0:1. */
.meter > svg { border-radius: 50%; transition: background-color 0.3s ease, box-shadow 0.3s ease; }
/* A meter the side looked at would move: a neutral glow, never which way,
   stronger as the move is (--impact, 0–1, set with the dot). Before the
   Coach's rule, so their disc wins on the nerve. */
.meter.moving > svg {
  background: rgba(var(--lightRgb), calc(0.1 + var(--impact, 0) * 0.12));
  box-shadow: 0 0 calc(0.5rem + var(--impact, 0) * 0.75rem) rgba(var(--lightRgb), calc(0.25 + var(--impact, 0) * 0.35));
}
.meter.coached > svg { background: var(--tint-coach); box-shadow: 0 0 0.75rem color-mix(in srgb, var(--tint-coach) 70%, transparent); }

.meter .track {
  position: relative;
  width: 100%;
  height: 0.375rem;
  border-radius: 0.1875rem;
  background: rgba(var(--lightRgb), 0.22);
  overflow: hidden;
}
.meter .fill {
  position: absolute;
  inset: 0;
  border-radius: 0.1875rem;
  background: var(--ink);
  transform-origin: left center;
  transition: transform 0.35s ease-out, background-color 0.45s ease-in-out;
}
.meter .fill.good { background: var(--verdictGood); transition: transform 0.35s ease-out, background-color 0.12s ease-out; }
.meter .fill.bad { background: var(--verdictBad); transition: transform 0.35s ease-out, background-color 0.12s ease-out; }
/* Cash put back by a new brief. */
.meter .fill.reset { background: var(--accent); transition: transform 0.35s ease-out, background-color 0.12s ease-out; }

.blind-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -30%;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--ceiling) 88%, transparent);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.meters.blind .blind-pill { opacity: 1; }

/* ---- Words ----------------------------------------------------------- */

/* Its height is set by table.js to the tallest the run's words can get,
   so a verdict never runs under the meters or the cards. */
.words:focus { outline: none; }
.words {
  flex: none;
  min-height: 5.75rem;
  padding: 0.75rem 1.75rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Should the words ever outgrow their room, they run down over the
     cards, never up over the meters. */
  justify-content: safe center;
  gap: 0.75rem;
  text-align: center;
}
.words.probe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  visibility: hidden;
  pointer-events: none;
}
/* The words fade with the flip rather than snapping (TableView.swift:170-175). */
.words > * { animation: words-in 0.35s ease-in-out; }
@keyframes words-in { from { opacity: 0; } }

.prompt { margin: 0; font-size: 1rem; font-weight: 500; }

.spoken { display: flex; flex-direction: column; align-items: center; gap: 0.4375rem; }
.spoken .who {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--inkMuted);
}
.spoken .line { margin: 0; font-size: 0.9375rem; font-weight: 600; }
/* Words too tall for the smallest card on the screen (table.js measure). The
   companion's name goes, since he stands beside them. */
#app.tight-words .words { gap: 0.375rem; padding-top: 0.25rem; }
#app.tight-words .prompt { font-size: 0.875rem; line-height: 1.3; }
#app.tight-words .spoken { gap: 0.25rem; }
#app.tight-words .spoken .who { display: none; }
#app.tight-words .spoken .line { font-size: 0.8125rem; line-height: 1.3; }
.spoken.good .line { color: var(--verdictGood); }
.spoken.bad .line { color: var(--verdictBad); }
.spoken.census .line { color: var(--ink); }

/* The Analyst's doubling, said under the verdict it paid. */
.doubled {
  margin: 0.125rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
}
#app.tight-words .doubled { margin: 0; gap: 0.3125rem; font-size: 0.6875rem; line-height: 1.2; }
.mini-disc {
  position: relative;
  overflow: hidden;
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tint);
  color: var(--onColour);
}
.mini-disc svg { width: 0.8125rem; height: 0.8125rem; }

/* A call the Time Traveller took back, under its verdict: what it would
   have cost, in the Banker's pills, smaller. */
.rewound {
  margin: 0.125rem 0 0;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
}
.rewound-pills { display: inline-flex; gap: 0.25rem; }
.rewound .pill { width: 2.125rem; height: 2.125rem; box-shadow: none; }
.rewound .pill svg { width: 0.625rem; height: 0.625rem; }
.rewound .pill .amount { font-size: 0.6875rem; }
#app.tight-words .rewound { margin: 0; gap: 0.3125rem; font-size: 0.6875rem; line-height: 1.2; }
#app.tight-words .rewound .pill { width: 1.625rem; height: 1.625rem; }
#app.tight-words .rewound .pill svg { width: 0.5rem; height: 0.5rem; }
#app.tight-words .rewound .pill .amount { font-size: 0.625rem; }

/* Chapter 4's standing brief (TableMoves.swift standing()): the terms of
   the account, panelled so it reads as a different kind of thing from a
   card's question. */
.brief {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-l);
  background: rgba(var(--lightRgb), 0.12);
  border: 0.0625rem solid rgba(var(--lightRgb), 0.2);
}
.brief .cycle {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 900;
  letter-spacing: 0.06875rem;
  text-transform: uppercase;
  /* The accent lifted towards white: 5:1 on the panel. */
  color: color-mix(in srgb, var(--accent) 75%, var(--light));
}
.brief .mandate { margin: 0.375rem 0 0; font-size: 0.90625rem; font-weight: 500; line-height: 1.3; }
.brief.compact { padding: 0.4375rem 0.875rem; }

/* ---- Cards ----------------------------------------------------------- */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.back, .live {
  position: absolute;
  left: calc(50% - var(--card-w) / 2);
  /* Held from the foot of the screen: the card's own foot runs past the
     edge (--tuck, table.js), as a hand of cards does. */
  bottom: calc(-1 * var(--tuck, 0px));
  width: var(--card-w);
  height: var(--card-h);
  transform-origin: 50% 100%;
}

.back {
  opacity: 0;
  pointer-events: none;
}

.card-back, .card-face {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--card-w) * 0.045);
  overflow: hidden;
}

/* The card's foot, where the thumb's row of controls sits (--band,
   table.js): reserved so the face's content stays above it. The blur that
   used to soften this band is gone (it bent the card's outline); the
   card stays crisp to its edges. */
.card-face, .card-back {
  --held: var(--band, calc(var(--card-h) * 0.2));
}

.card-back {
  background: var(--wallShadow);
  box-shadow: inset 0 0 0 0.0625rem color-mix(in srgb, var(--wallLit) 18%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wallLit);
}
.card-back > svg { width: 44%; height: 44%; opacity: 0.85; }
.card-back .name {
  position: absolute;
  left: 0;
  right: 0;
  /* Above the out-of-focus foot, where the thumb's row floats. */
  bottom: calc(var(--held, calc(var(--card-h) * 0.2)) + var(--card-h) * 0.03);
  text-align: center;
  font-size: calc(var(--card-w) * 0.052);
  font-weight: 600;
  color: color-mix(in srgb, var(--paper) 75%, transparent);
}

.live {
  touch-action: none;
  cursor: grab;
  perspective: 56.25rem;
}
.live:active { cursor: grabbing; }
.live[hidden] { display: none; }

.flipper {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.flipper > * { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flipper > .card-back { transform: rotateY(180deg); }

/* The name, and the character standing under it at the foot of the face,
   just above the thumb's row. A ticket and the companion's card keep
   theirs in the middle. */
.card-face {
  background: var(--paper);
  box-shadow: inset 0 0 0 0.09375rem var(--paperEdge);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 var(--held);
  gap: calc(var(--card-w) * 0.01);
}
.card-face.ticket, .card-face.answer { justify-content: center; }
.card-face.wild {
  background:
    linear-gradient(125deg, var(--wild1), var(--wild2) 40%, var(--wild3) 70%, var(--wild4)),
    var(--wallBack);
  box-shadow: inset 0 0 0 0.15625rem color-mix(in srgb, var(--accent) 80%, transparent);
}

/* As large as the face above the band allows, the name and a margin
   kept: 0.86 of the width on a tall card, less where the thumb's row
   takes more of a short one. */
.portrait {
  --portrait: min(calc(var(--card-w) * 0.86), calc(var(--card-h) - var(--held) - var(--card-w) * 0.2));
  flex: none;
  width: var(--portrait);
  height: var(--portrait);
  display: flex;
  align-items: center;
  justify-content: center;
}
.monogram {
  background: hsl(calc(var(--hue) * var(--monogramHueSpan) + var(--monogramHueStart)) var(--monogramSaturation) var(--monogramLightness));
  width: 78%;
  height: 78%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--card-w) * 0.2);
  font-weight: 800;
  color: var(--paperInk);
  letter-spacing: -0.02em;
}
.card-face .speaker {
  font-size: calc(var(--card-w) * 0.052);
  font-weight: 600;
  color: color-mix(in srgb, var(--paperInk) 70%, transparent);
  text-align: center;
  padding: 0 8%;
}
.card-face.wild .speaker { color: color-mix(in srgb, var(--paper) 85%, transparent); }

/* The companion's card (card.js answerFace, table.js NEXT 'card'): the
   call stamped in the middle, the word under it, the way on at the foot.
   The stamp's colours are deeper than the verdict's on the dark table,
   since they sit on cream: white on either is over 3:1, as a glyph needs. */
.card-face.answer {
  --tone: var(--paperEdge);
  background: color-mix(in srgb, var(--tone) 12%, var(--paper));
  box-shadow: inset 0 0 0 0.15625rem color-mix(in srgb, var(--tone) 70%, var(--paperEdge));
  gap: calc(var(--card-w) * 0.04);
}
.card-face.answer.good { --tone: var(--toneGood); }
.card-face.answer.bad { --tone: var(--toneBad); }
.card-face.answer.census { --tone: var(--toneCensus); }
.answer-who {
  position: absolute;
  top: calc(var(--card-h) * 0.05);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--card-w) * 0.022);
  font-size: calc(var(--card-w) * 0.05);
  font-weight: 600;
  color: color-mix(in srgb, var(--paperInk) 70%, transparent);
}
.stamp {
  flex: none;
  width: calc(var(--card-w) * 0.4);
  height: calc(var(--card-w) * 0.4);
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 calc(var(--card-w) * 0.02) color-mix(in srgb, var(--tone) 28%, transparent);
  color: var(--onColour);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
}
.stamp svg { width: 52%; height: 52%; }
.answer-word {
  font-size: max(1.125rem, calc(var(--card-w) * 0.085));
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--paperInk);
  text-align: center;
  padding: 0 8%;
}
.answer-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--held) + var(--card-h) * 0.03);
  margin: 0;
  padding: 0 10%;
  text-align: center;
  font-size: max(0.75rem, calc(var(--card-w) * 0.042));
  font-weight: 600;
  color: color-mix(in srgb, var(--paperInk) 62%, transparent);
}
/* The smallest cards, under the tallest words on a small phone: what stands
   above the thumb's row is too short for all of it at these sizes, so the
   name goes, since the words above the card already say it, and the word and
   the way on take a size of their own, with room kept for the way on. */
#app.small-card .card-face.answer { padding-bottom: calc(var(--held) + 2.25rem); gap: 0.25rem; }
#app.small-card .answer-who { display: none; }
#app.small-card .stamp { width: calc(var(--card-w) * 0.34); height: calc(var(--card-w) * 0.34); }
#app.small-card .answer-word { font-size: 0.9375rem; padding: 0 2%; }
#app.small-card .answer-hint { font-size: 0.6875rem; line-height: 1.2; padding: 0 4%; bottom: calc(var(--held) + 0.25rem); }

/* Stamped as the card comes face up. */
.live.answer.face-up .stamp { animation: stamp-in 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) 0.24s both; }
@keyframes stamp-in { from { transform: rotate(-22deg) scale(1.8); opacity: 0; } }
.reduce-motion .live.answer .stamp { animation: none; }

/* NEXT 'timer': what the verdict has left before the question comes back. */
.fuse {
  width: min(12rem, 60%);
  height: 0.1875rem;
  margin-top: 0.25rem;
  border-radius: 0.125rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}
.fuse > span { display: block; height: 100%; background: var(--inkMuted); transform-origin: left; }

/* An instrument, as a dealing slip (CardView.ticket). Never smaller than
   a phone can read, whatever the card's size. */
.card-face.ticket {
  padding: calc(var(--card-h) * 0.04) calc(var(--card-w) * 0.08) var(--held);
  gap: calc(var(--card-w) * 0.018);
  text-align: center;
}
/* On the smallest cards the same words stand closer, to stay on the face. */
#app.small-card .card-face.ticket { padding: 0.125rem calc(var(--card-w) * 0.04) var(--held); gap: 0; }
#app.small-card .ticket-ticker { font-size: 1.25rem; }
#app.small-card .ticket-name { line-height: 1.15; }
#app.small-card .ticket-fact { margin: 0; font-size: 0.6875rem; line-height: 1.2; }
.ticket-kind {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: max(0.625rem, calc(var(--card-w) * 0.036));
  font-weight: 800;
  letter-spacing: 0.06875rem;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paperInk) 70%, transparent);
}
.ticket-kind svg { width: max(0.6875rem, calc(var(--card-w) * 0.04)); height: max(0.6875rem, calc(var(--card-w) * 0.04)); }
.ticket-ticker { font-size: calc(var(--card-w) * 0.16); font-weight: 900; line-height: 1.05; color: var(--paperInk); }
.ticket-name { font-size: max(0.75rem, calc(var(--card-w) * 0.052)); font-weight: 700; color: color-mix(in srgb, var(--paperInk) 75%, transparent); }
.ticket-fact {
  margin: calc(var(--card-w) * 0.01) 0 0;
  font-size: max(0.71875rem, calc(var(--card-w) * 0.046));
  line-height: 1.3;
  color: color-mix(in srgb, var(--paperInk) 75%, transparent);
}
.ticket-cost { margin: calc(var(--card-w) * 0.012) 0 0; font-size: max(0.75rem, calc(var(--card-w) * 0.048)); font-weight: 800; color: var(--loss); }

/* The Central Banker reading the card: what each side costs, on the edge it
   would be swiped towards, half off the card (CardView.ledgers). */
.pills-slot {
  position: absolute;
  left: calc(var(--card-w) * -0.0875);
  right: calc(var(--card-w) * -0.0875);
  bottom: calc(var(--card-h) * 0.38);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.live.face-up .pills-slot { opacity: 1; transition: opacity 0.25s ease 0.25s; }
.pills {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  animation: pills-breathe 0.85s ease-in-out infinite alternate;
}
@keyframes pills-breathe {
  from { opacity: 0.88; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1.02); }
}
.pill-column { display: flex; flex-direction: column; gap: calc(var(--card-w) * 0.028); }
.pill {
  flex: none;
  width: calc(var(--card-w) * 0.175);
  height: calc(var(--card-w) * 0.175);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--onColour);
  box-shadow: 0 0.125rem 0.25rem rgba(var(--shadeRgb), 0.25);
}
.pill.better { background: var(--money); }
.pill.worse { background: var(--loss); }
/* A fall in nerve the Coach held, at 0, on their colour. */
.pill.held { background: var(--tint-coach); }
/* The one figure the Analyst lifted, ringed in their colour. */
.pill.ring { box-shadow: 0 0 0 0.1875rem var(--tint-analyst), 0 0.125rem 0.25rem rgba(var(--shadeRgb), 0.25); }
.pill svg { width: max(0.625rem, calc(var(--card-w) * 0.042)); height: max(0.625rem, calc(var(--card-w) * 0.042)); }
.pill .amount { font-size: max(0.6875rem, calc(var(--card-w) * 0.056)); font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }

/* A word the table says for a moment: the fund holding, a new brief. */
.cheer {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: 6%;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.cheer-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: calc(100% - 2rem);
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-l);
  background: var(--deep);
  border: 0.0625rem solid var(--surfaceStroke);
  box-shadow: 0 0.625rem 1.875rem rgba(var(--shadeRgb), 0.4);
  font-size: 1.0625rem;
  font-weight: 800;
  text-align: center;
  /* Two even lines rather than a last word alone ("…la" / "50."). */
  text-wrap: balance;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.cheer-banner.shown { opacity: 1; transform: none; transition: opacity 0.15s ease-out, transform 0.4s var(--spring-back); }
.cheer-banner svg { flex: none; width: 1.5rem; height: 1.5rem; }
.cheer-banner.fund { font-size: 1.625rem; padding: 0.75rem 1.375rem; }
.cheer-banner.fund svg { width: 1.875rem; height: 1.875rem; color: var(--verdictGood); }
.cheer-banner.brief svg { color: var(--accent); }
/* The Time Traveller taking a call back: as loud as the fund holding, its
   arrow in a light of its colour that reads on the dark (over 7:1). */
.cheer-banner.rewind { font-size: 1.625rem; padding: 0.75rem 1.375rem; }
.cheer-banner.rewind svg { width: 1.875rem; height: 1.875rem; color: color-mix(in srgb, var(--tint-rewind) 35%, var(--light)); }

/* The choice, around the rim of the card it belongs to. */
.rim {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
}
.rim text {
  fill: var(--ink);
  font-weight: 700;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
}

/* ---- Controls: the thumb's alternatives to a drag -------------------- */

/* The table is a grid of rows: the top bar, the meters, the words, then
   the stage down to the screen's foot. The thumb's row and the keys are
   laid over the stage's last rows, so they float on the card's
   out-of-focus foot (--controls: over, read by table.js), still in the
   thumb's reach. The DOM's order, and so the focus order, is unchanged. */
html { --controls: over; }
body.on-table #app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
}
body.on-table .topbar { grid-row: 1; grid-column: 1; }
body.on-table .meters { grid-row: 2; grid-column: 1; }
body.on-table .words { grid-row: 3; grid-column: 1; }
body.on-table .stage { grid-row: 4 / 7; grid-column: 1; }
body.on-table .controls { grid-row: 5; grid-column: 1; }
body.on-table .keys { grid-row: 6; grid-column: 1; }

/* One cluster in the middle of the card's foot: [←] [advisors] [→], the
   sides right beside the advisors rather than at the screen's edges, so
   one thumb reaches all of it. table.js says how many chips the bar holds
   (--chips, data-chips: none to five). The arrows are --unit across, and
   the bar is exactly as tall as they are: its chips are --chip, the unit
   less the bar's padding and its hairline border either side, so the row
   reads as one line of circles. --unit is what the row's width leaves,
   solved for that: with n chips the row is 2 units, n chips of
   (unit − 2 × (pad + border)), the gaps and the bar's own padding and
   border, which comes to (n + 2) units + 2 × gap-out + (n − 1) × (gap-in −
   2 × (pad + border)). Between 44px and 52px: five chips on a 360px phone
   make arrows of 49.7px and chips of 41.7px, exactly the row's 344px, and
   44px chips from 390px up; three get 52px arrows and 44px chips. */
.controls {
  --chips: 3;
  --gap-in: 0.5rem;
  --gap-out: 0.5rem;
  --pad-y: 0.1875rem;
  --pad-x: 0.1875rem;
  --bar-line: 0.0625rem;
  /* Resolved on each chip, against this row (container units). */
  --unit: clamp(2.75rem, calc((100cqi - 2 * var(--gap-out) - (var(--chips) - 1) * (var(--gap-in) - 2 * (var(--pad-y) + var(--bar-line)))) / (var(--chips) + 2)), 3.25rem);
  --chip: calc(var(--unit) - 2 * (var(--pad-y) + var(--bar-line)));
  container-type: inline-size;
  position: relative;
  z-index: 4;
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--gap-out);
  padding: 0 0.5rem max(0.75rem, env(safe-area-inset-bottom));
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.controls[hidden] { display: flex; opacity: 0; visibility: hidden; }
/* Four or five: the gaps close up before any chip goes under 44px. */
.controls:is([data-chips="4"], [data-chips="5"]) { --gap-in: 0.25rem; --gap-out: 0.375rem; }
/* None: the two sides alone, a thumb's width apart. */
.controls[data-chips="0"] { --gap-out: 1.25rem; }
.controls[data-chips="0"] .advisor-bar { display: none; }

/* Frosted chips: dark enough under them that the white glyphs read at
   more than 10:1 on the paper, on a foil and on the table alike. */
.swipe-btn {
  position: relative;
  isolation: isolate;
  pointer-events: auto;
  flex: none;
  width: var(--unit);
  height: var(--unit);
  padding: 0;
  border-radius: 50%;
  border: 0.0625rem solid var(--surfaceStroke);
  background: color-mix(in srgb, var(--deep) 86%, transparent);
  box-shadow: 0 0.25rem 0.875rem rgba(var(--tableShadeRgb), 0.3);
  backdrop-filter: blur(0.75rem) saturate(1.2);
  -webkit-backdrop-filter: blur(0.75rem) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease, transform 0.15s ease;
}
.swipe-btn svg { position: relative; z-index: 1; width: 1.5rem; height: 1.5rem; }
.swipe-btn:active { transform: scale(0.94); background: var(--swipe-pressed); }
.swipe-btn:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; }
.swipe-btn[aria-disabled="true"] { opacity: 0.35; cursor: default; }
/* Hovered and pressed stay dark and opaque: the arrows sit on the cream
   card now, where a see-through white would leave the glyph unreadable.
   White on either is over 11:1. */
.controls {
  --swipe-hover: color-mix(in srgb, var(--deep) 82%, var(--wallLit));
  --swipe-pressed: color-mix(in srgb, var(--deep) 68%, var(--wallLit));
}

/* The light on an arrow. Lit (a pointer over it, the focus on it, or a
   key's lean to its side): a rim of warm light and a glow round it, the
   glyph still white on dark (over 8:1). Pressed: a quick flash out from
   the middle (.flash, table.js), under the glyph. */
.swipe-btn::before, .swipe-btn::after {
  content: "";
  position: absolute;
  inset: -0.0625rem;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
.swipe-btn::before {
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--lamp) 26%, transparent), transparent 68%);
  box-shadow:
    inset 0 0 0 0.0625rem color-mix(in srgb, var(--lamp) 85%, transparent),
    0 0 0.875rem 0.0625rem color-mix(in srgb, var(--accent) 60%, transparent),
    0 0 2rem 0.25rem color-mix(in srgb, var(--lamp) 22%, transparent);
  transition: opacity 0.2s ease;
}
.swipe-btn.lit:not([aria-disabled="true"])::before { opacity: 1; }
.swipe-btn::after {
  z-index: 0;
  /* A ring of light, so the glyph in the middle stays dark-backed. */
  background: radial-gradient(circle, transparent 34%, color-mix(in srgb, var(--lamp) 85%, transparent) 52%, color-mix(in srgb, var(--accent) 50%, transparent) 62%, transparent 72%);
}
.swipe-btn.flash::after { animation: swipe-flash 0.36s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes swipe-flash {
  0% { opacity: 0.95; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* The same light on the card, on the side the arrow would send it to
   (table.js sets data-light and data-side on .live): a warm wash in from
   that edge, the edge itself lit, and a glow off it on the table. Faint
   while an arrow is only looked at, full while a key holds the lean or
   the arrow is pressed. It fades out over the card's out-of-focus foot. */
.side-light {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--card-w) * 0.045);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.side-light::before, .side-light::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.side-light::before {
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to right, color-mix(in srgb, var(--accent) 30%, transparent), transparent 32%);
  box-shadow: inset 0.1875rem 0 0 color-mix(in srgb, var(--lamp) 55%, var(--accent));
  -webkit-mask-image: linear-gradient(to bottom, var(--shade) calc(100% - var(--band, 20%)), transparent calc(100% - var(--band, 20%) * 0.3));
  mask-image: linear-gradient(to bottom, var(--shade) calc(100% - var(--band, 20%)), transparent calc(100% - var(--band, 20%) * 0.3));
}
.side-light::after {
  top: 8%;
  bottom: calc(var(--band, 20%) + 4%);
  left: -0.0625rem;
  width: 0.1875rem;
  border-radius: var(--radius-xs);
  background: var(--lamp);
  box-shadow: 0 0 0.5rem 0.125rem color-mix(in srgb, var(--lamp) 70%, transparent), 0 0 1.75rem 0.5rem color-mix(in srgb, var(--accent) 50%, transparent);
}
.live[data-side="right"] .side-light::before {
  background: linear-gradient(to left, color-mix(in srgb, var(--accent) 30%, transparent), transparent 32%);
  box-shadow: inset -0.1875rem 0 0 color-mix(in srgb, var(--lamp) 55%, var(--accent));
}
.live[data-side="right"] .side-light::after { left: auto; right: -0.0625rem; }
.live[data-light="hover"] .side-light { opacity: 0.55; }
.live[data-light="armed"] .side-light, .live[data-light="press"] .side-light { opacity: 1; }
.live:not(.face-up) .side-light { opacity: 0; }

/* The hint under the row, while a key holds the lean: lit like the arrow. */
.keys.leaning { border-color: color-mix(in srgb, var(--lamp) 60%, var(--accent)); }

/* Reduced motion: the light is there or not, at once; no flash, no swell.
   A pressed arrow shows the flash's light, still, while it is held. */
.reduce-motion .swipe-btn, .reduce-motion .swipe-btn::before, .reduce-motion .side-light { transition: none; }
.reduce-motion .swipe-btn.flash::after { animation: none; }
.reduce-motion .swipe-btn:active:not([aria-disabled="true"])::after { opacity: 0.6; }
.reduce-motion .swipe-btn:active, .reduce-motion .swipe-btn:hover:not([aria-disabled="true"]) { transform: none; }

/* The advisors, on a frosted capsule between the two sides
   (TableMoves.swift tools), the same chip as the sides so it reads on the
   paper card as on a foil, and as tall as they are, its ends as round:
   brought ones in their colour, a working one proud of the others with a
   white ring, the count or the raised arrow on a badge. */
.advisor-bar {
  pointer-events: auto;
  flex: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  height: var(--unit, 3.25rem);
  gap: var(--gap-in, 0.5rem);
  padding: var(--pad-y, 0.1875rem) var(--pad-x, 0.1875rem);
  border-radius: calc(var(--unit, 3.25rem) / 2);
  border: var(--bar-line, 0.0625rem) solid var(--surfaceStroke);
  background: color-mix(in srgb, var(--deep) 86%, transparent);
  box-shadow: 0 0.25rem 0.875rem rgba(var(--tableShadeRgb), 0.3);
  backdrop-filter: blur(0.75rem) saturate(1.2);
  -webkit-backdrop-filter: blur(0.75rem) saturate(1.2);
}
.advisor-bar[hidden] { display: flex; visibility: hidden; }
.advisor-slot {
  position: relative;
  flex: none;
  width: var(--chip, 2.75rem);
  height: var(--chip, 2.75rem);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.advisor-slot[aria-disabled="true"] { cursor: default; }
.advisor-slot:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.1875rem; }
.slot-disc {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--disc-off);
  color: var(--onColour);
  transition: transform 0.3s var(--spring-back), background-color 0.2s ease;
}
.slot-disc svg { width: 1.375rem; height: 1.375rem; }
.advisor-slot.held .slot-disc { background: var(--tint); }
.advisor-slot.working .slot-disc { transform: scale(1.06); outline: 0.15625rem solid var(--onColour); outline-offset: -0.15625rem; }
.advisor-slot:active:not([aria-disabled="true"]) .slot-disc { transform: scale(0.94); }
/* Tucked in on the chip's corner, so it sits inside the bar's rim and
   never on the next chip. */
.slot-badge {
  position: absolute;
  right: -0.125rem;
  bottom: -0.1875rem;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.25rem;
  border-radius: 0.6875rem;
  border: 0.125rem solid var(--deep);
  background: var(--tint);
  color: var(--onColour);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.advisor-slot:not(.held) .slot-badge { background: var(--disc-off); }
.slot-badge svg { width: 0.6875rem; height: 0.6875rem; }
.slot-badge[hidden] { display: none; }
.advisor-slot[hidden] { display: none; }
/* A test's stand-in for an advisor not yet in the game (table.js
   sampleChips, ?chips=N): drawn, grey, and nothing else. */
.advisor-slot.placeholder { display: block; cursor: default; }

.tint-banker { --tint: var(--tint-banker); }
.tint-fund { --tint: var(--tint-fund); }
.tint-analyst { --tint: var(--tint-analyst); }
.tint-rewind { --tint: var(--tint-rewind); }
.tint-coach { --tint: var(--tint-coach); }

/* An advisor's face in 3D (advisors.js advisorDisc), over their colour on
   whatever disc they are drawn on: once it is there, it takes the glyph's
   place. Grey in the bar for one spent or never brought, as the disc is. */
.advisor-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  animation: face-in 0.3s ease-out;
}
@keyframes face-in { from { opacity: 0; } }
.faced > svg { visibility: hidden; }
.advisor-slot:not(.held) .advisor-face { filter: grayscale(1); opacity: 0.75; }

/* ---- The season card ------------------------------------------------- */

/* In the middle of the table, where the card and the swipe buttons were
   (both gone by now, like the meters): the season card centred in the room
   under the top bar, so its way back and its language stay in reach, and
   scrolling when a card is taller than the room (its margins give way
   first). */
.end {
  position: absolute;
  inset: calc(env(safe-area-inset-top) + 3.75rem) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem max(1rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.end[hidden] { display: none; }

/* The season card appears, and turns over to its back (SeasonEnd's
   rotation3DEffect, the app's spring set by table.js). Both sides share one
   grid cell, so the card is as tall as the taller side. */
.turn {
  width: var(--card-w);
  min-width: min(18.75rem, 100%);
  margin-block: auto;
  padding-top: 1.9375rem;
  perspective: 87.5rem;
  transform: scale(0.86);
  opacity: 0;
  transition: transform 0.45s var(--spring-soft), opacity 0.25s ease;
}
.turn.shown { transform: none; opacity: 1; }
.turner { display: grid; transform-style: preserve-3d; }
/* Each side keeps its own height, sitting on the cell's floor: the score
   stays under the thumb when the back is the taller side. */
.turner > * { grid-area: 1 / 1; align-self: end; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.turner.turned { transform: rotateY(180deg); }

.season {
  position: relative;
  padding: 2.75rem 0 1.625rem;
  border-radius: calc(var(--card-w) * 0.045);
  background: var(--paper);
  color: var(--paperInk);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.season .badge {
  position: absolute;
  top: -1.9375rem;
  left: calc(50% - 1.9375rem);
  width: 3.875rem;
  height: 3.875rem;
  border-radius: 50%;
  background: var(--canvas);
  border: 0.25rem solid var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.season .badge svg { width: 2.125rem; height: 2.125rem; }

.season h2 { margin: 0; font-size: 1.4375rem; font-weight: 700; }
.season h2:focus { outline: none; }

.stars { display: flex; gap: 1.125rem; }
.stars svg {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--paperEdge);
  transform: scale(0.7);
  transition: transform 0.3s var(--spring-back), color 0.2s ease;
}
.stars svg.on { color: var(--accentOnPaper); transform: scale(1); }

.season .line { margin: 0; padding: 0 1.5rem; font-size: 0.875rem; font-weight: 600; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.season.ruined .line { color: var(--paperInk); }

.season .score { display: flex; flex-direction: column; gap: 0.125rem; padding-top: 0.125rem; }
.season .score .label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1rem; color: color-mix(in srgb, var(--paperInk) 70%, transparent); }
.season .score .value { font-size: 2.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }

.restart {
  margin: 0.25rem 1.5rem 0;
  align-self: stretch;
  height: 3.25rem;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--paperInk);
  color: var(--paper);
  font-size: 1.0625rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}
.restart svg { width: 1.125rem; height: 1.125rem; }
.restart[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.leave {
  margin: -0.375rem 1.5rem 0;
  align-self: stretch;
  height: 2.75rem;
  border: 0;
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--paperInk);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.leave:active { background: color-mix(in srgb, var(--paperInk) 10%, transparent); }
.leave:focus-visible { outline: 0.1875rem solid var(--accentOnPaper); outline-offset: 0.1875rem; }
.restart:active { transform: scale(0.97); }
.restart:focus-visible { outline: 0.1875rem solid var(--accentOnPaper); outline-offset: 0.1875rem; }

/* "What I noticed": quiet, and last; the reward is the score. */
.noticed {
  margin: -0.375rem 1.5rem 0;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: var(--radius-m);
  background: transparent;
  color: color-mix(in srgb, var(--paperInk) 78%, transparent);
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
}
.noticed svg { width: 0.875rem; height: 0.875rem; }
.noticed:active { background: color-mix(in srgb, var(--paperInk) 10%, transparent); }
.noticed:focus-visible, .turn-back:focus-visible { outline: 0.1875rem solid var(--accentOnPaper); outline-offset: 0.125rem; }

/* The back (SeasonReading.swift): the paper again, the notices on it. */
.season-back {
  margin-top: 0;
  padding: 1.875rem 1.5rem 1.125rem;
  border-radius: calc(var(--card-w) * 0.045);
  background: var(--paper);
  color: var(--paperInk);
  display: flex;
  flex-direction: column;
  transform: rotateY(180deg);
  user-select: text;
  -webkit-user-select: text;
}
.season-back h2 { margin: 0; font-size: 1.3125rem; font-weight: 700; text-align: center; }
.season-back h2:focus { outline: none; }
.back-lead { margin: 0.25rem 0 0; font-size: 0.78125rem; font-weight: 500; text-align: center; text-wrap: balance; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.notices { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.notice-kind { margin: 0; font-size: 0.625rem; font-weight: 800; letter-spacing: 0.075rem; text-transform: uppercase; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.notice-title { margin: 0.1875rem 0 0; font-size: 0.9375rem; font-weight: 700; }
.notice-line { margin: 0.1875rem 0 0; font-size: 0.84375rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 82%, transparent); }
.turn-back {
  margin: 1.125rem 0 0;
  min-height: 2.875rem;
  border: 0;
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--paperInk);
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}
.turn-back svg { width: 1rem; height: 1rem; }
.turn-back:active { background: color-mix(in srgb, var(--paperInk) 10%, transparent); }

/* ---- The profile's biases ------------------------------------------------ */

.biases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.bias + .bias { padding-top: 1rem; border-top: 0.0625rem solid color-mix(in srgb, var(--paperInk) 14%, transparent); }
.bias-state { flex: none; max-width: 55%; font-size: 0.75rem; font-weight: 700; text-align: right; }
.bias-what { margin: 0.25rem 0 0; font-size: 0.8125rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 75%, transparent); }
.bias-line { margin: 0.5rem 0 0; font-size: 0.875rem; line-height: 1.4; }
.bias-count { margin: 0.125rem 0 0; font-size: 0.75rem; color: color-mix(in srgb, var(--paperInk) 70%, transparent); }

/* ---- A class's boards ---------------------------------------------------- */

.board-class { display: flex; flex-direction: column; gap: 0.875rem; padding-top: 1rem; border-top: 0.0625rem solid var(--surfaceStroke); }
.board-class h2, .board-class h3 { margin: 0; }
.board-own { margin: 0; }
.board-own dd { font-size: 1rem; word-break: normal; }
.board { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.board-caption { padding-bottom: 0.25rem; font-weight: 700; text-align: left; }
.board th, .board td { padding: 0.375rem 0.5rem 0.375rem 0; text-align: left; font-weight: 400; border-bottom: 0.0625rem solid var(--surfaceStroke); }
.board thead th { font-size: 0.75rem; color: var(--inkMuted); }
.board tr.you th, .board tr.you td { font-weight: 700; }
.board-teams { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.625rem; }
.board-teams li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.board-teams .btn { margin-left: auto; }
.board-challenge { display: flex; flex-direction: column; gap: 0.5rem; }
.board-goal { margin: 0; font-weight: 700; }
.board-challenge .note { margin: 0; }
.age-choices { gap: 0.625rem; }

/* ---- The summit's page (SummitEnd.swift) ------------------------------- */

/* The whole room under the top bar, its own scroll, and "Back to seasons"
   kept under the thumb at its foot whatever the page's length. */
.end.page { overflow: hidden; padding-bottom: 0; }
.summit-end {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(1rem);
  transition: transform 0.4s var(--spring-soft), opacity 0.25s ease;
}
.summit-end.shown { opacity: 1; transform: none; }
.summit-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.875rem;
  user-select: text;
  -webkit-user-select: text;
}
.summit-badge {
  align-self: center;
  width: 5.25rem;
  height: 5.25rem;
  flex: none;
  border-radius: 50%;
  background: var(--paper);
  border: 0.1875rem solid var(--accent);
  color: var(--accentOnPaper);
  display: flex;
  align-items: center;
  justify-content: center;
}
.summit-badge svg { width: 2.375rem; height: 2.375rem; }
.summit-end h2 { margin: 0.125rem 0 0; font-size: 1.75rem; font-weight: 800; text-align: center; }
.summit-end h2:focus { outline: none; }
.summit-lead { margin: 0 0.5rem; font-size: 0.9375rem; line-height: 1.4; text-align: center; color: var(--inkMuted); }
.level-card {
  padding: 1rem;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--paperInk);
}
.level-name { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.level-line { margin: 0.5rem 0 0.75rem; font-size: 0.875rem; line-height: 1.4; }
/* It stands on the paper, so it takes the paper's ink, not the screen's. */
.btn.summit-profile { border-color: var(--paperInk); background: var(--paperInk); color: var(--paper); }
.btn.summit-profile:active { background: var(--paperInk); opacity: 0.85; }
.summit-footnote { margin: 0 0.25rem; font-size: 0.75rem; line-height: 1.45; color: var(--inkMuted); }
.summit-foot {
  flex: none;
  padding: 0.75rem 0 max(1rem, env(safe-area-inset-bottom));
  border-top: 0.0625rem solid var(--surfaceStroke);
}

.visually-hidden {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- The shell: Home, signing in, the account ------------------------ */

/* A screen fills the column and scrolls inside it when it must; its
   actions sit at the bottom, in the thumb's reach (port-spec §1.3). */
.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0 1rem max(1rem, env(safe-area-inset-bottom));
  user-select: text;
  -webkit-user-select: text;
}
.screen .topbar { padding: 0.5rem 0 0; }

.screen h1 {
  margin: 1.25rem 0 0.75rem;
  font-size: 1.875rem;
  line-height: 1.15;
  font-weight: 800;
}
.screen h1:focus { outline: none; }
.screen h2 { margin: 0 0 0.625rem; font-size: 1.125rem; font-weight: 700; }
.screen p { margin: 0 0 0.75rem; }
.lead { font-size: 1.125rem; }
.note, .hint { color: var(--inkMuted); font-size: 0.9375rem; }
.hint { margin: 0.375rem 0 0; }
.warning { font-weight: 700; color: var(--verdictBad); }

.stack { display: flex; flex-direction: column; flex: 1; }

.actions {
  margin-top: auto;
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1.25rem;
  border: 0.0625rem solid var(--surfaceStroke);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); background: var(--surfacePressed); }
.btn:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--deep); }
.btn.primary:active { background: color-mix(in srgb, var(--accent) 85%, var(--shade)); }
.btn.danger { color: var(--verdictBad); border-color: color-mix(in srgb, var(--verdictBad) 55%, transparent); }
.btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.small-link, .inline-link { color: var(--ink); font-weight: 600; }
.small-link {
  align-self: center;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--inkMuted);
}
.small-link:focus-visible, .inline-link:focus-visible, summary:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; border-radius: var(--radius-xs); }

/* Home: the name in the middle, the two buttons below it. */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 1.5rem;
}
.hero-mark { color: var(--accent); margin-bottom: 0.75rem; }
.home h1 { margin: 0 0 0.5rem; font-size: 2.75rem; letter-spacing: -0.03125rem; }
.hello { font-size: 1.25rem; color: var(--inkMuted); }
.home .note { max-width: 18.75rem; }
.home .actions { margin-top: 0; flex: none; }
/* Two equals side by side: the profile and the account. */
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.btn.with-icon, .btn-pair .btn { gap: 0.5rem; }
.btn svg { width: 1.25rem; height: 1.25rem; flex: none; }

/* Forms */
.field { display: flex; flex-direction: column; margin-bottom: 1rem; }
.field label { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.375rem; }
.field input, .check input { accent-color: var(--accent); }
.field input {
  height: 3.25rem;
  padding: 0 0.875rem;
  border: 0.0625rem solid var(--surfaceStroke);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
.field input:focus { outline: 0.1875rem solid var(--accent); outline-offset: 0.0625rem; }
.field input[aria-invalid="true"] { border-color: var(--verdictBad); }
#join-code, #class-code { text-transform: uppercase; letter-spacing: 0.125rem; }

.more { margin-bottom: 0.5rem; }
.more summary { padding: 0.5rem 0 0.875rem; font-weight: 600; cursor: pointer; }

.error { min-height: 0; color: var(--verdictBad); font-weight: 600; }
.error:empty { display: none; }

.check { display: flex; gap: 0.75rem; align-items: flex-start; margin: 0 0 0.875rem; cursor: pointer; }
.check input { width: 1.5rem; height: 1.5rem; flex: none; margin: 0; }

.notice {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-l);
  background: var(--surface);
  font-size: 0.9375rem;
}

/* What stands between a host app's token and the game, or a signed-out player
   and the app. The way to the email form looks like a link, no louder than the
   privacy notice's. */
.opening button.small-link { border: 0; background: none; font-family: inherit; font-weight: 500; font-size: 0.875rem; cursor: pointer; }

/* The account */
.facts { margin: 0 0 1.25rem; }
.facts dt { font-size: 0.9375rem; color: var(--inkMuted); }
.facts dd { margin: 0.125rem 0 0; font-size: 1.125rem; font-weight: 600; word-break: break-all; }
.group { display: flex; flex-direction: column; gap: 0.625rem; padding: 1.125rem 0; border-top: 0.0625rem solid var(--surfaceStroke); }
.group h2 { margin: 0; }
.group .lang { align-self: flex-start; }
.group .small-link { align-self: flex-start; padding-left: 0; }
.classes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.classes li { display: flex; flex-direction: column; }
.class-name { font-weight: 600; }
/* Leaving a class: a quiet link-like button, asked twice. */
.classes .leave-wrap { display: flex; flex-direction: column; align-items: flex-start; }
.classes .leave-class { align-self: flex-start; padding: 0.375rem 0; border: 0; background: none; font: inherit; font-size: 0.875rem; text-decoration: underline; text-underline-offset: 0.1875rem; cursor: pointer; }
.classes .leave-wrap .hint { margin: 0.125rem 0 0; }

/* ---- Settings (SettingsView.swift) ------------------------------------- */

/* Every choice in view at once, as segmented radio buttons: the input
   itself is hidden, its label is the segment, and the keyboard moves
   through a group with the arrow keys as radios do. */
.choices { margin: 0; padding: 1.125rem 0; border: 0; border-top: 0.0625rem solid var(--surfaceStroke); min-width: 0; }
/* Floated, so the legend sits inside the group rather than on its border. */
.choices legend { float: left; width: 100%; padding: 0; margin-bottom: 0.625rem; font-size: 0.9375rem; font-weight: 700; }
.choice-row { clear: both; display: flex; padding: 0.1875rem; gap: 0.1875rem; border-radius: var(--radius-m); background: var(--surface); border: 0.0625rem solid var(--surfaceStroke); }
.choice-row input { position: absolute; opacity: 0; width: 0.0625rem; height: 0.0625rem; margin: 0; pointer-events: none; }
.choice {
  flex: 1;
  min-height: 2.875rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--inkMuted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.choice-row input:checked + .choice { background: var(--ink); color: var(--deep); }
.choice-row input:focus-visible + .choice { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; }
.choices.disabled .choice-row { opacity: 0.45; }
.choices.disabled .choice { cursor: default; }
.choices .hint { font-size: 0.875rem; }
.saved { min-height: 1.4em; margin-top: 0.5rem; font-size: 0.9375rem; font-weight: 600; color: var(--verdictGood); }

/* ---- The profile (ProfileView.swift), on the game's paper ------------- */

.profile-body { display: flex; flex-direction: column; gap: 0.875rem; padding-bottom: 0.5rem; }
.profile-body > p.note { margin: 0; }
.p-stale { margin: 0; padding: 0.625rem 0.875rem; border-radius: var(--radius-l); background: var(--surface); font-size: 0.875rem; font-weight: 600; }
.p-card {
  padding: 1rem;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--paperInk);
}
.p-heading { margin: 0.75rem 0.25rem 0; font-size: 1.25rem; font-weight: 800; }
.screen .p-lead { margin: -0.375rem 0.25rem 0; font-size: 0.875rem; line-height: 1.4; color: var(--inkMuted); }
.p-note { margin: 0; font-size: 0.78125rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 78%, transparent); }

/* Who sees this (design §8): first, plainly, on the room's own colours. */

/* The streak (ProfileStreak.swift): the number, the week under it. */
.streak { display: flex; flex-direction: column; gap: 0.875rem; }
.streak-top { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; }
.screen .streak-figure { margin: 0; display: flex; align-items: baseline; gap: 0.625rem; }
.streak-number { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.streak-unit { font-size: 0.9375rem; font-weight: 600; color: color-mix(in srgb, var(--paperInk) 78%, transparent); }
.shields { display: inline-flex; align-items: center; gap: 0.3125rem; padding: 0.375rem 0.625rem; border-radius: var(--radius-s); background: color-mix(in srgb, var(--paperInk) 8%, transparent); font-size: 0.875rem; font-weight: 800; }
.shields svg { width: 0.875rem; height: 0.875rem; }
.week { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.375rem; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 0.3125rem; }
.week-dot {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--paperInk) 14%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.week-day.played .week-dot { background: var(--did); color: var(--onColour); }
.week-day.shielded .week-dot { background: color-mix(in srgb, var(--paperInk) 32%, transparent); color: var(--paperInk); }
.week-day.today .week-dot { box-shadow: 0 0 0 0.125rem var(--paper), 0 0 0 0.25rem var(--paperInk); }
.week-dot svg { width: 0.9375rem; height: 0.9375rem; }
.week-name { font-size: 0.6875rem; font-weight: 700; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.week-day.today .week-name { color: var(--paperInk); }
.screen .streak-status { margin: 0; font-size: 0.9375rem; font-weight: 700; }

/* The figures (ProfileTiles.swift): two columns, a note under each. */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.tile { padding: 0.875rem; border-radius: var(--radius-l); background: var(--paper); color: var(--paperInk); display: flex; flex-direction: column; gap: 0.5rem; }
.screen .tile-figure { margin: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.tile-value { font-size: 2rem; font-weight: 900; line-height: 1.05; }
.tile-title { font-size: 0.9375rem; font-weight: 700; }
.screen .tile-note { margin: 0; font-size: 0.75rem; line-height: 1.35; color: color-mix(in srgb, var(--paperInk) 76%, transparent); }

/* How you play: one track per dimension, said a ring, did a dot. */
.legend { display: flex; gap: 1.125rem; margin-bottom: 0.25rem; font-size: 0.8125rem; font-weight: 600; }
.legend-key { display: inline-flex; align-items: center; gap: 0.4375rem; }
.legend .mark { position: static; transform: none; }
.traits { list-style: none; margin: 0; padding: 0; }
.trait { padding: 0.875rem 0; border-bottom: 0.0625rem solid color-mix(in srgb, var(--paperInk) 12%, transparent); }
.trait:last-child { border-bottom: 0; }
.trait-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.625rem; }
.trait-title { margin: 0; font-size: 0.96875rem; font-weight: 700; }
.trait-words { font-size: 0.8125rem; font-weight: 700; text-align: right; color: color-mix(in srgb, var(--paperInk) 85%, transparent); }
.trait.provisional .trait-title, .trait.provisional .trait-words { color: color-mix(in srgb, var(--paperInk) 70%, transparent); }
.dumbbell { position: relative; height: 1.375rem; margin: 0.625rem 0.4375rem 0; }
.dumbbell-track { position: absolute; inset: 0.3125rem 0; width: 100%; height: 0.75rem; overflow: visible; }
.dumbbell-track .axis { stroke: color-mix(in srgb, var(--paperInk) 22%, transparent); stroke-width: 0.0625rem; vector-effect: non-scaling-stroke; }
.dumbbell-track .tick { stroke: color-mix(in srgb, var(--paperInk) 28%, transparent); stroke-width: 0.0625rem; vector-effect: non-scaling-stroke; }
.dumbbell-track .gap { stroke: color-mix(in srgb, var(--paperInk) 45%, transparent); stroke-width: 0.125rem; vector-effect: non-scaling-stroke; }
.mark {
  position: absolute;
  top: 50%;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}
.mark.said { border: 0.1875rem solid var(--said); background: var(--paper); box-shadow: 0 0 0 0.125rem var(--paper); }
.mark.did { background: var(--did); box-shadow: 0 0 0 0.125rem var(--paper); }
.dumbbell-ends { display: flex; justify-content: space-between; margin: 0.1875rem 0 0; font-size: 0.6875rem; font-weight: 600; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.pips { display: flex; gap: 0.3125rem; margin: 0.625rem 0 0; }
.pip { width: 1.375rem; height: 0.4375rem; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--paperInk) 14%, transparent); }
.pip.on { background: var(--paperInk); }
.screen .trait-sentence { margin: 0.5rem 0 0; font-size: 0.84375rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 85%, transparent); }
.as-table { margin-top: 0.5rem; border-top: 0.0625rem solid color-mix(in srgb, var(--paperInk) 12%, transparent); padding-top: 0.375rem; }
.as-table summary { padding: 0.5rem 0; font-size: 0.875rem; font-weight: 700; cursor: pointer; }
.as-table summary:focus-visible { outline-color: var(--accentOnPaper); }
.as-table table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.as-table th, .as-table td { padding: 0.375rem 0.25rem; text-align: left; vertical-align: top; border-bottom: 0.0625rem solid color-mix(in srgb, var(--paperInk) 10%, transparent); }
.as-table thead th { font-size: 0.75rem; color: color-mix(in srgb, var(--paperInk) 78%, transparent); }
.as-table .p-note { margin-top: 0.5rem; }

/* ---- The season map (SeasonMap.swift) --------------------------------- */

.map-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* The map's night sky, on the whole page rather than on the phone-wide
   column (#app, at most 430px): on a phone wider than that, a gradient on
   the column alone left flat bands either side of it. */
body:has(.map-screen) { background: linear-gradient(180deg, var(--deep) 0%, var(--canvas) 75%) fixed; }
.map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem 0.125rem;
}
.map-head h1 { margin: 0; font-size: 1.875rem; font-weight: 800; }
.map-head h1:focus { outline: none; }

/* One ladder, snapped so a rung rests in the middle. The ends fade rather
   than cut, the list carrying on past the frame: over a fifth of the height
   at each end, eased (a straight ramp shows its edge), so the rungs there,
   already small and faint (map.js), melt into the background. */
.ladder {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  --ladder-fade: linear-gradient(to bottom,
    transparent 0%, rgba(var(--shadeRgb), 0.08) 4%, rgba(var(--shadeRgb), 0.3) 9%, rgba(var(--shadeRgb), 0.62) 14%, rgba(var(--shadeRgb), 0.88) 19%, var(--shade) 23%,
    var(--shade) 77%, rgba(var(--shadeRgb), 0.88) 81%, rgba(var(--shadeRgb), 0.62) 86%, rgba(var(--shadeRgb), 0.3) 91%, rgba(var(--shadeRgb), 0.08) 96%, transparent 100%);
  -webkit-mask-image: var(--ladder-fade);
  mask-image: var(--ladder-fade);
}
.ladder::-webkit-scrollbar { display: none; }
.ladder-pad { flex: none; }
.rungs { list-style: none; margin: 0; padding: 0; }
.rung {
  height: 11.625rem;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rung.chapter { justify-content: center; }
/* A simulator keeps to the top of its row, as a lesson does, so when it
   swells it never lands on the crown below it (SeasonMapSummit.swift:
   padding(.bottom, 96)). */
.rung.chapter.sim { justify-content: flex-start; padding-top: 0.25rem; }
/* Three dots down to the next rung, one gradient repeated; map.js fades
   them with their distance from the middle. */
.trail {
  flex: none;
  width: 0.375rem;
  height: 2.25rem;
  margin: auto 0;
  opacity: 0.3;
  background: radial-gradient(circle, rgba(var(--lightRgb), 0.42) 0 0.15625rem, transparent 0.1875rem) center top / 0.375rem 0.75rem repeat-y;
}

/* What swells as it nears the middle; map.js sets its scale and opacity.
   At rest (far from the middle) as small and faint as map.js's ends. */
.swell {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.3;
  transform: scale(0.78);
  transform-origin: 50% 50%;
}
.swell.lesson { gap: 0.3125rem; }
.swell.heading { padding: 0.625rem 0; }
.swell.simulator { gap: 0.3125rem; transform-origin: 50% 100%; }

.node {
  position: relative;
  flex: none;
  width: 3.4375rem;
  height: 3.4375rem;
  padding: 0;
  border-radius: 50%;
  border: 0.09375rem solid var(--surfaceStroke);
  background: var(--surface);
  color: var(--inkMuted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.node svg { width: 1.125rem; height: 1.125rem; }
.node .number { font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.node.ahead { color: rgba(var(--lightRgb), 0.55); }
.node.done { background: var(--paper); color: color-mix(in srgb, var(--paperInk) 60%, transparent); cursor: pointer; }
.node.done svg { width: 1.375rem; height: 1.375rem; }
/* A lesson whose review day has come: a dot on its node, and a line under its name. */
.node.done.due::after { content: ''; position: absolute; top: -0.125rem; right: -0.125rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
.node-due { display: block; font-size: 0.75rem; font-weight: 600; color: var(--inkMuted); }
/* The one door is lit: a soft warm light behind the disc that brightens
   the purple rather than tinting it, breathing slowly, with no edge and no
   ring; the disc itself catches the light at its top. Its own stacking
   context, the face drawn by ::after over the light (::before), so hovered
   or pressed (a transform) the order stays light, face, number. */
.node.next {
  isolation: isolate;
  background: transparent;
  border: none;
  color: var(--paperInk);
  cursor: pointer;
}
.node.next::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--paperBright) 0%, var(--paper) 55%, var(--paperShade) 100%);
  pointer-events: none;
}
.node.next::before {
  content: "";
  position: absolute;
  inset: -86%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--nodeGlowInner), var(--nodeGlowOuter) 55%, transparent);
  filter: blur(0.875rem);
  animation: breathe 4.2s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes breathe {
  from { transform: scale(0.94); opacity: 0.55; }
  to { transform: scale(1.06); opacity: 0.95; }
}
.node.crown svg { width: 1.375rem; height: 1.375rem; }
.node.crown.done, .node.crown.next { background: var(--accent); border: 0.1875rem solid var(--paper); color: var(--ceiling); }
.node.crown.next { background: transparent; }
.node.crown.next::after { background: var(--accent); }
.node.sim { cursor: default; }
/* An open simulator (SeasonMapSummit.simulatorRung): the paper disc with a
   warm ring and the tool it is drawn on it, a node like every other. */
.node.sim.open { background: var(--paper); border: 0.1875rem solid var(--accent); color: var(--paperInk); cursor: pointer; }
.node.sim.open svg { width: 1.5rem; height: 1.5rem; }
.node:focus-visible { outline: 0.125rem solid var(--accent); outline-offset: 0.3125rem; }
.node:active:not([aria-disabled="true"]) { transform: scale(0.94); }
.node-title { max-width: 11.875rem; font-size: 0.75rem; font-weight: 600; line-height: 1.25; text-align: center; color: rgba(var(--lightRgb), 0.85); }

.heading-title { max-width: 15.625rem; margin: 0; font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.1125rem; line-height: 1.3; text-align: center; text-transform: uppercase; color: var(--ink); }
.heading-title.small { max-width: 11.875rem; font-size: 0.75rem; letter-spacing: 0.1rem; }
.heading-title.dim { color: rgba(var(--lightRgb), 0.62); }
.heading-title.warm { color: var(--accentText); }
.heading-note {
  margin: 0.25rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.075rem;
  color: rgba(var(--lightRgb), 0.62);
}
.heading-note svg { width: 0.6875rem; height: 0.6875rem; }
.heading-stars { display: flex; gap: 0.3125rem; margin-top: 0.3125rem; }
.heading-stars svg { width: 0.8125rem; height: 0.8125rem; color: rgba(var(--lightRgb), 0.22); }
.heading-stars svg.on { color: var(--accent); }

/* Back at the foot, in the thumb's reach, as in the app; a run under way
   can be picked up from here too. */
.map-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 1rem max(0.75rem, env(safe-area-inset-bottom));
}
.icon-btn.round { margin-left: 0; background: var(--surface); border: 0.0625rem solid var(--surfaceStroke); }
.map-continue { width: auto; min-height: 3rem; padding: 0.625rem 1.5rem; }

/* ---- Put to the player: the launch sheet, an advisor ------------------ */

.layer {
  position: fixed;
  /* top and height: the part of the window that can be seen (layer.js). */
  inset: 0 0 auto;
  height: 100%;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}
.layer.keyboard, .layer.signin-layer.keyboard { align-items: flex-start; padding-top: 0.75rem; }
.layer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--shadeRgb), 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.layer.shown .layer-backdrop { opacity: 1; }
/* Low on the screen, so Play is under the thumb; scrolls when it must. */
.layer-panel {
  position: relative;
  width: min(100%, 24.875rem);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2.25rem 0.75rem 0.25rem;
  opacity: 0;
  transform: translateY(1.5rem) scale(0.96);
  transition: transform 0.34s var(--spring-soft), opacity 0.2s ease;
}
.layer.shown .layer-panel { opacity: 1; transform: none; }
.layer.leaving .layer-panel { transition-duration: 0.18s; }

.sheet {
  position: relative;
  padding: 2.875rem 1.25rem 1.375rem;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--paperInk);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 1.125rem 3.125rem rgba(var(--shadeRgb), 0.35);
  user-select: text;
  -webkit-user-select: text;
}
.sheet-badge {
  position: absolute;
  top: -2.0625rem;
  left: calc(50% - 2.0625rem);
  width: 4.125rem;
  height: 4.125rem;
  border-radius: 50%;
  border: 0.3125rem solid var(--paper);
  background: var(--accent);
  color: var(--deep);
  font-size: 1.625rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-badge.crown svg { width: 1.75rem; height: 1.75rem; }
.sheet-close {
  position: absolute;
  top: -0.625rem;
  right: -0.625rem;
  width: 2.375rem;
  height: 2.375rem;
  padding: 0;
  border-radius: 50%;
  border: 0.1875rem solid var(--paper);
  background: var(--loss);
  color: var(--onColour);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sheet-close svg { width: 1rem; height: 1rem; }
.sheet-close:focus-visible, .choice-disc:focus-visible, .choice-toggle:focus-visible { outline: 0.1875rem solid var(--accentOnPaper); outline-offset: 0.1875rem; }
.sheet-title { margin: 0; font-size: 1.375rem; font-weight: 800; line-height: 1.2; }
.sheet-label {
  margin: 1.25rem 0 1rem;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.075rem;
  color: color-mix(in srgb, var(--paperInk) 75%, transparent);
}
.sheet-hint { margin: 1rem 0 0; font-size: 0.8125rem; color: color-mix(in srgb, var(--paperInk) 75%, transparent); }
.sheet .btn.primary {
  margin-top: 1.25rem;
  width: auto;
  min-width: 11.875rem;
  box-shadow: 0 0.375rem 1.125rem color-mix(in srgb, var(--accent) 45%, transparent);
}
.sheet .btn:focus-visible { outline-color: var(--accentOnPaper); }

/* Five, three over two: never more than three a row, so a wide sheet
   does not make it four and one. Three of 5rem and their gaps come to
   16.5rem, the sheet's room inside on a 360px phone. */
.advisor-choices {
  --choice-gap: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem var(--choice-gap);
  max-width: calc(3 * 5rem + 2 * var(--choice-gap));
  margin-inline: auto;
}
.advisor-choice { display: flex; flex-direction: column; align-items: center; gap: 0.625rem; width: 5rem; }
.choice-discs { position: relative; width: 3.875rem; height: 3.875rem; }
.choice-disc {
  width: 3.875rem;
  height: 3.875rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  animation: breathe 1.5s ease-in-out infinite alternate;
}
.advisor-choice:nth-child(2) .choice-disc { animation-duration: 1.78s; }
.advisor-choice:nth-child(3) .choice-disc { animation-duration: 2.06s; }
.advisor-choice:nth-child(4) .choice-disc { animation-duration: 1.64s; }
.advisor-choice:nth-child(5) .choice-disc { animation-duration: 1.92s; }
@keyframes breathe {
  from { transform: scale(0.97); }
  to { transform: scale(1.04); }
}
.disc, .sheet-disc {
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--disc-off);
  color: var(--onColour);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.disc { position: relative; }
.disc svg { width: 1.75rem; height: 1.75rem; }
.advisor-choice.on .disc { background: var(--tint); box-shadow: 0 0 1.375rem color-mix(in srgb, var(--tint) 55%, transparent); }
.choice-toggle {
  position: absolute;
  right: -0.4375rem;
  bottom: -0.4375rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  border: 0.1875rem solid var(--paper);
  background: var(--disc-off);
  color: var(--onColour);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
/* A bigger target than it looks. */
.choice-toggle::after { content: ""; position: absolute; inset: -0.4375rem; }
.choice-toggle svg { width: 0.9375rem; height: 0.9375rem; }
.advisor-choice.on .choice-toggle { background: var(--tint); }
.choice-name { font-size: 0.75rem; font-weight: 700; line-height: 1.2; color: color-mix(in srgb, var(--paperInk) 80%, transparent); }

/* An advisor's own card (AdvisorSheet.swift). */
.advisor-card { padding-top: 3rem; }
.sheet-disc {
  position: absolute;
  top: -2.125rem;
  left: calc(50% - 2.125rem);
  width: 4.25rem;
  height: 4.25rem;
  border: 0.3125rem solid var(--paper);
  background: var(--tint);
  box-shadow: 0 0 1.375rem color-mix(in srgb, var(--tint) 45%, transparent);
}
.sheet-disc svg { width: 1.75rem; height: 1.75rem; }
.advisor-blurb { margin: 0.5rem 0.375rem 0; font-size: 0.875rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 80%, transparent); }
.advisor-caption { margin: 0.75rem 0.25rem 0; font-size: 0.78125rem; line-height: 1.4; color: color-mix(in srgb, var(--paperInk) 75%, transparent); }
.advisor-choose {
  margin-top: 1.25rem;
  width: auto;
  min-width: 13.125rem;
  background: var(--tint);
  border-color: var(--tint);
  color: var(--onColour);
}
.advisor-choose.on { background: transparent; border-color: color-mix(in srgb, var(--paperInk) 30%, transparent); color: var(--paperInk); }

/* The picture of an advisor working, on a loop (AdvisorExample). */
.example {
  position: relative;
  flex: none;
  width: 14.5rem;
  height: 7.25rem;
  margin-top: 1.375rem;
  border-radius: var(--radius-l);
  background: var(--paperBright);
  border: 0.0625rem solid var(--paperEdge);
  display: flex;
  align-items: center;
  justify-content: center;
}
.example .pill { width: 2.75rem; height: 2.75rem; }
.example .pill svg { width: 0.6875rem; height: 0.6875rem; }
.example .pill .amount { font-size: 0.9375rem; }
.example-col { position: absolute; top: 50%; display: flex; flex-direction: column; gap: 0.3125rem; translate: 0 -50%; }
.example-col.left { left: -1rem; }
.example-col.right { right: -1rem; }
.example-row { display: flex; align-items: center; gap: 0.75rem; }
.example-sides {
  position: absolute;
  left: 2.125rem;
  right: 2.125rem;
  bottom: 0.5625rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--paperInk) 75%, transparent);
}
.example-arrow { color: color-mix(in srgb, var(--paperInk) 45%, transparent); display: flex; }
.example-arrow svg { width: 1rem; height: 1rem; }
.example .pill.muted { opacity: 0.45; }
.example .cue { animation: cue 2.8s var(--spring-back) infinite both; }
.example .cue[data-cue="1"] { animation-delay: 0.14s; }
.example .cue[data-cue="2"] { animation-delay: 0.28s; }
@keyframes cue {
  0% { opacity: 0; transform: scale(0.5); }
  12%, 80% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; transform: scale(0.5); }
}
.example-meter { display: flex; flex-direction: column; align-items: center; gap: 0.5625rem; color: color-mix(in srgb, var(--paperInk) 60%, transparent); }
.example-symbol svg { width: 1.0625rem; height: 1.0625rem; }
.example-track { position: relative; width: 9.375rem; height: 0.625rem; border-radius: 0.3125rem; background: color-mix(in srgb, var(--paperInk) 14%, transparent); }
.example-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 55%; border-radius: 0.3125rem; background: var(--loss); animation: fall 2.8s linear infinite; }
@keyframes fall {
  0%, 12% { width: 55%; background: var(--loss); }
  56%, 61% { width: 3%; background: var(--loss); }
  64%, 88% { width: 12%; background: var(--money); }
  100% { width: 55%; background: var(--loss); }
}
.example-shield {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  display: flex;
  translate: 0 -50%;
  color: var(--money);
  background: var(--paperBright);
  border-radius: 50%;
  animation: catch 2.8s var(--spring-back) infinite;
}
.example-shield svg { width: 1.25rem; height: 1.25rem; }
@keyframes catch {
  0%, 60% { opacity: 0; transform: scale(0.2); }
  68%, 88% { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(0.2); }
}

/* The Time Traveller's: a card goes off to the wrong side and the meter
   under it starts to fall; the arrow turns back, and the card springs home
   with the meter whole again. */
.example-rewind { flex-direction: column; gap: 0.75rem; }
.example-card {
  width: 2.5rem;
  height: 3.5rem;
  padding: 0.5rem 0.375rem;
  box-sizing: border-box;
  border-radius: var(--radius-s);
  background: var(--paperWhite);
  border: 0.0625rem solid var(--paperEdge);
  box-shadow: 0 0.25rem 0.625rem rgba(var(--paperShadeRgb), 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
  animation: away-and-back 2.8s infinite;
}
.example-line { height: 0.25rem; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--paperInk) 22%, transparent); }
.example-line.short { width: 60%; }
@keyframes away-and-back {
  0%, 12% { transform: none; animation-timing-function: cubic-bezier(0.42, 0, 1, 1); }
  34%, 44% { transform: translateX(-4.75rem) rotate(-14deg); animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
  56% { transform: translateX(0.375rem) rotate(2deg); }
  64%, 100% { transform: none; }
}
.example-back {
  position: absolute;
  left: calc(50% - 0.875rem);
  top: 1.125rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--tint-rewind);
  color: var(--onColour);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: turn-back 2.8s var(--spring-back) infinite;
}
.example-back svg { width: 1rem; height: 1rem; }
@keyframes turn-back {
  0%, 32% { opacity: 0; transform: scale(0.3) rotate(120deg); }
  40%, 48% { opacity: 1; transform: none; }
  58%, 100% { opacity: 0; transform: scale(0.3); }
}
.example-rewind .example-fill { width: 70%; background: var(--money); animation: fall-and-back 2.8s infinite; }
@keyframes fall-and-back {
  0%, 12% { width: 70%; background: var(--money); }
  34%, 44% { width: 30%; background: var(--loss); }
  58%, 100% { width: 70%; background: var(--money); }
}

/* The Coach's: a blow to the nerve comes down on its meter, the coach's
   whistle is there on the bar, and the bar holds where it was. */
.example-coach { flex-direction: column; gap: 0.5rem; }
.example .example-blow { animation: blow 2.8s infinite both; }
@keyframes blow {
  0%, 8% { opacity: 0; transform: translateY(-0.75rem); }
  18%, 30% { opacity: 1; transform: none; animation-timing-function: cubic-bezier(0.5, 0, 1, 1); }
  40% { opacity: 1; transform: translateY(0.5rem); filter: none; }
  48%, 84% { opacity: 0.4; transform: translateY(0.125rem) scale(0.86); filter: grayscale(1); }
  94%, 100% { opacity: 0; transform: translateY(0.125rem) scale(0.86); filter: grayscale(1); }
}
.example-coach .example-fill { width: 62%; background: var(--money); animation: none; }
.example-mark {
  position: absolute;
  left: calc(62% - 0.8125rem);
  top: 50%;
  width: 1.625rem;
  height: 1.625rem;
  translate: 0 -50%;
  border-radius: 50%;
  border: 0.125rem solid var(--paperBright);
  background: var(--tint-coach);
  color: var(--onColour);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: guard 2.8s var(--spring-back) infinite;
}
.example-mark svg { width: 0.9375rem; height: 0.9375rem; }
@keyframes guard {
  0%, 28% { opacity: 0; transform: scale(0.2); }
  36%, 88% { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(0.2); }
}

/* What sync.js and the shell have to say, over whatever is showing. */
.toast {
  position: fixed;
  z-index: 10;
  top: calc(env(safe-area-inset-top) + 3.75rem);
  left: 50%;
  translate: -50% 0;
  width: min(calc(100vw - 2rem), 24.875rem);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-l);
  background: var(--deep);
  border: 0.0625rem solid var(--surfaceStroke);
  box-shadow: 0 0.5rem 1.875rem rgba(var(--shadeRgb), 0.35);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.toast.shown { opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; transition: opacity 0.25s ease; }
body.on-table .toast.shown { pointer-events: none; }
/* On the table it sits over the top bar and ends above the row where the
   meters' dots show during a drag (table.js sets the room, about 56px), so
   the meters and the buttons at the bottom are never covered. Three lines
   of 12px fit in it: 3 × 14.4 + 8 + 2 = 53.2px. Wider than elsewhere, so
   the longest Romanian message still takes three lines at 320px. */
body.on-table .toast {
  top: calc(env(safe-area-inset-top) + 0.25rem);
  width: min(calc(100vw - 1rem), 25.875rem);
  /* Over the top bar, so a tap goes through to the button under it. */
  pointer-events: none;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1.2;
  max-height: var(--toast-room, 3.5rem);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* ---- The greeting (port-spec §1.1–1.2, neutral) ----------------------- */

.greeting {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  background: var(--canvas);
  text-align: center;
  cursor: pointer;
}
.greeting-mark { color: var(--ink); transition: transform 0.5s var(--spring-soft); }
.greeting-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.85s ease-in-out forwards; }
.greeting-mark path:nth-child(2) { animation-duration: 0.4s; animation-delay: 0.55s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.greeting-line {
  margin: 1.75rem 0 0;
  max-width: 18.75rem;
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--inkMuted);
  animation: fade-in 0.5s ease 0.6s both;
}
@keyframes fade-in { from { opacity: 0; } }
.greeting-hint {
  position: absolute;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  margin: 0;
  font-size: 0.8125rem;
  color: var(--inkMuted);
}

.greeting.loading { justify-content: flex-start; }
.greeting.loading .greeting-mark { transform: scale(0.6); margin: -1.5rem 0 1rem; }
.greeting.loading .greeting-line { display: none; }
.loader { width: min(14.75rem, 62vw); height: auto; margin-top: 6vh; animation: fade-in 0.3s ease; }
.loader-sky { fill: var(--surface); }
.hill { transform-box: view-box; }
.hill.front { fill: var(--verdictGood); animation: slide 2.6s linear infinite; }
.hill.back { fill: var(--verdictBad); opacity: 0.8; animation: slide 3.8s linear infinite reverse; }
@keyframes slide { to { transform: translateX(-14.75rem); } }
.patter { margin: 1.75rem 0 0; font-size: 1.0625rem; font-weight: 700; }

.greeting.still .greeting-mark path { animation: none; stroke-dashoffset: 0; }
.greeting.still .hill, .greeting.still .greeting-line { animation: none; }

/* ---- Marks drawn at a fixed size by markSvg(), in rem like the rest -------- */

.hero-mark svg { width: 4.5rem; height: 4.5rem; }
.greeting-mark svg { width: 10rem; height: 10rem; }

/* The arrow keys, said under the table where there is a keyboard (below). */
.keys { display: none; }
kbd {
  display: inline-block;
  min-width: 1.75em;
  margin: 0 0.15em;
  padding: 0.05em 0.4em;
  border-radius: var(--radius-s);
  border: 1px solid var(--surfaceStroke);
  border-bottom-width: 0.1875rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: center;
}

/* The world beside the map's ladder: only where there is room for it. */
.map-world { display: none; }

/* ---- Phone landscape: the table spread sideways --------------------------

   A phone on its side has the height of a card and little more. The card
   takes the middle, whole height; the words and the way back sit to its
   left, the meters and the advisors to its right, and the two sides under
   the two thumbs, one in each bottom corner. */
@media (max-height: 500px) and (orientation: landscape) {
  /* The thumbs' corners, not the card's foot: the sides and the advisors
     stay beside the card, where each thumb rests. Held sideways in two
     hands, each thumb lies on its own edge and the middle of the foot is
     the one place neither reaches; the card also fills the height here,
     so a cluster on its foot would cover the face. */
  html { --table-layout: side; --controls: beside; }
  body.on-table #app {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "top   stage meters"
      "words stage bar"
      "left  stage right";
    column-gap: 0.5rem;
    padding: env(safe-area-inset-top) max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
  }
  body.on-table .topbar { grid-area: top; padding: 0.25rem 0 0; min-height: 0; }
  body.on-table .meters { grid-area: meters; align-self: start; padding: 0.5rem 0 0; gap: 0.5rem; }
  body.on-table .words { grid-area: words; align-self: center; padding: 0.5rem 0; }
  body.on-table .stage { grid-area: stage; width: calc(var(--card-w) * 1.35); }
  /* The row's three parts go to three corners of the grid. */
  body.on-table .controls, body.on-table .controls[hidden] { display: contents; }
  body.on-table .swipe-btn { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
  body.on-table .swipe-btn:first-child { grid-area: left; justify-self: start; }
  body.on-table .swipe-btn:last-child { grid-area: right; justify-self: end; }
  body.on-table .advisor-bar { grid-area: bar; justify-self: center; align-self: center; }
  /* Away from the arrows here, so not held to their height: five chips are
     wider than the column beside the card on a small phone, and shrink
     to fit it, still round. */
  body.on-table .advisor-bar { max-width: 100%; height: auto; }
  body.on-table .advisor-slot { flex: 0 1 var(--chip, 2.75rem); min-width: 0; height: auto; aspect-ratio: 1; }
  body.on-table .keys { display: none; }
}

/* ---- From a tablet up ---------------------------------------------------- */

@media (min-width: 600px) and (min-height: 501px) {
  /* The game's table fills the window: the canvas, lit a little in the
     middle and darker towards the edges. */
  body {
    background:
      radial-gradient(ellipse 75% 70% at 50% 42%, color-mix(in srgb, var(--wallLit) 16%, var(--canvas)) 0%, var(--canvas) 55%, color-mix(in srgb, var(--deep) 70%, var(--canvas)) 100%);
  }
  #app { width: 100%; }

  /* The top bar keeps to a frame rather than the window's far corners. */
  .topbar, .screen .topbar, .map-head {
    width: 100%;
    max-width: 76rem;
    margin-inline: auto;
    padding: 1rem 1.5rem 0;
  }
  .icon-btn { margin-left: 0; }

  /* The table, still a column (a tablet upright, a narrow window): the
     meters, the words and the thumb's row at a readable width, centred. */
  body.on-table .meters { width: min(100%, 30rem); margin-inline: auto; padding-top: 1rem; }
  body.on-table .words { width: min(100%, 36rem); margin-inline: auto; }
  body.on-table .prompt { font-size: 1.125rem; }
  /* The thumb's row on the card's foot, one cluster in its middle. */
  body.on-table .controls { width: min(100%, calc(var(--card-w) + 0.5rem)); margin-inline: auto; padding: 0 1rem max(1.25rem, env(safe-area-inset-bottom)); }
  .end .turn { margin-block: auto; }
  .end.page .summit-end { width: min(100%, 40rem); }

  /* Screens: one centred measure, its top bar across the frame. */
  .screen {
    display: grid;
    grid-template-columns: [full-start] minmax(1.5rem, 1fr) [content-start] minmax(0, var(--measure, 36rem)) [content-end] minmax(1.5rem, 1fr) [full-end];
    align-content: start;
    padding: 0 0 max(2.5rem, env(safe-area-inset-bottom));
  }
  .screen > * { grid-column: content; }
  .screen > .topbar { grid-column: full; }
  .screen h1 { margin: 2.5rem 0 1.25rem; font-size: 2.5rem; }
  .screen .actions { margin-top: 0.5rem; }

  /* Home: the name as a hero, the actions grouped under it. */
  .screen.home { grid-template-rows: auto 1fr auto; align-content: stretch; }
  .home .hero { padding-top: 2rem; }
  .home h1 { font-size: 4rem; letter-spacing: -0.03em; }
  .home .actions { width: min(100%, 24rem); justify-self: center; padding-bottom: 1rem; }

  /* Account: two columns of groups under the address. */
  .screen.account { --measure: 40rem; }

  .screen.profile { --measure: 40rem; }
  .p-heading { margin-top: 1.75rem; font-size: 1.5rem; }
  .screen .p-lead { max-width: 60ch; }

  /* Sheets come up as a dialog in the middle, not from the foot. */
  .layer { align-items: center; }
  .layer-panel { width: min(100%, 28rem); }

  /* The map: the rows taller with the root (map.js measures them). */
  .map-screen { background: transparent; }
  .map-head h1 { font-size: 2.25rem; }
  .map-foot { width: 100%; max-width: 76rem; margin-inline: auto; padding: 0.75rem 1.5rem max(1.25rem, env(safe-area-inset-bottom)); }
  .ladder { width: min(100%, 26rem); margin-inline: auto; }
}

/* ---- Two columns where there is the width (a tablet across, a desktop) --- */

@media (min-width: 900px) and (min-height: 501px) {
  /* The map: the ladder, and the world in its middle beside it. */
  .map-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem) minmax(0, 24rem) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 3rem;
  }
  .map-head, .map-foot { grid-column: 1 / -1; }
  .ladder { grid-column: 2; grid-row: 2; width: 100%; }
  .map-world { grid-column: 3; grid-row: 2; align-self: center; display: block; }

  /* Account: the groups in two columns. */
  .screen.account { --measure: 58rem; }
  .account .facts { margin-bottom: 1.5rem; }
  .screen.account > .group { grid-column: content; }
  .screen.account {
    grid-template-columns: [full-start] minmax(1.5rem, 1fr) [content-start a-start] minmax(0, 27rem) [a-end] 4rem [b-start] minmax(0, 27rem) [b-end content-end] minmax(1.5rem, 1fr) [full-end];
    align-items: start;
  }
  .screen.account > section.group:nth-of-type(odd) { grid-column: a; }
  .screen.account > section.group:nth-of-type(even) { grid-column: b; }

  /* The profile: the streak beside the six figures, the lessons in a row,
     the six measures and the six errors in columns. The cards are tighter
     here, so more of it is on screen at once. */
  .screen.profile { --measure: 56rem; }
  .profile-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem 1.25rem; align-items: start; }
  .profile-body > * { grid-column: 1 / -1; }
  .profile-body > .streak { grid-column: 1; align-self: stretch; gap: 0.625rem; padding: 0.875rem; }
  .profile-body > .tiles:not(.lessons-tiles) { grid-column: 2; }
  .profile-body .streak-number { font-size: 2.75rem; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
  .profile-body .tile { padding: 0.625rem 0.75rem; gap: 0.25rem; }
  .profile-body .tile-value { font-size: 1.5rem; }
  .profile-body .tile-title { font-size: 0.875rem; }
  .tiles.lessons-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .traits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
  .trait { border-bottom: 1px solid color-mix(in srgb, var(--paperInk) 12%, transparent); }
  .trait:nth-last-child(-n + 2) { border-bottom: 0; }
}

/* Desktop: the six measures and the six errors three across. */
@media (min-width: 1100px) and (min-height: 501px) {
  .screen.profile { --measure: 64rem; }
  .traits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trait:nth-last-child(-n + 3) { border-bottom: 0; }
}

/* ---- Desktop and large: the table as a scene, the map with its worlds ---- */

/* Landscape and wide enough: the words to the card's left, the meters to
   its right as a rail, the thumb's row and the keys under it. The reading
   order (meters, words, card, buttons) is the DOM's, unchanged: only the
   places move. */
@media (min-width: 900px) and (min-height: 501px) and (min-aspect-ratio: 5/4) {
  html { --table-layout: side; }
  body.on-table #app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    /* The stage runs down to the screen's foot; the thumb's row and the
       keys are laid over its last two rows, on the card's foot. */
    grid-template-areas:
      "top   top   top"
      "words stage meters"
      "words stage meters"
      "words stage meters";
    column-gap: 1.5rem;
    padding-inline: max(2rem, env(safe-area-inset-left)) max(2rem, env(safe-area-inset-right));
  }
  body.on-table .topbar { grid-area: top; }
  body.on-table .stage { grid-area: stage; width: calc(var(--card-w) * 1.35); }

  /* The words and the meters level with the middle of the card. */
  body.on-table .words, body.on-table .meters { align-self: end; margin-bottom: var(--card-mid, 50%); translate: 0 50%; }
  body.on-table .words {
    grid-area: words;
    justify-self: end;
    width: min(100%, 22rem);
    margin-inline: 0;
    padding: 0;
    align-items: flex-start;
    text-align: left;
    gap: 1rem;
  }
  body.on-table .prompt { font-size: 1.625rem; font-weight: 600; line-height: 1.25; text-wrap: pretty; }
  body.on-table .spoken { align-items: flex-start; gap: 0.5rem; }
  body.on-table .spoken .who { font-size: 0.8125rem; }
  body.on-table .spoken .line { font-size: 1.375rem; line-height: 1.3; text-wrap: pretty; }
  body.on-table .brief { padding: 1rem 1.25rem; }
  body.on-table .brief .mandate { font-size: 1.0625rem; }

  /* The meters as a rail: a dot, the symbol, the name and the bar. */
  body.on-table .meters {
    grid-area: meters;
    justify-self: start;
    width: min(100%, 15rem);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }
  body.on-table .meters[hidden] { display: flex; }
  body.on-table .meter {
    display: grid;
    grid-template-columns: 1.75rem 2rem minmax(0, 1fr);
    grid-template-areas: "dot icon name" "dot icon track";
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0.375rem;
  }
  /* The dot against its symbol, whatever its size, not adrift in the column. */
  body.on-table .meter .dot-slot { grid-area: dot; height: 1.75rem; justify-content: flex-end; }
  body.on-table .meter .dot { scale: 1.3; transform-origin: right center; }
  /* Max stands with the words: a card dragged over him covers him as it
     covers them. */
  body.on-table .partner { z-index: 0; }
  body.on-table .meter svg { grid-area: icon; width: 2rem; height: 2rem; padding: 0.25rem; }
  body.on-table .meter .track { grid-area: track; height: 0.5rem; border-radius: var(--radius-xs); }
  body.on-table .meter::after {
    grid-area: name;
    content: attr(title);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--inkMuted);
  }
  body.on-table .blind-pill { left: 3.75rem; translate: 0 -50%; }

  body.on-table .controls { grid-row: 3; grid-column: 2; justify-self: center; width: calc(var(--card-w) + 0.5rem); padding: 0 1rem 1.25rem; }
  body.on-table .keys { grid-row: 4; grid-column: 2; }

  /* Home: the hero to the left, the actions grouped to its right. */
  .screen.home {
    grid-template-columns: [full-start] minmax(1.5rem, 1fr) [hero-start] minmax(0, 34rem) [hero-end] 4rem [act-start] minmax(0, 22rem) [act-end] minmax(1.5rem, 1fr) [full-end];
    grid-template-rows: auto 1fr;
  }
  .home .hero { grid-column: hero; grid-row: 2; align-items: flex-start; text-align: left; padding: 0 0 4rem; }
  .home .hero-mark svg { width: 6rem; height: 6rem; }
  .home h1 { font-size: 5.5rem; }
  .home .hello { font-size: 1.5rem; }
  .home .actions {
    grid-column: act;
    grid-row: 2;
    align-self: center;
    width: 100%;
    margin: 0 0 4rem;
    padding: 1.5rem;
    border-radius: var(--radius-l);
    background: color-mix(in srgb, var(--deep) 55%, transparent);
    border: 1px solid var(--surfaceStroke);
    box-shadow: 0 1.5rem 4rem rgba(var(--shadeRgb), 0.25);
  }
}

/* Large: more air round the same scene, the reading a little wider. */
@media (min-width: 1800px) and (min-height: 501px) {
  .screen.profile { --measure: 72rem; }
  body.on-table .words { width: min(100%, 24rem); }
}

/* ---- The world beside the map ------------------------------------------- */

.world-card {
  padding: 1.75rem 1.75rem 1.5rem;
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--deep) 60%, transparent);
  border: 1px solid var(--surfaceStroke);
  box-shadow: 0 1.5rem 4rem rgba(var(--shadeRgb), 0.25);
}
.world-title { margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.world-card.summit .world-title { color: var(--accentText); }
.world-card .heading-note { margin-top: 0.5rem; font-size: 0.8125rem; }
.world-card .world-pitch { margin: 0.625rem 0 0; font-size: 0.9375rem; line-height: 1.45; color: var(--inkMuted); }
.world-card .heading-note svg { width: 0.875rem; height: 0.875rem; }
.world-card .heading-stars { gap: 0.375rem; margin-top: 0.625rem; }
.world-card .heading-stars svg { width: 1.375rem; height: 1.375rem; }
.world-progress { margin-top: 1.25rem; }
.world-count { margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 600; color: var(--inkMuted); }
.world-learned { margin: 0.5rem 0 0; font-size: 0.8125rem; font-weight: 600; color: var(--inkMuted); }
.world-bar { position: relative; display: block; height: 0.375rem; border-radius: 0.1875rem; background: rgba(var(--lightRgb), 0.18); overflow: hidden; }
.world-fill { position: absolute; inset: 0; background: var(--accent); transform-origin: left center; }
.world-lessons { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.625rem; }
.world-lesson { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9375rem; font-weight: 600; color: var(--inkMuted); }
.world-mark {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surfaceStroke);
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 900;
}
.world-mark svg { width: 0.875rem; height: 0.875rem; }
.world-lesson.done { color: var(--ink); }
.world-lesson.due .world-mark { box-shadow: 0 0 0 2px var(--accent); }
.world-lesson.done .world-mark { background: var(--paper); border-color: var(--paper); color: var(--paperInk); }
.world-lesson.next { color: var(--ink); }
.world-lesson.next .world-mark { background: var(--paper); border: 2px solid var(--accent); color: var(--paperInk); }
.world-lesson.locked, .world-lesson.ahead { color: rgba(var(--lightRgb), 0.55); }
.world-name { flex: 1; min-width: 0; }
.world-lesson .heading-stars { margin: 0; gap: 0.1875rem; }
.world-lesson .heading-stars svg { width: 0.875rem; height: 0.875rem; }

/* ---- Input: a mouse and a keyboard, or a thumb ----------------------------

   With a fine pointer that hovers: what can be pressed answers the pointer,
   and the table says which keys play. A thumb keeps the drag and the
   buttons as they are; every target there is 44px or more already. */
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  /* A frosted chip under the thumb's row, on the card's foot like it. */
  .keys {
    position: relative;
    z-index: 4;
    display: block;
    justify-self: center;
    margin: 0 0 max(1rem, env(safe-area-inset-bottom));
    padding: 0.3125rem 0.875rem;
    border-radius: var(--radius-s);
    border: 0.0625rem solid var(--surfaceStroke);
    background: color-mix(in srgb, var(--deep) 86%, transparent);
    box-shadow: 0 0.25rem 0.875rem rgba(var(--tableShadeRgb), 0.3);
    -webkit-backdrop-filter: blur(0.75rem) saturate(1.2);
    backdrop-filter: blur(0.75rem) saturate(1.2);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    color: var(--ink);
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  body.on-table .controls { padding-bottom: 0.625rem; }
  body.on-table .controls[hidden] ~ .keys { opacity: 0; visibility: hidden; }
}
@media (hover: hover) and (pointer: fine) {

  .btn:hover { background: var(--surfacePressed); }
  .btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--light)); }
  .sheet .btn.primary:hover { box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, var(--accent) 60%, transparent); }
  .advisor-choose:hover { filter: brightness(1.08); }
  .icon-btn:hover { background: var(--surface); }
  .lang button:hover:not([aria-pressed="true"]) { color: var(--ink); background: var(--surface); }
  .choice:hover { color: var(--ink); }
  .choice-row input:not(:checked) + .choice:hover { background: var(--surface); }
  .small-link:hover, .inline-link:hover { color: var(--ink); text-decoration-thickness: 2px; }
  .swipe-btn { transition: background-color 0.15s ease, opacity 0.3s ease, transform 0.2s var(--spring-back); }
  .swipe-btn:hover:not([aria-disabled="true"]) { background: var(--swipe-hover); transform: scale(1.08); }
  .swipe-btn:hover:not([aria-disabled="true"])::before { opacity: 1; }
  .advisor-slot:hover:not([aria-disabled="true"]) .slot-disc { transform: scale(1.08); }
  .node.done, .node.next { transition: transform 0.2s var(--spring-back), box-shadow 0.2s ease; }
  /* A small lift and a deeper shadow, never a ring. */
  .node.done:hover, .node.next:hover { transform: translateY(-0.125rem) scale(1.05); box-shadow: 0 0.375rem 0.875rem rgba(var(--nodeShadeRgb), 0.45); }
  .restart:hover { background: color-mix(in srgb, var(--paperInk) 88%, var(--light)); }
  .leave:hover, .noticed:hover, .turn-back:hover { background: color-mix(in srgb, var(--paperInk) 8%, transparent); }
  .sheet-close:hover { filter: brightness(1.12); }
  .choice-disc:hover .disc { box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--tint, var(--disc-off)) 35%, transparent); }
  summary:hover { color: var(--accentText); }
  .toast.shown:hover { border-color: var(--accent); }
}

/* Reduced motion: the device's setting, or the player's own in Settings
   (client/play/motion.js puts .reduce-motion on <html>). Every movement
   has a still version: the end state, shown at once, never the same
   movement made slower. */
.reduce-motion .stars svg, .reduce-motion .meter .fill { transition-duration: 0.01s; }
.reduce-motion .words > * { animation: none; }
.reduce-motion .btn, .reduce-motion .toast, .reduce-motion .greeting-mark, .reduce-motion .choice { transition-duration: 0.01s; }
.reduce-motion .node.next::before, .reduce-motion .choice-disc, .reduce-motion .pills { animation: none; }
.reduce-motion .node.next::before { opacity: 0.8; }
.reduce-motion .layer-panel, .reduce-motion .layer-backdrop, .reduce-motion .cheer-banner { transition-duration: 0.01s; }
/* The advisors' pictures stand still on their last frame. */
.reduce-motion .example .cue, .reduce-motion .example-fill, .reduce-motion .example-shield { animation: none; }
.reduce-motion .example .cue, .reduce-motion .example-shield { opacity: 1; transform: none; }
.reduce-motion .example-fill { width: 12%; background: var(--money); }
/* The Time Traveller's: the card home, the arrow that brought it, the
   meter whole. The Coach's: the blow spent, the whistle on the bar. */
.reduce-motion .example-card, .reduce-motion .example-back, .reduce-motion .example .example-blow, .reduce-motion .example-mark { animation: none; }
.reduce-motion .example-back { opacity: 1; transform: none; }
.reduce-motion .example-rewind .example-fill { width: 70%; }
.reduce-motion .example .example-blow { opacity: 0.4; transform: scale(0.86); filter: grayscale(1); }
.reduce-motion .example-mark { opacity: 1; transform: none; }
.reduce-motion .example-coach .example-fill { width: 62%; }
/* The table: backs are down, the card is face up or gone, at once
   (table.js sets these transitions inline as it plays). */
.reduce-motion .live, .reduce-motion .flipper, .reduce-motion .back { transition: none !important; }
/* The season card is there, and its back is simply the other side shown. */
.reduce-motion .turn, .reduce-motion .summit-end { transition: none; transform: none; opacity: 1; }
.reduce-motion .turner { transition: none !important; transform: none !important; }
.reduce-motion .turner > .season-back { transform: none; }
.reduce-motion .turner.turned > .season,
.reduce-motion .turner:not(.turned) > .season-back { visibility: hidden; }

/* ---- The map with a mouse, a trackpad and keys (map.js) -------------------

   A mouse drags the ladder as a thumb does. While map.js moves it (a wheel,
   a drag, a key, a fling settling) the browser's snapping is off, or it
   would snap every frame; the ladder always stops on a rung, where the
   snapping goes back on without moving it. */
.ladder { cursor: grab; -webkit-user-select: none; user-select: none; }
.ladder.driven { scroll-snap-type: none; }
.ladder .node:not(.done):not(.next) { cursor: grab; }
.ladder.grabbing, .ladder.grabbing * { cursor: grabbing !important; }

/* ---- The landing (play.js landing(), landing.js) --------------------------

   Signed out, Home is the landing: the name and Sign in in the top bar,
   three words for what the game is, the way to join a class, and the footer
   with who makes it, all over the key visual, which fills the window
   behind them (landing-scene.css lays the words out over it). On a phone the
   button is always in the bottom third, in the thumb's reach, with nothing to scroll. */
.wordmark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}
.btn.sign-in-btn {
  width: auto;
  min-height: 2.5rem;
  padding: 0.375rem 1rem;
  font-size: 0.9375rem;
  margin-left: 0.25rem;
}
/* The picture: the whole window, behind the screen, and never in the way of
   a tap. */
.kv {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.landing > :not(.kv) { position: relative; z-index: 1; }
.landing .pitch { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* One word to a line. */
.landing .pitch h1 { margin: 1rem 0 0; font-size: clamp(2.75rem, 14vw, 3.75rem); line-height: 0.98; letter-spacing: -0.035em; }
.landing .pitch h1 span { display: block; }
.landing .pitch .btn.primary { flex: none; margin: auto 0 1.25rem; }
.landing-foot {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--inkMuted);
}

/* A phone on its side: the three words on one line, to leave room below. */
@media (max-height: 500px) {
  .landing .pitch h1 { margin-top: 0.5rem; font-size: 2.25rem; }
  .landing .pitch h1 span { display: inline; }
  .landing .pitch .btn.primary { margin-bottom: 0.75rem; }
}

@media (min-width: 600px) and (min-height: 501px) {
  .screen.landing { --measure: 36rem; grid-template-rows: auto minmax(0, 1fr) auto; align-content: stretch; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  .landing .pitch h1 { margin-top: 2rem; font-size: 4.5rem; }
  .landing .pitch .btn.primary { width: auto; align-self: flex-start; padding-inline: 2.25rem; margin-bottom: 2rem; }
  .landing .landing-foot { grid-column: full; width: 100%; max-width: 76rem; justify-self: center; padding: 0 1.5rem; }
}


/* ---- Signing in (play.js openSignIn) --------------------------------------

   A dialog over the landing, as on most sites: a card with a title and a
   line under it, the fields and Continue; then "Check your email" with six
   boxes for the code, and a foot with Try again. In the middle of the
   window, on a phone too. */
.layer.signin-layer { align-items: center; padding-top: max(1rem, env(safe-area-inset-top)); }
.signin-layer .layer-panel { width: min(100%, 28rem); padding: 0; border-radius: var(--radius-l); box-shadow: 0 1.5rem 4rem rgba(var(--shadeRgb), 0.45); }
/* Darker than the other layers' veil, so the card stands out over the landing. */
.signin-layer .layer-backdrop { background: var(--signinBackdrop); }
.signin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  --side: 1.5rem;
  --end: 2rem;
  padding: 2.75rem var(--side) var(--end);
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--canvas) 70%, var(--deep));
  border: 0.0625rem solid var(--surfaceStroke);
  color: var(--ink);
  user-select: text;
  -webkit-user-select: text;
}
.signin-close { position: absolute; top: 0.75rem; right: 0.75rem; margin: 0; color: var(--inkMuted); }
.signin-close svg { width: 1.375rem; height: 1.375rem; }
.signin-tile {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 0.0625rem solid var(--surfaceStroke);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.signin-tile svg { width: 1.75rem; height: 1.75rem; }
.signin h2 { margin: 0 0 0.75rem; font-size: 1.25rem; font-weight: 700; line-height: 1.25; text-wrap: balance; }
.signin h2:focus { outline: none; }
.signin-sub { margin: 0 0 2rem; color: var(--inkMuted); font-size: 1rem; line-height: 1.45; }
.signin-sub strong { color: var(--ink); font-weight: 600; }
.signin-address { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
#join-code::placeholder, #class-code::placeholder { text-transform: none; letter-spacing: normal; }
.signin-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accentText);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.signin-link:focus-visible { outline: 0.1875rem solid var(--accent); outline-offset: 0.125rem; border-radius: var(--radius-xs); }
.signin-form { width: 100%; display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.signin-form > .btn.primary { margin-top: 0.5rem; }
.signin-input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-m);
  border: 0.0625rem solid var(--surfaceStroke);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
.signin-input::placeholder { color: var(--inkMuted); }
.signin-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--accent) 35%, transparent); }
.signin-input[aria-invalid="true"] { border-color: var(--verdictBad); }
.signin-form .error:empty { display: none; }
.signin-form .error { margin: 0; }
.signin .btn { border-radius: var(--radius-m); }
/* The notice reads in full, the dialog scrolling as one (layer.js). */
.signin .notice { text-align: left; }
.signin .notice h3 { margin: 0 0 0.5rem; font-size: 1.0625rem; }
.signin-foot {
  align-self: stretch;
  margin: 2rem calc(var(--side) * -1) calc(var(--end) * -1);
  padding: 1.125rem var(--side) 1.25rem;
  border-top: 0.0625rem solid var(--surfaceStroke);
  color: var(--inkMuted);
  font-size: 0.9375rem;
}
.signin > .error { margin: 0.75rem 0 0; }
.signin > .error:empty { display: none; }

/* The code's six boxes (shared/code-boxes.js): one real input over them,
   transparent; the boxes draw its digits and which one is next. */
.code-boxes { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 3.25rem)); justify-content: center; gap: 0.5rem; width: 100%; }
.code-box {
  aspect-ratio: 5 / 6;
  border-radius: var(--radius-m);
  border: 0.125rem solid var(--surfaceStroke);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 1.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.code-box.current { border-color: var(--accent); box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--accent) 35%, transparent); }
.code-boxes.wrong .code-box { border-color: var(--verdictBad); }
.code-boxes input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 1rem;
  outline: none;
  cursor: text;
}
.code-boxes input::selection { background: transparent; }

/* The guess at a mistyped address: under the field, with its button. */
.suggest { padding: 0.75rem 1rem; border-radius: var(--radius-l); background: var(--surface); border: 0.0625rem solid var(--surfaceStroke); }
.suggest p { margin: 0 0 0.625rem; font-weight: 600; }
.suggest .note { margin: 0.625rem 0 0; font-weight: 400; font-size: 0.875rem; }
.suggest .btn { min-height: 2.75rem; }

@media (min-width: 600px) and (min-height: 600px) {
  .signin { --side: 2.75rem; --end: 2.75rem; padding-top: 3.5rem; }
  .signin h2 { font-size: 1.5rem; }
  .signin-sub { margin-bottom: 2.5rem; }
  .signin-form { gap: 1.25rem; }
  .signin-foot { padding-block: 1.25rem 1.5rem; }
}


/* ---- The sound switch (play.js soundToggle), on every screen ------------ */
.topbar-end { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn.sound-toggle { margin-left: 0; margin-right: -0.5rem; }
.icon-btn.sound-toggle[aria-pressed="false"] { color: var(--inkMuted); }
.map-head .sound-toggle { flex: none; }
@media (min-width: 600px) and (min-height: 501px) {
  .icon-btn.sound-toggle { margin-right: 0; }
}

/* ---- Home as the game's menu --------------------------------------------- */
.menu { display: flex; flex-direction: column; gap: 0.75rem; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
/* An odd one out at the end takes the whole row. */
.menu-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.menu .btn svg { flex: none; width: 1.25rem; height: 1.25rem; }
.menu .btn.primary svg { width: 1.125rem; height: 1.125rem; }

/* The days in a row, under the greeting: the number, the last seven days
   as dots (the profile's, smaller), and whether today is played. */
.day-streak { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.day-streak[hidden] { display: none; }
.day-streak-count { margin: 0; display: flex; align-items: baseline; gap: 0.4rem; font-weight: 700; }
.day-streak-number { font-size: 1.75rem; font-weight: 800; color: var(--accentText); font-variant-numeric: tabular-nums; }
.day-streak-week { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.375rem; }
.day-streak-week li {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 0.0625rem solid var(--surfaceStroke);
}
.day-streak-week li.played { background: var(--accent); border-color: var(--accent); color: var(--deep); }
.day-streak-week li.shielded { background: var(--surfacePressed); color: var(--ink); }
.day-streak-week li.today { box-shadow: 0 0 0 0.125rem var(--canvas), 0 0 0 0.25rem var(--ink); }
.day-streak-week svg { width: 0.8125rem; height: 0.8125rem; }
.day-streak-say { margin: 0; font-size: 0.875rem; color: var(--inkMuted); }
@media (min-width: 1100px) and (min-height: 501px) and (min-aspect-ratio: 5/4) {
  .home .day-streak { align-items: flex-start; }
}

/* ---- Max, the partner on screen (partner.js; design §2–3) --------------------
   Off the cards and beside the words, on the side away from the thumb, so
   what the companion says reads as his speech. His bubble, the combo's count
   and the chain cards he holds sit by him. The table takes on a combo as a
   mood (table.js renderMood, --combo-tier 0–5): the light behind the card
   warms, sparkles rise from the third tier, the deck's edge catches gilt
   from the fourth, and all of it eases back over a second when it ends.
   --gilt is the brand's. */
body.on-table #app {
  --max: 5.5rem;
  /* The sparkles' layer stays behind the table, in front of the page. */
  isolation: isolate;
}

.partner { position: relative; z-index: 4; pointer-events: none; transition: opacity 0.3s ease, visibility 0s; }
/* The season card is its own moment: he steps away while it is up. */
.partner.away { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; }
.partner-body { position: relative; width: var(--max); height: var(--max); }
.partner-figure, .partner-figure > .character3d { position: absolute; inset: 0; }
/* His own pool of light, smaller than a card's, round his feet. */
.partner-figure > .character3d::before { inset: 30% 14% 2%; background: radial-gradient(closest-side, var(--partnerGlow), transparent); }
/* Without WebGL: the companion's mark on a disc. */
.partner-mark {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--deep);
}
.partner-mark svg { width: 60%; height: 60%; }

/* On the table: in the words' row, at its foot, standing on the deck; the
   words make room for him. */
body.on-table .partner { grid-row: 3; grid-column: 1; align-self: end; justify-self: stretch; padding-left: 0.25rem; margin-bottom: -0.625rem; }
body.on-table .words { padding-left: calc(var(--max) + 0.25rem); padding-right: 1.25rem; }
/* Words that end above his head, centred across the table (table.js centreWords). */
/* They centre in the room over his head rather than in the whole row, so
   they sit a little higher, nearer the meters. */
body.on-table .words.centred { padding-left: 1.25rem; padding-bottom: calc(var(--max) * 0.8); }

/* The count: ×2 and up, over his head, warming with the tier. */
.partner-count {
  position: absolute;
  bottom: calc(100% - 0.25rem);
  left: 50%;
  translate: -50% 0;
  min-width: 2.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-s);
  background: var(--surfacePressed);
  border: 0.0625rem solid var(--surfaceStroke);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background-color 1s ease, color 1s ease, border-color 1s ease;
}
.partner-count[hidden] { display: none; }
#app[data-combo-tier="1"] .partner-count, #app[data-combo-tier="2"] .partner-count { background: var(--accent); border-color: var(--accent); color: var(--deep); }
#app[data-combo-tier="3"] .partner-count, #app[data-combo-tier="4"] .partner-count, #app[data-combo-tier="5"] .partner-count { background: var(--gilt); border-color: var(--giltLight); color: var(--deep); }
.partner-count.pop { animation: partner-pop 0.4s var(--spring-back); }
@keyframes partner-pop { from { transform: scale(1.4); } }

/* A chain card: a gilt token with a link on it, held by him, flown to a
   card it spots, and shown in the words as it plays. Ink on gilt is 6:1. */
.chain-token {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--giltChain), var(--gilt) 58%, var(--giltDeep));
  color: var(--paperInk);
  box-shadow: 0 0.125rem 0.375rem rgba(var(--shadeRgb), 0.35), inset 0 0 0 0.0625rem rgba(var(--lightRgb), 0.4);
}
.chain-token svg { width: 64%; height: 64%; }
/* On a phone they lie on the table under his feet, beside the deck. */
.partner-tokens { position: absolute; left: 0.125rem; top: calc(100% - 0.125rem); display: flex; gap: 0.25rem; }
.partner-tokens[hidden] { display: none; }
.chain-token.flying { position: fixed; z-index: 60; margin: 0; pointer-events: none; }

/* What he says: a bubble at his side, over the deck's top for a moment,
   clear of the words above it and never over the meters. */
.partner-bubble {
  position: absolute;
  z-index: 1;
  left: calc(var(--max) - 0.25rem);
  top: calc(var(--max) * 0.45);
  width: max-content;
  max-width: min(17rem, calc(100% - var(--max) - 0.25rem));
  opacity: 0;
  transform: scale(0.85);
  transform-origin: 0 1rem;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.partner-bubble.shown { opacity: 1; transform: none; transition: opacity 0.15s ease-out, transform 0.4s var(--spring-back); }
.partner-say {
  position: relative;
  margin: 0;
  padding: 0.5rem 0.75rem 0.5625rem;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--paperInk);
  box-shadow: 0 0.5rem 1.5rem rgba(var(--shadeRgb), 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  text-wrap: balance;
}
/* The tail, towards his head. */
.partner-say::before {
  content: "";
  position: absolute;
  left: -0.375rem;
  top: 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  background: inherit;
  border-radius: 0.125rem;
  transform: rotate(45deg);
}
.partner-say strong { font-size: 1rem; font-weight: 800; line-height: 1.2; }
.partner-say span { font-size: 0.8125rem; font-weight: 600; line-height: 1.3; color: color-mix(in srgb, var(--paperInk) 75%, transparent); }
.partner-say.tier-3, .partner-say.tier-4 { box-shadow: 0 0 0 0.125rem var(--gilt), 0 0.5rem 1.5rem rgba(var(--shadeRgb), 0.35); }
.partner-say.tier-5 {
  border: 0.125rem solid transparent;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    linear-gradient(125deg, var(--spectrum1), var(--spectrum2) 40%, var(--spectrum3) 70%, var(--spectrum4)) border-box;
}
.partner-say.tier-5::before { background: var(--paper); }
.partner-say.forged strong { color: color-mix(in srgb, var(--gilt) 45%, var(--paperInk)); }
/* A combo that ended: said plainly and quietly, on the table's own dark. */
.partner-say.ended { background: var(--deep); color: var(--ink); box-shadow: inset 0 0 0 0.0625rem var(--surfaceStroke); }
.partner-say.ended span { color: var(--inkMuted); }

/* ---- The table's mood ---- */

/* The light warms with the tier: round the top of the deck, so it shows
   above the card and at its sides even where the card fills the width. */
body.on-table .stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(var(--card-h) - var(--tuck, 0px));
  width: calc(var(--card-w) * 2.4);
  height: calc(var(--card-h) * 1.5);
  translate: -50% 50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tableGlow) 50%, transparent), color-mix(in srgb, var(--accent) 22%, transparent) 55%, transparent);
  opacity: calc(var(--combo-tier, 0) * 0.13);
  transition: opacity 1s ease;
  pointer-events: none;
}
/* From the fourth tier the deck's edge catches gilt. */
body.on-table .back > .card-back { transition: box-shadow 1s ease; }
#app[data-combo-tier="4"] .back > .card-back,
#app[data-combo-tier="5"] .back > .card-back {
  box-shadow: inset 0 0 0 0.09375rem color-mix(in srgb, var(--gilt) 90%, transparent), 0 0 0.625rem color-mix(in srgb, var(--gilt) 40%, transparent);
}
/* From the third, sparkles rise (table.js createSparkles). */
.combo-sparks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
.combo-sparks.on { opacity: 1; }

/* ---- A card that plays itself (momentum.js) ---- */

/* What a tap does, on its top edge, and the chain card that spotted it in
   its corner; both go with it. */
.auto-hint {
  display: none;
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  translate: -50% -50%;
  margin: 0;
  padding: 0.3125rem 0.75rem;
  border-radius: var(--radius-s);
  background: var(--deep);
  border: 0.0625rem solid var(--surfaceStroke);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.live.auto .auto-hint { display: block; }
.chain-slot { position: absolute; z-index: 3; top: calc(var(--card-w) * 0.035); left: calc(var(--card-w) * 0.035); pointer-events: none; }
.chain-slot .chain-token { width: max(1.75rem, calc(var(--card-w) * 0.12)); height: max(1.75rem, calc(var(--card-w) * 0.12)); }
/* Max says who plays it and why (table.js sayAuto): who as a small
   heading, with the chain card's token when one spotted it, and the
   reason as what he says. The words keep the card's question. */
.partner-say.auto strong { display: flex; align-items: center; gap: 0.3125rem; font-size: 0.75rem; font-weight: 800; color: color-mix(in srgb, var(--paperInk) 72%, transparent); }
.partner-say.auto span { font-size: 0.875rem; font-weight: 600; line-height: 1.35; color: var(--paperInk); text-wrap: pretty; }
.partner-say strong .chain-token { width: 1.125rem; height: 1.125rem; box-shadow: none; }
/* On the season card: how many cards played themselves. */
.season .momentum-count { margin: -0.25rem 0 0; font-size: 0.8125rem; font-weight: 700; color: color-mix(in srgb, var(--paperInk) 70%, transparent); }

/* ---- Home: Max by the menu, waving now and then ---- */
.partner.home { --max: 6.5rem; align-self: flex-start; margin: -0.5rem 0 -1.125rem 0.25rem; }

/* ---- Wider screens ---- */

/* A phone on its side: smaller, in the bottom corner by the card, clear of
   the words above him and of the arrow under the thumb; he speaks upwards. */
@media (max-height: 500px) and (orientation: landscape) {
  body.on-table #app { --max: 4.5rem; }
  body.on-table .partner { grid-area: left; align-self: end; justify-self: end; width: auto; padding: 0; margin: 0 0 max(0.75rem, env(safe-area-inset-bottom)); }
  body.on-table .words { padding: 0.5rem 0; }
  body.on-table .partner-bubble { top: auto; left: auto; right: 0; bottom: calc(100% + 1.5rem); max-width: 15rem; transform-origin: 100% 100%; }
  body.on-table .partner-say::before { left: auto; right: 1.25rem; top: auto; bottom: -0.375rem; }
  body.on-table .partner-tokens { top: auto; bottom: 0.25rem; left: auto; right: calc(100% + 0.125rem); }
  /* While a card plays itself, its question goes to the top of its row,
     out from under what he says of it, which is set a little smaller and
     comes down to his head: the count over it steps aside meanwhile. */
  body.on-table #app[data-auto] .words { align-self: start; justify-content: flex-start; }
  body.on-table #app[data-auto] .partner-count { visibility: hidden; }
  body.on-table #app[data-auto] .partner-bubble { bottom: calc(100% + 0.25rem); }
  body.on-table .partner-say.auto span { font-size: 0.8125rem; }
}

/* A tablet, still a column: beside the words at their readable width. The
   words' row is short here, so the count sits at his shoulder. */
@media (min-width: 600px) and (min-height: 501px) {
  body.on-table .partner { justify-self: center; width: min(100%, 36rem); }
  body.on-table .partner-count { bottom: auto; top: 0; left: auto; right: -0.25rem; translate: none; }
}

/* The scene: larger, standing on top of the words beside the card, which
   start right under him and are said by him. */
@media (min-width: 900px) and (min-height: 501px) and (min-aspect-ratio: 5/4) {
  body.on-table #app { --max: 8rem; }
  body.on-table .partner {
    grid-area: words;
    justify-self: end;
    align-self: end;
    width: min(100%, 22rem);
    padding: 0;
    margin-bottom: calc(var(--card-mid, 50%) + var(--words-h, 0px) / 2 + 0.25rem);
  }
  body.on-table .words { padding: 0; justify-content: flex-start; }
  body.on-table .partner-count { top: auto; right: auto; bottom: calc(100% - 0.25rem); left: 50%; translate: -50% 0; }
  /* Here the words are under him: the bubble by his head, growing upwards
     so it never covers them, the tokens at his feet on his other side.
     As wide as reads well (about 25 characters of its heading a line):
     past his row, into the gap and the stage's margin, short of the card. */
  body.on-table .partner-bubble {
    top: auto;
    bottom: calc(var(--max) * 0.4);
    max-width: max(13rem, min(16.5rem, calc(100% - var(--max) + 0.5rem + var(--card-w, 0px) * 0.175)));
    transform-origin: 0 100%;
  }
  body.on-table .partner-say::before { top: auto; bottom: 0.875rem; }
  body.on-table .partner-tokens { top: auto; bottom: 0.25rem; left: calc(100% + 0.25rem); }
  .partner-count { font-size: 1rem; }
  .chain-token { width: 2rem; height: 2rem; }
  .partner-say strong { font-size: 1.125rem; }
  .partner-say span { font-size: 0.875rem; }
  /* The reason for a card he plays reads beside the question's size. */
  .partner-say.auto strong { font-size: 0.8125rem; }
  .partner-say.auto span { font-size: 1rem; }
  .partner.home { --max: 8rem; margin: -6rem 0 -1rem -0.5rem; }
}
@media (min-width: 1800px) and (min-height: 501px) {
  body.on-table #app { --max: 9rem; }
  body.on-table .partner { width: min(100%, 24rem); }
}

/* Reduced motion: he stands still (partner.js), and everything here is
   there or not at once. */
.reduce-motion .partner-bubble, .reduce-motion .partner-count, .reduce-motion .combo-sparks, .reduce-motion .partner,
.reduce-motion .back > .card-back, .reduce-motion .stage::before { transition-duration: 0.01s; }
.reduce-motion .partner-bubble { transform: none; }
.reduce-motion .partner-count.pop { animation: none; }
