/* frontend/gemduel.css — GEM DUEL board, both layouts.
 *
 * ⛔ ITS OWN FILE, NOT A BLOCK IN style.css — the Thin Ice / Dibs precedent.
 *
 * ── Colour is data ──────────────────────────────────────────────────────────
 * Chrome colours are the mock's Classic look (docs/design/batch7/Gem duel.dc.html `theme('classic')`) as
 * `--gd-*` variables. ⛔ THE SCREEN CARRIES THE PALETTE, NOT ONLY THE BOARD: the setup card sits outside
 * `.gd-root`. ARCADE (a global layout preference, GameTheme puts `gm-arcade` on the screen) only RECOLOURS —
 * same box, same sizes (the Pachisi / Yut Nori shape). ⛔ Never `--pgr-accent` (a hairline in Classic).
 *
 * ── ⭐ THE GEM SET (owner ruling) ─────────────────────────────────────────────
 * Each face value = one of OUR dice skins (gemduel.js GD_GEMS) on a backplate of the SAME colour and its own
 * SHAPE: 1 circle · 2 rounded square · 3 hexagon · 4 octagon · 5 cut corner · 6 notched slab. Lightness steps
 * down with the face, so greyscale still ramps; shape alone still tells them apart (the owner is colourblind).
 *
 * ── ⭐ LOCKED LAYOUT ────────────────────────────────────────────────────────
 * Every slot is reserved at its final size: four card slots, the turn bar, the banner, the cascade counter,
 * six feed rows. The board's cell size is ONE variable, `--gd-c`, set by gemduel.js from the board band.
 * Feedback changes colour, glow or a transform — never size or spacing.
 */

#gemduel-game-screen, .gd-root {
  --gd-bg: radial-gradient(125% 120% at 50% -10%, #1c1e24 0%, #141519 58%, #0d0e11 100%);
  --gd-panel: rgba(255, 255, 255, .04); --gd-panel2: rgba(255, 255, 255, .075); --gd-line: rgba(255, 255, 255, .09);
  --gd-txt: #e9e8e4; --gd-dim: #8b8d93;
  --gd-accent: oklch(.78 .13 152); --gd-accentInk: #06210f; --gd-danger: oklch(.66 .17 27);
  --gd-glow: rgba(120, 230, 170, .55);
  --gd-slot: rgba(255, 255, 255, .028); --gd-chute: rgba(255, 255, 255, .035);
  --gd-ui: 'Outfit', 'Avenir Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gd-rBox: 18px; --gd-rCard: 14px; --gd-rBar: 10px;
}
/* ARCADE — recolour only (GameTheme: `gm-arcade` on the screen; colours from the 12 app palettes). */
#gemduel-game-screen.gm-arcade, .gm-arcade .gd-root {
  --gd-bg: var(--pgr-bg);
  --gd-panel: rgba(255, 255, 255, .08); --gd-panel2: rgba(255, 255, 255, .14);
  --gd-line: color-mix(in oklch, var(--pgr-sel, #60a5fa) 40%, transparent);
  --gd-txt: #fff; --gd-dim: rgba(255, 255, 255, .66);
  --gd-accent: var(--pgr-sel, #60a5fa); --gd-accentInk: #0b0c10; --gd-glow: rgba(255, 255, 255, .45);
  --gd-slot: rgba(0, 0, 0, .26); --gd-chute: rgba(0, 0, 0, .3);
  --gd-ui: 'Poppins', 'Futura', 'Avenir Next', system-ui, sans-serif;
}

/* ── setup ─────────────────────────────────────────────────────────────── */
.gd-setup-card { max-width: 560px; margin: 24px auto; padding: 26px 28px; font-family: var(--gd-ui); }
.gd-setup-eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gd-dim); }
.gd-setup-title { margin: 6px 0 10px; font-size: 30px; }
.gd-setup-blurb { line-height: 1.55; margin: 0 0 16px; }
.gd-setup-row { display: flex; align-items: center; gap: 14px; margin: 12px 0; }
.gd-setup-lab { width: 80px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gd-dim); }
.gd-opts { display: flex; gap: 8px; }
.gd-opt { min-width: 52px; height: 38px; border-radius: var(--gd-rBar); border: 1px solid var(--gd-line); background: var(--gd-panel);
  color: var(--gd-txt); font: 700 14px var(--gd-ui); cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.gd-opt:hover { background: var(--gd-panel2); }
.gd-opt:active { transform: translateY(1px); }
.gd-opt[data-on="1"] { background: var(--gd-accent); color: var(--gd-accentInk); border-color: var(--gd-accent); }
.gd-setup-hint { font-size: 12.5px; color: var(--gd-dim); line-height: 1.5; }
.gd-start { width: 100%; height: 46px; margin-top: 8px; border: 0; border-radius: 12px; background: var(--gd-accent); color: var(--gd-accentInk);
  font: 800 15px var(--gd-ui); letter-spacing: .06em; cursor: pointer; transition: filter .15s, transform .1s; }
.gd-start:hover { filter: brightness(1.1); }
.gd-start:active { transform: translateY(2px); filter: brightness(.9); }
/* 🧩 The puzzle button is the SECOND way in, so it reads as an alternative rather than a rival to
   "Deal the board": the accent stays as an outline, the fill does not compete. Same box, same
   height, same press — only the weight differs. */
.gd-start-alt { background: transparent; color: var(--gd-accent); box-shadow: inset 0 0 0 2px var(--gd-accent); }
.gd-start-alt:hover { background: color-mix(in srgb, var(--gd-accent) 14%, transparent); filter: none; }

/* ── the root ──────────────────────────────────────────────────────────── */
.gd-root { position: relative; box-sizing: border-box; background: var(--gd-bg); color: var(--gd-txt); font-family: var(--gd-ui);
  border: 1px solid var(--gd-line); border-radius: var(--gd-rBox); overflow: hidden; user-select: none; -webkit-user-select: none; }
.gd-root *, .gd-root *::before, .gd-root *::after { box-sizing: border-box; }
.gd-lab { display: block; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gd-dim); height: 14px; }

/* cards */
.gd-cards { display: flex; min-height: 0; }
.gd-card { position: relative; display: flex; align-items: center; gap: 9px; overflow: hidden; background: var(--gd-panel);
  border: 1px solid var(--gd-line); border-radius: var(--gd-rCard); padding: 0 12px 0 14px; transition: background .2s, border-color .2s; }
.gd-card[data-empty="1"] { visibility: hidden; }
.gd-card[data-turn="1"] { background: var(--gd-panel2); border: 1.5px solid var(--gd-accent); }
.gd-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--gd-accent); transition: width .2s ease; }
.gd-card[data-turn="1"] .gd-accent { width: 4px; }
.gd-av { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--gd-line); background: rgba(255, 255, 255, .07);
  display: flex; align-items: center; justify-content: center; }
.gd-card[data-me="1"] .gd-av { background: var(--gd-panel2); }
.gd-card[data-turn="1"] .gd-av { box-shadow: 0 0 0 2px var(--gd-accent), 0 0 14px -2px var(--gd-accent); animation: gdGlow 2.4s ease-in-out infinite; }
.gd-sym { font-style: normal; font-size: 18px; line-height: 1; color: var(--gd-dim); }
.gd-card[data-turn="1"] .gd-sym { color: var(--gd-accent); }
.gd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gd-nrow { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.gd-cname { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-tag { flex: none; font-style: normal; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gd-dim);
  border: 1px solid var(--gd-line); border-radius: 4px; padding: 1px 4px; }
.gd-srow { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.gd-score { flex: none; min-width: 52px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; transition: color .2s; }
.gd-card[data-turn="1"] .gd-score { color: var(--gd-accent); }
.gd-pipsw { font-size: 10px; color: var(--gd-dim); letter-spacing: .1em; text-transform: uppercase; }
.gd-left { flex: none; margin-left: auto; font-size: 11px; color: var(--gd-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gd-now { flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gd-accentInk);
  background: var(--gd-accent); border-radius: 4px; padding: 3px 6px; opacity: 0; transition: opacity .2s; }
.gd-card[data-turn="1"] .gd-now { opacity: 1; }

/* turn bar + alert strip */
.gd-turnbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--gd-panel);
  border: 1px solid var(--gd-line); border-radius: var(--gd-rBar); min-width: 0; }
.gd-tsym { font-style: normal; font-size: 13px; color: var(--gd-accent); }
.gd-root[data-turn="bot"] .gd-tsym { color: var(--gd-dim); }
.gd-tlab { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-tmeta { flex: none; font-size: 10.5px; color: var(--gd-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gd-menu { display: none; flex: none; width: 28px; height: 24px; border: 1px solid var(--gd-line); border-radius: 7px; background: var(--gd-panel2);
  color: var(--gd-txt); cursor: pointer; font-size: 13px; }
/* 🌐 MP — THE TURN CLOCK (⚖️ GDM2). It is the SERVER'S deadline SHOWN, never a local timer that
   decides anything: gemduel.js paints it off `deadline`, and the server already added this move's own
   animation (R.gdAnimMs, up to ~17s on a deep cascade) before it set that deadline. Absent on a solo
   board and on a clock-off table, and its presence never changes DURING a match, so nothing jumps. */
.gd-clock { display: none; }
.gd-clock[data-on="1"] { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.gd-ctrack { display: block; width: 74px; height: 7px; border-radius: 5px; background: var(--gd-slot);
  border: 1px solid var(--gd-line); overflow: hidden; }
.gd-ctrack b { display: block; height: 100%; width: 100%; border-radius: 5px; background: var(--gd-dim);
  transition: width .25s linear; }
.gd-clock[data-mine="1"] .gd-ctrack b { background: var(--gd-accent); }
.gd-clock[data-low="1"] .gd-ctrack b { background: var(--gd-danger); }
.gd-clock em { font-style: normal; font-weight: 800; font-size: 11px; min-width: 26px; text-align: right;
  color: var(--gd-dim); font-variant-numeric: tabular-nums; }
.gd-clock[data-low="1"] em { color: var(--gd-danger); }
.gd-clock[data-run="0"] { opacity: .3; }
/* ⛔⛔ THE DESKTOP TURN BAR IS A 2×2 GRID (the GD-M2 rail, in the min-width:1000px block below), not the
   flex row the phone gets — so the clock has to be PLACED. Left to auto-place it landed in the 14px
   SYMBOL column and the 74px track rendered 2px wide. Caught in a real browser; every unit test was
   green, because a check that asserts the element exists cannot see that it is two pixels across.
   ⛔ And it does NOT go in a third COLUMN either: the rail is only 258px, so a 107px clock truncated
   "Your move — tap a die." to "Your move — t…". It gets its own ROW, where the rail has room to spare.
   Keyed on the root, so a solo board keeps exactly the grid it had. */
@media (min-width: 1000px) {
  .gd-root[data-clock="1"] .gd-turnbar { height: 62px; grid-template-rows: auto auto auto; row-gap: 3px; align-content: center; }
  .gd-root[data-clock="1"] .gd-clock { grid-column: 2; grid-row: 3; justify-self: stretch; }
  .gd-root[data-clock="1"] .gd-ctrack { flex: 1 1 auto; width: auto; }
}
/* The short-phone tier squeezes every fixed band, so the clock gives up its number first. */
@media (max-width: 999px) and (max-height: 700px) {
  .gd-ctrack { width: 48px; }
  .gd-clock em { display: none; }
}

.gd-alert { flex: none; display: flex; gap: 8px; }
.gd-banner { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--gd-rBar);
  border: 1px dashed var(--gd-line); opacity: .55; overflow: hidden; transition: background .25s, opacity .25s; }
.gd-banner i { font-style: normal; font-size: 15px; color: var(--gd-dim); }
.gd-banner[data-on="0"] i { opacity: 0; }
.gd-banner b { flex: 0 1 auto; min-width: 0; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--gd-dim); }
.gd-banner small { flex: none; margin-left: auto; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--gd-accentInk); }
.gd-banner[data-on="1"] { background: var(--gd-accent); border: 1px solid var(--gd-accent); opacity: 1; }
.gd-banner[data-on="1"] i, .gd-banner[data-on="1"] b { color: var(--gd-accentInk); }
.gd-combo { flex: none; display: flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: var(--gd-rBar);
  border: 1px dashed var(--gd-line); opacity: .55; transition: background .25s, opacity .25s; }
.gd-combo small { font-size: 9px; letter-spacing: .16em; color: var(--gd-dim); white-space: nowrap; }
.gd-combo b { font-size: 17px; font-weight: 800; color: var(--gd-dim); font-variant-numeric: tabular-nums; }
.gd-combo em { margin-left: auto; font-style: normal; font-size: 16px; font-weight: 800; color: var(--gd-dim); font-variant-numeric: tabular-nums; }
.gd-combo[data-on="1"] { background: var(--gd-panel2); border: 1px solid var(--gd-accent); opacity: 1; }
.gd-combo[data-on="1"] b { color: var(--gd-accent); }
.gd-combo[data-on="1"] em { color: var(--gd-txt); }
/* GD-M1: the counter's frame thickens with the wave too, not only its colour */
.gd-combo[data-k="3"] { border-width: 2px; }
.gd-combo[data-k="4"] { border-width: 3px; box-shadow: 0 0 16px -4px var(--gd-accent); }

/* feed */
.gd-feed { display: flex; flex-direction: column; background: var(--gd-panel); border: 1px solid var(--gd-line); border-radius: var(--gd-rCard); overflow: hidden; }
.gd-frow { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; border-bottom: 1px solid var(--gd-line); }
.gd-frow:last-child { border-bottom: 0; }
.gd-frow[data-fresh="1"] { background: var(--gd-panel2); animation: gdRise .3s ease-out; }
.gd-fsym { flex: none; width: 16px; text-align: center; font-style: normal; font-size: 11px; color: var(--gd-dim); }
.gd-ftxt { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-fpts { flex: none; font-size: 13px; font-weight: 700; color: var(--gd-accent); font-variant-numeric: tabular-nums; }
.gd-ftag { flex: none; font-style: normal; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--gd-accentInk);
  background: var(--gd-accent); border-radius: 3px; padding: 2px 4px; }
.gd-ftag[data-on="0"] { display: none; }

/* ── the board ─────────────────────────────────────────────────────────── */
.gd-band { min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
.gd-board { position: relative; flex: none; width: var(--gd-bw, 400px); height: var(--gd-bh, 500px); touch-action: none; transition: filter .3s; }
.gd-board[data-turn="bot"] { filter: saturate(.72); }
.gd-chute { position: absolute; top: 0; left: calc(var(--col) * (var(--gd-c) + var(--gd-cg))); width: var(--gd-c); height: calc(var(--gd-hoph) - 8px);
  background: var(--gd-chute); border: 1px solid var(--gd-line); border-top: 0; border-radius: 0 0 calc(var(--gd-c) * .3) calc(var(--gd-c) * .3); }
.gd-hopline { position: absolute; left: 0; right: 0; top: calc(var(--gd-hoph) - 6px); height: 1px; background: var(--gd-line); }
.gd-slot { position: absolute; width: var(--gd-c); height: var(--gd-c); left: calc(var(--col) * (var(--gd-c) + var(--gd-cg)));
  top: calc(var(--gd-hoph) + var(--row) * (var(--gd-c) + var(--gd-cg))); background: var(--gd-slot); border-radius: calc(var(--gd-c) * .22);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.gd-dice { position: absolute; inset: 0; clip-path: inset(0 -30px -30px -30px); }   /* a die spawning into a hopper enters from under the top edge, never above the chute */

/* one die: the NODE is positioned (left/top) and animated by gemduel.js; `.gd-in` carries the hover / press /
   select motion, so the two never fight over one transform. */
.gd-d { position: absolute; width: var(--gd-c); height: var(--gd-c); transform-origin: 50% 50%; z-index: 2; }
.gd-d[data-bd="0"] { z-index: 1; }
.gd-in { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform .16s ease, filter .24s ease; }
.gd-ring, .gd-plate, .gd-fill, .gd-flash { position: absolute; clip-path: var(--shape); }
.gd-ring { inset: -4px; background: transparent; transition: background .16s ease, inset .16s ease; }
.gd-plate { inset: 0; background: var(--rim); }
.gd-fill { inset: 7%; background: var(--pl); }
.gd-face { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); line-height: 0; pointer-events: none; }
.gd-flash { inset: 0; background: var(--gd-tint, #fff); opacity: 0; pointer-events: none; }
.gd-num { font: 800 18px var(--gd-ui); color: #222; }
.gd-badge { position: absolute; right: calc(var(--gd-c) * -.08); bottom: calc(var(--gd-c) * -.08); width: calc(var(--gd-c) * .34); height: calc(var(--gd-c) * .34);
  min-width: 13px; min-height: 13px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: calc(var(--gd-c) * .21);
  font-weight: 700; background: var(--gd-accent); color: var(--gd-accentInk); opacity: 0; transition: opacity .15s ease; pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

/* the gem set: shape + plate colour matched to the skin (gemduel.js GD_GEMS) */
.gd-d[data-f="1"] { --shape: circle(50% at 50% 50%); --pl: #e8dcc0; --rim: #a39062; }
.gd-d[data-f="2"] { --shape: inset(0% round 26%); --pl: #a9cdf5; --rim: #4d7cbd; }
.gd-d[data-f="3"] { --shape: polygon(50% 0%, 100% 26%, 100% 74%, 50% 100%, 0% 74%, 0% 26%); --pl: #e3b646; --rim: #8f6512; }
.gd-d[data-f="4"] { --shape: polygon(22% 0%, 78% 0%, 100% 22%, 100% 78%, 78% 100%, 22% 100%, 0% 78%, 0% 22%); --pl: #c07c43; --rim: #6a3a12; }
.gd-d[data-f="5"] { --shape: polygon(30% 0%, 100% 0%, 100% 70%, 70% 100%, 0% 100%, 0% 30%); --pl: #cf3d43; --rim: #7a1016; }
.gd-d[data-f="6"] { --shape: polygon(0% 0%, 38% 0%, 50% 11%, 62% 0%, 100% 0%, 100% 100%, 62% 100%, 50% 89%, 38% 100%, 0% 100%); --pl: #1e3869; --rim: #5cb6ff; }

/* states — hover / pressed only while it's your move; everything is ring, glow, badge, dim or a 2–3px lift */
.gd-root[data-lock="0"] .gd-d[data-bd="1"] { cursor: pointer; }
.gd-root[data-lock="0"] .gd-d[data-bd="1"][data-hov="1"] .gd-in { transform: translateY(-2px); }
.gd-root[data-lock="0"] .gd-d[data-bd="1"][data-hov="1"] .gd-ring { inset: -3px; background: rgba(255, 255, 255, .3); }
.gd-root[data-lock="0"] .gd-d[data-press="1"] .gd-in { transform: translateY(2px); }
.gd-root[data-lock="0"] .gd-d[data-press="1"] .gd-ring { inset: -3px; background: rgba(255, 255, 255, .55); }
.gd-d[data-sel="1"] { z-index: 5; }
.gd-d[data-sel="1"] .gd-in { animation: gdSway 2.4s ease-in-out infinite; filter: drop-shadow(0 0 10px var(--gd-glow)); }
.gd-d[data-sel="1"] .gd-ring { inset: -5px; background: var(--gd-accent); }
.gd-d[data-sel="1"] .gd-badge { opacity: 1; }
.gd-d[data-sel="1"] .gd-badge::after { content: '\25C6'; }
.gd-d[data-pt="1"] .gd-ring { inset: -3px; background: var(--gd-accent); }
.gd-d[data-pt="1"] .gd-badge { opacity: 1; }
.gd-d[data-pt="1"] .gd-badge::after { content: '\21C4'; }
.gd-d[data-x="1"] .gd-badge { opacity: 1; background: var(--gd-danger); color: #fff; }
.gd-d[data-x="1"] .gd-badge::after { content: '\2715'; }
.gd-d[data-dim="1"] .gd-in { filter: saturate(.5) brightness(.72); }
.gd-d[data-clr="1"] { z-index: 6; }
.gd-d[data-clr="1"] .gd-ring { inset: -5px; background: var(--gd-tint, #fff); }
.gd-d[data-clr="1"] .gd-in { filter: drop-shadow(0 0 12px var(--gd-tint, #fff)); }

/* board FX layer (inside the board, board px) */
.gd-bfx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.gd-shock { position: absolute; border-radius: 50%; border: 3px solid #fff; }
.gd-spark { position: absolute; border-radius: 2px; box-shadow: 0 0 6px rgba(255, 255, 255, .5); }
.gd-lbl { position: absolute; display: flex; flex-direction: column; align-items: center; white-space: nowrap; pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8), 0 0 2px #000; }
.gd-lbl small { font-size: calc(var(--gd-c) * .3); font-weight: 800; color: #fff; letter-spacing: .02em; }
.gd-lblx { font-size: calc(var(--gd-c) * .8); font-weight: 900; line-height: .95; letter-spacing: -.02em; }
.gd-lbl[data-k="3"] .gd-lblx { font-size: calc(var(--gd-c) * .95); }
.gd-lbl[data-k="4"] .gd-lblx { font-size: calc(var(--gd-c) * 1.1); }
.gd-shuffle { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); z-index: 9; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 12px 20px; border-radius: 14px; background: rgba(0, 0, 0, .72); border: 1px solid var(--gd-line); opacity: 0; transition: opacity .2s;
  pointer-events: none; }
.gd-shuffle[data-on="1"] { opacity: 1; }
.gd-shuffle b { font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gd-shuffle small { font-size: 12px; color: var(--gd-dim); }

/* screen-level FX (root px): pip chips, the extra-move burst, the monster-move celebration */
.gd-fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.gd-chip { position: absolute; font-size: 14px; font-weight: 800; color: var(--gd-accentInk); background: var(--gd-accent); border-radius: 999px;
  padding: 2px 7px; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.gd-burst { position: absolute; white-space: nowrap; padding: 10px 22px; border-radius: 14px; background: var(--gd-accent); color: var(--gd-accentInk);
  font-size: 22px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; box-shadow: 0 10px 40px -8px rgba(0, 0, 0, .7), 0 0 30px -6px var(--gd-accent); }
.gd-celeb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(60% 60% at 50% 50%, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); }
.gd-celeb div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gd-celeb b { font-size: 58px; font-weight: 900; color: var(--gd-accent); letter-spacing: -.02em; text-shadow: 0 4px 24px rgba(0, 0, 0, .6); }
.gd-celeb small { font-size: 15px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.gd-celring { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; border-radius: 50%; border: 5px solid var(--gd-accent); }

@keyframes gdSway { 0%, 100% { transform: translateY(-3px) rotate(-1.3deg); } 50% { transform: translateY(-5.5px) rotate(1.3deg); } }
@keyframes gdGlow { 0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .25)); } 50% { filter: drop-shadow(0 0 10px rgba(255, 255, 255, .55)); } }
@keyframes gdRise { 0% { transform: translateY(9px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* end screen rows (GameEndScreen html section) */
.gd-endrows { display: flex; flex-direction: column; gap: 5px; }
.gd-endrow { display: grid; grid-template-columns: 1fr auto 80px; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; }
.gd-endrow[data-win="1"] { background: rgba(111, 212, 154, .16); }
.gd-endnm { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.gd-endnm .gd-sym { font-size: 13px; }
.gd-endst { font-size: 12px; opacity: .75; }
.gd-endsc { text-align: right; font-weight: 800; font-size: 15px; }
.gd-endnote { margin-top: 8px; font-size: 12px; opacity: .75; }

/* personal bests (GameEndScreen html section). ⭐ The ring is REBUILT here rather than reusing .gd-celring:
   the board's #gd-fx layer sits under the end-screen overlay, so a burst fired there would be hidden. Same
   idiom — one expanding accent ring — drawn inside the card that earned it. */
/* ⛔⛔ THE CARD CARRIES ITS OWN ACCENT. GameEndScreen does `document.body.appendChild(overlay)`, so the
   popup is NOT inside #gemduel-game-screen and inherits NONE of the --gd-* tokens declared above — a ring
   painted with var(--gd-accent) would be a transparent border and the NEW pill near-black on a dark row.
   What the overlay DOES carry is the --pgr-* set and .ges-arcade / .ges-classic, so the card mirrors the
   board's two looks off those instead. */
.gd-pb { display: flex; flex-direction: column; gap: 5px;
  --gd-pbAccent: oklch(.78 .13 152); --gd-pbInk: #06210f; }
.ges-arcade .gd-pb { --gd-pbAccent: var(--pgr-sel, #60a5fa); --gd-pbInk: #0b0c10; }
.gd-pbrow { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "l v" "g g"; align-items: center; gap: 2px 10px; padding: 6px 9px; border-radius: 8px; background: rgba(255, 255, 255, .04); }
.gd-pbrow[data-beat="1"] { background: rgba(111, 212, 154, .16); }
.gd-pbl { grid-area: l; font-weight: 700; font-size: 13px; }
.gd-pbv { grid-area: v; font-weight: 800; font-size: 15px; }
.gd-pbg { grid-area: g; font-size: 12px; opacity: .78; display: flex; align-items: center; gap: 6px; }
.gd-pbrow[data-beat="1"] .gd-pbg { opacity: .95; }
.gd-pbnew { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .12em; padding: 1px 5px; border-radius: 4px; background: var(--gd-pbAccent); color: var(--gd-pbInk); }
.gd-pbring { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; border: 3px solid var(--gd-pbAccent); opacity: 0; pointer-events: none; animation: gdPbRing 1100ms ease-out 180ms 1 both; }
@keyframes gdPbRing { 0% { transform: scale(.18); opacity: 0; } 25% { opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
.gd-pbrow[data-lead="1"] .gd-pbv { animation: gdPbPop 620ms cubic-bezier(.34, 1.56, .64, 1) 180ms 1 both; }
@keyframes gdPbPop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* 🧩 Puzzle end screen (gemduel_puzzle.js). The same body-level-sibling rule as .gd-pb above: no
   --gd-* token reaches here, so every colour is literal or inherited from the overlay's own text. */
.gd-pznote { padding: 8px 9px; border-radius: 8px; font-size: 13px; background: rgba(255, 255, 255, .04); opacity: .85; }
.gd-pznote[data-k="wait"] { animation: gdPzWait 1.4s ease-in-out infinite; }
@keyframes gdPzWait { 50% { opacity: .5; } }
.gd-pzstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.gd-pzt { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 8px; background: rgba(255, 255, 255, .04); text-align: center; }
.gd-pzt b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gd-pzt small { font-size: 11px; opacity: .72; line-height: 1.2; }
@media (max-width: 420px) { .gd-pzstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .gd-d .gd-in, .gd-card .gd-av, .gd-frow { animation: none !important; }
  .gd-pbring, .gd-pbrow[data-lead="1"] .gd-pbv { animation: none !important; }
  .gd-pbring { display: none; }
  .gd-pznote[data-k="wait"] { animation: none !important; }
}

/* ── PHONE — the mock's frame 01b: opponent chips · turn · banner + counter · board · feed ticker · your seat ── */
@media (max-width: 999px) {
  #gemduel-game-screen.gd-playing .wrap { padding: 0 2px; max-width: none; }
  #gemduel-game-screen.gd-playing .topbar { display: none; }
  #gemduel-game-screen.gd-playing.gd-topbar-open .topbar { display: flex; }
  .gd-root { height: var(--gd-phone-h, 700px); display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; }
  .gd-rail { flex: none; display: flex; flex-direction: column; gap: 6px; }
  .gd-lab-players { display: none; }
  .gd-cards { flex-direction: row; gap: 6px; height: 70px; }
  .gd-cards .gd-card { flex: 1 1 0; min-width: 0; padding: 0 8px 0 10px; gap: 7px; }
  .gd-cards .gd-card[data-me="1"], .gd-cards .gd-card[data-empty="1"] { display: none; }
  .gd-cards .gd-av { width: 34px; height: 34px; }
  .gd-cards .gd-score { font-size: 18px; min-width: 40px; }
  .gd-cards .gd-cname { font-size: 12px; }
  .gd-cards .gd-now { display: none; }
  /* three opponents: the tight chip (the mock's 07) — the seat glyph carries BOT, NOW becomes the lit border */
  .gd-cards[data-n="4"] .gd-card { padding: 0 6px 0 7px; gap: 5px; }
  .gd-cards[data-n="4"] .gd-av { width: 26px; height: 26px; }
  .gd-cards[data-n="4"] .gd-sym { font-size: 13px; }
  .gd-cards[data-n="4"] .gd-tag, .gd-cards[data-n="4"] .gd-pipsw { display: none; }
  .gd-cards[data-n="4"] .gd-score { font-size: 16px; min-width: 30px; }
  .gd-cards[data-n="4"] .gd-cname { font-size: 11px; }
  .gd-cards[data-n="4"] .gd-left { font-size: 10px; }
  .gd-cards[data-n="3"] .gd-srow, .gd-cards[data-n="4"] .gd-srow { flex-wrap: nowrap; }
  .gd-turnbar { height: 30px; }
  .gd-menu { display: block; }
  .gd-alert { height: 40px; }
  .gd-banner b { font-size: 11.5px; letter-spacing: .08em; }
  .gd-banner small { font-size: 11px; }
  .gd-combo { width: 146px; }
  .gd-combo b { font-size: 15px; }
  .gd-combo em { font-size: 14px; }
  .gd-band { flex: 1 1 0; }
  .gd-feedcol { flex: none; height: 26px; }
  .gd-feedcol .gd-lab { display: none; }
  .gd-feed { height: 26px; border-radius: 8px; }
  .gd-frow { height: 26px; padding: 0 8px; border-bottom: 0; }
  .gd-frow:not(:first-child) { display: none; }
  .gd-ftxt { font-size: 11.5px; }
  .gd-fpts { font-size: 12px; }
  .gd-seat { flex: none; height: 68px; display: flex; }
  .gd-seat .gd-card { flex: 1; }
  .gd-seat .gd-score { font-size: 24px; }
  .gd-chip { font-size: 12px; }
  .gd-celeb b { font-size: 44px; }
  .gd-celeb small { font-size: 13px; }
  .gd-burst { font-size: 17px; }
  .gd-celring { width: 340px; height: 340px; }
}
@media (max-width: 370px) {
  .gd-combo { width: 128px; }
}

/* ── SHORT PHONE (≤ 700px tall: iPhone SE, and every iPhone in Safari with its bottom toolbar) ──────
   Every fixed band tightens so the board keeps the room it needs ABOVE the chat bar. Heights only —
   nothing moves or re-centres, so the locked layout still holds. */
@media (max-width: 999px) and (max-height: 700px) {
  .gd-root { gap: 4px; padding: 6px; }
  .gd-rail { gap: 4px; }
  .gd-cards { height: 54px; }
  .gd-cards .gd-av { width: 28px; height: 28px; }
  .gd-cards .gd-sym { font-size: 14px; }
  .gd-cards .gd-score { font-size: 15px; min-width: 30px; }
  .gd-cards .gd-cname { font-size: 11px; }
  .gd-cards .gd-tag, .gd-cards .gd-pipsw { display: none; }
  .gd-turnbar { height: 26px; }
  .gd-tlab { font-size: 11.5px; }
  .gd-tmeta { font-size: 10px; }
  .gd-alert { height: 32px; }
  .gd-banner b { font-size: 10.5px; }
  .gd-feedcol, .gd-feed, .gd-frow { height: 22px; }
  .gd-seat { height: 54px; }
  .gd-seat .gd-av { width: 34px; height: 34px; }
  .gd-seat .gd-score { font-size: 19px; }
}

/* ── DESKTOP — ONE design box, scaled as a unit by BoardFit (the mock's 1280 × 637 less its 84px chat strip).
   GD-M2: the turn bar, banner and cascade counter stack in the LEFT rail, so the board takes the centre's
   whole height. ── */
@media (min-width: 1000px) {
  #gemduel-game-screen .wrap { max-width: none; padding-left: 0; padding-right: 0; }
  .gd-root {
    width: 1280px; height: 553px; padding: 12px 16px;
    display: grid; grid-template-columns: 258px minmax(0, 1fr) 286px; grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "rail band feed"; column-gap: 14px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 26px 60px -30px #000;
  }
  .gd-rail { grid-area: rail; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
  .gd-cards { flex: 1 1 auto; flex-direction: column; gap: 8px; }
  .gd-cards .gd-card { flex: none; height: 76px; }
  /* the rail is 258px wide: the turn line and its meta take two rows rather than truncating */
  .gd-turnbar { height: 48px; display: grid; grid-template-columns: 14px minmax(0, 1fr); grid-template-rows: 1fr 1fr; column-gap: 8px; padding: 4px 12px; }
  .gd-tsym { grid-row: 1 / 3; align-self: center; }
  .gd-tlab { align-self: end; font-size: 13px; }
  .gd-tmeta { grid-column: 2; align-self: start; }
  .gd-alert { flex-direction: column; }
  .gd-banner, .gd-combo { height: 42px; }
  .gd-band { grid-area: band; }
  .gd-feedcol { grid-area: feed; display: flex; flex-direction: column; gap: 6px; }
  .gd-seat { display: none; }
}
