/* ─────────────────────────────────────────────────────────────
   Chaupat Samrat · चौपट — 5×5 cowrie game
   Art direction: dark walnut table, pine board, engraved lines,
   brass fittings. Everything procedural, no image assets.
   ───────────────────────────────────────────────────────────── */

/**
 * "Lantern-lit teak."
 *
 * The board is the most valuable object on the screen, so the room around it
 * is dark and the light falls on the table. Everything warm and lit reads as
 * play surface; everything dark and matte recedes into furniture. One warm
 * key light from above-left governs every highlight and shadow in the game -
 * pawns, buttons and carved lines all agree about where the lamp is.
 */
/* `hidden` means hidden, everywhere, once.
 *
 * The browser's own `[hidden]{display:none}` is a single class-level rule in
 * the UA stylesheet, so any rule in here that sets `display` on a class beats
 * it simply by loading later - and `el.hidden = true` then does nothing at
 * all. This file had been answering that one element at a time
 * (.setup-preview[hidden], .overlay[hidden], .badge[hidden], and half a dozen
 * more), which is a workaround that has to be remembered every time a new
 * class sets display. It was not: an audit found the empty-state buttons, the
 * loading skeletons, the result screen's league strip and every control
 * Family mode is supposed to remove all still on screen and still clickable,
 * because each had been missed. There are 140 `.hidden =` assignments in
 * ui.js; this is the rule that makes all of them mean what they say. */
[hidden] { display: none !important; }

:root {
  /* The room: a saturated warm maroon, lit in the middle and falling away
     hard at the edges. Colour rather than darkness is what makes the wood of
     the board look like wood - against a neutral black it just looks brown. */
  --stage-0: #2e1010;
  --stage-1: #5d2320;
  --stage-2: #8a4534;

  /* panels: dark wood, so UI reads as furniture against the lit stage */
  --surface: #43201b;
  --surface-2: #331714;
  --well: rgba(0, 0, 0, .38);
  --edge: rgba(224, 176, 85, .30);
  --edge-soft: rgba(224, 176, 85, .14);

  /* type: warm cream, never pure white - it would look blue against the teak */
  --ink: #f8ecd6;
  --ink-2: #cdb28c;
  /* Was #9b8261, which measured 3.94:1 on --surface - under the 4.5 AA floor,
     and used as a text colour in 31 places. A correction block further down
     had already lifted five of those selectors to --ink-2 one at a time;
     fixing the token instead fixes all 31 and stops the next quiet text from
     inheriting the problem again. #b09776 measured 5.16:1 (4.36 on --stage-1, so lifted to #bfa684: 6.16 / 5.21) on --surface, 5.92
     on --surface-2, and still sits clearly below --ink-2's 7.08, so the three
     tiers of the type hierarchy are preserved. The four non-text uses (a
     skill bar, a friend dot, a badge fill, a border blend) are decorative and
     unharmed by the lift. */
  --ink-3: #bfa684;

  --brass: #e0b055;
  --brass-hi: #ffeab4;
  --brass-lo: #7d5413;
  --glow: rgba(255, 198, 96, .55);

  /* Two more, added because brass had come to mean five different things -
     the primary button, the league badge, a selected chip, the brand, and
     "it is your turn". A colour that means everything signals nothing, so
     the two states worth spotting across a room get their own.
     Both are drawn from the same materials as the rest of the board rather
     than picked off a palette: verdigris is what brass itself does with age,
     and sindoor is the vermilion already familiar from an Indian table - so
     neither reads as a web accent dropped onto teak. */

  /* Verdigris: your move. Calm rather than urgent - it is an invitation. */
  --jade: #7fc0a0;
  --jade-lo: rgba(127, 192, 160, .45);
  --jade-dim: rgba(127, 192, 160, .12);

  /* Sindoor: running out of time. Used only where something is genuinely
     expiring, so it never becomes background noise. */
  --vermilion: #e8714c;
  --vermilion-lo: rgba(232, 113, 76, .45);

  --radius: 16px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .72), 0 2px 0 rgba(255, 226, 170, .10) inset;
  --shadow-md: 0 10px 26px rgba(0, 0, 0, .55);
  /* Referenced by .hud-corner-box and .room-card since they were written, and
     never defined - so `box-shadow: var(--shadow-sm)` was invalid at computed
     value time and fell back to none. Both are the only raised furniture on
     their screens, so they read as flat rectangles. */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, .40), inset 0 1px 0 rgba(255, 240, 214, .12);

  /* motion. Nothing in this game moves linearly: pieces have weight, so they
     lead in slowly, overshoot slightly and settle. */
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --snap: cubic-bezier(.2, .9, .25, 1);

  /* The Indic families are listed after the Latin ones and before the generic
     fallback, which is what makes them apply: a font stack is consulted per
     character, so Latin text still takes Iowan/ui-rounded and only Devanagari,
     Telugu, Kannada and Tamil codepoints - which none of the Latin faces
     contain - fall through to Noto. Without them the game's Indic text, which
     is most of what its bot opponents say, resolves to the system default:
     fine on mainstream Android, tofu on Android Go and older regional OEM
     ROMs where the Noto Indic faces are not always installed. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
    "Noto Serif Devanagari", "Noto Serif Telugu", "Noto Serif Kannada", "Noto Serif Tamil", "Noto Serif Gujarati",
    "Noto Sans Devanagari", "Noto Sans Telugu", "Noto Sans Kannada", "Noto Sans Tamil", "Noto Sans Gujarati", serif;
  --sans: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, system-ui,
    "Noto Sans Devanagari", "Noto Sans Telugu", "Noto Sans Kannada", "Noto Sans Tamil", "Noto Sans Gujarati", sans-serif;
}

/* Jewel tones - saturated enough to read at pawn size on a dark board, with a
   deep shadow tone and a hot highlight so each piece can be shaded as a solid. */
.pc-red    { --pc: #b3122e; --pc-lo: #5a0716; --pc-hi: #f2788c; }
.pc-green  { --pc: #1f7a4d; --pc-lo: #0c3b24; --pc-hi: #7fd3a6; }
.pc-yellow { --pc: #d9962b; --pc-lo: #6e4709; --pc-hi: #ffd88a; }
.pc-blue   { --pc: #2457a6; --pc-lo: #0e2a57; --pc-hi: #8fb6f0; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
/* The page itself never moves. Every screen is a fixed pane the height of
   the viewport; anything longer than the viewport scrolls inside its own
   .scroller under a chrome that stays put - the way a native lobby feels,
   with no page rubber-banding behind the UI. */
html, body { overflow: hidden; }

body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  overscroll-behavior: none;
  /* One saturated colour with a soft spotlight in the middle. Deliberately
     smooth and untextured: the board carries all the material detail, and a
     busy background competes with it. The falloff to a much darker edge is
     what frames the play area without drawing a frame. */
  background:
    radial-gradient(90% 30% at 50% 104%, rgba(255, 150, 70, .10), transparent 70%),
    radial-gradient(circle at 50% 36%,
      var(--stage-2) 0%, var(--stage-1) 46%, var(--stage-0) 100%);
  background-attachment: fixed;
}

/* Just enough grain to stop a big smooth gradient banding on phone screens.
   Far lighter than a texture - you should never see it, only not see steps. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .10;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/>\
<feColorMatrix type='saturate' values='0'/></filter>\
<rect width='140' height='140' filter='url(%23n)' opacity='.5'/></svg>");
}
.screen { position: relative; z-index: 1; }

/* height, not min-height: the app root is the wall the page lock leans on.
   With min-height the root grew with its tallest screen and flex:1 children
   grew with it, so height:100dvh on a screen was silently beaten by its own
   flex-basis and the panes never got a bound to scroll inside. */
#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.screen { display: none; flex: 1; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
.screen.is-active { display: flex; animation: screenIn .32s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to { opacity: 1; transform: none; }
}
/* Navigation reads directionally: drilling in slides from the right, backing
   out from the left, and tab switches keep the vertical rise (siblings, not
   depth). html[data-nav] is stamped by showScreen() just before the class
   flips. Same duration and easing as screenIn so the app has one tempo. */
html[data-nav="fwd"] .screen.is-active { animation-name: screenInFwd; }
html[data-nav="back"] .screen.is-active { animation-name: screenInBack; }
@keyframes screenInFwd {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: none; }
}
@keyframes screenInBack {
  from { opacity: 0; transform: translateX(-26px); }
  to { opacity: 1; transform: none; }
}

/* overflow-x is set on purpose. Declaring only overflow-y leaves the other
   axis computing to `auto` rather than `visible` - the spec does not allow
   one axis to scroll while the other stays visible - so every one of these
   panels was silently a horizontal scroller too, and anything inside that
   ran wide let the whole app be dragged sideways. Nothing here is meant to
   scroll horizontally; content that does not fit should wrap. */
.scroller { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 16px 0; -webkit-overflow-scrolling: touch; }
.pad { height: 44px; }
.spacer { width: 42px; }

/* ─────────────────────────────────────────── brass buttons */
.btn {
  position: relative;
  border: 0; border-radius: 13px; padding: 13px 22px;
  font: inherit; font-weight: 700; letter-spacing: .01em; cursor: pointer;
  transition: transform .12s ease, filter .18s ease, box-shadow .18s ease;
}
.btn:active { transform: translateY(2px); }

.btn-primary {
  color: #2b1c05;
  /* Foil, not paint: the vertical brass ramp carries the form, a soft
     diagonal specular band crosses it the way light crosses curved metal,
     and a hairline of near-white rides the very top edge. All under the
     same above-left lamp as everything else. */
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 44%, rgba(255, 255, 255, .05) 56%, transparent 68%),
    linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 42%, var(--brass-lo) 100%);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .75),
    inset 0 -2px 6px rgba(96, 62, 8, .55),
    inset 0 0 0 1px rgba(255, 234, 180, .25),
    0 4px 0 #6c4c10, 0 12px 26px rgba(0, 0, 0, .55), 0 2px 8px rgba(255, 190, 92, .18);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
}
.btn-primary:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .5),
    inset 0 0 0 1px rgba(255, 234, 180, .2),
    0 2px 0 #6c4c10, 0 6px 14px rgba(0, 0, 0, .5);
}
.btn-primary:disabled { filter: grayscale(.7) brightness(.6); box-shadow: none; cursor: default; transform: none; }

.btn-ghost {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  color: var(--ink-2); border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(255,240,214,.14), 0 3px 10px rgba(0, 0, 0, .3);
}
.btn-lg { padding: 17px 36px; font-size: 18px; }
.btn-block { width: 100%; margin: 10px 0 4px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--edge); color: var(--ink-2); font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255,240,214,.14), var(--shadow-md);
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--brass); border-color: var(--brass-lo); }
.icon-btn.is-off { opacity: .45; }

/* ─────────────────────────────────────────── menu */
/* The menu is a list of things to do, so it starts at the top rather than
   centring: `justify-content: center` only looks balanced when everything
   fits, and here it pushed the lower half of the list off-screen while
   leaving air above the logo.
   The 38px gap was the single largest cost on this screen - seven gaps, over
   260px, more than a third of a phone screen spent on nothing. */
.menu-wrap {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: 7px; padding: 8px 24px 24px; text-align: center;
}
/* Sized for a screen the player is passing through, not a splash screen.
   The mark still reads as the board at this size - it is all silhouette -
   and the 46px it gives back is a whole row of the menu. */
.brand-mark {
  width: 92px; height: 92px; margin: 2px auto 4px; color: var(--brass);
  /* No filter: drop-shadows on the logo were re-rasterised every frame. The
     painted logo carries its own shading. */
  filter: none;
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.brand-mark svg { width: 100%; height: 100%; }

.brand h1 {
  margin: 0; font-family: var(--serif); font-size: 38px; font-weight: 600;
  letter-spacing: .01em; line-height: 1.2;
  /* struck brass: hot along the top edge, deepening as it turns away */
  background: linear-gradient(178deg,
    #fff4d6 0%, #ffdc96 26%, #e0b055 52%, #a3701e 78%, #d8ad57 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .65)) drop-shadow(0 0 18px rgba(255, 190, 92, .30));
}
.brand .deva {
  margin: 2px 0 2px; font-size: 22px; color: var(--brass);
  /* No tracking: Devanagari conjuncts and matras join across letters, and
     letter-spacing breaks the joins into visibly wrong shapes. */
  opacity: .82; letter-spacing: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
/* Kept, but sized as the caption it is. It earns its place by telling a new
   player which game this actually is - Chowka Bara and Ashta Chamma are the
   names most people know it by - which the title alone does not. */
.tagline { margin: 0 auto; color: var(--ink-2); font-size: 12.5px; max-width: 340px; line-height: 1.3; }

.menu-actions { display: flex; flex-direction: column; gap: 12px; width: min(300px, 82vw); }
.menu-actions .btn { width: 100%; }
.foot-note { color: var(--ink-3); font-size: 12px; margin: 0; letter-spacing: .02em; }

/* ─────────────────────────────────────────── top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: max(14px, var(--sat, env(safe-area-inset-top, 0px))) 16px 12px; }
.topbar h2 { flex: 1; margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600;
  text-align: center; color: var(--ink); }

.turn-pill {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--edge); border-radius: 999px; padding: 8px 18px;
  font-size: 14px; font-weight: 700;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255,240,214,.14), var(--shadow-md);
  transition: border-color .3s;
}
.turn-pill .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--pc-hi), var(--pc) 58%, var(--pc-lo));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 24%, transparent);
  animation: beat 2.2s ease-in-out infinite;
}
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }

/* ─────────────────────────────────────────── panels */
.panel {
  position: relative; border-radius: var(--radius); padding: 17px; margin-bottom: 14px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,240,214,.14), inset 0 -8px 14px -12px rgba(0, 0, 0, .6);
}
.panel::before {
  content: ""; position: absolute; inset: 5px; border-radius: 11px;
  border: 1px solid var(--edge-soft); pointer-events: none;
}
.panel h3 { margin: 0 0 5px; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.hint { margin: 0 0 13px; color: var(--ink-3); font-size: 12.5px; }

.segmented {
  display: flex; gap: 5px; padding: 5px; border-radius: 12px;
  background: var(--well); box-shadow: inset 0 2px 4px rgba(90, 50, 10, .22);
}
.segmented.sm { padding: 4px; }
.seg {
  flex: 1; border: 0; background: transparent; color: var(--ink-2);
  padding: 10px 8px; border-radius: 9px; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: color .15s;
  /* 34px tall was under every touch-target guideline, and these are among the
     most-tapped controls in the game - table size, difficulty, which league
     table you are looking at. Set as a minimum rather than a height so a
     wrapped label still grows the button instead of overflowing it. */
  min-height: 44px;
}
.segmented.sm .seg { padding: 7px 11px; font-size: 13px; }
.seg.is-on {
  color: #2b1c05;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 6px rgba(0, 0, 0, .45);
}

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.swatch {
  background: var(--well); border: 2px solid transparent; border-radius: 13px;
  padding: 13px 4px 9px; cursor: pointer; display: grid; gap: 7px; justify-items: center;
  transition: border-color .18s, background .18s, transform .12s;
}
.swatch:active { transform: scale(.96); }
.swatch span {
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 33% 28%, var(--pc-hi), var(--pc) 55%, var(--pc-lo) 100%);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, .45), 0 3px 6px rgba(0, 0, 0, .45);
}
.swatch em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.swatch.is-on { border-color: var(--brass-lo); background: rgba(216, 177, 105, .3); }
.swatch.is-on em { color: var(--ink); }

.pawn-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 10px; }
.pawn-card {
  background: var(--well); border: 2px solid transparent; border-radius: 13px;
  padding: 13px 10px; cursor: pointer; text-align: center; display: grid; gap: 5px;
  justify-items: center; color: var(--ink); transition: border-color .18s, background .18s, transform .12s;
}
.pawn-card:active { transform: scale(.97); }
.pawn-card.is-on { border-color: var(--brass-lo); background: rgba(216, 177, 105, .3); }
.pawn-card b { font-size: 13px; }
.pawn-card em { font-style: normal; font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.pawn-preview {
  width: 52px; height: 52px; display: grid; place-items: center; position: relative;
  border-radius: 9px; border: 1px solid rgba(0, 0, 0, .5);
  background:
    repeating-linear-gradient(93deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 6px),
    linear-gradient(150deg, #eed9ab, #d9be8b);
  box-shadow: inset 0 0 10px rgba(90, 60, 20, .3);
}
.pawn-preview .pawn-body { position: relative; inset: auto; width: 32px; height: 32px; }

/* ── the live table preview ───────────────────────────────────────────────
   A small rendering of the actual board and your actual piece, sitting
   above the setup panels rather than in a list saying "wooden" or "red".
   Redrawn whenever theme/colour/pawn change, so this is what you're about
   to play on, not a description of it. */
.setup-preview {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 16px 4px; position: relative;
}
/* `.setup-preview{display:flex}` otherwise wins over the browser's own
   `[hidden]{display:none}` default - same specificity, but this stylesheet
   loads after the UA one, so the later rule wins and the attribute goes
   visually inert. Reasserting it here is the fix, the same way chat-sheet
   and coach-scrim already have to nearby. */
.setup-preview[hidden] { display: none; }
.setup-preview-board {
  width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .4);
  flex-shrink: 0;
}
.setup-preview-board svg { display: block; width: 100%; height: 100%; }
.setup-preview-piece {
  width: 44px; height: 44px; margin-left: -18px; z-index: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6));
  animation: previewFloat 3.4s ease-in-out infinite;
}
.setup-preview-piece .pawn-body { display: block; position: relative; inset: auto; width: 100%; height: 100%; }
@keyframes previewFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ── mode cards ────────────────────────────────────────────────────────────
   "Who's playing" used to be three words in a segmented pill, which reads
   as a form field. An icon, a name and a one-line reason to pick it is what
   turns the same choice into something worth tapping. */
.mode-cards { display: flex; flex-direction: column; gap: 9px; }
.mode-card {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 13px 14px; border-radius: 13px; text-align: left;
  background: var(--well); border: 2px solid transparent; color: var(--ink);
  transition: border-color .18s, background .18s, transform .12s;
}
.mode-card:active { transform: scale(.98); }
.mode-card.is-on { border-color: var(--brass-lo); background: rgba(216, 177, 105, .22); }
.mode-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; color: var(--ink-3);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255, 240, 214, .1), inset 0 -2px 4px rgba(0, 0, 0, .3);
  transition: color .18s, background .18s;
}
.mode-icon svg { width: 24px; height: 24px; }
.mode-card.is-on .mode-icon {
  color: #2b1c05;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo));
}
.mode-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* Only the icon box gets the solid brass fill when selected - the card
   itself stays the same dark surface either way, so the copy text has to
   stay light-on-dark in both states. Without this it inherits `.seg.is-on`'s
   dark ink (meant for text sitting *on* a brass pill), which on this card's
   still-dark background is nearly unreadable. */
.mode-copy b { font-size: 15px; color: var(--ink); }
.mode-copy em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.mode-card.is-on .mode-copy em { color: var(--ink-2); }

/* ── board theme thumbnails ───────────────────────────────────────────────
   The actual carved artwork, small, instead of the word "wooden" - you are
   picking a look, so let the look do the talking. */
.theme-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card {
  display: grid; justify-items: center; gap: 8px; padding: 10px 8px 12px;
  background: var(--well); border: 2px solid transparent; border-radius: 13px;
  color: var(--ink); transition: border-color .18s, background .18s, transform .12s;
}
.theme-card:active { transform: scale(.97); }
.theme-card.is-on { border-color: var(--brass-lo); background: rgba(216, 177, 105, .22); }
/* Same fix as .mode-copy b: the card keeps a tinted-dark background even
   when selected (no solid brass fill), so the label has to stay light text
   in both states rather than inherit `.seg.is-on`'s dark-on-brass ink. */
.theme-card b { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.theme-thumb {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .35);
}
.theme-thumb svg { display: block; width: 100%; height: 100%; }

/* ── skill meter ───────────────────────────────────────────────────────────
   Three bars instead of trusting "Easy/Normal/Hard" alone to carry weight -
   a filled meter reads at a glance the way a plain label doesn't. */
.skill-seg { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.skill-bars { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.skill-bars s { display: block; width: 4px; border-radius: 1px; background: var(--ink-3); text-decoration: none; }
.skill-bars s:nth-child(1) { height: 5px; }
.skill-bars s:nth-child(2) { height: 8px; }
.skill-bars s:nth-child(3) { height: 11px; }
.skill-seg[data-value="easy"] .skill-bars s:nth-child(1),
.skill-seg[data-value="normal"] .skill-bars s:nth-child(1),
.skill-seg[data-value="normal"] .skill-bars s:nth-child(2),
.skill-seg[data-value="hard"] .skill-bars s { background: var(--ink-2); }
.skill-seg.is-on .skill-bars s { background: #2b1c05; opacity: .55; }
.skill-seg.is-on[data-value="easy"] .skill-bars s:nth-child(1),
.skill-seg.is-on[data-value="normal"] .skill-bars s:nth-child(1),
.skill-seg.is-on[data-value="normal"] .skill-bars s:nth-child(2),
.skill-seg.is-on[data-value="hard"] .skill-bars s { opacity: 1; }

/* ── the docked start bar ─────────────────────────────────────────────────
   A footer, not a floating overlay: a plain flex sibling below the
   scrolling panel list, so it never scrolls away and never needs a scrim. */
.setup-cta {
  /* This screen scrolls at the page level, not inside .scroller - its flex
     parent only sets a min-height, so the box simply grows taller than the
     viewport rather than clipping and forcing internal overflow. A footer
     placed as an ordinary flex sibling would scroll away with everything
     else instead of staying put, so it's pinned to the viewport directly
     instead, the same way the chat sheet is. */
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px 16px calc(12px + var(--sab, env(safe-area-inset-bottom, 0px)));
  border-top: 1px solid var(--edge-soft);
  background: linear-gradient(180deg, transparent, rgba(20, 10, 8, .82) 32%, rgba(20, 10, 8, .93));
  backdrop-filter: blur(2px);
}
/* Room for the fixed footer so the last panel isn't hidden behind it. */
#screen-setup .pad { height: 132px; }
.setup-cta-summary {
  margin: 0 0 9px; text-align: center; font-size: 12.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rule-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--edge-soft); }
.rule-row:first-of-type { border-top: 0; padding-top: 4px; }
.rule-row > div:first-child { flex: 1; }
.rule-row b { display: block; font-size: 14px; }
.rule-row span { font-size: 12px; color: var(--ink-3); }
.rule-row .segmented { flex: 0 0 auto; }

/* On a narrow phone a three-option group sharing a row with its own label is
   squeezed to about 42px per option. Letting the row wrap gives the group a
   full-width line of its own, so each option gets a comfortable share -
   rather than forcing a min-width, which in a fixed row would simply push
   the group off the edge. */
@media (max-width: 420px) {
  .rule-row { flex-wrap: wrap; }
  .rule-row > div:first-child { flex: 1 1 100%; }
  .rule-row .segmented { flex: 1 1 100%; }
}
.rule-row.toggle { cursor: pointer; }
.rule-row input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  flex: 0 0 auto; width: 48px; height: 28px; border-radius: 999px; position: relative;
  background: var(--well); border: 1px solid var(--edge);
  box-shadow: inset 0 2px 4px rgba(90, 50, 10, .3); transition: background .2s, border-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: linear-gradient(180deg, #c9ab7d, #93764c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5); transition: transform .2s ease, background .2s;
}
input:checked + .switch { background: rgba(216, 177, 105, .55); border-color: var(--brass-lo); }
input:checked + .switch::after {
  transform: translateX(20px);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
}

/* ─────────────────────────────────────────── rules prose */
.prose h3 { margin: 20px 0 7px; font-family: var(--serif); font-size: 16px; color: var(--brass); }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 11px; font-size: 14px; color: var(--ink-2); }
.prose b { color: var(--ink); }
table.odds { width: 100%; border-collapse: collapse; margin: 6px 0 13px; font-size: 13px; }
table.odds th, table.odds td {
  border: 1px solid var(--edge-soft); padding: 7px 4px; text-align: center; color: var(--ink-2);
}
table.odds th {
  background: rgba(0, 0, 0, .22); color: var(--ink-3); font-weight: 600;
  text-align: left; padding-left: 9px;
}

/* ─────────────────────────────────────────── player chips */
#screen-game { padding-bottom: max(10px, var(--sab, env(safe-area-inset-bottom, 0px))); overflow-y: auto; }
/* ── the guide ────────────────────────────────────────────────────────────
   A tip sits next to the thing it is talking about, with the rest of the
   screen dimmed and a hole cut over that thing. The hole is the whole idea:
   dim everything and the eye goes to the words, but leave the subject lit
   and the eye goes to the subject, which is what you actually want taught. */
.coach-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(14, 6, 4, .68);
  animation: scrimIn .22s ease both;
}
.coach-hole {
  position: fixed; border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(14, 6, 4, .68), 0 0 26px 4px rgba(255, 198, 96, .5);
  background: transparent;
  animation: holePulse 2s var(--ease-out) infinite;
}
@keyframes holePulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(14, 6, 4, .68), 0 0 22px 2px rgba(255, 198, 96, .40); }
  50%      { box-shadow: 0 0 0 9999px rgba(14, 6, 4, .68), 0 0 32px 7px rgba(255, 198, 96, .62); }
}
.coach-card {
  position: fixed; left: 50%; transform: translateX(-50%);
  z-index: 61; width: min(340px, calc(100vw - 32px));
  padding: 16px 18px 14px; border-radius: 16px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 18px 46px rgba(0, 0, 0, .7);
  animation: coachIn .3s var(--spring) both;
  /* Unbounded, this card pushes its own "Got it" button off-screen at a large
     font scale - and since the coach scrim has no other way out, that is a
     first-run lock-out rather than an untidy overlay. */
  max-height: calc(100dvh - 32px); overflow-y: auto;
}
@keyframes coachIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateX(-50%); }
}
.coach-title {
  display: block; font-family: var(--serif); font-size: 18px;
  color: var(--brass); margin-bottom: 5px;
}
.coach-text { margin: 0 0 13px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.coach-ok { width: 100%; padding: 11px; }

/* ── folded preferences ───────────────────────────────────────────────────
   Setup used to ask eight questions in a row, of which two actually decide
   the game. The rest are preferences, so they fold away - with their current
   values on the summary line, so nothing is hidden, only tidied. */
.fold {
  margin: 0 0 12px; border-radius: var(--radius);
  border: 1px solid var(--edge-soft);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 55%, transparent),
    color-mix(in srgb, var(--surface-2) 55%, transparent));
}
.fold > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; cursor: pointer; list-style: none;
  font-family: var(--serif); font-size: 17px; color: var(--ink);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "⌄"; margin-left: auto; color: var(--brass);
  font-size: 18px; line-height: 1; transition: transform .22s var(--ease-out);
}
.fold[open] > summary::after { transform: rotate(180deg); }
.fold-value {
  margin-left: auto; font-family: var(--sans); font-size: 12.5px;
  color: var(--ink-3); font-weight: 600; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%;
}
.fold[open] .fold-value { display: none; }
.fold .panel { margin: 0 10px 10px; border-radius: 12px; }
.fold .panel:first-of-type { margin-top: 0; }

/* ── the table ────────────────────────────────────────────────────────────
   Four seats around the board, in the positions the players actually occupy.
   The board turns so you're always nearest, and these slots follow it, so
   the person across the board from you is across the board from you here. */
/* A phone is not wide enough for chip - board - chip in a row: give the side
   seats their own column and the board shrinks to a postage stamp. So the
   near and far seats get real rows, and the two side seats ride on the
   board's own edge instead, over the decorative frame band where they cost
   no play area. */
.table {
  position: relative;
  display: grid; grid-template-rows: auto auto auto;
  justify-items: center; align-items: center; gap: 8px;
}
.seat { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.seat[hidden] { display: none; }

.seat-left, .seat-right {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
}
.seat-left { left: 0; }
.seat-right { right: 0; }

/* Side seats shed everything that isn't identity: colour, who, how many home. */
.seat-left .chip, .seat-right .chip {
  flex-direction: column; text-align: center;
  min-width: 0; width: 58px; padding: 7px 4px; gap: 3px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  /* backdrop-filter removed. These two chips sit over the board, so the blur
     was re-reading and re-blurring a *live, animating* backdrop - every 72ms
     during a walk, every frame during a capture knock - for an effect that
     was nearly invisible behind an 88%-opaque gradient. Made fully opaque
     instead, which does the same job of lifting the chip off the board. */
}
.seat-left .chip .chip-where, .seat-right .chip .chip-where,
.seat-left .chip .pips i, .seat-right .chip .pips i { display: none; }
.seat-left .chip b, .seat-right .chip b {
  font-size: 12px; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.seat-left .chip .pips, .seat-right .chip .pips { justify-content: center; }
.seat-left .chip-body, .seat-right .chip-body { min-width: 0; width: 100%; }

.chip {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; min-width: 122px;
  border: 1px solid var(--edge); border-radius: 13px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255,240,214,.14), var(--shadow-md);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.chip.is-turn {
  border-color: color-mix(in srgb, var(--pc) 70%, #000);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 55%, transparent),
              0 6px 16px -6px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255,240,214,.14);
  transform: translateY(-2px);
}
.chip-dot {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle at 34% 30%, var(--pc-hi), var(--pc) 58%, var(--pc-lo));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .5);
}
/* Ruby sits close to the velvet ground, so its dot carries a gold rim. */
.pc-red .chip-dot, .chip-dot.pc-red { box-shadow: 0 0 0 1.5px #d4af37, inset 0 -2px 3px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .5); }
.chip-body { display: grid; line-height: 1.35; }
.chip-body b { font-size: 13px; }
.pips { display: flex; align-items: center; gap: 3px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 236, 200, .28); transition: background .3s; }
.pips i.on { background: var(--pc); box-shadow: 0 0 5px color-mix(in srgb, var(--pc) 70%, transparent); }
.pips em { font-style: normal; font-size: 12px; color: var(--ink-3); margin-left: 6px; }
.chip-badge { color: var(--brass); font-size: 14px; }

#me { padding: 12px 12px 4px; display: flex; justify-content: center; }
#me .chip { min-width: 190px; }

/* happy / sad chip reactions - captures, homes, and getting cut */
.chip.is-happy { animation: chipHappy .65s ease; }
@keyframes chipHappy {
  0% { transform: translateY(0) scale(1); }
  32% {
    transform: translateY(-7px) scale(1.06);
    box-shadow: 0 0 0 3px rgba(120, 200, 110, .55), var(--shadow-md);
  }
  60% { transform: translateY(0) scale(1); }
  100% { transform: none; box-shadow: inset 0 1px 0 rgba(255,240,214,.14), var(--shadow-md); }
}
.chip.is-sad { animation: chipSad .5s ease; }
@keyframes chipSad {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-6px) rotate(-2.5deg); box-shadow: 0 0 0 3px rgba(214, 74, 60, .4), var(--shadow-md); }
  40% { transform: translateX(5px) rotate(2deg); }
  60% { transform: translateX(-4px) rotate(-1.5deg); }
  80% { transform: translateX(3px) rotate(1deg); }
}

/* a red pulse across the board itself when a capture lands, for weight */
.board-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px;
  pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(214, 74, 60, .28), transparent 68%);
}
.board-wrap.is-kill::after { animation: killFlash .55s ease-out; }
@keyframes killFlash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  30% { opacity: .85; }
  100% { opacity: 0; }
}

/* A capture should land with weight, not just tint the board. The knock is
   short and unevenly damped - a long, smoothly-decaying shake reads as an
   earthquake, while a hard first beat that dies fast reads as an impact.
   It moves the whole board, so the pieces ride it and feel heavy. */
.board-wrap.is-kill .board { animation: boardKnock .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes boardKnock {
  0%   { transform: translate(0, 0) rotate(0deg); }
  14%  { transform: translate(-6px, 3px) rotate(-.55deg); }
  30%  { transform: translate(5px, -2px) rotate(.42deg); }
  48%  { transform: translate(-3px, 1px) rotate(-.24deg); }
  66%  { transform: translate(2px, -1px) rotate(.13deg); }
  84%  { transform: translate(-1px, 0) rotate(-.05deg); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .board-wrap.is-kill .board { animation: none; }
}

/* a warm glow on the throw tray when a grace throw lands */
.tray.is-grace { animation: trayGrace .7s ease-out; }
@keyframes trayGrace {
  0% { box-shadow: inset 0 3px 10px rgba(0, 0, 0, .6), 0 0 0 0 rgba(216, 177, 105, 0); }
  35% { box-shadow: inset 0 3px 10px rgba(0, 0, 0, .6), 0 0 22px 4px rgba(216, 177, 105, .55); }
  100% { box-shadow: inset 0 3px 10px rgba(0, 0, 0, .6), 0 0 0 0 rgba(216, 177, 105, 0); }
}

/* A throw with no legal move. Transform-only, and deliberately smaller than
   the chip shake a captured player gets: this is a null result, not a loss.
   The decaying amplitude is what makes it read as a physical rattle rather
   than a wobble. */
.tray.is-blocked { animation: trayBlocked .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes trayBlocked {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-4px); }
  35% { transform: translateX(3px); }
  55% { transform: translateX(-2px); }
  75% { transform: translateX(1px); }
}

/* ─────────────────────────────────────────── board */
.board-wrap { display: grid; place-items: center; padding: 0 12px; position: relative; }
.board {
  position: relative; width: min(93vw, 58vh, 470px); aspect-ratio: 1 / 1;
  border-radius: 12px; isolation: isolate;
  box-shadow:
    0 2px 0 rgba(255, 236, 200, .16),
    0 26px 44px -14px rgba(0, 0, 0, .8),
    0 0 0 1px rgba(0, 0, 0, .55);
  transition: box-shadow .5s ease;
  touch-action: manipulation;
}
/* box-shadow, not drop-shadow. The board is a rounded rectangle, so the glow
   is identical - but a `filter` puts the whole subtree (the SVG artwork and
   all 16 pieces) behind a filtered render surface, which means every single
   pawn repaint re-runs a 16px blur over the entire board. That was quietly
   multiplying the cost of every move in the game. */
.board-wrap.is-you .board {
  box-shadow:
    0 2px 0 rgba(255, 236, 200, .16),
    0 26px 44px -14px rgba(0, 0, 0, .8),
    0 0 0 1px rgba(0, 0, 0, .55),
    0 0 16px 2px color-mix(in srgb, var(--pc) 34%, transparent);
}
.grid { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 12px; }

/* engraving */
.cp-cut { fill: none; stroke: #2b1a09; stroke-linecap: round; stroke-linejoin: round; opacity: .96; }
.cp-hi { fill: none; stroke: #fff6e2; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.cp-grid .cp-cut, .cp-cross .cp-cut, .cp-frame .cp-cut { opacity: 1; }
.cp-ornament .cp-cut { opacity: .52; }
.cp-ornament .cp-hi { opacity: .34; }
.cp-ghar-motif .cp-cut { opacity: .42; }
.cp-ghar-motif .cp-hi { opacity: .3; }

/* Brass inlay: groove, metal, then the fine highlight along the lamp-facing
   edge that turns a flat stroke into a rounded rod sitting in the wood. */
.cp-groove {
  fill: none; stroke: #1f1103; opacity: .92;
  stroke-linecap: round; stroke-linejoin: round;
}
.cp-metal {
  fill: none; stroke: url(#cp-brass);
  stroke-linecap: round; stroke-linejoin: round;
}
.cp-metal-hi {
  fill: none; stroke: #fff6dd; opacity: .7;
  stroke-linecap: round; stroke-linejoin: round;
}
.cp-ornament .cp-metal { opacity: .72; }
.cp-ornament .cp-metal-hi { opacity: .26; }
.cp-ghar-motif .cp-metal { opacity: .95; }

/* On dark rosewood these have to carry their own light or they just read as
   stains. Higher opacity and a lifted tone, so each home square glows like a
   piece of set glass with a lamp behind it. */
.cp-seat.tint-red    { fill: rgba(226, 80, 60, .60); }
.cp-seat.tint-green  { fill: rgba(92, 182, 72, .55); }
.cp-seat.tint-yellow { fill: rgba(242, 186, 34, .58); }
.cp-seat.tint-blue   { fill: rgba(69, 147, 220, .58); }
/* the cut edge of a set stone: dark groove, lit along the lamp side */
.cp-seat-bevel {
  fill: none; stroke: rgba(255, 236, 190, .30); stroke-width: .45;
}

.pawn-layer, .hint-layer { position: absolute; inset: 0; }
.hint-layer { pointer-events: none; }
.hint-layer .move-hint { pointer-events: none; }

/* ─────────────────────────────────────────── pawns */
.pawn {
  /* Positioned from a fixed origin and moved by transform - see layout() in
     view.js. The translate(-50%,-50%) that used to live here is written by
     that code as part of the same transform, since a scripted transform
     replaces this one rather than composing with it. */
  position: absolute; padding: 0; border: 0; background: none;
  left: 0; top: 0; cursor: default; z-index: 2;
  transition: transform .11s linear;
}
.pawn::after {                       /* the shadow it casts on the board */
  content: ""; position: absolute; left: 50%; bottom: -8%;
  width: 88%; height: 24%; transform: translateX(-50%);
  background: radial-gradient(closest-side,
    rgba(0, 0, 0, .66), rgba(0, 0, 0, .30) 55%, transparent 78%);
  filter: blur(.5px);
  z-index: -1;
  transition: opacity .2s ease, transform .2s ease;
}
.pawn.is-home { display: none; }
.pawn.is-walking { z-index: 6; }
.pawn.is-cut {
  transition: transform .42s cubic-bezier(.5, -.35, .35, 1.4);
  z-index: 7;
}

/* ── the light every piece catches ────────────────────────────────────────
   The six materials are drawn differently, but they're sitting on one table
   under one lamp, and this layer is what says so: the same specular hotspot
   in the same top-left corner of every piece, plus a little warm bounce
   coming back up off the board. Six materials, one light. */
.pawn-gloss {
  position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; z-index: 3;
  background:
    radial-gradient(ellipse 22% 17% at 33% 24%, rgba(255, 255, 255, .9), transparent 70%),
    radial-gradient(ellipse 52% 24% at 60% 91%, rgba(255, 205, 138, .28), transparent 76%);
}
.pawn.style-seed .pawn-gloss,
.pawn.style-clay .pawn-gloss { opacity: .4; }    /* matte: same lamp, less shine */
.pawn.style-cowrie .pawn-gloss { border-radius: 50% / 62%; }

/* Movable. The piece lifts and its shadow spreads and fades underneath it -
   the shadow doing the opposite of the piece is what actually reads as
   "picked up". A glowing ring on its own only decorates. */
.pawn.movable { cursor: pointer; z-index: 4; }
/* A static brass rim on movable pieces - deliberately not animated (see the
   note below on why the pulsing ring was removed). This is the layer that
   survives prefers-reduced-motion: when the bob is disabled, the rim is
   still there saying "this one can move". */
.pawn.movable .pawn-body { box-shadow: 0 0 0 1.5px rgba(232, 196, 124, .85), 0 0 7px 1px rgba(216, 177, 105, .4); }
/* The ring that used to sit here is gone, and the comment above is why: the
   bob and its shadow already say "picked up", and the ring was a third
   infinite animation on a third box (::before), on a different period to the
   other two so it drifted in and out of phase with them - and with the other
   movable pieces, since nothing synchronised their start times. Four movable
   sogtī meant twelve unsynchronised loops during the one moment the player
   most needs to scan the board calmly and choose. The destination hint still
   pulses, which is the cue that actually asks for a tap. */
/* 44px of tappable area around a piece that may only be 13px of artwork.
   Only on a piece that can actually be moved: an always-on hit area would
   have every idle sogtī quietly swallowing taps meant for the square behind
   it, and on a 5x5 board those areas would overlap several cells deep. */
.pawn-hit {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; transform: translate(-50%, -50%);
  border-radius: 50%;
}
.pawn:not(.movable) .pawn-hit { display: none; }
/* Bounded to the spacing between pieces once a cell is shared, so two targets
   never cover the same point. Still comfortably larger than the artwork
   underneath (20px / 15px), which is the part that was actually unhittable. */
.pawn.is-crowded .pawn-hit { width: 28px; height: 28px; }
.pawn.is-packed .pawn-hit { width: 22px; height: 22px; }

.pawn-body { position: absolute; inset: 0; border-radius: 50%; transform-origin: 50% 85%; }
.pawn-body::before, .pawn-body::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.pawn.movable .pawn-body { animation: bob 1.5s var(--ease-out) infinite; }
.pawn.movable::after      { animation: bob-shadow 1.5s var(--ease-out) infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-18%) scale(1.04, .98); }
}
@keyframes bob-shadow {
  0%, 100% { opacity: 1;  transform: translateX(-50%) scale(1); }
  50%      { opacity: .5; transform: translateX(-50%) scale(1.25); }
}

.pawn-body.is-hopping { animation: hop .144s ease-in-out infinite; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-34%) scale(1.06, .96); }
}
.pawn-body.is-landing { animation: land .17s ease-out; }
@keyframes land {
  0% { transform: translateY(-18%) scale(1.04, .96); }
  55% { transform: translateY(0) scale(1.14, .86); }
  100% { transform: none; }
}
.pawn-body.is-tumbling { animation: tumble .43s ease-in-out; }
@keyframes tumble {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(260deg) scale(.72) translateY(-40%); }
  100% { transform: rotate(540deg) scale(1); }
}
/* .6s, not .43s. A piece reaching Ghar is permanent and can happen at most
   four times a player per game; knocking an opponent off a square is routine
   and reversible, and it was getting the identical duration plus a board-wide
   knock and flash on top. The rarer, larger event should not be the cheaper
   one. The overshoot curve was already right - only the time was wrong. */
.pawn-body.is-arriving { animation: arrive .6s cubic-bezier(.3, 1.4, .5, 1) forwards; }
@keyframes arrive {
  0% { transform: scale(1.8); }
  45% { transform: scale(1.45) rotate(14deg); }
  100% { transform: scale(.1) rotate(40deg); opacity: 0; }
}

/* The insurance piece. Every base style is a PNG referenced from CSS, and
   a stylesheet background that fails to fetch or decode fails silently - on
   one OEM WebView in the field that left empty home squares with only the
   marks and shadows painting. view.js probes each style's art with a real
   Image load and swaps failing pieces onto this class: the same colour
   jewel the chips and swatches draw, guaranteed to paint because it is
   nothing but gradients on the piece's own --pc variables. */
.pawn-body.is-fallback {
  background: radial-gradient(circle at 34% 30%, var(--pc-hi), var(--pc) 58%, var(--pc-lo));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .45), inset 0 1px 2px rgba(255, 255, 255, .4);
}

/* pawn designs */
/* ── the rendered set ─────────────────────────────────────────────────────
   Every pawn is a photographed piece rather than a CSS drawing. Each
   material was rendered once and then re-tinted per player from its own
   luminance, so all four colours of a style are the same object - and every
   style was shot under the same lamp, so the six of them are one cabinet.

   Their shading, rims and highlights are baked in, so the shared lighting
   layer and the material pseudo-elements are switched off: doubling a
   painted highlight with a CSS one is what makes composited art look like
   a sticker stuck on a board. */
.pawn-render {
  background: center / contain no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}
.pawn-render::before, .pawn-render::after { display: none; }
.pawn.is-render .pawn-gloss { display: none; }
.pawn-lacquer.pc-red { background-image: url("../img/pawns/sogti-lacquer-red.png"); }
.pawn-lacquer.pc-green { background-image: url("../img/pawns/sogti-lacquer-green.png"); }
.pawn-lacquer.pc-yellow { background-image: url("../img/pawns/sogti-lacquer-yellow.png"); }
.pawn-lacquer.pc-blue { background-image: url("../img/pawns/sogti-lacquer-blue.png"); }
.pawn-cowrie.pc-red { background-image: url("../img/pawns/sogti-cowrie-red.png"); }
.pawn-cowrie.pc-green { background-image: url("../img/pawns/sogti-cowrie-green.png"); }
.pawn-cowrie.pc-yellow { background-image: url("../img/pawns/sogti-cowrie-yellow.png"); }
.pawn-cowrie.pc-blue { background-image: url("../img/pawns/sogti-cowrie-blue.png"); }
.pawn-seed.pc-red { background-image: url("../img/pawns/sogti-seed-red.png"); }
.pawn-seed.pc-green { background-image: url("../img/pawns/sogti-seed-green.png"); }
.pawn-seed.pc-yellow { background-image: url("../img/pawns/sogti-seed-yellow.png"); }
.pawn-seed.pc-blue { background-image: url("../img/pawns/sogti-seed-blue.png"); }
.pawn-coin.pc-red { background-image: url("../img/pawns/sogti-coin-red.png"); }
.pawn-coin.pc-green { background-image: url("../img/pawns/sogti-coin-green.png"); }
.pawn-coin.pc-yellow { background-image: url("../img/pawns/sogti-coin-yellow.png"); }
.pawn-coin.pc-blue { background-image: url("../img/pawns/sogti-coin-blue.png"); }
.pawn-marble.pc-red { background-image: url("../img/pawns/sogti-marble-red.png"); }
.pawn-marble.pc-green { background-image: url("../img/pawns/sogti-marble-green.png"); }
.pawn-marble.pc-yellow { background-image: url("../img/pawns/sogti-marble-yellow.png"); }
.pawn-marble.pc-blue { background-image: url("../img/pawns/sogti-marble-blue.png"); }
.pawn-clay.pc-red { background-image: url("../img/pawns/sogti-clay-red.png"); }
.pawn-clay.pc-green { background-image: url("../img/pawns/sogti-clay-green.png"); }
.pawn-clay.pc-yellow { background-image: url("../img/pawns/sogti-clay-yellow.png"); }
.pawn-clay.pc-blue { background-image: url("../img/pawns/sogti-clay-blue.png"); }

/* The CSS-drawn materials that used to live here are gone: every pawn is
   now a rendered image, and their `background:` shorthands were quietly
   resetting background-size/repeat on the images that replaced them. */

/* ─────────────────────────────────────────── move hints */
.move-hint {
  pointer-events: none;
  --hint: 172, 118, 32;
  /* Above .pawn.movable (4), not below it as before. Both now carry a 44px
     hit area, so on a small board they overlap - and where they do, the
     destination has to win: "move here" is the deliberate tap, and having a
     neighbouring piece intercept it would pick up the wrong sogtī. */
  position: absolute; transform: translate(-50%, -50%); z-index: 5; padding: 0;
  border-radius: 11px; cursor: pointer;
  border: 2.5px dashed rgb(var(--hint));
  background: radial-gradient(circle, rgba(var(--hint), .3), rgba(var(--hint), .07) 72%);
  box-shadow: 0 0 12px rgba(var(--hint), .45), inset 0 0 12px rgba(var(--hint), .3);
  animation: pulse 1.2s ease-in-out infinite;
}
/* Same 44px floor as the pieces. The ring itself is cell*0.76 - about 37px on
   a 320px board - so it was short of the target size on exactly the phones
   where the board is smallest. Transparent, so the ring keeps its drawn size
   and the board does not fill up with hint.
   48 rather than 44 because the hint pulses down to scale(.95) and this rides
   along with it - 44 would spend part of every cycle just under the floor. */
.move-hint::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; transform: translate(-50%, -50%);
  border-radius: 50%;
}
.move-hint::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22%; height: 22%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: rgb(var(--hint)); opacity: .55;
}
/* Three hints that differed by hue alone - brass, red, green - and two of
   those three are the exact pair a red-green colour-blind player cannot
   separate. "Move here", "cut here" and "go home" are three different
   decisions, so they now differ in FORM as well as colour: an ordinary move
   keeps the dashed ring, a capture is solid with a cross through the middle,
   and home is a double ring. Readable with the colour ignored entirely. */
.move-hint-capture {
  --hint: 178, 38, 26;
  border-style: solid;
}
/* The cross: two bars through the centre dot, so a capture reads as a strike
   rather than a destination. */
.move-hint-capture::after {
  width: 52%; height: 52%; border-radius: 0; opacity: .8;
  background:
    linear-gradient(45deg, transparent 43%, rgb(var(--hint)) 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, rgb(var(--hint)) 43% 57%, transparent 57%);
}
.move-hint-home {
  --hint: 40, 128, 44;
  border-style: double; border-width: 5px;
}
@keyframes pulse {
  0%, 100% { opacity: .78; transform: translate(-50%, -50%) scale(.95); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
}

.ghar-burst {
  position: absolute; width: 10px; height: 10px; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none; z-index: 8;
  animation: burst .74s ease-out forwards;
}
@keyframes burst {
  0% { box-shadow: 0 0 0 0 rgba(255, 232, 170, .95), 0 0 0 0 rgba(216, 177, 105, .7); opacity: 1; }
  100% { box-shadow: 0 0 0 60px rgba(255, 232, 170, 0), 0 0 0 100px rgba(216, 177, 105, 0); opacity: 0; }
}

/* ─────────────────────────────────────────── status & throw */
.status {
  text-align: center; margin: 14px 16px 10px;
  /* Two lines reserved, always. Indic status lines wrap to two at 280-320px
     and English ones rarely do, so the board and tray jumped by a line every
     time the turn changed hands. */
  min-height: calc(2 * 1.45em); line-height: 1.45;
  display: flex; align-items: center; justify-content: center;
  /* --ink, not --ink-2. This line sits directly on the stage gradient, not on
     a panel, and that gradient runs from #8a4534 at the centre to #2e1010 at
     the edges. --ink-2 measures 3.47:1 against the bright end - and on a
     short screen the board shrinks and pushes this line up into exactly that
     zone. --ink holds 6.02:1 at the worst point. It is also the primary
     game-state text in the game, so it should not have been the third tier. */
  font-size: 15px; color: var(--ink); font-family: var(--serif); letter-spacing: .01em;
}

.throw-area { display: flex; align-items: stretch; justify-content: center; gap: 12px; padding: 0 16px; }
.tray {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 16px;
  border: 1px solid var(--edge); min-height: 58px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .32), rgba(0, 0, 0, .14)),
    linear-gradient(160deg, #4a3520, #33220f);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .6), 0 2px 0 rgba(255, 236, 200, .1);
}
.shells { display: flex; align-items: center; gap: 8px; }
/* 34px, up from 30: at 30px the serrated mouth that distinguishes an up
   shell from a down one dissolved into the tray shadow, and the throw read
   only through the number beside it. */
/* The shells stay natural cream; the thrower's colour rides on the tray
   border instead of tinting the shells themselves. */
.tray:has(.shells[class*="pc-"]) { border-color: color-mix(in srgb, var(--pc-tray, var(--brass)) 70%, transparent); }
.tray:has(.shells.pc-red) { --pc-tray: #b3122e; }
.tray:has(.shells.pc-green) { --pc-tray: #1f7a4d; }
.tray:has(.shells.pc-yellow) { --pc-tray: #d9962b; }
.tray:has(.shells.pc-blue) { --pc-tray: #2457a6; }
/* The "—" placeholder only shows once a value exists (needs JS hook). */
.throw-value.is-empty, .throw-value[data-empty] { color: transparent; }
.shell { width: 34px; height: 25px; display: block; position: relative; }
/* the shell's shadow is a painted ellipse under it, not a filter: four of
   these tumble for half a second on every throw, and a filtered layer is
   re-rasterised on each frame of that */
.shell::before { content: ""; position: absolute; left: 8%; right: 8%; bottom: -8%; height: 34%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, .5), rgba(0, 0, 0, .2) 55%, transparent 72%); z-index: -1; }
.cowrie { width: 100%; height: 100%; display: block; }
.tray.is-rolling .shell { animation: tumbleShell .3s linear infinite; }
.tray.is-rolling .shell:nth-child(2) { animation-delay: .06s; }
.tray.is-rolling .shell:nth-child(3) { animation-delay: .12s; }
.tray.is-rolling .shell:nth-child(4) { animation-delay: .18s; }
@keyframes tumbleShell {
  0% { transform: translateY(0) rotate(0) scaleY(1); }
  30% { transform: translateY(-9px) rotate(-140deg) scaleY(.5); }
  60% { transform: translateY(-4px) rotate(-260deg) scaleY(1); }
  100% { transform: translateY(0) rotate(-360deg) scaleY(1); }
}
/* The landing. Replaces the hard cut from tumble to face: each shell drops
   in with a small squash, staggered left to right, so the result reads as
   four objects coming to rest rather than a texture swap. One-shot. */
/* The stagger has to finish inside the 240ms the throw choreography waits
   (js/ui.js removes .is-settling then, and the value pops). At .05s steps of
   a .2s animation the fourth shell was still landing at 350ms, so the last
   two were cut off mid-flight on every single throw and the number arrived
   over a tray that had not finished moving. .06 + .18 = 240ms exactly. */
.tray.is-settling .shell { animation: settleShell .18s var(--ease-out) both; }
.tray.is-settling .shell:nth-child(2) { animation-delay: .02s; }
.tray.is-settling .shell:nth-child(3) { animation-delay: .04s; }
.tray.is-settling .shell:nth-child(4) { animation-delay: .06s; }
/* "That piece cannot take this throw." Short, and no colour change - it is a
   correction, not an error.
   Applied to .pawn-body, never to .pawn: the pawn itself is positioned by an
   inline transform written per frame by view.js layout(), and animating that
   property would snap the piece to the board's origin for the duration. The
   body has no positioning transform of its own - it is what `bob` animates. */
.pawn.is-refused .pawn-body { animation: refusePawn .26s var(--ease-out); }
@keyframes refusePawn {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

@keyframes settleShell {
  0% { transform: translateY(-10px) scale(1.05, .9); }
  60% { transform: translateY(0) scale(.96, 1.05); }
  100% { transform: none; }
}
.tray-divider {
  flex: 0 0 auto; width: 1px; align-self: stretch;
  background: linear-gradient(180deg, transparent, rgba(255, 236, 200, .22), transparent);
}
.throw-value {
  flex: 0 0 auto; min-width: 34px; height: 34px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 10px;
  background: rgba(216, 177, 105, .14);
  box-shadow: inset 0 0 0 1px rgba(216, 177, 105, .3);
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--pc-hi, var(--brass-hi));
}
/* The number lands with a pop once the shells have settled - the value is
   the payoff of the throw, so it arrives like one instead of mutating in
   place. The grace variant flashes the well gold: 4s and 8s grant another
   throw, and that difference should be visible before it is read. */
.throw-value.is-pop { animation: valuePop .28s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes valuePop {
  0% { transform: scale(.6); opacity: .3; }
  100% { transform: scale(1); opacity: 1; }
}
.throw-value.is-grace-pop { animation: gracePop .55s ease-out; }
@keyframes gracePop {
  0% { transform: scale(.6); opacity: .3; }
  30% {
    transform: scale(1.22);
    background: rgba(255, 214, 130, .5);
    box-shadow: 0 0 16px 4px rgba(255, 200, 100, .5), inset 0 0 0 1px rgba(255, 220, 150, .8);
  }
  100% { transform: scale(1); }
}
.btn-throw { min-width: 112px; min-height: 58px; }

/* The throw row is a tray and a button that both refuse to shrink: the tray
   is sized by four cowries plus its padding, the button by min-width. On a
   360px phone the two together are wider than the screen, and the Throw
   button - the single most important control in the game - hung off the
   right edge. Letting the tray give way first keeps the button whole. */
.throw-area .tray { min-width: 0; flex: 0 1 auto; }
@media (max-width: 400px) {
  .throw-area { gap: 8px; padding: 0 10px; }
  .throw-area .tray { padding: 10px 12px; gap: 9px; }
  /* Still a comfortable target - only the slack comes off. */
  .btn-throw { min-width: 96px; }
}
/* The glow lives on a pseudo-element and only its opacity animates.
   It used to animate `filter` on the button itself, going from one function
   to two mid-animation (brightness -> brightness + drop-shadow) - a filter
   list that changes shape cannot be interpolated as a composited filter, so
   every frame re-rasterised the most prominent button on the screen, forever,
   while the player was deciding what to do. Same look, compositor-only. */
.btn-throw { position: relative; }
.btn-throw::after {
  content: ""; position: absolute; inset: -6px; border-radius: 19px;
  pointer-events: none; opacity: 0;
  box-shadow: 0 0 10px 2px rgba(216, 177, 105, .5);
  background: radial-gradient(closest-side, rgba(255, 236, 190, .18), transparent 72%);
}
.btn-throw.is-ready::after { animation: readyGlow 1.8s ease-in-out infinite; }
@keyframes readyGlow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ─────────────────────────────────────────── log */
/* The history button is an icon beside the chat one (it carries .chat-open
   for the shared round-button look), so it needs no text or spacing of its own. */
/* Zero-width slot after your seat: the button hangs off its right edge, so
   chat and the seat stay exactly where they were and the row stays centred. */
.log-slot { position: relative; flex: 0 0 0; width: 0; height: 44px; margin-left: -10px; }
.log-slot .log-toggle { position: absolute; left: 10px; top: 0; }
.log-toggle.is-open { color: var(--brass); border-color: var(--brass-lo); }
.log {
  list-style: none; margin: 0 auto 4px; padding: 11px 13px; width: 100%; max-width: 560px;
  box-sizing: border-box; max-height: 46vh; overflow-y: auto;
  border: 1px solid var(--edge-soft); border-radius: 11px; font-size: 13px; line-height: 1.55;
  color: var(--ink-2); background: var(--well);
}
.log:empty::before { content: "No moves yet."; color: var(--ink-3); }
.log li { padding: 2px 0; }
.log li.hot { color: #ff8b7a; }
.log li.good { color: #7fd070; }
.log li.dim { color: var(--ink-3); }

/* ─────────────────────────────────────────── result */
/* Above everything, because a modal that something else paints over is not a
   modal. At z-index 20 the tab bar (45), the chat sheet and its scrim (39/40)
   and the coach tip (60/61) all sat on top: the tab bar stayed tappable
   underneath every card, so a player could switch tabs out from under the
   first-run language question - which has no cancel button by design - and be
   left with an undismissable card over the Settings screen.
   The overlay also has to be able to scroll. It is a fixed, centred grid, so
   a card taller than the viewport spilled off *both* edges at once with no
   way to reach the button at the bottom - reachable today at large Android
   font sizes on the six-language card. */
.overlay {
  /* both axes named: `overflow-y: auto` alone forces overflow-x to auto,
     which is what turned a too-wide card into a horizontal pan container. */
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(circle at 50% 40%, rgba(74, 36, 8, .6), rgba(40, 18, 4, .82));
  backdrop-filter: blur(5px);
  animation: screenIn .3s ease both;
}
.overlay[hidden] { display: none; }

.result-card {
  /* 100%, not 92vw. The overlay already supplies a 24px gutter, and `vw` is
     the *unpadded* viewport - so on any screen under 600px the card was wider
     than the box holding it. Measured at 360px: a 330px card in a 310px
     content box, 19px of overflow, and because the card is centred the half
     spilling left is unreachable (scroll origin is 0). Every modal in the app
     was affected, including the first-run language card. */
  position: relative; width: min(410px, 100%); padding: 26px 24px 24px; text-align: center;
  /* The same treatment .pass-card already has, for the same reason and one
     worse case: the overlay centres its child, so a card taller than the
     screen overflows both edges and the top half - the heading and the
     winner - cannot be scrolled back to. At Android's largest font scale
     with four players, that is exactly what happened. */
  max-height: calc(100dvh - 48px); overflow-y: auto;
  border: 1px solid var(--edge); border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,240,214,.14);
}
.result-card::before {
  content: ""; position: absolute; inset: 7px; border-radius: 14px;
  border: 1px solid var(--edge-soft); pointer-events: none;
}
.result-crest {
  width: 60px; height: 60px; margin: 0 auto 8px; color: var(--brass); opacity: .9;
  animation: spinIn .8s cubic-bezier(.2, .9, .3, 1) both;
}
.result-crest svg { width: 100%; height: 100%; }
@keyframes spinIn { from { transform: rotate(-140deg) scale(.4); opacity: 0; } to { transform: none; opacity: .85; } }

.result-card h2 {
  margin: 0 0 18px; font-family: var(--serif); font-size: 27px; font-weight: 600; color: var(--brass);
  animation: titlePop .5s cubic-bezier(.2, 1.5, .4, 1) .15s both;
}
@keyframes titlePop {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.standings { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.standings li {
  display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px;
  background: var(--well); border: 1px solid var(--edge-soft);
  border-radius: 11px; padding: 11px 13px;
  animation: screenIn .4s ease both;
}
.standings li:nth-child(2) { animation-delay: .08s; }
.standings li:nth-child(3) { animation-delay: .16s; }
.standings li:nth-child(4) { animation-delay: .24s; }
/* First place earns the brass. One-shot glow rather than a loop: the win
   moment should flare and then let the standings be read in peace. */
.standings li:first-child {
  border-color: var(--brass-lo);
  animation: screenIn .4s ease both, winnerGlow 1.4s ease-out .4s;
}
@keyframes winnerGlow {
  0% { box-shadow: 0 0 0 0 rgba(255, 205, 110, 0); }
  30% { box-shadow: 0 0 18px 3px rgba(255, 205, 110, .55); }
  100% { box-shadow: 0 0 0 0 rgba(255, 205, 110, 0); }
}
.standings .place { width: 34px; color: var(--brass); font-weight: 800; font-size: 13px; font-family: var(--serif); }
.standings .tail { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* Grows to its label rather than clipping it: "மீண்டும் விளையாடு" is three
   times the width of "Rematch". */
.result-actions .btn { flex: 1 1 auto; }

/* League points, where they were earned. The delta pops in brass once the
   server awards it; the standing line beneath stays quiet. */
.result-league {
  margin: -6px 0 18px; display: grid; gap: 2px; text-align: center;
}
.result-league b {
  font-family: var(--serif); font-size: 20px; color: var(--brass-hi);
  animation: valuePop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.result-league span { font-size: 12px; color: var(--ink-3); }

.btn-share {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 12px; padding: 12px 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--edge); color: var(--ink-2);
  box-shadow: inset 0 1px 0 rgba(255,240,214,.14), var(--shadow-md);
}
.btn-share span { font-size: 16px; }
.btn-share:active { transform: translateY(1px) scale(.99); }
.btn-share.is-busy { opacity: .6; pointer-events: none; }

/* Rewarded-ad button on the result screen. Same shape as btn-share so an
   opt-in ad reads as one more quiet option, never a banner shouting for
   attention - see js/ads.js for why that restraint is the point. */
.btn-watch-ad {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px; padding: 11px 20px; font-size: 13.5px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px dashed var(--edge); color: var(--ink-3);
}
.btn-watch-ad:active { transform: translateY(1px) scale(.99); }
.btn-watch-ad.is-busy { opacity: .6; pointer-events: none; }

/* ─────────────────────────────────────────── pass the device */
.pass-card {
  position: relative; width: min(380px, 100%); padding: 40px 28px; text-align: center;
  /* The card scrolls rather than the backdrop, so the primary button at the
     bottom stays reachable however tall the content gets. */
  max-height: calc(100dvh - 48px); overflow-y: auto;
  border: 1px solid var(--edge); border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,240,214,.14);
}
.pass-dot {
  display: block; width: 46px; height: 46px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--pc-hi), var(--pc) 58%, var(--pc-lo));
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .3);
  animation: floaty 2.4s ease-in-out infinite;
}
#pass-title { margin: 0 0 6px; font-family: var(--serif); font-size: 24px; color: var(--ink); }
.pass-card .hint { margin: 0 0 22px; }
.pass-card .btn-lg { width: 100%; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute; top: -6%; left: var(--x); width: 9px; height: 14px;
  background: var(--c); border-radius: 2px; opacity: .9;
  /* Two passes and done. An endless drizzle kept animating behind the
     standings for as long as the card was open - the celebration is the
     first few seconds; after that it is just noise over text. */
  animation: fall 2.6s linear var(--d) 2 forwards;
}
@keyframes fall {
  0% { transform: translateY(-10vh) rotate(var(--r)); opacity: 0; }
  10% { opacity: .95; }
  100% { transform: translateY(105vh) rotate(calc(var(--r) + 720deg)); opacity: .9; }
}

/* ─────────────────────────────────────────── responsive */
@media (max-height: 760px) {
  .board { width: min(90vw, 50vh, 420px); }
  .status { margin: 9px 16px 7px; }
  .brand h1 { font-size: 42px; }
  .brand-mark { width: 88px; height: 88px; }
  /* The menu's own mark is sized by the height ladder at the end of this
     file. A 48px rule used to sit here and never applied: the later
     `#screen-menu .brand-mark` rule has the same specificity and won. */
}
@media (min-width: 780px) {
  .scroller { padding: 4px 0 0; max-width: 640px; margin: 0 auto; width: 100%; }
}

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

/* ─────────────────────────────────────────── slate & chalk board */
.cp-theme-slate .cp-cut { stroke: #f5f2e6; opacity: .9; }
.cp-theme-slate .cp-hi { stroke: rgba(0, 0, 0, .5); opacity: .3; }
.cp-theme-slate .cp-ornament .cp-cut { opacity: .55; }
.cp-theme-slate .cp-ghar-motif .cp-cut { opacity: .5; }
.cp-theme-slate .cp-seat.tint-red    { fill: rgba(226, 86, 70, .34); }
.cp-theme-slate .cp-seat.tint-green  { fill: rgba(96, 196, 96, .3); }
.cp-theme-slate .cp-seat.tint-yellow { fill: rgba(246, 202, 70, .32); }
.cp-theme-slate .cp-seat.tint-blue   { fill: rgba(94, 158, 226, .32); }

.board.board-slate {
  box-shadow:
    0 0 0 8px #6b4a2a, 0 0 0 10px #3d2917,
    0 24px 40px -14px rgba(0, 0, 0, .75);
}

/* ─────────────────────────────────────────── loading skeletons */
/* The shape of a list row, breathing. Gradient position is the only thing
   animating, on the compositor, and the whole block is aria-hidden - screen
   readers get the real rows or the real empty text, never this. */
.skeleton-rows { display: grid; gap: 8px; }
.skeleton-row {
  height: 64px; border-radius: 13px; border: 1px solid var(--edge-soft);
  background:
    linear-gradient(100deg, transparent 30%, rgba(255, 236, 200, .07) 50%, transparent 70%) 0 0 / 200% 100%,
    var(--well);
  animation: shimmer 1.4s linear infinite;
}
.skeleton-row:nth-child(2) { opacity: .7; }
.skeleton-row:nth-child(3) { opacity: .4; }
@keyframes shimmer {
  from { background-position: 120% 0, 0 0; }
  to { background-position: -80% 0, 0 0; }
}

/* ─────────────────────────────────────────── turn clock */
/* Always present at a fixed height next to the player's own chip, so a turn
   starting or ending never adds/removes layout and nothing below it jumps. */
.turn-timer {
  display: flex; align-items: center; gap: 10px;
  margin: 10px auto 0; padding: 0 18px; width: min(420px, 100%);
  height: 20px; opacity: .38; transition: opacity .25s ease;
}
.turn-timer.is-active { opacity: 1; }
.turn-timer-track {
  flex: 1; height: 9px; border-radius: 99px; overflow: hidden;
  background: rgba(90, 50, 10, .22); box-shadow: inset 0 1px 2px rgba(60, 30, 6, .35);
}
.turn-timer i {
  display: block; height: 100%; width: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brass-hi), var(--brass));
  transition: width 1s linear;
}
.turn-timer b {
  flex: 0 0 auto; min-width: 22px; text-align: right;
  font-size: 12px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.turn-timer.is-low i { background: linear-gradient(90deg, #ff8a5c, #d5341f); }
.turn-timer.is-low b { color: #ff7a63; }
.turn-timer.is-low { animation: lowPulse .9s ease-in-out infinite; }
@keyframes lowPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ─────────────────────────────────────────── connecting screen */
.connect-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 40px 24px; text-align: center;
}
.connect-spinner { display: flex; gap: 8px; margin-bottom: 10px; }
.connect-spinner span {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  box-shadow: 0 2px 5px rgba(90, 50, 10, .35);
  animation: hopDot 1.1s ease-in-out infinite;
}
.connect-spinner span:nth-child(2) { animation-delay: .15s; }
.connect-spinner span:nth-child(3) { animation-delay: .3s; }
@keyframes hopDot { 0%, 100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-9px); opacity: 1; } }

#connect-title { margin: 0; font-family: var(--serif); font-size: 26px; color: var(--ink); }
.connect-sub { margin: 0 0 14px; font-size: 13px; color: var(--ink-3); }

.connect-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; width: min(360px, 90vw); }
.connect-list li {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  border: 1px solid var(--edge); border-radius: 13px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md); text-align: left;
  animation: joinIn .38s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes joinIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
/* Carries the language name in its own script, so it clips for the same
   reason the bubbles did. */
.connect-who { display: grid; line-height: 1.45; }
.connect-who b { font-size: 14px; }
.connect-who em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.connect-ok { margin-left: auto; font-size: 12px; font-weight: 700; color: #7fd070; }
/* A tick as well as the green, so "ready" does not rest on colour alone. */
.connect-ok::before { content: '✓ '; }

/* ─────────────────────────────────────────── chat */
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.chat-bubble {
  position: fixed; max-width: min(260px, 74vw); padding: 8px 13px;
  /* 1.5, not 1.35: almost everything said in a bubble is Devanagari, Telugu,
     Kannada or Tamil, and those scripts hang marks above and below the Latin
     box that 1.35 clips. Latin lines are a little airier as a result, which
     is the cheaper of the two costs. */
  border-radius: 14px; font-size: 13.5px; line-height: 1.5;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--edge);
  border-bottom: 3px solid color-mix(in srgb, var(--pc) 65%, var(--ink-3));
  box-shadow: 0 8px 20px rgba(60, 30, 6, .35);
  animation: bubbleIn .26s cubic-bezier(.2, 1.3, .4, 1) both;
}
.chat-bubble.is-me { border-bottom-color: color-mix(in srgb, var(--pc) 70%, var(--ink-3)); }
/* With four people able to be talking at once, each bubble has to say who
   said it - position alone stops being enough the moment two are on screen. */
.bubble-who {
  /* A filled pill in the speaker's colour rather than coloured text: green
     text on the maroon bubble measured under 3:1, so MANDA was a smudge. */
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 2px;
  background: var(--pc); color: #1a0f0a; padding: 0 6px; border-radius: 6px;
}
.chat-bubble.is-out { animation: bubbleOut .3s ease forwards; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes bubbleOut { to { opacity: 0; transform: translateY(-6px) scale(.96); } }

/* Your seat, with the chat button to the left of it. Grouped so the pair
   stays centred under the board together rather than the button drifting to
   its own line further down the screen. */
.seat-row-bottom { display: flex; align-items: center; justify-content: center; gap: 10px; }

.chat-open {
  position: relative; flex: 0 0 auto; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 999px;
  color: var(--ink-2); border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md);
}
.chat-open svg { width: 19px; height: 19px; display: block; }
.chat-open.is-open { border-color: var(--brass-lo); color: var(--ink); }

/* A bottom sheet, not an inline panel. Inline, it sat at the end of a long
   scrolling screen, so opening it often put it below the fold - and the
   on-screen keyboard then pushed it further out of sight. Pinned to the
   viewport it is always reachable, and it stays open between messages so you
   can fire off two or three without reopening it each time. */
.chat-scrim {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(20, 8, 6, .5); backdrop-filter: blur(1.5px);
  animation: scrimIn .2s ease both;
}
.chat-scrim[hidden] { display: none; }
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }

.chat-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  margin: 0; padding: 10px 16px calc(max(var(--sab, env(safe-area-inset-bottom, 0px)), 24px) + 10px);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--edge); border-bottom: 0;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 -14px 44px rgba(0, 0, 0, .6);
  animation: sheetUp .26s var(--ease-out) both;
  max-height: 68vh; overflow-y: auto;
}
.chat-sheet[hidden] { display: none; }
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: none; }
}
.chat-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); padding: 2px 2px 10px;
}
.chat-close {
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 6px 8px; border-radius: 8px;
}
.chat-close:hover { color: var(--ink); background: var(--well); }
/* The conversation. Scrolls on its own rather than growing the sheet, so
   the quick phrases and the input stay put as messages arrive. */
.chat-log {
  list-style: none; margin: 0 auto 10px; padding: 0 2px;
  /* A conversation column, not the width of the window. The sheet spans the
     whole screen, and left/right alignment across a desktop's full width put
     the two speakers so far apart they stopped reading as one exchange. */
  width: 100%; max-width: 560px;
  max-height: 30vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-line {
  align-self: flex-start; max-width: 78%;
  padding: 7px 11px; border-radius: 13px 13px 13px 4px;
  background: var(--well); border: 1px solid var(--edge);
  /* See .chat-bubble - same scripts, same clipping. */
  font-size: 13.5px; line-height: 1.5; color: var(--ink);
  overflow-wrap: anywhere;
}
.chat-line.is-me {
  align-self: flex-end; border-radius: 13px 13px 4px 13px;
  background: linear-gradient(180deg, var(--brass-lo), var(--brass));
  border-color: var(--brass-lo); color: #2b1d12;
}
.chat-line-who {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; opacity: .72; margin-bottom: 2px;
}
/* .pc-* already carries the player's colour as --pc (see the palette near
   the top), so the name takes it from there rather than restating it. */
.chat-line .chat-line-who { color: var(--pc-hi, var(--ink-3)); }
.chat-line.is-me .chat-line-who { color: inherit; }
.chat-log-empty {
  align-self: center; color: var(--ink-3); font-size: 12.5px; padding: 6px 0;
}

/* A message that lands while the sheet is shut needs to survive the six
   seconds its bubble gets, or it may as well not have arrived. */
.chat-unread {
  /* On the button's corner now that it is a circle, instead of trailing the
     words it used to sit after. */
  position: absolute; top: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--danger, #c0392b); box-shadow: 0 0 0 2px var(--surface);
}
.chat-unread[hidden] { display: none; }
.chat-open.has-unread { border-color: var(--danger, #c0392b); color: var(--ink); }

/* Same column as the transcript, so the sheet reads as one thing on a wide
   screen instead of a narrow conversation over full-width controls. */
.chat-quick, .chat-form, .chat-sheet-head { width: 100%; max-width: 560px; margin-inline: auto; }

.chat-quick { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.quick {
  border: 1px solid var(--edge-soft); background: var(--well); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; cursor: pointer;
}
.quick:active { transform: scale(.96); }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 11px; font: inherit; font-size: 14px;
  border: 1px solid var(--edge); color: var(--ink);
  background: linear-gradient(180deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .16));
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
}
.chat-form input::placeholder { color: var(--ink-3); opacity: .7; }
.chat-form input:focus {
  outline: none; border-color: var(--brass);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(224, 176, 85, .22);
}
.chat-form .btn { padding: 11px 18px; }

/* A square icon rather than the word "Send".
   The text button was as wide as its label, which is a width that changes
   with the device's font-size setting and the translation - so on some
   phones it grew until it no longer sat beside the field. A fixed square
   cannot do that, and flex-shrink:0 keeps the field giving way instead of
   the button. */
.chat-form .btn-send {
  flex: 0 0 auto; width: 46px; height: 46px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-form .btn-send svg { width: 21px; height: 21px; display: block; }

.log li.chat { color: #c3aef0; }

/* village line on the player chips */
.chip-where { font-size: 12px; color: var(--ink-3); }

/* ─────────────────────────────────────────── online setup */
.sub-label {
  margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 600;
}
.code-input {
  width: 100%; padding: 13px 16px; border-radius: 12px; font: inherit; font-size: 18px;
  font-family: var(--serif); letter-spacing: .12em; text-align: center; text-transform: uppercase;
  /* a well cut into the panel, not a white card sitting on it */
  border: 1px solid var(--edge); color: var(--ink); margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .16));
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 236, 190, .07);
}
.code-input::placeholder { color: var(--ink-3); opacity: .7; }
.code-input:focus {
  outline: none; border-color: var(--brass);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(224, 176, 85, .22);
}
/* .code-input is styled for codes - uppercase, wide tracking. A person's
   name is not a code, so these opt back out of that treatment. */
/* Names are typed as names. .code-input uppercases and tracks its text for
   six-character room and friend codes; these fields borrow its shape but hold
   a person's name, and a player typing "Suhas" who saw "SUHAS" reasonably
   concluded the app had rejected it. */
#online-name-input, #my-name-input, #alias-input, #name-ask-input, #group-name-input {
  text-transform: none; letter-spacing: normal; font-family: var(--sans); font-size: 15px;
}
#online-status { color: var(--ink-2); margin: 10px 0 0; }
#online-status.is-error, .hint.is-error { color: var(--brass); }

/* ─────────────────────────────────────────── online lobby */
.lobby-wrap {
  /* The same pane treatment .menu-wrap has, and for the same reason: the
     screen around it is `height:100dvh; overflow:hidden`, so a child without
     `min-height:0; overflow-y:auto` is clipped rather than scrolled. The
     lobby measured 1098px against a 721px viewport, which put
     #btn-fill-bots at y=1072 and #btn-lobby-start below it - both off
     screen, with no way to scroll to them. The host read "you can start
     without them" next to a button they could not reach, and once a friend
     arrived, Start game was unreachable too: two players in a lobby and no
     way to begin. */
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; padding: 24px 20px 40px; max-width: 460px; margin: 0 auto; width: 100%;
}
.lobby-code-card {
  width: 100%; text-align: center; padding: 22px; border-radius: 18px;
  border: 1px solid var(--edge); background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,240,214,.14);
}
.lobby-code-card .hint { display: block; margin: 0 0 8px; }
/* Two equal shares side by side, wrapping to a column if the words in them
   grow (a longer language, a larger font setting) rather than overflowing. */
.lobby-share-row { display: flex; gap: 9px; flex-wrap: wrap; }
.lobby-share-row .btn { flex: 1 1 130px; min-width: 0; }
.lobby-code {
  font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: .14em;
  color: var(--brass); margin-bottom: 14px;
}
.lobby-status { margin: 0; color: var(--ink-2); text-align: center; font-size: 14px; }

.lobby-roster { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 9px; }
.lobby-roster li {
  display: flex; align-items: center; gap: 11px; padding: 12px 15px;
  border: 1px solid var(--edge); border-radius: 13px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md); animation: joinIn .38s cubic-bezier(.2, 1.2, .4, 1) both;
  /* A flex row will not shrink below the total width of what it holds, and
     three buttons plus a name is wider than a phone. Left alone it forced
     this row wider than the list that contains it, and because the screen
     scrolls horizontally when something inside is too wide, the whole page
     panned sideways - the row was dragging the entire app off-screen with
     it. Wrapping lets the actions drop to their own line instead. */
  flex-wrap: wrap; min-width: 0;
}
/* min-width:0 is what actually permits the shrink; `flex: 1` alone still
   floors a flex item at the width of its own text. */
.lobby-roster b {
  flex: 1 1 auto; min-width: 0; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Brass on brass at 1.36:1 - the label naming who controls the table was a
   smudge. Same treatment as the other brass pills that already work. */
.lobby-roster .lobby-host-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #2b1d12; background: var(--brass); padding: 3px 8px; border-radius: 999px;
}
.lobby-roster .lobby-you-tag { font-size: 12px; color: var(--ink-2); }

/* The "bot" mark on a practice-room chair. Small and lower-contrast than the
   name it sits under: it is a qualifier, not a headline. */
.room-seat.is-bot-seat em {
  /* 11px, --ink-2: at 9px in --ink-3 this was unreadable at 280px. */
  display: block; font-style: normal; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2); margin-top: 1px;
}

/* Pushed to the right of the name, and to the right of its own line once it
   has wrapped onto one. */
.lobby-roster .row-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.lobby-roster .row-actions .btn { padding: 8px 14px; font-size: 13px; }

/* Square icon action, same shape as the composer's send button so the two
   read as the same kind of control. The unread dot rides the corner instead
   of sitting after a word, which is what made it drift onto its own line in
   one row and not the next. */
.btn-icon {
  position: relative; flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 19px; height: 19px; display: block; }
.btn-icon .badge {
  position: absolute; top: -3px; right: -3px; margin: 0;
  min-width: 12px; height: 12px; padding: 0;
}

@media (max-width: 420px) {
  /* Three actions have to fit a phone without the row growing: tighter than
     the desktop rhythm, still above the 44px touch target. */
  .lobby-roster li { gap: 8px; padding: 11px 12px; }
  .lobby-roster .row-actions { gap: 6px; width: 100%; }
  .lobby-roster .row-actions .btn { padding: 9px 12px; font-size: 12.5px; }
  /* ...but an icon button is already the right size and must not be squashed
     into a rectangle by the rule above. */
  .lobby-roster .row-actions .btn-icon { padding: 0; width: 44px; height: 44px; }
}

.notify-ask-ico { display: block; margin: 0 auto 10px; color: var(--brass); }
.notify-ask-ico svg { width: 38px; height: 38px; display: block; }
#notify-ask .pass-card .btn-block { margin-top: 10px; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 8px;
  border-radius: 999px; background: var(--danger, #c0392b); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.badge[hidden] { display: none; }

/* Family mode hides these three, and each one sets `display` from a class
   selector - which beats the browser's own `[hidden]{display:none}` at equal
   specificity, so `el.hidden = true` did nothing at all and every control
   the setting is supposed to remove stayed on screen and clickable. Same
   hazard the note at the top of this file describes. */
.mode-tile[hidden] { display: none; }
.tabbar .tab[hidden] { display: none; }
.segmented[hidden] { display: none; }
/* The countless variant: presence, not quantity. */
.badge.is-dot { min-width: 10px; height: 10px; padding: 0; }

/* Floats above whichever screen is showing - see the note in index.html for
   why this is not part of the menu. */
.invite-toast {
  /* Centred with auto margins rather than translateX(-50%): the joinIn
     animation below finishes on `transform: none`, and with fill-mode `both`
     that final frame sticks - silently cancelling any centring transform. */
  position: fixed; left: 0; right: 0; margin-inline: auto;
  bottom: max(18px, var(--sab, env(safe-area-inset-bottom, 0px))); z-index: 60;
  width: min(420px, calc(100% - 32px)); padding: 14px 15px;
  border: 1px solid var(--edge); border-radius: 15px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md);
  animation: joinIn .38s cubic-bezier(.2, 1.2, .4, 1) both;
}
.invite-toast[hidden] { display: none; }
.invite-toast p { margin: 0 0 11px; font-size: 14px; }
.invite-toast-row { display: flex; gap: 9px; }
.invite-toast-row .btn { flex: 1; }

.lobby-invite { width: 100%; margin-top: 6px; }
.lobby-invite[hidden] { display: none; }

/* The DM screen is a full-height conversation: the log takes whatever is
   left and scrolls, the composer stays put at the bottom. */
.dm-wrap {
  /* Grow to fill what the topbar leaves, rather than asking for 100% of it.
     A percentage height here did not resolve to the screen's full height, so
     the conversation stopped short and the composer sat marooned in the
     middle with a dead gap beneath it. Growing is also the honest way to say
     what this wants: whatever space is left. min-height:0 is what still lets
     the log scroll inside it instead of pushing the composer off. */
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
  padding: 12px 16px calc(max(var(--sab, env(safe-area-inset-bottom, 0px)), 24px) + 10px);
  gap: 10px; max-width: 560px; margin-inline: auto; width: 100%;
}
.dm-log { flex: 1 1 auto; min-height: 0; max-height: none; margin: 0; }
.dm-form { flex: 0 0 auto; }

/* A friend's presence and their unread count, on their row. */
.friend-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  margin-right: 7px; background: var(--ink-3); opacity: .45;
}
.friend-dot.is-online { background: #7fd070; opacity: 1; box-shadow: 0 0 6px rgba(127, 208, 112, .7); }
/* The turn-based bot's row. Brass rather than the green of a person who is
   genuinely online, so the list never implies somebody is there who is not. */
.friend-dot.is-bot { background: var(--brass); opacity: 1; box-shadow: 0 0 6px rgba(224, 176, 85, .55); }
#async-friend-list small { display: block; margin-left: 15px; color: var(--ink-2); font-size: 12px; }

.lobby-mine { width: 100%; margin-top: 4px; }
.lobby-mine[hidden] { display: none; }
.lobby-mine .pawn-picker { max-height: 30vh; overflow-y: auto; }

/* A colour someone else holds stays visible, wearing their name, rather than
   vanishing - so it reads as "taken", not as though it never existed. */
.swatch.is-taken {
  opacity: .42; cursor: not-allowed; filter: saturate(.5);
}
.swatch.is-taken em { font-style: italic; }

/* ─────────────────────────────────────────── tab bar
   A destination switcher, not a history stack. Sits above the safe-area
   inset so it clears a phone's home indicator, and hides entirely on the
   board, the lobby and the chat sheet, where the screen has its own bottom
   controls to compete with. */
.table-size-caption {
  margin: 2px 0 -2px; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  /* minmax(0,1fr) because 1fr carries an implicit min-width:auto, so the
     longest label (Tamil at 130% system font scale) grew the whole bar past
     the viewport and clipped the fifth tab. */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  overflow: hidden;
  background: linear-gradient(180deg, #4a241e, var(--surface-2) 70%);
  border-top: 1px solid var(--edge);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .5), 0 -10px 30px rgba(0, 0, 0, .35);
  /* max(), not the bare inset. On a gesture-navigation device that reports a
     zero inset the labels end up underneath the system's home pill - seen on
     a real emulator, where "Your turns" sat behind it. The floor guarantees
     clearance without fighting devices that report a real inset. */
  padding-bottom: max(var(--sab, env(safe-area-inset-bottom, 0px)), 12px);
  box-shadow: 0 -6px 22px rgba(0, 0, 0, .38);
}
.tabbar[hidden] { display: none; }

/* Screens scroll under a fixed bar, so they need room to finish above it.
   The clearance tracks the bar's real height (written to --tabbar-h by a
   ResizeObserver in ui.js) rather than assuming 84px: at Android's larger
   font scales the labels wrap the bar taller and a fixed number leaves the
   last row of content stuck underneath it. */
body.has-tabbar .scroller { padding-bottom: calc(var(--tabbar-h, 72px) + 12px); }
/* 12px, not 2: at 2 the last row of mode cards finished flush against the
   bar's top edge on a 568px phone and read as cut off rather than as the
   end of the list. */
body.has-tabbar .menu-wrap { padding-bottom: calc(var(--tabbar-h, 72px) + 12px); }

/* The home screen is a fixed pane, not a scroll: everything above was
   compacted to fit a normal phone height, and clamping it keeps the layout
   still under the finger - a lobby that pans reads as overflowing, one that
   doesn't reads as designed. Only at heights where even the compact stack
   cannot fit (small phones, split screen) does scrolling come back as the
   safety net, because a clamp there would make the bottom rows unreachable. */
/* (The old per-screen home clamp lived here; the global page lock above
   made it redundant - every screen is bounded now, and anything that
   overflows scrolls inside its own pane.) */

.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 9px 6px 8px;
  /* 44px is the floor for a comfortable target; this clears it with room. */
  min-height: 56px;
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-3);
  -webkit-tap-highlight-color: transparent;
}
.tab .tab-ico { display: flex; align-items: center; justify-content: center; opacity: .78; transition: transform .12s ease; }
/* Tabs answer the finger the same way every button does. */
.tab:active .tab-ico { transform: scale(.86); }
.tab .tab-ico svg { width: 23px; height: 23px; display: block; }
/* The active tab thickens its own strokes rather than only changing hue, so
   the current tab is still obvious to someone who cannot separate the two
   colours. */
.tab.is-on .tab-ico svg { stroke-width: 1.9; }
.tab.is-on { color: var(--brass); }
.tab.is-on .tab-ico { opacity: 1; }
/* The active tab is marked by a rule as well as colour, so it does not rely
   on hue alone to say where you are. */
.tab.is-on::before {
  content: ''; position: absolute; top: 0; left: 22%; right: 22%;
  height: 2px; background: var(--brass); border-radius: 0 0 2px 2px;
}
.tab:focus-visible { outline: 2px solid var(--brass); outline-offset: -3px; }
.tab .badge { position: absolute; top: 6px; left: 55%; }

.quick-sub {
  margin: 8px 0 4px; text-align: center;
  font-size: 12.5px; color: var(--ink-2);
}

.lobby-seats { width: 100%; margin: 4px 0 2px; }
.lobby-seats[hidden] { display: none; }
.lobby-seats .seg[disabled] { opacity: .4; cursor: not-allowed; }

/* ─────────────────────────────────────────── accessibility corrections
   Measured against the real tokens: --ink-3 on --surface is 3.94:1, under
   the 4.5:1 AA needs for body text, so hint copy moves up to --ink-2
   (7.08:1). --ink-3 stays for chrome and dividers, which are not text. */
.hint, .foot-note, .chip-where, .chat-log-empty, .connect-sub { color: var(--ink-2); }

/* Errors were the same brass as every heading and active border in the app -
   contrast was never the problem, distinguishability was. */
:root { --danger: #ff7a68; }
#online-status.is-error,
.hint.is-error,
.lobby-status.is-error { color: var(--danger); }
#online-status.is-error::before,
.hint.is-error::before,
.lobby-status.is-error::before { content: '⚠ '; }

/* Taken colours were dimmed and nothing else. Dimming alone reads as
   "disabled for some reason"; the lock says which reason. */
.swatch.is-taken::after {
  content: '🔒'; position: absolute; top: 6px; right: 8px; font-size: 11px;
}
.swatch { position: relative; min-width: 44px; }

/* ─────────────────────────────────────────── Play tab layout
   Structured after the lobby-style games this sits beside on a phone: a
   persistent identity strip, one dominant action, then the other ways to
   play as equal-weight tiles beneath it. */
.hud {
  /* Three slots, title dead centre: the side cells are given equal width so
     the name sits centred against the bar rather than against whatever the
     profile happens to measure. No panel behind it - the sketch has two
     free-standing corners and a title, not a bar. */
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  width: 100%; padding: 2px 2px 0; margin: 0 0 2px;
  border: 0; background: none; box-shadow: none;
}
.hud-corner {
  display: grid; justify-items: center; gap: 3px;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  min-width: 0;
}
.hud-corner:first-child { justify-self: start; }
.hud-corner:last-child { justify-self: end; }
.hud-corner:active { transform: scale(.95); }
.hud-corner-box {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--edge); border-radius: 11px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm); font-size: 19px; color: var(--brass);
}
.hud-corner-label {
  font-size: 11px; color: var(--ink-2); max-width: 74px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 700; color: #2b1d12;
  background: linear-gradient(180deg, var(--brass), var(--brass-lo));
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.3);
}
/* No avatar chosen yet: show the default painted face, not a bare letter.
   The element holds only the fallback initial, so the letter is hidden. */
.hud-avatar:not(.has-img) {
  color: transparent; font-size: 0;
  background: url("../img/avatars/a0.webp") center / cover no-repeat,
    radial-gradient(circle at 50% 35%, #5a1a2a, #2a0812);
  box-shadow: 0 0 0 1px rgba(216, 177, 105, .5), inset 0 -2px 4px rgba(0, 0, 0, .3);
}
.hud-id {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  justify-self: start; text-align: left;
}
.hud-id:active { transform: scale(.97); }
.hud-title {
  align-self: center;
  font-family: var(--serif); font-size: 25px; letter-spacing: .06em;
  background: linear-gradient(178deg, #fff4d6 0%, #ffdc96 30%, #e0b055 60%, #c9a227 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6));
  white-space: nowrap;
}
.hud-gear { justify-self: end; }
.hud-who { display: grid; line-height: 1.35; min-width: 0; }
.hud-who b { font-size: 15px; }
.hud-who em {
  font-style: normal; font-size: 12px; color: var(--ink-2);
  letter-spacing: .1em;
  /* Wrapping the code to a second line grows the left cell and shoves the
     centred title off-centre, so it is clipped instead. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-gear {
  margin-left: auto; width: 44px; height: 44px; flex: 0 0 44px;
  border: 1px solid var(--edge); border-radius: 11px;
  background: var(--well); color: var(--ink-2);
  font-size: 17px; cursor: pointer;
}
.hud-gear:hover { color: var(--ink); }

.hero-card {
  position: relative; display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 13px 18px; margin-bottom: 4px;
  border: 1.5px solid var(--brass-lo); border-radius: 20px; cursor: pointer;
  background:
    radial-gradient(120% 140% at 12% 10%, rgba(224,176,85,.26), transparent 58%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  /* The frame is lit like a fitting, not drawn like an outline: a bright
     hairline where the lamp catches the top of the brass, falling away to
     the plain border colour down the sides. */
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 234, 180, .28),
    0 -1px 0 rgba(255, 234, 180, .35),
    0 0 18px -6px rgba(255, 190, 92, .35);
  font: inherit; text-align: left; color: var(--ink);
  transition: transform .12s, border-color .18s;
}
.hero-card:active { transform: scale(.985); }
.hero-copy { display: grid; gap: 3px; }
.hero-copy b { font-size: 21px; letter-spacing: -.01em; }
.hero-copy em { font-style: normal; font-size: 13px; color: var(--ink-2); }
.hero-badge {
  margin-left: auto; align-self: flex-start;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px;
  background: var(--brass); color: #2b1d12;
}
.hero-art { flex: 0 0 56px; display: grid; place-items: center; }
.hero-die {
  width: 46px; height: 46px; border-radius: 11px; position: relative;
  background: linear-gradient(150deg, #fffdf6, #e6d9bd);
  box-shadow: 0 4px 12px rgba(0,0,0,.4), inset 0 -3px 6px rgba(0,0,0,.18);
  transform: rotate(-9deg);
}
.hero-die i {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: #2b1d12;
}
.hero-die i:nth-child(1) { top: 8px;  left: 8px; }
.hero-die i:nth-child(2) { top: 8px;  right: 8px; }
.hero-die i:nth-child(3) { top: 50%; left: 50%; transform: translate(-50%,-50%); }
.hero-die i:nth-child(4) { bottom: 8px; left: 8px; }
.hero-die i:nth-child(5) { bottom: 8px; right: 8px; }

/* Four ways to play, in one block. Turn-based was a full-width card of its
   own until the fold was measured: it sat below the fold, which made the
   newest mode the hardest one to find. Two-by-two keeps every way of
   starting a game in a single scannable group and above the fold, which is
   worth more than the prominence a separate card was buying it. */
.mode-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
/* Five tiles in a 2-column grid left the fifth orphaned on its own row at
   full tile height. Nearby spans the row as a slim horizontal strip instead -
   same tap target, ~40px given back, and the grid reads as a closed shape. */
/* The 2x2 lobby grid. Tall cards, icon as the hero of each - the layout
   every casual player already knows how to scan, drawn in teak and brass
   instead of candy. */
.mode-tile.is-big {
  position: relative;
  min-height: 128px; padding: 16px 10px 13px;
  gap: 5px; align-content: center; border-radius: 18px;
}
.mode-tile.is-big .mode-tile-ico { width: 44px; height: 44px; }
.mode-tile.is-big b { font-size: 15.5px; }
.mode-tile.is-big em { font-size: 12px; }
/* The gold card: the primary action wears the primary material. */
.mode-tile.is-gold {
  border-color: var(--brass-lo);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(224, 176, 85, .30), transparent 70%),
    linear-gradient(180deg, #513222, var(--surface-2));
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 234, 180, .3),
    0 -1px 0 rgba(255, 234, 180, .3),
    0 0 18px -6px rgba(255, 190, 92, .4);
}
.mode-tile.is-gold b { color: var(--brass-hi); }
.mode-tile.is-big .hero-badge {
  position: absolute; top: 8px; right: 8px; margin: 0;
}

.mode-row .mode-tile:nth-child(5) {
  grid-column: 1 / -1;
  display: flex; flex-direction: row; justify-content: center; align-items: center;
  gap: 8px; padding: 9px 12px;
}
.mode-row .mode-tile:nth-child(5) .mode-tile-ico { width: 20px; height: 20px; }
.mode-row .mode-tile:nth-child(5) em { margin-left: 2px; }
.mode-tile {
  display: grid; gap: 2px; justify-items: center; align-content: start;
  padding: 8px 8px 7px; cursor: pointer; font: inherit; color: var(--ink);
  border: 1px solid var(--edge); border-radius: 15px;
  background:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--tile) 10%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 240, 214, .12);
  transition: transform .12s, border-color .18s;
  min-height: 72px;
}
.mode-tile:active { transform: scale(.97); }
.mode-tile:hover { border-color: var(--brass-lo); }
/* A colour per way of playing, taken from the four sogtī rather than picked
   fresh - these are the game's own colours, so the menu ends up looking like
   the board it belongs to instead of like a settings screen. Four identical
   brown boxes were also hard to tell apart at a glance; now each tile has a
   constant the eye can learn. Applied as a soft glow behind the icon and on
   the edge, never as a fill - the tiles still have to read as one group. */
.mode-row .mode-tile:nth-child(1) { --tile: var(--brass); }  /* play online - gold */
.mode-row .mode-tile:nth-child(2) { --tile: #4593dc; }   /* bots - blue */
.mode-row .mode-tile:nth-child(3) { --tile: #5cb648; }   /* pass & play - green */
.mode-row .mode-tile:nth-child(4) { --tile: #f2ba22; }   /* turn-based - yellow */
.mode-tile {
  --tile: var(--brass);
  background:
    radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--tile) 16%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
}
.mode-tile:hover, .mode-tile:active { border-color: color-mix(in srgb, var(--tile) 55%, var(--edge)); }
.mode-tile-ico {
  display: block; width: 26px; height: 26px;
  /* SVG line art, not emoji - it takes the tile's own accent colour instead
     of carrying a fixed colour no palette swap could ever touch. */
  color: var(--tile);
  filter: drop-shadow(0 0 9px color-mix(in srgb, var(--tile) 55%, transparent));
}
.mode-tile-ico svg { width: 100%; height: 100%; display: block; }
.mode-tile b { font-size: 13.5px; }
.mode-tile em { font-style: normal; font-size: 12px; color: var(--ink-2); text-align: center; }

.menu-setup { margin-top: 4px; }

.result-friends { display: grid; gap: 8px; margin: 4px 0 14px; }
.result-friends[hidden] { display: none; }
.result-friends .hint { margin: 0 0 2px; }

/* A thumb-sized way out, low on the screen where the thumb already is. */
#btn-cancel-match { min-height: 48px; min-width: 160px; margin-top: 24px; }
#btn-connect-bots { min-height: 48px; min-width: 200px; margin-top: 18px; }
#btn-connect-bots:not([hidden]) + #btn-cancel-match { margin-top: 10px; }
#screen-connect.is-stopped .connect-spinner { visibility: hidden; }

/* The badge is two characters and a dash; it must never wrap. */
.hero-badge { white-space: nowrap; }

/* On the Play tab the logo is an identity mark, not the subject - the modes
   below it are what the screen is for, so it gives up height to them.
   These are the rules that actually apply: the base .brand-mark size loses
   to this block's specificity, so tuning that one alone changes nothing on
   the only screen where it matters. Measured, the whole brand block was 194px
   of a 751px fold - a quarter of the first screen on identity - which is what
   pushed the ways to play off the bottom. */
#screen-menu .brand-mark { width: 84px; height: 84px; margin-bottom: 2px; }
#screen-menu .brand h1 { font-size: 26px; margin: 2px 0 0; }
#screen-menu .brand .deva { font-size: 20px; margin: 0 0 2px; }
/* The tagline is ASO copy; on the home screen it cost a line of height on
   every single visit for a sentence read once. Gone from here, kept in the
   store listing where it does its job. */
#screen-menu .brand .tagline { display: none; }
/* The lockup stands back up, as the wireframe draws it: the board centred
   with the Devanagari beneath. It can afford the height again because the
   wordmark moved into the bar above, so this is the mark and one short line
   rather than the three-storey column that once pushed the modes off screen. */
#screen-menu .brand {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
}
#screen-menu .brand .brand-mark { margin: 0; }
#screen-menu .brand .deva { margin: 6px 0 0; }
#screen-menu .brand { margin-bottom: 6px; }

/* A player with games in progress has already been introduced.
   Identity earns its space on an empty first-run screen, where the app has
   to say what it is. It stops earning it the moment there is a match with a
   clock on it waiting above - at that point the logo is 133px of a 751px
   fold spent telling someone the name of the app they are already inside,
   and it is what pushes the ways to play off the bottom. The name stays, as
   one line, so the screen is never anonymous. */
#screen-menu.has-games .brand-mark,
#screen-menu.has-games .brand .deva,
#screen-menu.has-games .brand .tagline { display: none; }
#screen-menu.has-games .brand h1 { font-size: 21px; margin: 0; }
#screen-menu.has-games .brand { margin-bottom: 2px; }

/* Sits directly under the hero card it configures. */
.table-size { margin: -6px 0 14px; }

/* ─────────────────────────────────────────── colour is not the only cue
   Player identity was carried by hue alone, on a brown board, with red and
   green among the four - the single most common form of colour blindness
   makes exactly that pair indistinguishable. Each colour now also carries a
   fixed shape, so a dot can be told apart with the colour ignored entirely. */
.chip-dot { position: relative; }
/* .friend-dot is deliberately NOT in this rule any more. It never receives a
   .pc-* class - a friend has no player colour - so no shape rule below could
   ever match it, and all it got was an unexplained black square punched into
   every friend's dot. It read as damage and carried no information.
   7px, not 4px: .chip-dot is 15px across (see above), and a 4px mark inside
   it was at the edge of legibility for the players this exists for. */
.chip-dot::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 7px; height: 7px;
  background: rgba(0, 0, 0, .62);
}
/* red = disc · green = triangle · yellow = square · blue = diamond */
.pc-red   .chip-dot::after, .chip-dot.pc-red::after   { border-radius: 50%; }
.pc-green .chip-dot::after, .chip-dot.pc-green::after {
  background: none;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-bottom: 7px solid rgba(0, 0, 0, .62);
  width: 0; height: 0;
}
.pc-yellow .chip-dot::after, .chip-dot.pc-yellow::after { border-radius: 1px; }
.pc-blue  .chip-dot::after, .chip-dot.pc-blue::after   { border-radius: 1px; transform: rotate(45deg); }

/* The same pairing on the colour swatches, so the choice you make in the
   lobby is the mark you will recognise on the board. */
.swatch span { position: relative; }
.swatch span::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 7px; height: 7px; background: rgba(0, 0, 0, .5);
}
.swatch.pc-red span::after { border-radius: 50%; }
.swatch.pc-green span::after {
  background: none; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 8px solid rgba(0, 0, 0, .5);
}
.swatch.pc-yellow span::after { border-radius: 1px; }
.swatch.pc-blue span::after { border-radius: 1px; transform: rotate(45deg); }

/* And, finally, on the pieces - the place the whole idea was for. The chips
   and swatches carried the shapes; the sogtī on the board did not, so the
   board itself was still hue-only. Measured, red #e2503c against green
   #5cb648 is 1.51:1 in luminance: under deuteranopia they are near enough
   the same colour and the same brightness, on a 5x5 board where telling your
   piece from an opponent's is the game.
   Sized in percent of the piece, not px, so it survives the piece shrinking
   to 27% of a cell when five share it. Light rim under a dark mark is what
   makes it read as carved rather than printed. */
.pawn-mark {
  position: absolute; left: 50%; top: 40%;
  width: 30%; height: 30%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .55);
  box-shadow: 0 1px 0 rgba(255, 240, 214, .3);
  pointer-events: none; z-index: 3;
  /* Off unless asked for: on the rendered pieces the mark read as a black
     sticker over the artwork rather than a carving, and most players never
     need it. The Settings toggle (opt-pawn-marks) turns it on for anyone
     who tells colours apart by shape - the feature is a switch now, not a
     default. */
  display: none;
}
body.show-pawn-marks .pawn-mark { display: block; }
/* clip-path rather than the border trick the chips and swatches use: border
   widths cannot be percentages, and these marks must scale with a piece whose
   size changes with how many share its cell. The chip version can stay on
   borders because a chip dot is a fixed 8px. */
.pawn.pc-red .pawn-mark { border-radius: 50%; }
.pawn.pc-green .pawn-mark { clip-path: polygon(50% 4%, 96% 92%, 4% 92%); }
.pawn.pc-yellow .pawn-mark { border-radius: 1px; }
.pawn.pc-blue .pawn-mark { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

/* Pass-and-play identifies whose turn it is with a single coloured circle and
   nothing else - and it is the mode most likely to be played by a family
   across three generations, so it is the worst place to rely on hue. */
.pass-dot { position: relative; }
.pass-dot::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 8px; height: 8px; background: rgba(0, 0, 0, .55);
}
.pass-dot.pc-red::after { border-radius: 50%; }
.pass-dot.pc-green::after {
  background: none; width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 9px solid rgba(0, 0, 0, .55);
}
.pass-dot.pc-yellow::after { border-radius: 1px; }
.pass-dot.pc-blue::after { border-radius: 1px; transform: rotate(45deg); }

/* ─────────────────────────────────────────── league */

/* Turn-based games waiting on the player, above the league card. Built on
   the same card shape as .league-card so the menu reads as one stack rather
   than two visual languages; the only thing that sets a game apart is the
   brass edge when it is actually the player's move. */
/* App-level transient message. Above the tab bar rather than centred, so it
   never sits under a thumb reaching for it, and pointer-events:none so it
   can never swallow a tap meant for what is underneath. */
.toast {
  position: fixed; left: 50%; bottom: calc(max(var(--sab, env(safe-area-inset-bottom, 0px)), 24px) + 48px);
  transform: translateX(-50%);
  z-index: 60; max-width: min(88vw, 380px); box-sizing: border-box;
  padding: 11px 16px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--surface-2);
  box-shadow: var(--shadow-md); color: var(--ink);
  font-size: 13.5px; text-align: center; pointer-events: none;
  animation: toastIn .18s var(--ease-out, ease-out);
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}


/* The friend picker inside the turn-based overlay. Scrolls rather than
   growing, so a player with forty friends still sees the Cancel button. */
.async-friend-list {
  list-style: none; margin: 4px 0 10px; padding: 0;
  max-height: 45vh; overflow-y: auto;
}
.async-friend-list li { margin: 0 0 6px; }
.async-friend-list button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  box-sizing: border-box; min-width: 0;
  padding: 11px 13px; cursor: pointer; font: inherit; color: inherit; text-align: left;
  border: 1px solid var(--edge); border-radius: 13px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.async-friend-list button:active { transform: scale(.985); }
.async-friend-list b {
  font-size: 14.5px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Friends as faces. Scrolls sideways rather than wrapping to a second row:
   the strip must cost the same height whether the player has three friends
   or thirty, or it becomes the next thing pushing the menu off the screen. */
.friends-strip { margin: 0 0 12px; width: 100%; min-width: 0; box-sizing: border-box; }
/* Tighter, so a row of friends reads as one group rather than as separate
   buttons with air between them - and so more of them are visible before any
   scrolling is needed at all. The horizontal scroll is the point: the strip
   must cost the same height whether somebody has three friends or thirty,
   and scroll-snap makes flicking through a long list land on whole faces
   instead of halfway across one. */
.friends-strip-row {
  display: flex; gap: 4px; overflow-x: auto; padding: 2px 2px 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.friends-strip-row > .friend-chip { scroll-snap-align: start; }
.friends-strip-row::-webkit-scrollbar { display: none; }

/* One friend: the face and their name, as a single tappable column. The
   name is under the icon rather than in a tooltip because a row of initials
   is a memory test - "A" is only obvious to someone who already knows which
   friend that is, which is exactly the person who did not need the strip. */
.friend-chip {
  flex: 0 0 auto; width: 62px; display: flex; flex-direction: column;
  align-items: center; gap: 5px; padding: 0; cursor: pointer;
  background: none; border: 0; color: inherit; font: inherit;
  transition: transform .12s var(--ease-out, ease-out);
}
.friend-chip:active { transform: scale(.94); }
/* Two lines, then ellipsis. Wide enough that ordinary names and most
   aliases ("Amit (work)") arrive complete, bounded so that one person with
   a very long name cannot set the height of the whole strip. */
.friend-chip-name {
  width: 100%; font-size: 12px; line-height: 1.25; color: var(--ink-2);
  text-align: center; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.friend-chip .friend-avatar.is-away + .friend-chip-name { color: var(--ink-3); }

/* A colour per person, held constant for that friend, so a row of faces is
   scanned rather than read. It is deliberately applied to the *inside* of the
   circle only: the ring and the dot carry whether someone is free, playing or
   away, and a decorative colour that competed with those would cost more than
   it added. Same four sogtī tones as the tiles. */
/* Lifted a step from the pawn colours towards their highlight tones. The
   sogtī reds and blues are tuned to read as solid objects on a lit board, not
   as text on a dark panel: measured against --surface, the pawn red came out
   at 3.73:1, which fails AA for 18px bold. These clear 4.5:1. */
.friend-avatar { --tone: var(--brass); }
.friend-avatar.tone-0 { --tone: #ff8f7a; }   /* red */
.friend-avatar.tone-1 { --tone: #8fdd7c; }   /* green */
.friend-avatar.tone-2 { --tone: #ffd766; }   /* yellow */
.friend-avatar.tone-3 { --tone: #7fbdf0; }   /* blue */
.friend-avatar .friend-avatar-initial { color: var(--tone); }

.friend-avatar {
  position: relative; flex: 0 0 auto; width: 46px; height: 46px;
  display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid var(--edge);
  background:
    radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--tone) 26%, transparent), transparent 68%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  color: var(--ink); font-size: 18px; font-weight: 700;
  font-family: var(--serif);
  transition: border-color .18s;
}
/* Away is dimmed, so the tone goes quiet with it rather than glowing at
   somebody who is not there. */
.friend-avatar.is-away .friend-avatar-initial { color: var(--ink-2); }
.friend-avatar.lg { width: 54px; height: 54px; font-size: 21px; }

/* The status dot. Three states, and only two of them use a colour - "away"
   is the absence of one, because most of a friends list is usually away and
   colouring all of it would leave nothing standing out. */
.friend-avatar-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--stage-0); background: var(--ink-3);
}
.friend-avatar.is-free { border-color: var(--jade-lo); }
.friend-avatar.is-free .friend-avatar-dot { background: var(--jade); }
/* Vermilion, the same colour a match uses when it is running out of time -
   in both places it means "this one is not simply waiting for you". */
.friend-avatar.is-playing { border-color: var(--vermilion-lo); }
.friend-avatar.is-playing .friend-avatar-dot { background: var(--vermilion); }
.friend-avatar.is-away { opacity: .62; }

.friend-card-head { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 14px; }
.friend-card-head h2 { margin: 0 0 2px; }
.friend-card-head .hint { margin: 0; }

/* A flex item in .menu-wrap's column, so min-width:0 is required: the
   default `auto` refuses to shrink below the widest content inside, which
   let a long opponent name push this section - and with it the whole menu -
   wider than the screen. */
.async-games { margin: 0 0 12px; width: 100%; min-width: 0; box-sizing: border-box; }
.async-games-title {
  margin: 0 0 8px; font-size: 12.5px; font-weight: 700;
  /* Also drawn on the bare stage rather than on a card, so it gets the same
     treatment as .status - one tier up from the quiet text it would otherwise
     share a colour with. */
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2);
}
/* box-sizing and min-width:0 are both load-bearing here, not defensive
   padding: without them a long opponent name or a wide clock makes this row
   wider than the screen and puts a horizontal scrollbar on the whole menu.
   Flex items refuse to shrink below their content by default, so the
   min-width is what actually lets the name truncate instead. */
.async-game {
  display: flex; align-items: center; gap: 12px; width: 100%;
  box-sizing: border-box; min-width: 0;
  margin: 0 0 8px; padding: 12px 15px; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md); color: inherit; font: inherit; text-align: left;
  transition: transform .12s var(--ease-out, ease-out);
}
.async-game:active { transform: scale(.985); }
/* A finished game is a record, not a control: it is rendered as a div rather
   than a button, so it must not keep the affordances of one. */
/* The overflow row. Quieter than a real game - it is a signpost, not a game
   waiting on you - but still a full-width target rather than a text link. */
.async-game.is-more { border-style: dashed; background: none; box-shadow: none; }
.async-game.is-more b { color: var(--ink-2); font-size: 14px; }
.async-game.is-more .async-game-clock { color: var(--brass); font-weight: 700; }

.async-game.is-done { cursor: default; opacity: .82; }
.async-game.is-done:active { transform: none; }

/* The Ongoing / Completed switch sits above the groups it filters. */
#turns-tabs { margin: 2px 0 14px; }
#screen-turns .async-games { margin-bottom: 18px; }
/* Whose move it is, said in colour rather than in more words: a list of
   several games is scanned, not read. Verdigris rather than brass, so "your
   move" is not competing with every other brass thing on the screen - the
   whole point of the second colour. */
.async-game.is-yours {
  border-color: var(--jade-lo);
  background:
    linear-gradient(180deg, var(--jade-dim), transparent 46%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
}
.async-game-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.async-game-copy b {
  font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* --ink-2, not --ink-3: measured, ink-3 on this card is 3.94:1, under the 4.5
   AA floor, and "Waiting for them" is half of what this row says. Its sibling
   "Your turn" is jade at 6.81, so the failing branch was the quiet one. */
.async-game-copy em { font-style: normal; font-size: 12.5px; color: var(--ink-2); }
.async-game.is-yours .async-game-copy em { color: var(--jade); font-weight: 600; }
.async-game-clock {
  flex: 0 0 auto; font-size: 12px; color: var(--ink-3); white-space: nowrap;
}
/* The clock only shouts when it has something to shout about. Below six
   hours a turn-based game is genuinely at risk of expiring unplayed, which
   is the one thing on this screen a player would want to be warned about. */
.async-game-clock.is-urgent { color: var(--vermilion); font-weight: 600; }

.league-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin: 0 0 4px; padding: 10px 15px; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md); color: inherit; font: inherit; text-align: left;
}
.league-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.league-copy b { font-size: 15px; }
.league-copy em { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.league-lp {
  font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--brass);
  flex: 0 0 auto;
}

/* One velvet badge for every division, so the tiers read as a progression
   rather than six unrelated labels: the tier lives in the gold hairline and
   the ink, never the fill. */
.league-badge {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; padding: 6px 10px; border-radius: 999px;
  font-family: "Lora", var(--serif); font-size: 12px; font-weight: 600; letter-spacing: .03em;
  border: 1px solid rgba(216, 177, 105, .55); color: var(--ink);
  background: linear-gradient(180deg, #4a1424, #2a0812);
  box-shadow: inset 0 1px 0 rgba(255, 236, 200, .1), inset 0 -6px 10px rgba(0, 0, 0, .28);
}
.league-badge.lg { font-size: 15px; padding: 9px 16px; min-width: 84px; }
.league-badge[data-div="0"] { border-color: #8a5a3c; color: #d9a988; }
.league-badge[data-div="1"] { border-color: #9a6a36; color: #e2b47e; }
.league-badge[data-div="2"] { border-color: #c0883a; color: #f0c27a; }
.league-badge[data-div="3"] { border-color: #b9c1c7; color: #e4e9ec; }
.league-badge[data-div="4"] { border-color: #d4af37; color: #f5d98a; }
.league-badge[data-div="5"] { border-color: #f3e6c4; color: #fff6e0; }

.league-hero { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.league-hero b { font-family: var(--serif); font-size: 23px; color: var(--brass); }

/* Your own row, so you can find yourself without reading every name. */
#league-table li.is-me { border-color: var(--brass-lo); }
#league-table .league-rank {
  flex: 0 0 auto; min-width: 26px; font-family: var(--serif);
  font-size: 15px; font-weight: 700; color: var(--ink-3);
}
#league-table .league-pts { flex: 0 0 auto; font-weight: 700; color: var(--brass); }

/* ─────────────────────────────────────────── league reward pawns
   Drawn rather than rendered, so no new binary art is needed and they stay
   crisp at any size. Each is a material disc with the player's own colour at
   its centre: the reward is what the piece is made of, but whose piece it is
   must still be readable at a glance from across a 5x5 board. */

.pawn-render.pawn-sandal,
.pawn-render.pawn-silverleaf,
.pawn-render.pawn-ivory,
.pawn-render.pawn-royal {
  /* The six rendered styles set a background-image; these must clear it or
     the old material shows through underneath. */
  background-image: none;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .38), inset 0 2px 3px rgba(255, 255, 255, .3);
}

/* The coloured core, shared by all four. Sized so it reads at board scale
   without swallowing the material around it. */
.pawn-render.pawn-sandal::before,
.pawn-render.pawn-silverleaf::before,
.pawn-render.pawn-ivory::before,
.pawn-render.pawn-royal::before {
  background:
    radial-gradient(circle at 38% 32%, var(--pc-hi), var(--pc) 60%, var(--pc-lo));
  /* Half the piece, not a dot. At board scale a sogtī is a few millimetres
     across, and a small centre disappears into the material - which defeats
     the point, because whose piece it is has to be readable before what it
     is made of. */
  /* .pawn-render::before/::after are set to display:none, because the six
     rendered styles draw everything from their PNG and need no layers. These
     four are drawn instead, so the layers have to be switched back on - a
     rule that sets background and position but not display inherits the
     none and paints nothing, which is exactly what happened. */
  display: block;
  inset: 22%;
  z-index: 2;
  border-radius: 50%;
  /* A dark ring around the core, heavier than it looks necessary. Yellow on
     the gold piece is nearly the same value, and without separation the two
     merge into one pale disc - the reward stops reading as a reward and the
     player stops being able to find their own pieces. */
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .62), inset 0 1px 2px rgba(255, 255, 255, .5);
}

.pawn-render.pawn-sandal {
  background: radial-gradient(circle at 33% 27%, #e8cfa6, #c9a173 55%, #8a6440);
}
.pawn-render.pawn-silverleaf {
  background: radial-gradient(circle at 33% 27%, #ffffff, #ccd3d8 48%, #7c878e);
}
.pawn-render.pawn-ivory {
  background: radial-gradient(circle at 33% 27%, #fffaf0, #f0e4cd 52%, #bda87f);
}
.pawn-render.pawn-royal {
  background: radial-gradient(circle at 33% 27%, #fff6d2, #e8c46a 50%, #9a6f16);
}
/* The top prize catches the light a little harder than the rest. */
.pawn-render.pawn-royal::after {
  display: block;
  background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .75), transparent 46%);
  /* Under the core: this sheen covers the whole disc, so left on top it
     washes the player's colour straight out. */
  z-index: 1;
}

/* Locked entries in the picker: visible, so there is something to want, but
   plainly not yours yet. */
/* Dim the preview, not the copy. The whole card used to fade to 58% and its
   text was --brass-lo on a dark well - 2.16:1 before the fade - so the one
   sentence telling a player how to earn the piece was the least readable
   thing on the screen. The artwork can be dim; the instructions cannot. */
.pawn-card.is-locked .pawn-preview,
.pawn-card.is-locked .pawn-render { opacity: .58; filter: saturate(.6); }
.pawn-card.is-locked em { color: var(--ink-3); }
.pawn-card .lock-note { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ─────────────────────────────────────────── game feel
   The board already reacts - pieces hop, captures knock the board, the tray
   glows on a grace throw. The menu and chrome did not, which is where the
   app-ness was coming from: a game should feel like it is alive before you
   have pressed anything. Everything below is covered by the global
   prefers-reduced-motion block further up. */

/* Things arrive in sequence rather than all at once. The eye is led down the
   screen to the button it is meant to press first. */
.screen.is-active .menu-wrap > * {
  animation: riseIn .42s cubic-bezier(.2, .8, .3, 1) both;
}
.screen.is-active .menu-wrap > *:nth-child(1) { animation-delay: .02s; }
.screen.is-active .menu-wrap > *:nth-child(2) { animation-delay: .07s; }
.screen.is-active .menu-wrap > *:nth-child(3) { animation-delay: .12s; }
.screen.is-active .menu-wrap > *:nth-child(4) { animation-delay: .17s; }
.screen.is-active .menu-wrap > *:nth-child(5) { animation-delay: .22s; }
.screen.is-active .menu-wrap > *:nth-child(6) { animation-delay: .27s; }
.screen.is-active .menu-wrap > *:nth-child(n+7) { animation-delay: .32s; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Cowrie and coin are cream and brass objects, so at the 16-27px the board
   draws them the player's colour was carried only as a faint tint - a yellow
   cowrie on the pale field, inside the amber safe-square glow, was a cream
   blob with no owner. The rims follow the sprite's own alpha, so they read as
   the piece being that colour rather than as a box around it. */
.pawn-render.pawn-cowrie, .pawn-render.pawn-coin {
  filter:
    drop-shadow(0 0 0 var(--pc))
    drop-shadow(0 0 1.5px var(--pc-lo, var(--pc)))
    drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}

/* A slow gleam across brass, like light moving over metal. Long and faint on
   purpose - a shine that reads as "shiny" rather than as a loading bar. */
.hero-card, .league-badge.lg, .league-card { position: relative; overflow: hidden; }
/* `overflow:hidden` sets a flex item's automatic minimum size to 0, so these
   gave up their own height to the tiles above them whenever the menu column
   overflowed - which is every phone. The league card painted as a 22px strip
   with its badge, its sentence and its LP number sliced through the middle.
   Reported independently by the art and accessibility seats. */
.mode-row, .friends-strip, .async-games, .hero-card, .league-card { flex-shrink: 0; }
.hero-card::after, .league-badge.lg::after {
  content: ""; position: absolute; top: -60%; bottom: -60%; left: 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 245, 214, .16), transparent);
  /* Moved with translate rather than `left`. Animating `left` re-runs layout
     every frame, which is a real cost on a cheap phone for something purely
     decorative; a transform is handled by the compositor and costs close to
     nothing. `will-change` is deliberately not set - this runs forever, and
     permanently promoting two layers to save a decoration is a worse trade
     than the animation itself. */
  animation: sheen 5.5s ease-in-out infinite;
  pointer-events: none;
}
.league-badge.lg::after { animation-duration: 4s; }
@keyframes sheen {
  0%        { transform: translateX(-160%) skewX(-18deg); }
  55%, 100% { transform: translateX(320%) skewX(-18deg); }
}

/* The tab you just chose acknowledges the press. */
.tab.is-on .tab-ico { animation: tabPop .34s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes tabPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22) translateY(-2px); }
  100% { transform: scale(1); }
}

/* Cards press in rather than just changing colour. */
.league-card { transition: transform .12s var(--ease-out, ease-out); }
.league-card:active { transform: scale(.985); }
.hero-card { transition: transform .12s ease-out; }
.hero-card:active { transform: scale(.99); }

/* A number that has just gone up says so. */
.league-lp.is-bumped { animation: lpBump .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes lpBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); color: #fff3d0; }
  100% { transform: scale(1); }
}

/* The privacy link at the foot of Settings. Centred and quiet - it has to be
   present and reachable for Play, not prominent. */
.legal-row {
  text-align: center;
  margin: 18px 0 0;
}
.legal-row a { color: var(--brass); text-decoration: none; }
.legal-row a:active { opacity: .7; }

/* The language picker has seven options, which will not sit on one row on a
   360px phone - so this is the one segmented control allowed to wrap. */
.segmented.wrap {
  flex-wrap: wrap;
  gap: 6px;
}
.segmented.wrap .seg { flex: 0 1 auto; padding-inline: 14px; }

/* ─────────────────────────────────────────── live rooms
   The wireframe draws each room as a small board with chairs round it, two
   to a row, rather than a list of sentences - so the table's shape (a duel
   or a four-hander) and who is already sitting read at a glance. */
#rooms-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.room-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 9px; text-align: left; color: inherit; font: inherit;
  border: 1px solid var(--edge); border-radius: 15px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
}
.room-card:active { transform: scale(.985); }
.room-card.is-bot-room { border-style: dashed; }

/* The board: a 2x2 for a four-hander, two stacked chairs for a duel - the
   same geometry the real board has, so the card is a small picture of it. */
.room-board {
  /* Wider than tall on purpose. A square board made each card so tall that
     only two rows of rooms fit on a phone, and a browse list you have to
     scroll to see three rooms is not a browse list. */
  display: grid; gap: 3px; aspect-ratio: 1.5;
  border: 1px solid var(--edge); border-radius: 10px; padding: 3px;
  background: rgba(0, 0, 0, .16);
}
.room-board.is-seats-2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.room-board.is-seats-3,
.room-board.is-seats-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.room-seat {
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; padding: 2px;
  /* 1.4, not 1.1: a name in Devanagari or Kannada hangs its vowel marks
     above and below the Latin box, and 1.1 sliced them off. */
  font-size: 11px; font-weight: 700; line-height: 1.4;
  text-align: center; overflow: hidden;
  /* A name that does not fit is cut, never wrapped to a second line: every
     chair has to stay the same size or the board stops looking like one. */
  white-space: nowrap; text-overflow: ellipsis;
}
.room-seat.is-taken { background: rgba(255, 255, 255, .1); color: var(--ink); }
.room-seat.is-free {
  border: 1px dashed var(--edge); color: var(--ink-3); font-size: 14px;
}

.room-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.room-tag { font-size: 12px; color: var(--ink-2); }
.room-join {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #2b1d12;
  background: linear-gradient(180deg, var(--brass-hi, #e8c877), var(--brass, #c9a227));
}

/* ─────────────────────────────────────────── play with friends
   Share and Enter sit as a pair, the way the wireframe draws them: two
   halves of one question rather than two consecutive steps. */
.code-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.code-pair .code-half { margin: 0; padding: 12px 11px; }
.code-pair .code-half h3 { margin: 0 0 6px; font-size: 15px; }
.code-pair .code-half .hint { margin: 6px 0 8px; font-size: 12px; }
.code-pair .code-half .lobby-code {
  /* Six characters have to sit on one line inside a half-width card. Wrapped,
     a code read aloud from two lines is read wrong. */
  font-size: 17px; letter-spacing: .04em; margin: 0; white-space: nowrap;
}
.code-pair .code-half .code-input { font-size: 17px; letter-spacing: .12em; padding: 10px 8px; }
/* Stacked, not squeezed: two ghost buttons side by side inside a half-width
   card leaves each too narrow to read its own label. */
.code-pair .lobby-share-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
.code-pair .lobby-share-row .btn { padding: 8px 6px; font-size: 12.5px; }

/* ─────────────────────────────────────────── network state
   One banner, one meaning: the network is down (or has just come back).
   It sits directly above the tab bar - never over a topbar, a back button or
   a board - and only on the tab screens; the game, the lobby and the connect
   screen each say it in their own place, next to the control it affects. */
.net-banner {
  position: fixed; left: 0; right: 0; z-index: 46;
  /* --tabbar-h is the bar's measured height, safe-area padding included. */
  bottom: var(--tabbar-h, 72px);
  padding: 6px 16px; font-size: 13px; line-height: 1.35; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #7a4a12; color: var(--ink); border-top: 1px solid var(--brass);
}
.net-banner.is-ok { background: #2f5a24; }
body:not(.has-tabbar) .net-banner { display: none; }
/* Room for it at the end of every scrolling tab, so it never sits on the
   last row, and the toast lifts clear of it. */
body.has-tabbar.is-offline .scroller { padding-bottom: calc(var(--tabbar-h, 72px) + 44px); }
body.has-tabbar.is-offline .menu-wrap { padding-bottom: calc(var(--tabbar-h, 72px) + 44px); }
body.has-tabbar .toast { bottom: calc(var(--tabbar-h, 72px) + 10px); }
body.has-tabbar.is-offline .toast { bottom: calc(var(--tabbar-h, 72px) + 42px); }

/* Online-only controls stay visible - so a player can see what comes back
   with the connection - but dimmed and inert. pointer-events covers rows
   rendered after syncNet() ran, which it cannot `disabled` itself. */
.is-offline [data-online-only] { opacity: .5; pointer-events: none; }
/* The table-size choice only drives Play online, which cannot run now. */
.is-offline .seg-online { display: none; }
/* The gold highlight moves to the mode that works offline. */
.is-offline #btn-play-random { filter: saturate(.4); }
.is-offline #btn-quick-play {
  border-color: var(--brass-lo);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(224, 176, 85, .30), transparent 70%),
    linear-gradient(180deg, #513222, var(--surface-2));
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 234, 180, .3),
    0 -1px 0 rgba(255, 234, 180, .3),
    0 0 18px -6px rgba(255, 190, 92, .4);
}
.is-offline #btn-quick-play b { color: var(--brass-hi); }
/* Live rooms offline: the one way into a game that needs no internet goes
   to the top, above a room list that cannot load. */
.is-offline #screen-rooms .scroller { display: flex; flex-direction: column; }
.is-offline #screen-rooms .rooms-nearby { order: -1; margin-top: 4px; }

/* The friend-code slot while there is no code: a quiet sentence, not a
   brass headline that reads like the code itself. */
.code-pair .code-half .lobby-code.is-pending {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; letter-spacing: normal;
  white-space: normal; color: var(--ink-2); line-height: 1.35; margin: 4px 0;
}

/* In a live game: the strip above the throw, and a table that cannot be
   played while it shows. Same colours as the banner. */
.game-net-strip {
  margin: 0 16px 8px; padding: 6px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.35; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #7a4a12; color: var(--ink); border: 1px solid var(--brass);
}
.game-net-strip.is-ok { background: #2f5a24; }
.is-reconnecting .throw-area,
.throw-area.is-stale { opacity: .5; pointer-events: none; }
.is-reconnecting #screen-game .board { pointer-events: none; }
/* Nothing said while nobody can hear it; nothing started either. */
.is-reconnecting #chat-quick,
.is-reconnecting #chat-form,
.is-reconnecting #btn-lobby-start,
.is-reconnecting #btn-fill-bots { opacity: .5; pointer-events: none; }
#turn-timer.is-paused { opacity: 1; animation: none; }
#turn-timer.is-paused i { background: var(--ink-3); }
#turn-timer.is-paused b { display: none; }
#turn-timer.is-paused::after {
  content: attr(data-paused); font-size: 12px; font-weight: 700; color: var(--ink-2);
}

/* A seat whose phone has dropped: still there, visibly not answering. */
.chip.is-offline { opacity: .55; }
.chip-net {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--ink-2); white-space: nowrap;
}
.chip-net svg { flex: 0 0 auto; }
.seat-left .chip .chip-net, .seat-right .chip .chip-net { font-size: 11px; white-space: normal; text-align: center; }

.btn-async-retry { display: block; margin: 10px auto 0; min-height: 44px; }
#lobby-retry { min-height: 44px; }

/* ─────────────────────────────────────────── focus and touch */
/* Only the tab bar ever drew a focus ring, so a keyboard, D-pad or switch
   user moving through Settings or the result card could not see where they
   were. Brass, offset, and only for keyboard-style focus. */
button:focus-visible,
a:focus-visible,
[role=button]:focus-visible,
.chat-form input:focus-visible,
.code-input:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
/* The checkbox itself is invisible; its switch is what gets the ring. */
.rule-row input:focus-visible + .switch { outline: 2px solid var(--brass); outline-offset: 2px; }
/* The whole label row is the target, so it is the row that must be tall
   enough - the 13px checkbox the scan flagged is not what gets tapped. */
.rule-row.toggle { min-height: 48px; }
/* 37px measured. 48 for both share buttons, with room between them. */
#btn-friend-code-share, #btn-friend-code-whatsapp { min-height: 48px; }
.code-pair .lobby-share-row { gap: 8px; }

/* A full-width grid regardless of what the tiles say, so the offline
   "Needs internet" line does not narrow the whole block. */
.menu-wrap > .mode-row { width: 100%; }

/* Coach tips speak alone - a bot's greeting over the first lesson competes
   with it. */
.coach-open .bubbles { visibility: hidden; }

/* Status lines in an Indic script take the sans stack, whose Noto faces
   carry the matras the serif fallback clips. */
.status:lang(hi), .status:lang(mr), .status:lang(ta), .status:lang(te), .status:lang(kn), .status:lang(gu) {
  font-family: var(--sans);
}
/* Tamil, Telugu and Kannada mode names run long; a step down keeps two
   tiles in a row the same height. */
.mode-tile b:lang(ta), .mode-tile b:lang(te), .mode-tile b:lang(kn) { font-size: 13.5px; }
/* Indic labels run longer and carry matras above and below the line: tab
   labels get a touch more size and room, sub-lines step down. i18n stamps
   lang on each element, so :lang() matches the element itself. */
.tab .tab-label:is(:lang(hi), :lang(mr), :lang(ta), :lang(te), :lang(kn), :lang(gu)) { font-size: 12px; line-height: 1.25; }
.mode-tile em:is(:lang(hi), :lang(mr), :lang(ta), :lang(te), :lang(kn), :lang(gu)),
#screen-menu .mode-tile.is-big em:is(:lang(hi), :lang(mr), :lang(ta), :lang(te), :lang(kn), :lang(gu)) { font-size: 11px; line-height: 1.35; flex-shrink: 0; }
/* Indic headings take the sans stack: the serif fallback clips matras. */
:is(h1, h2, .hw-title):is(:lang(hi), :lang(mr), :lang(ta), :lang(te), :lang(kn), :lang(gu)) { font-family: var(--sans); }

/* ─────────────────────────────────────────── "Big and simple" look preset
   Larger type where it is read mid-game, and a solid X on the safe squares. */
html.big-simple .tab .tab-label { font-size: 15px; line-height: 1.2; }
html.big-simple .chip-body b { font-size: 15px; }
html.big-simple .chip-where, html.big-simple .pips em { font-size: 14px; }
html.big-simple .throw-value { min-width: 56px; height: 56px; font-size: 38px; }
html.big-simple .btn-primary { font-size: 19px; }
html.big-simple .cp-cross .cp-x, html.big-simple .cp-cross .cp-cut { stroke-width: 2.6; opacity: 1; }
html.big-simple .cp-cross .cp-x-hi { display: none; }

/* The Throw glow stays inside the button. At inset:-6px it drew a hard-
   edged box past the button's own corners, visible on every tablet. */
.btn-throw::after { inset: 0; border-radius: 13px; }

/* ─────────────────────────────────────────── height ladder: the menu
   The logo gives way before the ways to play do. */
@media (max-height: 640px) {
  #screen-menu .brand-mark { width: 56px; height: 56px; }
  #screen-menu .brand .deva { font-size: 16px; }
}
@media (max-height: 500px) {
  #screen-menu .brand-mark, #screen-menu .brand .deva { display: none; }
}

/* ─────────────────────────────────────────── narrow: 360 and below */
@media (max-width: 360px) {
  /* One line per label, all five on the same baseline. Two-line labels made
     the bar uneven and taller than the content it was covering. */
  .tab .tab-label {
    font-size: 11px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
  }
  /* Tamil and Telugu labels are the longest; a point smaller lets most of
     them finish before the ellipsis. */
  .tab .tab-label:lang(ta), .tab .tab-label:lang(te) { font-size: 11px; }
  /* 73px measured at 320 - a ninth of an SE's height on navigation. */
  .tab { min-height: 50px; padding: 7px 3px 5px; }
  .tabbar { padding-bottom: max(var(--sab, env(safe-area-inset-bottom, 0px)), 8px); }
}

/* ─────────────────────────────────────────── narrowest: 340 and below */
@media (max-width: 340px) {
  /* At 280px the fourth shell sat under the Throw button. Shrinking the
     shells keeps the board its full height, where stacking the tray would
     have taken the space from it. */
  /* Measured at 280: tray 166px + gap + an 84px button fits the 260px
     between the gutters with nothing tucked under anything. */
  .throw-area { gap: 8px; padding: 0 10px; }
  .throw-area .tray, .tray { padding: 8px; gap: 6px; }
  .shells { gap: 3px; }
  .shell { width: 25px; height: 19px; }
  .throw-value { min-width: 28px; padding: 0 4px; font-size: 20px; }
  .btn-throw { flex: 0 0 auto; min-width: 84px; padding-inline: 12px; white-space: nowrap; }
  .chat-bubble { max-width: min(200px, 60vw); }
  /* The share buttons stop sharing a half-width card with each other. */
  .code-pair { grid-template-columns: 1fr; }
  /* The Tamil sub-line does not fit a 130px tile; the title carries it. */
  .mode-tile.is-big em:lang(ta) { display: none; }
  .result-actions .btn { padding-inline: 16px; }
}

/* ─────────────────────────────────────────── tablet: 600 and wider */
@media (min-width: 600px) {
  /* The menu's blocks share one column and one pair of edges. The grid,
     the league strip and the setup button each used to size themselves, so
     on a 768px tablet their sides did not line up. */
  #screen-menu .mode-row,
  #screen-menu .league-card,
  #screen-menu .menu-setup,
  #screen-menu .async-games,
  #screen-menu .friends-strip { width: 100%; max-width: 600px; margin-inline: auto; }
  /* The table is as wide as its board, so the side seats ride the board's
     own edge instead of the viewport's - Manda was half off a tablet. */
  .table { width: fit-content; max-width: 100%; margin-inline: auto; }
}
@media (min-width: 600px) and (min-height: 900px) {
  /* A tablet has room for a real board. The tray and the clock take the
     board's width, so the three read as one column. */
  :root { --board-w: min(80vw, calc(100dvh - 380px), 640px); }
  .board { width: var(--board-w); }
  .throw-area, #turn-timer { width: var(--board-w); margin-inline: auto; box-sizing: border-box; }
  .throw-area { padding: 0; }
  .throw-area .tray { flex: 1 1 auto; justify-content: center; }
  #turn-timer { padding-inline: 0; }
}

/* ─────────────────────────────────────────── landscape phone
   A 390px-tall screen cannot stack chips, board, status, tray and clock -
   the board shrank to a stamp and Throw fell below the fold. The board takes
   the left and the full height; everything about the turn stacks on the
   right, Throw low under the thumb. Placed after the max-height:760px block
   so its board size wins. */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-game.is-active {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto auto 1fr auto auto auto auto auto auto;
    grid-template-areas:
      "top   top    top    top"
      "board seatl  seatt  seatr"
      "board me     me     me"
      "board .      .      ."
      "board status status status"
      "board strip  strip  strip"
      "board throw  throw  throw"
      "board timer  timer  timer"
      "board logt   logt   logt"
      "board log    log    log";
    column-gap: 16px; align-content: stretch;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  #screen-game .topbar {
    grid-area: top; height: 44px; box-sizing: content-box;
    padding: max(6px, var(--sat, env(safe-area-inset-top, 0px))) 0 6px;
  }
  #screen-game .table { display: contents; }
  #screen-game .board-wrap { grid-area: board; align-self: start; padding: 0; }
  #screen-game .board { width: min(calc(100dvh - 72px), 55vw); }
  #screen-game .seat-top { grid-area: seatt; justify-self: center; }
  #screen-game .seat-left,
  #screen-game .seat-right { position: static; transform: none; justify-self: center; }
  #screen-game .seat-left { grid-area: seatl; }
  #screen-game .seat-right { grid-area: seatr; }
  #screen-game .seat-row-bottom { grid-area: me; margin-top: 6px; }
  #screen-game .status { grid-area: status; margin: 4px 0; }
  #screen-game .game-net-strip { grid-area: strip; margin: 0 0 6px; }
  #screen-game .throw-area { grid-area: throw; padding: 0; }
  #screen-game .btn-async-retry { grid-area: strip; }
  #screen-game .turn-timer { grid-area: timer; margin-top: 6px; }
  #screen-game .log { grid-area: log; }

  /* The coach card is wide and short here, and still scrolls if it must,
     so "Got it" is never below the fold. */
  .coach-card { width: min(560px, 70vw); max-height: calc(100dvh - 24px); }
  .coach-text { font-size: 13px; }

  /* Tab bar: icon beside label, one short row. */
  .tabbar { min-height: 48px; padding-bottom: max(var(--sab, env(safe-area-inset-bottom, 0px)), 4px); }
  .tabbar .tab { flex-direction: row; gap: 6px; padding: 6px; min-height: 44px; }
}

/* ─────────────────────────────────────────── short phones: every way to play on one screen
   The menu must not scroll (a hard rule for this app), yet at 360x640 the
   Nearby tile sat under the tab bar and at 320x568 three tiles did. Measured
   against the tab bar, not guessed: the logo and the Devanagari give way
   first, then the tiles go from tall cards to compact rows of icon + label,
   so all five fit down to 280px wide / 568px tall. */
@media (max-height: 800px) {
  #screen-menu .brand-mark { display: none; }
  #screen-menu .brand { margin-bottom: 0; }
  #screen-menu .brand .deva { margin: 0; font-size: 15px; }
  #screen-menu .table-size-caption { margin: 0 0 2px; }
  #screen-menu .table-size { margin: 0 0 8px; }
  .mode-row { gap: 8px; }
  .mode-tile.is-big { min-height: 0; padding: 10px 8px; }
  .mode-tile.is-big .mode-tile-ico { width: 32px; height: 32px; }
  .mode-tile.is-big em { display: none; }
}
@media (max-height: 640px) {
  #screen-menu .brand .deva { display: none; }
  .mode-tile, .mode-tile.is-big { min-height: 0; padding: 7px 6px; gap: 0; }
  .mode-tile.is-big .mode-tile-ico, .mode-tile-ico { width: 24px; height: 24px; }
  .mode-tile.is-big .hero-badge { top: 4px; right: 4px; }
}

/* First-run language card on short phones: the "pick at least one" warning
   pushed Start playing below the card at 320x568 - the very first screen a
   new player sees. Tighter spacing keeps Start in view, and the card scrolls
   as a last resort rather than clipping it. */
.pass-card { max-height: calc(100dvh - 24px); overflow-y: auto; }
@media (max-height: 640px), (max-width: 300px) {
  #lang-ask .pass-card { padding-left: 16px; padding-right: 16px; }
  #lang-ask .pass-card { padding-top: 18px; padding-bottom: 14px; }
  #lang-ask .pass-card h2 { font-size: 20px; margin-bottom: 4px; }
  #lang-ask .pass-card .hint { margin: 4px 0; font-size: 13px; }
  #lang-ask .pass-card .segmented { margin: 4px 0; }
}

/* ─────────────────────────────────────────── play with a friend (home)
   First thing under the table size: the two actions players could not find.
   Big, labelled, and in the brass of the primary action so they read as
   buttons, not decoration. */
.friend-play { width: 100%; margin: 0 0 10px; }
.friend-play-title {
  display: block; margin: 0 0 6px; text-align: center;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.friend-play-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.friend-play-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 8px; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 15px; color: var(--ink);
  border: 1px solid var(--brass-lo);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 240, 214, .14);
}
.friend-play-btn.is-invite {
  color: #2b1a0a; border-color: var(--brass-hi);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
}
.friend-play-btn:active { transform: scale(.97); }
.friend-play-btn svg { flex: none; }
.friend-play-btn:disabled { opacity: .5; }
.code-input-big { font-size: 28px; letter-spacing: .3em; text-align: center; }
@media (max-height: 640px) {
  .friend-play { margin-bottom: 6px; }
  .friend-play-title { display: none; }
  .friend-play-btn { min-height: 44px; padding: 8px 6px; font-size: 14px; }
}

/* ─────────────────────────────────────────── chat stays off the board
   A line that had no room off the board becomes a count on the chat button
   and a pulse on the speaker's seat, instead of a bubble over the cells. */
.chat-open { position: relative; }
.chat-open[data-unread]::after {
  content: attr(data-unread); position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  background: var(--brass-hi); color: #2b1a0a; box-shadow: 0 0 0 2px var(--surface);
}
.has-msg { animation: seatPing 1.5s ease-out; }
@keyframes seatPing {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass-hi) 70%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
.chat-bubble { max-width: min(200px, 58vw); font-size: 13px; }
#opt-chat-bubbles { margin: 0 0 12px; }
@media (prefers-reduced-motion: reduce) { .has-msg { animation: none; } }

.btn-watch-ad.is-loading { opacity: .6; }
#result-loan-btn { border-style: solid; border-color: var(--brass-lo); color: var(--ink-2); }

/* ─────────────────────────────────────────── shop boards
   The inlay metal and, on dark fields, a light engraving instead of a dark one.
   The palettes themselves live in js/decor.js (SKINS). */
.cp-theme-marble .cp-metal, .cp-theme-marble .cp-ornament .cp-metal { stroke: url(#cp-metal-marble); }
.cp-theme-terracotta .cp-metal { stroke: url(#cp-metal-terracotta); }
.cp-theme-jade .cp-metal { stroke: url(#cp-metal-jade); }
.cp-theme-midnight .cp-metal { stroke: url(#cp-metal-midnight); }
.cp-theme-rangoli .cp-metal { stroke: url(#cp-metal-rangoli); }
.cp-theme-velvet .cp-metal { stroke: url(#cp-metal-velvet); }

/* Heritage boards: the inlay metal of each (palettes in js/decor.js). */
.cp-theme-bagh .cp-metal { stroke: url(#cp-metal-bagh); }
.cp-theme-pirate .cp-metal { stroke: url(#cp-metal-pirate); }
.cp-theme-pari .cp-metal { stroke: url(#cp-metal-pari); }
.cp-theme-pichwai .cp-metal { stroke: url(#cp-metal-pichwai); }
.cp-theme-khatam .cp-metal { stroke: url(#cp-metal-khatam); }
.cp-theme-marble .cp-cut { stroke: #4b5058; opacity: .85; }
.cp-theme-marble .cp-hi { stroke: #fff; opacity: .7; }
.cp-theme-terracotta .cp-cut { stroke: #4a2012; }
.cp-theme-terracotta .cp-hi { stroke: #ffd8b0; opacity: .45; }
.cp-dark .cp-cut { stroke: #f1ece0; opacity: .88; }
.cp-dark .cp-hi { stroke: rgba(0, 0, 0, .55); opacity: .35; }
.cp-dark .cp-ornament .cp-cut { opacity: .5; }
.cp-dark .cp-ghar-motif .cp-cut { opacity: .55; }
.cp-theme-midnight .cp-cut { stroke: #d6e0f8; }
.cp-theme-jade .cp-cut { stroke: #dff7ea; }
.cp-theme-rangoli .cp-cut { stroke: #ffe6c0; }
.cp-theme-velvet .cp-cut { stroke: #ecdcff; }
.cp-dark .cp-seat.tint-red    { fill: rgba(230, 90, 74, .5); }
.cp-dark .cp-seat.tint-green  { fill: rgba(100, 200, 100, .45); }
.cp-dark .cp-seat.tint-yellow { fill: rgba(248, 206, 76, .48); }
.cp-dark .cp-seat.tint-blue   { fill: rgba(96, 164, 232, .48); }

/* ─────────────────────────────────────────── shop sogtī
   Drawn like the league pieces: a material disc with the player's colour as
   the core, so whose piece it is stays readable before what it is made of. */
.pawn-render.pawn-ruby, .pawn-render.pawn-emerald, .pawn-render.pawn-sapphire,
.pawn-render.pawn-pearl, .pawn-render.pawn-obsidian, .pawn-render.pawn-rosegold,
.pawn-render.pawn-amethyst {
  background-image: none;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255, 255, 255, .32);
}
.pawn-render.pawn-ruby::before, .pawn-render.pawn-emerald::before, .pawn-render.pawn-sapphire::before,
.pawn-render.pawn-pearl::before, .pawn-render.pawn-obsidian::before, .pawn-render.pawn-rosegold::before,
.pawn-render.pawn-amethyst::before {
  background: radial-gradient(circle at 38% 32%, var(--pc-hi), var(--pc) 60%, var(--pc-lo));
  display: block; inset: 22%; z-index: 2; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .62), inset 0 1px 2px rgba(255, 255, 255, .5);
}
/* Gems: facets as a conic wheel under a soft highlight. */
.pawn-render.pawn-ruby {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .75), transparent 30%),
    conic-gradient(from 25deg, #ff6a7c, #b3102c, #ff4a62, #8a0a20, #ff6a7c);
}
.pawn-render.pawn-emerald {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .7), transparent 30%),
    conic-gradient(from 25deg, #5be08a, #0d7a3c, #3cc96f, #095c2c, #5be08a);
}
.pawn-render.pawn-sapphire {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .7), transparent 30%),
    conic-gradient(from 25deg, #6aa2ff, #1740b0, #4a82f0, #0f2c82, #6aa2ff);
}
.pawn-render.pawn-amethyst {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .7), transparent 30%),
    conic-gradient(from 25deg, #c58bff, #6a2bb8, #a866f0, #4c1c8a, #c58bff);
}
.pawn-render.pawn-pearl {
  background:
    radial-gradient(circle at 32% 26%, #ffffff, #f7e6ee 38%, #dcc0cf 70%, #a98b9c),
    linear-gradient(135deg, rgba(255, 190, 220, .25), rgba(170, 220, 255, .2));
}
.pawn-render.pawn-obsidian {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .55), transparent 26%),
    radial-gradient(circle at 40% 40%, #5b5e6b, #1a1b22 58%, #040406);
}
.pawn-render.pawn-rosegold {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .6), transparent 32%),
    radial-gradient(circle at 36% 30%, #ffe4d8, #eaa994 52%, #a65f58);
}
.pawn-card .shop-note { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }


/* ───────────────────────────────────────────── Shop */
.coin-dot {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff1b8, #e0b055 55%, #8f5f12);
  box-shadow: 0 0 0 1.5px #7d5413 inset, 0 1px 2px rgba(0, 0, 0, .4);
}
.shop-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: min(360px, 100%); min-height: 40px; margin: 2px auto 6px; padding: 6px 16px;
  border: 1px solid var(--edge); border-radius: 999px; color: var(--ink); font: inherit;
  background: linear-gradient(180deg, rgba(224, 176, 85, .22), rgba(224, 176, 85, .08));
  cursor: pointer;
}
.shop-bar[hidden] { display: none; }
.shop-bar:active { transform: scale(.98); }
.shop-bar b { font-variant-numeric: tabular-nums; }
.shop-bar-label { font-size: 13px; color: var(--ink-2); }
.shop-bar-new {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: var(--brass); color: #2a1206;
}

.shop-overlay { place-items: stretch center; padding: 0; }
.shop-sheet {
  display: flex; flex-direction: column; width: min(480px, 100%); min-height: 100dvh;
  padding: 14px 14px calc(18px + var(--sab, env(safe-area-inset-bottom, 0px)));
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
/* The shop as a page: header, tab chips, then a scrolling body above the tab bar. */
#screen-shop .shop-tabs { margin: 0 auto 10px; padding: 0 16px; width: 100%; max-width: 640px; box-sizing: border-box; flex: none; }
#screen-shop .shop-body { padding-top: 2px; }
#screen-shop .shop-foot { margin: 6px 16px calc(var(--tabbar-h, 72px) + 6px); }
body.has-tabbar #screen-shop .shop-body { padding-bottom: 12px; }
.shop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.shop-head h2 { margin: 0; flex: 1; font-size: 22px; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--well); font-variant-numeric: tabular-nums;
}
.shop-close {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge-soft);
  background: var(--well); color: var(--ink); font-size: 16px; cursor: pointer;
}
.shop-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.shop-tab {
  flex: 1; min-height: 40px; padding: 6px 4px; border-radius: 10px; font: inherit; font-size: 13.5px;
  font-weight: 700; color: var(--ink-2); border: 1px solid var(--edge-soft); background: var(--well); cursor: pointer;
}
.shop-tab[hidden] { display: none; }
.shop-tab.is-on { color: #2a1206; background: var(--brass); border-color: var(--brass-hi); }
.shop-body { flex: 1; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shop-card {
  display: flex; flex-direction: column; gap: 6px; padding: 10px; min-width: 0;
  border: 1px solid var(--edge-soft); border-radius: 14px; background: var(--well);
}
.shop-card.is-on { border-color: var(--brass); }
.shop-card h3 { margin: 0; font-size: 14px; }
.shop-card p { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.35; min-height: 2.7em; }
.shop-thumb { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.shop-thumb svg { display: block; width: 100%; height: 100%; }
.shop-thumb.is-pawn { display: grid; place-items: center; background: rgba(0, 0, 0, .25); }
.shop-thumb.is-pawn .pawn-preview { transform: scale(1.5); }
.shop-btn {
  min-height: 40px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
  border: 1px solid var(--brass-lo); color: #2a1206;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.shop-btn:disabled { opacity: .55; cursor: default; }
.shop-btn.is-quiet { color: var(--ink); background: transparent; border-color: var(--edge); }
.shop-btn.is-owned { color: var(--ink-2); background: transparent; border-color: var(--edge-soft); }
.shop-btn.is-cash { background: linear-gradient(180deg, #b7f0c8, #5fbf80); border-color: #2f7a4a; }
.shop-section-title { margin: 14px 2px 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.shop-section-title:first-child { margin-top: 0; }
.shop-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--edge-soft); border-radius: 14px; background: var(--well);
}
.shop-row-main { flex: 1; min-width: 0; }
.shop-row-main b { display: block; font-size: 14px; }
.shop-row-main span { font-size: 12px; color: var(--ink-3); }
.shop-row .shop-btn { min-width: 96px; padding: 0 12px; }
.shop-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px;
  font-weight: 800; background: var(--brass); color: #2a1206; vertical-align: 1px;
}
.shop-pack-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.shop-pack-thumbs .shop-thumb { width: 56px; flex: none; }
.shop-sheet { min-width: 0; overflow-x: hidden; }
.shop-card { max-width: 100%; box-sizing: border-box; }
.shop-foot { margin: 14px 2px 0; text-align: center; font-size: 12px; }
@media (max-width: 300px) { .shop-grid { grid-template-columns: 1fr; } }

.theme-card.is-locked { opacity: .6; }
.theme-card .lock-note { display: block; font-size: 11px; color: var(--ink-3); }

.home-chips { display: flex; gap: 8px; width: min(360px, 100%); margin: 2px auto 6px; }
.home-chips .shop-bar { flex: 1; width: auto; margin: 0; padding: 6px 12px; }
.chip-league {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--ink); border: 1px solid var(--edge); cursor: pointer;
  background: linear-gradient(180deg, rgba(224, 176, 85, .22), rgba(224, 176, 85, .08));
}
.chip-league:active { transform: scale(.97); }
.chip-league svg { color: var(--brass); }

/* ─────────────────────────────────────────── premium sogtī
   Art-directed medallion faces. The player's colour stays as the core so a
   piece is still readable at a glance; the face is the premium part. */
.pawn-render.pawn-maharaja, .pawn-render.pawn-mor, .pawn-render.pawn-nakshatra, .pawn-render.pawn-gulabi {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 0 0 1.5px #f3cf72, 0 0 0 2.5px rgba(60, 30, 4, .7), inset 0 -2px 4px rgba(0, 0, 0, .35), inset 0 2px 3px rgba(255, 255, 255, .3);
}
.pawn-render.pawn-maharaja::before, .pawn-render.pawn-mor::before, .pawn-render.pawn-nakshatra::before, .pawn-render.pawn-gulabi::before {
  /* The centre is a generated jewel in the player's colour, so whose piece it
     is stays readable while the face around it is the premium part. */
  background: center / cover no-repeat;
  display: block; inset: 24%; z-index: 2; border-radius: 50%;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .6));
}
.pawn-render.pawn-maharaja.pc-red::before, .pawn-render.pawn-mor.pc-red::before, .pawn-render.pawn-nakshatra.pc-red::before, .pawn-render.pawn-gulabi.pc-red::before { background-image: url("../img/pawns/premium-core-red.webp"); }
.pawn-render.pawn-maharaja.pc-green::before, .pawn-render.pawn-mor.pc-green::before, .pawn-render.pawn-nakshatra.pc-green::before, .pawn-render.pawn-gulabi.pc-green::before { background-image: url("../img/pawns/premium-core-green.webp"); }
.pawn-render.pawn-maharaja.pc-yellow::before, .pawn-render.pawn-mor.pc-yellow::before, .pawn-render.pawn-nakshatra.pc-yellow::before, .pawn-render.pawn-gulabi.pc-yellow::before { background-image: url("../img/pawns/premium-core-yellow.webp"); }
.pawn-render.pawn-maharaja.pc-blue::before, .pawn-render.pawn-mor.pc-blue::before, .pawn-render.pawn-nakshatra.pc-blue::before, .pawn-render.pawn-gulabi.pc-blue::before { background-image: url("../img/pawns/premium-core-blue.webp"); }
.pawn-render.pawn-maharaja { background-image: url("../img/pawns/premium-maharaja.webp"); }
.pawn-render.pawn-mor { background-image: url("../img/pawns/premium-mor.webp"); }
.pawn-render.pawn-nakshatra { background-image: url("../img/pawns/premium-nakshatra.webp"); }
.pawn-render.pawn-gulabi { background-image: url("../img/pawns/princess-gulabi.webp"); }
.shop-card.is-premium { border-color: #f3cf72; background: linear-gradient(180deg, rgba(243, 207, 114, .12), rgba(0, 0, 0, .38)); }
.shop-card.is-premium h3::after {
  content: 'Premium'; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; background: #f3cf72; color: #2a1206; vertical-align: 1px;
}

.cp-theme-court .cp-metal { stroke: url(#cp-metal-court); }
.cp-theme-mahal .cp-metal { stroke: url(#cp-metal-mahal); }
.cp-theme-sky .cp-metal { stroke: url(#cp-metal-sky); }
.cp-theme-court .cp-cut { stroke: #ffe9b8; }
.cp-theme-mahal .cp-cut { stroke: #e8fff6; }
.cp-theme-sky .cp-cut { stroke: #eef2ff; }

/* ───────────────────────────────────────────── How to play */
.chip-help {
  flex: none; width: 40px; min-height: 40px; border-radius: 50%; font: inherit; font-size: 18px; font-weight: 800;
  color: var(--brass); border: 1px solid var(--edge); background: rgba(224, 176, 85, .1); cursor: pointer;
}
.chip-help:active { transform: scale(.94); }
.settings-howto { margin: 0 0 10px; }
.hw-card { padding: 22px 22px 20px; text-align: left; }
.hw-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.hw-step { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.hw-skip { background: none; border: 0; color: var(--ink-2); font: inherit; font-size: 13px; padding: 8px 4px; cursor: pointer; }
.hw-title { margin: 0 0 12px; font-size: 22px; }
.hw-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.hw-body b { color: var(--ink); }
.hw-art { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 14px; min-height: 64px; }
.hw-sogti { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .55);
  background: radial-gradient(circle at 35% 30%, var(--pc-hi), var(--pc) 60%, var(--pc-lo)); box-shadow: inset 0 -2px 3px rgba(0,0,0,.3); }
.hw-table { display: grid; gap: 8px; margin: 2px 0 14px; }
.hw-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--well); }
.hw-row b { font-size: 20px; min-width: 22px; }
.hw-eq { color: var(--ink-3); }
.hw-tag { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--brass); color: #2a1206; }
.hw-shells { display: inline-flex; gap: 6px; }
.hw-shell { width: 22px; height: 14px; border-radius: 50%; background: #4a2a16; border: 1px solid rgba(255, 220, 160, .25); }
.hw-shell.is-up { background: radial-gradient(ellipse at 40% 35%, #fff8e6, #e8d3a4); border-color: #b99a62; }
.hw-grace b { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; font-size: 26px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: #2a1206; border: 1px solid var(--brass-lo); }
.hw-x { position: relative; display: block; width: 64px; height: 64px; border-radius: 8px; background: rgba(0, 0, 0, .3); border: 2px solid var(--brass); }
.hw-x::before, .hw-x::after { content: ''; position: absolute; left: 50%; top: -6%; width: 3px; height: 112%; background: var(--brass); transform-origin: center; }
.hw-x::before { transform: translateX(-50%) rotate(45deg); }
.hw-x::after { transform: translateX(-50%) rotate(-45deg); }
.hw-spiral { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 7px, rgba(224, 176, 85, .7) 7px 9px); }
.hw-ways b { font-size: 34px; }
.hw-ways img { width: 40px; height: 40px; object-fit: contain; }
.hw-dots { display: flex; justify-content: center; gap: 7px; margin: 12px 0; }
.hw-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .22); }
.hw-dots i.is-on { background: var(--brass); width: 18px; border-radius: 4px; }
.hw-nav { display: flex; gap: 10px; }
.hw-nav .btn { flex: 1; }
.hw-nav .btn-ghost[hidden] { display: none; }
.hw-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--ink-2); font-size: 15px; cursor: pointer; }
.hw-body { min-height: 300px; }
.hw-nav .btn { white-space: nowrap; padding-left: 10px; padding-right: 10px; font-size: 16px; }

/* ───────────────────────────────────────────── chat stickers */
.chat-stickers { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; width: 100%; max-width: 560px; margin-inline: auto; scrollbar-width: none; }
.chat-stickers::-webkit-scrollbar { display: none; }
.chat-stickers[hidden] { display: none; }
.sticker-btn { position: relative; flex: none; width: 58px; height: 58px; padding: 3px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--edge-soft); background: var(--well); }
.sticker-btn:active { transform: scale(.94); }
.sticker-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sticker-btn.is-locked img { filter: grayscale(.55) brightness(.75); }
.sticker-lock { position: absolute; right: 2px; bottom: 0; font-size: 13px; }
.chat-sticker { display: block; width: 84px; height: 84px; object-fit: contain; }
.chat-bubble.is-sticker { padding: 4px 8px 6px; background: rgba(40, 14, 12, .82); }
.chat-bubble.is-sticker .bubble-who { display: block; margin-bottom: 2px; }
.chat-line.is-sticker .chat-sticker { width: 72px; height: 72px; margin-top: 3px; }
.shop-thumb.is-sticker { display: grid; place-items: center; background: rgba(0, 0, 0, .25); padding: 6px; }
.shop-thumb.is-sticker img { width: 100%; height: 100%; object-fit: contain; }

.chat-bubble.is-sticker .chat-sticker { width: 52px; height: 52px; }
.chat-bubble.is-sticker { padding: 3px 8px 4px; }

.sticker-pop { position: fixed; z-index: 60; display: grid; justify-items: center; gap: 2px; padding: 4px 8px 5px; border-radius: 16px;
  pointer-events: none; background: rgba(30, 10, 8, .72); box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  animation: stickerPop .35s cubic-bezier(.2, 1.4, .4, 1) both; transition: opacity .35s ease, transform .35s ease; }
.sticker-pop .chat-sticker { width: 96px; height: 96px; }
.sticker-pop span { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.sticker-pop.is-out { opacity: 0; transform: translateY(-6px) scale(.96); }
@keyframes stickerPop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sticker-pop { animation: none; } }

/* Large screens: the home column is 600px wide (the mode grid and league card),
   so the friend buttons and the chip row line up with it instead of stretching
   across a tablet or a desktop window. */
@media (min-width: 640px) {
  .friend-play { max-width: 600px; margin-inline: auto; }
  .home-chips { width: 600px; max-width: 100%; }
}

/* ─────────────────────────────────────────── Sogat bundles: 32 sogtī rendered as 3D pieces (8 packs of 4).
   The object itself is the piece, filling its square: no base, no coloured rim or glow, only a soft shadow. */
.pawn-render.pawn-sg_besan, .pawn-render.pawn-sg_tilgud, .pawn-render.pawn-sg_motichoor, .pawn-render.pawn-sg_kaju, .pawn-render.pawn-sg_modak, .pawn-render.pawn-sg_hathi, .pawn-render.pawn-sg_kalash, .pawn-render.pawn-sg_sikka, .pawn-render.pawn-sg_matka, .pawn-render.pawn-sg_lattu, .pawn-render.pawn-sg_diyal, .pawn-render.pawn-sg_ghungroo, .pawn-render.pawn-sg_donut, .pawn-render.pawn-sg_cupc, .pawn-render.pawn-sg_truffle, .pawn-render.pawn-sg_macaron, .pawn-render.pawn-sg_dog, .pawn-render.pawn-sg_cat, .pawn-render.pawn-sg_rabbit, .pawn-render.pawn-sg_panda, .pawn-render.pawn-sg_tiger, .pawn-render.pawn-sg_elephant, .pawn-render.pawn-sg_peacockb, .pawn-render.pawn-sg_monkey, .pawn-render.pawn-sg_cow, .pawn-render.pawn-sg_goat, .pawn-render.pawn-sg_sheep, .pawn-render.pawn-sg_horse, .pawn-render.pawn-sg_lion, .pawn-render.pawn-sg_fox, .pawn-render.pawn-sg_bear, .pawn-render.pawn-sg_deer {
  background-size: contain; background-position: center; background-repeat: no-repeat; box-shadow: none;
  filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .5));
}
.pawn-render.pawn-sg_besan { background-image: url("../img/pawns/sogat/sg_besan.webp"); }
.pawn-render.pawn-sg_tilgud { background-image: url("../img/pawns/sogat/sg_tilgud.webp"); }
.pawn-render.pawn-sg_motichoor { background-image: url("../img/pawns/sogat/sg_motichoor.webp"); }
.pawn-render.pawn-sg_kaju { background-image: url("../img/pawns/sogat/sg_kaju.webp"); }
.pawn-render.pawn-sg_modak { background-image: url("../img/pawns/sogat/sg_modak.webp"); }
.pawn-render.pawn-sg_hathi { background-image: url("../img/pawns/sogat/sg_hathi.webp"); }
.pawn-render.pawn-sg_kalash { background-image: url("../img/pawns/sogat/sg_kalash.webp"); }
.pawn-render.pawn-sg_sikka { background-image: url("../img/pawns/sogat/sg_sikka.webp"); }
.pawn-render.pawn-sg_matka { background-image: url("../img/pawns/sogat/sg_matka.webp"); }
.pawn-render.pawn-sg_lattu { background-image: url("../img/pawns/sogat/sg_lattu.webp"); }
.pawn-render.pawn-sg_diyal { background-image: url("../img/pawns/sogat/sg_diyal.webp"); }
.pawn-render.pawn-sg_ghungroo { background-image: url("../img/pawns/sogat/sg_ghungroo.webp"); }
.pawn-render.pawn-sg_donut { background-image: url("../img/pawns/sogat/sg_donut.webp"); }
.pawn-render.pawn-sg_cupc { background-image: url("../img/pawns/sogat/sg_cupc.webp"); }
.pawn-render.pawn-sg_truffle { background-image: url("../img/pawns/sogat/sg_truffle.webp"); }
.pawn-render.pawn-sg_macaron { background-image: url("../img/pawns/sogat/sg_macaron.webp"); }
.pawn-render.pawn-sg_dog { background-image: url("../img/pawns/sogat/sg_dog.webp"); }
.pawn-render.pawn-sg_cat { background-image: url("../img/pawns/sogat/sg_cat.webp"); }
.pawn-render.pawn-sg_rabbit { background-image: url("../img/pawns/sogat/sg_rabbit.webp"); }
.pawn-render.pawn-sg_panda { background-image: url("../img/pawns/sogat/sg_panda.webp"); }
.pawn-render.pawn-sg_tiger { background-image: url("../img/pawns/sogat/sg_tiger.webp"); }
.pawn-render.pawn-sg_elephant { background-image: url("../img/pawns/sogat/sg_elephant.webp"); }
.pawn-render.pawn-sg_peacockb { background-image: url("../img/pawns/sogat/sg_peacockb.webp"); }
.pawn-render.pawn-sg_monkey { background-image: url("../img/pawns/sogat/sg_monkey.webp"); }
.pawn-render.pawn-sg_cow { background-image: url("../img/pawns/sogat/sg_cow.webp"); }
.pawn-render.pawn-sg_goat { background-image: url("../img/pawns/sogat/sg_goat.webp"); }
.pawn-render.pawn-sg_sheep { background-image: url("../img/pawns/sogat/sg_sheep.webp"); }
.pawn-render.pawn-sg_horse { background-image: url("../img/pawns/sogat/sg_horse.webp"); }
.pawn-render.pawn-sg_lion { background-image: url("../img/pawns/sogat/sg_lion.webp"); }
.pawn-render.pawn-sg_fox { background-image: url("../img/pawns/sogat/sg_fox.webp"); }
.pawn-render.pawn-sg_bear { background-image: url("../img/pawns/sogat/sg_bear.webp"); }
.pawn-render.pawn-sg_deer { background-image: url("../img/pawns/sogat/sg_deer.webp"); }

/* ───────────────────────────────────────────── Diwali sogtī and boards */
.pawn-render.pawn-diya, .pawn-render.pawn-genda, .pawn-render.pawn-sparkler, .pawn-render.pawn-mandala {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 0 0 1.5px #f3cf72, 0 0 0 2.5px rgba(60, 30, 4, .7), inset 0 -2px 4px rgba(0, 0, 0, .35), inset 0 2px 3px rgba(255, 255, 255, .25);
}
.pawn-render.pawn-diya::before, .pawn-render.pawn-genda::before, .pawn-render.pawn-sparkler::before, .pawn-render.pawn-mandala::before {
  display: block; inset: 24%; z-index: 2; border-radius: 50%; background: center / cover no-repeat;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .6));
}
.pawn-render.pawn-diya { background-image: url("../img/pawns/diwali-diya.webp"); }
.pawn-render.pawn-genda { background-image: url("../img/pawns/diwali-genda.webp"); }
.pawn-render.pawn-sparkler { background-image: url("../img/pawns/diwali-sparkler.webp"); }
.pawn-render.pawn-mandala { background-image: url("../img/pawns/diwali-mandala.webp"); }
.pawn-render.pawn-diya.pc-red::before, .pawn-render.pawn-genda.pc-red::before, .pawn-render.pawn-sparkler.pc-red::before, .pawn-render.pawn-mandala.pc-red::before { background-image: url("../img/pawns/premium-core-red.webp"); }
.pawn-render.pawn-diya.pc-green::before, .pawn-render.pawn-genda.pc-green::before, .pawn-render.pawn-sparkler.pc-green::before, .pawn-render.pawn-mandala.pc-green::before { background-image: url("../img/pawns/premium-core-green.webp"); }
.pawn-render.pawn-diya.pc-yellow::before, .pawn-render.pawn-genda.pc-yellow::before, .pawn-render.pawn-sparkler.pc-yellow::before, .pawn-render.pawn-mandala.pc-yellow::before { background-image: url("../img/pawns/premium-core-yellow.webp"); }
.pawn-render.pawn-diya.pc-blue::before, .pawn-render.pawn-genda.pc-blue::before, .pawn-render.pawn-sparkler.pc-blue::before, .pawn-render.pawn-mandala.pc-blue::before { background-image: url("../img/pawns/premium-core-blue.webp"); }
.cp-theme-deepmala .cp-metal { stroke: url(#cp-metal-deepmala); }
.cp-theme-laxmi .cp-metal { stroke: url(#cp-metal-laxmi); }
.cp-theme-deepmala .cp-cut { stroke: #ffe9b8; }
.cp-theme-laxmi .cp-cut { stroke: #ffeec2; }

/* ───────────────────────────────────────────── event sale */
.shop-bar.is-event { border-color: #f0a030; background: linear-gradient(180deg, rgba(240, 160, 48, .34), rgba(200, 80, 20, .16)); }
.shop-bar.is-event .shop-bar-label { color: #ffd9a0; font-weight: 700; }
.shop-card.is-event { border-color: #f0a030; background: linear-gradient(180deg, rgba(240, 160, 48, .14), rgba(0, 0, 0, .38)); }
.shop-ribbon { align-self: flex-start; margin: -2px 0 2px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; background: #f0a030; color: #2a1206; }
.shop-card.is-event .shop-pack-thumbs { flex-wrap: wrap; }
.shop-bar-label, .shop-bar b { white-space: nowrap; }
.home-chips .shop-bar { min-width: 0; }

/* ── Voice calls ───────────────────────────────────────────────────── */
.call-card { text-align: center; padding: 28px 22px; }
.call-avatar {
  width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 36px; font-weight: 700;
  color: var(--ink, #2a1608); background: radial-gradient(circle at 35% 30%, #f3cf72, #b98a2f);
  box-shadow: 0 0 0 6px rgba(243, 207, 114, .18);
}
.call-card h2 { margin: 0 0 4px; }
.call-status { margin: 0 0 20px; opacity: .8; min-height: 1.4em; }
.call-actions { display: flex; gap: 12px; justify-content: center; }
.call-btn { min-width: 120px; }
.call-accept { background: #2e9d57; color: #fff; }
.call-decline, .call-end { background: #c0392b; color: #fff; }
/* The ringing pulse is a ring on ::after that only scales and fades, so the
   compositor animates it without repainting the shadow every frame. */
.call-overlay[data-ringing] .call-avatar, .call-banner[data-ringing] .call-avatar, .game-call.is-calling { position: relative; }
.call-overlay[data-ringing] .call-avatar::after, .call-banner[data-ringing] .call-avatar::after, .game-call.is-calling::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 6px rgba(243, 207, 114, .5);
  animation: callPulse 1.4s ease-out infinite;
}
@keyframes callPulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.3); opacity: 0; } }
.call-bar {
  /* A pill, not a bar: it floats over the game without covering the buttons
     at the screen edges, so you can talk and play at the same time. */
  position: fixed; top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 6px); left: 50%; transform: translateX(-50%);
  z-index: 90; max-width: 94vw;
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px;
  background: rgba(30, 60, 40, .95); color: #fff; font-size: 13px;
  border-radius: 999px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.call-bar[hidden] { display: none; }
.call-bar b { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-bar .btn { padding: 4px 10px; min-height: 0; font-size: 12px; border-radius: 999px; white-space: nowrap; flex: none; }
.call-dot { width: 9px; height: 9px; border-radius: 50%; background: #5fe08a; }
.call-btn-icon { }
@media (prefers-reduced-motion: reduce) { .call-overlay[data-ringing] .call-avatar::after, .call-banner[data-ringing] .call-avatar::after, .game-call.is-calling::after { animation: none; } }

.call-minutes { margin: 0 0 8px; font-size: 13px; opacity: .8; }
.call-minutes.is-low, .call-bar small.is-low { color: #ff8a7a; opacity: 1; }
.call-bar small { opacity: .85; white-space: nowrap; }

.call-more { margin: 0 0 8px; padding: 4px 10px; min-height: 0; font-size: 13px; }

/* In-game call toggle: only drawn when a friend is at the table. */
.game-call {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; min-height: 0; white-space: nowrap; flex: none;
  border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: inherit; background: rgba(255, 255, 255, .08); border: 1px solid rgba(243, 207, 114, .45);
}
.game-call[hidden] { display: none; }
.game-call.is-on { background: #c0392b; color: #fff; border-color: transparent; }
.game-call.is-calling { opacity: .8; }
.game-call-menu {
  position: absolute; top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 54px); right: 56px; z-index: 80;
  margin: 0; padding: 6px; list-style: none; min-width: 170px;
  background: #3a1d12; border: 1px solid rgba(243, 207, 114, .4); border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.game-call-menu[hidden] { display: none; }
.game-call-menu button { width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; color: inherit; font-size: 14px; border-radius: 8px; }
.game-call-menu button:active { background: rgba(255, 255, 255, .1); }

/* On the game screen the header carries the call controls, so the floating pill
   steps aside rather than covering the turn indicator and the buttons. */
html[data-screen="game"] .call-bar { display: none; }
.game-bar { gap: 8px; }
.game-call.is-on { padding: 8px 10px; }
.game-call.is-on #game-call-label { display: none; }
.game-mute {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0;
  border-radius: 50%; color: inherit; cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(243, 207, 114, .45);
}
.game-mute[hidden] { display: none; }
.game-mute .mute-slash { display: none; }
.game-mute.is-muted { background: #7a2a20; color: #fff; border-color: transparent; }
.game-mute.is-muted .mute-slash { display: inline; }

/* Dialling / incoming call: a small banner, not a full-screen card, so the game
   underneath stays visible and playable. */
.call-banner {
  position: fixed; left: 10px; right: 10px; top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 8px); z-index: 95;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: rgba(40, 22, 14, .97); color: #fff; border-radius: 16px;
  border: 1px solid rgba(243, 207, 114, .5); box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.call-banner[hidden] { display: none; }
.call-banner .call-avatar { width: 38px; height: 38px; margin: 0; font-size: 18px; flex: none; box-shadow: none; }
.call-banner .call-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.call-banner .call-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.call-banner .call-status { font-size: 12px; opacity: .8; margin: 0; min-height: 0; }
.call-banner .call-btn { min-width: 0; padding: 7px 12px; min-height: 0; font-size: 13px; font-weight: 700; border: 0; border-radius: 999px; white-space: nowrap; flex: none; }
.call-banner .call-btn[hidden] { display: none; }
/* In a game the banner sits just under the header so the turn indicator stays visible. */
html[data-screen="game"] .call-banner { top: calc(var(--sat, env(safe-area-inset-top, 0px)) + 66px); }

/* ───────────────────────────────────────── Family and Family War */
.family-entry .badge { position: static; display: inline-block; margin-left: 8px; vertical-align: middle; }
.family-name-input { text-transform: none; letter-spacing: .02em; }
.crest-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.crest-picker button {
  font-size: 24px; line-height: 1; padding: 10px 0; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--edge); background: var(--well); color: inherit;
}
.crest-picker button.is-on { border-color: var(--brass); box-shadow: 0 0 0 2px rgba(216, 177, 105, .35); background: rgba(216, 177, 105, .14); }
.family-card { text-align: center; }
.family-crest { font-size: 46px; line-height: 1.1; }
.family-code { margin: 6px auto 10px; }
.war-list li, .war-boards li { flex-wrap: wrap; row-gap: 6px; }
.war-list li b, .war-boards li b { flex: 1 1 140px; min-width: 0; }
.war-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--edge); color: var(--ink-2);
}
.war-pill.is-live { color: #7fd070; border-color: rgba(127, 208, 112, .5); }
.war-pill.is-won { color: var(--brass-hi); border-color: var(--brass-lo); }
.war-pill.is-lost { color: var(--ink-3); }
.war-sub { flex-basis: 100%; font-size: 12px; color: var(--ink-3); margin: 0; }

.war-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: center; }
.war-side { flex: 1 1 0; min-width: 0; }
.war-side .crest { font-size: 34px; line-height: 1.1; }
.war-side b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.war-side small { color: var(--ink-3); font-size: 11px; }
.war-side.is-winner b { color: var(--brass-hi); }
.war-score { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.war-score b { font-family: var(--serif); font-size: 28px; font-variant-numeric: tabular-nums; color: var(--brass-hi); }
.war-score small { font-size: 11px; color: var(--ink-3); max-width: 120px; }

.pick-list li { cursor: pointer; }
.pick-list li.is-on { background: rgba(216, 177, 105, .16); box-shadow: inset 0 0 0 1px var(--brass-lo); }
.pick-list li .tick { margin-left: auto; opacity: 0; }
.pick-list li.is-on .tick { opacity: 1; color: var(--brass-hi); }

.cheer-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.cheer-row button {
  font-size: 22px; padding: 10px 0; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--edge); background: var(--well);
}
.cheer-row button:active { transform: scale(.94); }
.cheer-row button[disabled] { opacity: .45; }

.cheer-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.cheer-bubble {
  position: absolute; bottom: 18%; font-size: 34px; text-align: center; animation: cheerUp 2.4s ease-out forwards;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5));
}
.cheer-bubble small { display: block; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; }
@keyframes cheerUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { transform: translateY(-20px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-260px) scale(1); opacity: 0; }
}
.war-safety { display: grid; gap: 8px; }
.war-team-tag {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 2px 7px;
  border-radius: 999px; background: rgba(216, 177, 105, .2); color: var(--brass-hi); margin-left: 6px;
}

/* ───────────────────────────────────────── App updates */
.update-forced { z-index: 300; }
.update-ready {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + var(--sab, env(safe-area-inset-bottom, 0px))); z-index: 250;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px;
  border: 1px solid var(--edge); background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-lg);
}
.update-ready[hidden] { display: none; }
.update-ready span { flex: 1 1 auto; font-weight: 600; }

/* family crests are painted medallions now, not emoji */
.crest-img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.crest-picker button { padding: 4px; aspect-ratio: 1; }
.family-crest { width: 84px; height: 84px; margin: 0 auto; font-size: 0; }
.war-side .crest { width: 56px; height: 56px; margin: 0 auto; font-size: 0; }
#wc-rival .crest-img, #family-entry-hint .crest-img { display: inline-block; width: 22px; height: 22px; vertical-align: -6px; }

/* On a bot-family table the side seats still say which family they play for. */
.seat-left .chip .chip-where.is-family, .seat-right .chip .chip-where.is-family { display: block; font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
