/* GoldChat Games — every screen the hub draws, and the games inside it.
   Tokens hang off .gm-root and fall back to the house values, so a palette change in
   style.css carries through. Prefix gm-; nothing here reaches outside .gm-root except
   the floating block piece iBhloko Blast drags over the page (.gm-blox-float) and the
   tappable game lines in a chat (.msg.system.system-game). */

/* The sheet host is mounted on <body>, outside .gm-root, so the tokens must reach it too —
   a sheet drawn without them has no background, no radius and no shadow. */
.gm-root, .gm-sheet-host {
  --gm-bg:       var(--bg, #f6efe0);
  --gm-bg2:      var(--bg2, #faf6ec);
  --gm-panel:    var(--panel, #ffffff);
  --gm-panel2:   var(--panel2, #f4ecd9);
  --gm-line:     var(--line, #e8dbbe);
  --gm-hairline: var(--hairline, rgba(170, 135, 45, .18));
  --gm-ink:      var(--text, #3b3122);
  --gm-muted:    #6f6350;
  --gm-gold:     var(--gold-action, #8f6a12);
  --gm-gold-hover: var(--gold-hover, #7d5c0f);
  --gm-gold-deep:  var(--gold-deep, #a87e18);
  --gm-accent:   var(--accent, #c79a2e);
  --gm-accent-soft: var(--accent-soft, #ecd085);
  --gm-grad:     var(--gold-grad, linear-gradient(135deg, #ecd085 0%, #c79a2e 100%));
  --gm-danger:   var(--danger, #a33b49);
  --gm-danger-soft: var(--danger-soft, rgba(163, 59, 73, .10));
  --gm-ok:       var(--ok, #2c6e34);
  --gm-r-sm: var(--r-sm, 8px); --gm-r-md: var(--r-md, 12px); --gm-r-lg: var(--r-lg, 18px); --gm-r-pill: 999px;
  --gm-lift-1: var(--lift-1, 0 1px 2px rgba(60, 45, 10, .05));
  --gm-lift-2: var(--lift-2, 0 1px 2px rgba(60, 45, 10, .04), 0 12px 32px rgba(60, 45, 10, .08));
  --gm-focus: var(--focus, 0 0 0 3px rgba(199, 154, 46, .32));
  --gm-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.gm-root {
  position: fixed; inset: 0; z-index: 45;          /* above the Shop (40), under Sizani (50) and calls (90) */
  display: flex; flex-direction: column;
  background: var(--gm-bg); color: var(--gm-ink);
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.gm-root[hidden] { display: none !important; }
html.gm-open, html.gm-open body { overflow: hidden; }
.gm-root *, .gm-root *::before, .gm-root *::after,
.gm-sheet-host *, .gm-sheet-host *::before, .gm-sheet-host *::after { box-sizing: border-box; }
.gm-root button, .gm-sheet-host button { font: inherit; color: inherit; cursor: pointer; }
.gm-root button:focus-visible, .gm-root [role=button]:focus-visible { outline: none; box-shadow: var(--gm-focus); }
.gm-root h1, .gm-root h2, .gm-root h3, .gm-root p, .gm-root ol, .gm-root ul { margin: 0; }
.gm-root ol, .gm-root ul { padding: 0; list-style: none; }

/* ═══ header ═══ */
.gm-header {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 6px;
  background: var(--gm-bg2); border-bottom: 1px solid var(--gm-line); flex: none;
}
.gm-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--gm-r-sm); color: var(--gm-muted); background: none; border: 0; flex: none;
}
.gm-back:hover { background: var(--gm-panel2); color: var(--gm-ink); }
.gm-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.gm-title span { font-size: 12.5px; color: var(--gm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-week {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--gm-r-pill); background: var(--gm-panel2);
  color: var(--gm-gold-hover); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ═══ body ═══ */
.gm-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(28px + env(safe-area-inset-bottom, 0px)); }
.gm-pane { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.gm-pane[hidden] { display: none !important; }
.gm-loading, .gm-empty { text-align: center; padding: 36px 20px; color: var(--gm-muted); line-height: 1.6; }
.gm-hint { font-size: 12.5px; color: var(--gm-muted); line-height: 1.5; }
.gm-error {
  color: var(--gm-danger); font-size: 13px; font-weight: 600; line-height: 1.5;
  background: var(--gm-danger-soft); padding: 9px 12px; border-radius: var(--gm-r-md);
}
.gm-error[hidden] { display: none !important; }
.gm-h2 { font-size: 15px; letter-spacing: -.01em; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.gm-h2 small { font-size: 12px; font-weight: 600; color: var(--gm-muted); }
.gm-card { background: var(--gm-panel); border: 1px solid var(--gm-line); border-radius: var(--gm-r-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--gm-lift-1); }
.gm-note { font-size: 13px; line-height: 1.55; background: var(--gm-panel2); border: 1px solid var(--gm-hairline); padding: 11px 13px; border-radius: var(--gm-r-md); }

/* buttons */
.gm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--gm-r-md); border: 1px solid transparent;
  font-weight: 700; font-size: 14px; background: var(--gm-panel2); color: var(--gm-ink); transition: background .15s, transform .08s;
}
.gm-btn:active { transform: translateY(1px); }
.gm-btn:disabled { opacity: .55; cursor: default; }
.gm-btn-primary { background: var(--gm-gold); color: #fff; }
.gm-btn-primary:hover:not(:disabled) { background: var(--gm-gold-hover); }
.gm-btn-outline { background: var(--gm-panel); border-color: var(--gm-line); }
.gm-btn-quiet { background: none; color: var(--gm-muted); }
.gm-btn-wide { width: 100%; }
.gm-btn-roll { font-size: 17px; min-height: 56px; }
.gm-row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gm-row-btns .gm-btn { flex: 1 1 140px; }

/* avatars */
.gm-av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gm-panel2); color: var(--gm-gold-hover); font-weight: 800; font-size: 14px;
}
.gm-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gm-av-sm { width: 28px; height: 28px; font-size: 12px; }
.gm-av-md { width: 42px; height: 42px; font-size: 15px; }
.gm-av-lg { width: 48px; height: 48px; font-size: 18px; }

/* ═══ home ═══ */
.gm-hero { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--gm-r-lg); background: var(--gm-grad); color: #3b2c07; }
.gm-hero b { font-size: 17px; display: block; }
.gm-hero span { font-size: 12.5px; }
.gm-hero .gm-crowns { margin-left: auto; text-align: center; font-variant-numeric: tabular-nums; }
.gm-hero .gm-crowns b { font-size: 22px; line-height: 1; }
.gm-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gm-tile {
  text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 12px;
  background: var(--gm-panel); border: 1px solid var(--gm-line); border-radius: var(--gm-r-lg); min-height: 128px;
  box-shadow: var(--gm-lift-1); transition: transform .12s, box-shadow .12s;
}
.gm-tile:hover { transform: translateY(-1px); box-shadow: var(--gm-lift-2); }
.gm-tile-art { width: 100%; height: 56px; border-radius: var(--gm-r-md); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.gm-tile-art-snakes { background: linear-gradient(135deg, #dfe9c8, #b9d29a); }
.gm-tile-art-2048 { background: linear-gradient(135deg, #f6e4b6, #edc36b); }
.gm-tile-art-tatrix { background: linear-gradient(135deg, #2a2838, #4b4870); }
.gm-tile-art-blox { background: linear-gradient(135deg, #1e2a6e, #3d4d9e); }
.gm-tile-art-khumbula { background: linear-gradient(135deg, #f4d9d0, #e9b3a3); }
.gm-tile-art-chess { background: linear-gradient(135deg, #f2e8cf, #b9975b); }
.gm-tile-art-shootout { background: linear-gradient(135deg, #dff0d0, #9fce8a); }
.gm-tile b { font-size: 14px; }
.gm-tile span { font-size: 12px; color: var(--gm-muted); line-height: 1.4; }
.gm-tile .gm-tile-lead { display: flex; align-items: center; gap: 6px; margin-top: auto; font-size: 12px; color: var(--gm-ink); }
.gm-tile .gm-tile-lead b { font-size: 12px; }
.gm-tile-together { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.gm-tile-together .gm-tile-art { width: 64px; height: 64px; flex: none; }
.gm-tile-together > div { display: flex; flex-direction: column; gap: 4px; }

/* ═══ tabs ═══ */
.gm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gm-line); }
.gm-tab { flex: 1; padding: 11px 4px; color: var(--gm-muted); font-weight: 700; font-size: 13.5px; background: none; border: 0; border-bottom: 2.5px solid transparent; border-radius: 0; }
.gm-tab.on { color: var(--gm-gold-hover); border-bottom-color: var(--gm-accent); }
.gm-seg { display: inline-flex; background: var(--gm-panel2); border-radius: var(--gm-r-pill); padding: 3px; gap: 2px; align-self: flex-start; }
.gm-seg button { border: 0; background: none; padding: 6px 12px; border-radius: var(--gm-r-pill); font-size: 12.5px; font-weight: 700; color: var(--gm-muted); }
.gm-seg button.on { background: var(--gm-panel); color: var(--gm-ink); box-shadow: var(--gm-lift-1); }

/* ═══ leaderboard ═══ */
.gm-board { display: flex; flex-direction: column; }
.gm-boardrow { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--gm-hairline); }
.gm-boardrow:last-child { border-bottom: 0; }
.gm-boardrow.you { background: linear-gradient(90deg, rgba(236, 208, 133, .28), transparent); border-radius: var(--gm-r-sm); }
.gm-rank { width: 28px; text-align: center; font-weight: 800; color: var(--gm-muted); font-variant-numeric: tabular-nums; }
.gm-rank-1 { color: #b8860b; } .gm-rank-2 { color: #8a8a8a; } .gm-rank-3 { color: #a0642c; }
.gm-boardname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-boardname b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-boardname span { font-size: 11.5px; color: var(--gm-muted); }
.gm-score { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
/* The level of a best play, beside its score. Normal wears no chip; Easy is muted, Hard is
   gold — the same tint the crown row uses, so "worth more" reads at a glance. */
.gm-root .gm-chip { display: inline-block; flex: none; padding: 2px 7px; border-radius: var(--gm-r-pill); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; line-height: 1.3; background: var(--gm-panel2); color: var(--gm-muted); }
.gm-root .gm-chip-hard { background: var(--gm-accent-soft); color: var(--gm-gold-hover); }
.gm-mebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--gm-r-md); background: var(--gm-panel2); font-size: 13px; }
.gm-mebar b { font-variant-numeric: tabular-nums; }

/* ═══ play ═══ */
.gm-playbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gm-playbar .gm-live { display: flex; flex-direction: column; }
.gm-playbar .gm-live span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--gm-muted); font-weight: 700; }
.gm-playbar .gm-live b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gm-playbar .gm-best { text-align: right; }
/* The level row sits between the score bar and the stage: the three choices stretch across
   so a thumb finds them, and the line under them says what the level does and counts. */
.gm-root .gm-level { display: flex; flex-direction: column; gap: 6px; }
.gm-root .gm-level .gm-seg { display: flex; align-self: stretch; }
.gm-root .gm-level .gm-seg button { flex: 1; padding: 8px 10px; }
.gm-root .gm-level .gm-hint { padding: 0 4px; }
.gm-stage { position: relative; display: flex; justify-content: center; }
.gm-play-hint { font-size: 12px; color: var(--gm-muted); text-align: center; line-height: 1.5; margin-top: 8px; }
.gm-result { text-align: center; gap: 8px; }
.gm-result .gm-result-score { font-size: 40px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.gm-result .gm-result-line { font-size: 13.5px; color: var(--gm-muted); }
.gm-result .gm-result-new { color: var(--gm-gold-hover); font-weight: 800; }
.gm-chall-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--gm-r-md); background: rgba(233, 205, 122, .22); border: 1px solid rgba(199, 154, 46, .35); font-size: 13px; }

/* ═══ chat screen ═══ */
.gm-chatcard { display: flex; align-items: center; gap: 12px; }
.gm-chatcard .gm-tile-art { width: 56px; height: 56px; flex: none; }
.gm-chatcard > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gm-chatcard b { font-size: 14px; }
.gm-chatcard span { font-size: 12.5px; color: var(--gm-muted); }
.gm-chall { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gm-hairline); }
.gm-chall:last-child { border-bottom: 0; }
.gm-chall > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-chall b { font-size: 13.5px; }
.gm-chall span { font-size: 12px; color: var(--gm-muted); }
.gm-chall .gm-btn { min-height: 38px; padding: 6px 12px; font-size: 13px; }
.gm-pick { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; flex: 1 1 auto; margin: 0 -4px; padding: 0 4px; overscroll-behavior: contain; }
.gm-pickrow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; min-height: 58px; border: 0; background: none; text-align: left; border-radius: var(--gm-r-md); width: 100%; }
.gm-pickrow + .gm-pickrow { border-top: 1px solid var(--gm-hairline); border-top-left-radius: 0; border-top-right-radius: 0; }
.gm-pickrow:hover, .gm-pickrow:focus-visible { background: var(--gm-bg2); outline: none; }
.gm-pickrow:active { background: var(--gm-panel2); }
.gm-pickrow > b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-pickrow > span { font-size: 12px; color: var(--gm-muted); }
.gm-pickrow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gm-pickrow-text b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-pickrow-text span { font-size: 12.5px; color: var(--gm-muted); }
.gm-pickrow .gm-av { flex: none; }
.gm-pick-search { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--gm-line); border-radius: var(--gm-r-md); background: var(--gm-bg2); color: var(--gm-ink); font: inherit; font-size: 14px; -webkit-appearance: none; appearance: none; }
.gm-pick-search::placeholder { color: var(--gm-muted); }
.gm-pick-search:focus { outline: none; border-color: var(--gm-accent); box-shadow: var(--gm-focus); }
.gm-pick-empty { padding: 18px 8px; text-align: center; font-size: 13px; color: var(--gm-muted); }

/* ═══ sheet ═══
   A solid card on a dimmed page: a bottom sheet on a phone, a centred dialog on a wide
   screen. The card never scrolls as a whole — its list does — so the title and the search
   field stay put while a long chat list moves under them. */
.gm-sheet-host { position: fixed; inset: 0; z-index: 46; background: rgba(40, 30, 10, .5); display: flex; align-items: flex-end; justify-content: center; color: var(--gm-ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.gm-sheet-host[hidden] { display: none !important; }
.gm-sheet { width: 100%; max-width: 560px; max-height: min(82vh, 680px); overflow: hidden; background: var(--gm-panel); border-radius: var(--gm-r-lg) var(--gm-r-lg) 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--gm-lift-2); }
.gm-sheet h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.gm-sheet-sub { font-size: 13px; color: var(--gm-muted); margin-top: -6px; line-height: 1.45; }
.gm-sheet .gm-btn-wide { flex: none; }
@media (min-width: 700px) {
  .gm-sheet-host { align-items: center; padding: 24px; }
  .gm-sheet { border-radius: var(--gm-r-lg); padding-bottom: 16px; }
}

/* ═══ hall ═══ */
.gm-week-card { gap: 8px; }
.gm-week-card h3 { font-size: 14px; color: var(--gm-muted); }
.gm-crownrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.gm-crownrow .gm-medal { width: 26px; text-align: center; font-size: 16px; }
.gm-crownrow > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-crownrow b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-crownrow span { font-size: 12px; color: var(--gm-muted); }

/* ═══ a game line in the chat ═══ */
.msg.system.system-game { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

/* ═══ 2048 ═══ */
.gm-2048 { width: 100%; max-width: 360px; }
.gm-2048-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; background: #b9a57a; border-radius: var(--gm-r-md); aspect-ratio: 1; touch-action: none; user-select: none; }
.gm-2048-cell { border-radius: 8px; background: rgba(255, 255, 255, .35); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: clamp(18px, 6vw, 30px); color: #6b5a3a; font-variant-numeric: tabular-nums; }
.gm-2048-t { color: #5c4a2a; background: #f7ecd2; }
.gm-2048-t4 { background: #f2dfb5; } .gm-2048-t8 { background: #f4b56d; color: #fff; } .gm-2048-t16 { background: #f59457; color: #fff; }
.gm-2048-t32 { background: #f57a5f; color: #fff; } .gm-2048-t64 { background: #f45d3c; color: #fff; }
.gm-2048-t128 { background: #edcf72; color: #fff; font-size: clamp(16px, 5vw, 26px); } .gm-2048-t256 { background: #edcc61; color: #fff; font-size: clamp(16px, 5vw, 26px); }
.gm-2048-t512 { background: #edc850; color: #fff; font-size: clamp(16px, 5vw, 26px); } .gm-2048-t1024 { background: #edc53f; color: #fff; font-size: clamp(14px, 4.4vw, 22px); }
.gm-2048-t2048 { background: #b8860b; color: #fff; font-size: clamp(14px, 4.4vw, 22px); box-shadow: 0 0 18px rgba(184, 134, 11, .6); }
.gm-2048-t4096 { background: #3b3122; color: #f6e4b6; font-size: clamp(14px, 4.4vw, 22px); }
.gm-2048-new { animation: gm-pop .16s ease-out; }
@keyframes gm-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

/* ═══ Khumbula ═══ */
.gm-khumbula { width: 100%; max-width: 360px; }
.gm-khumbula-hud { display: flex; justify-content: space-between; font-weight: 700; color: var(--gm-muted); padding: 0 4px 8px; font-variant-numeric: tabular-nums; }
.gm-khumbula-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gm-khumbula-card { aspect-ratio: 3 / 4; border: 0; background: none; padding: 0; perspective: 600px; }
.gm-khumbula-inner { position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; display: block; }
.gm-khumbula-up .gm-khumbula-inner, .gm-khumbula-done .gm-khumbula-inner { transform: rotateY(180deg); }
.gm-khumbula-back, .gm-khumbula-front { position: absolute; inset: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.gm-khumbula-back { background: var(--gm-grad); color: #3b2c07; font-weight: 900; font-size: 22px; }
.gm-khumbula-front { background: var(--gm-panel); border: 2px solid var(--gm-line); transform: rotateY(180deg); font-size: clamp(26px, 9vw, 40px); }
.gm-khumbula-done .gm-khumbula-front { border-color: var(--gm-ok); box-shadow: 0 0 0 2px rgba(44, 110, 52, .25) inset; }

/* ═══ Tatrix ═══ */
.gm-tatrix { display: flex; flex-direction: column; align-items: center; width: 100%; }
.gm-tatrix-top { display: flex; gap: 10px; align-items: flex-start; }
.gm-tatrix-canvas { border-radius: 8px; box-shadow: var(--gm-lift-2); background: #1b1a24; touch-action: none; }
.gm-tatrix-side { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 90px; }
.gm-tatrix-side > span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--gm-muted); font-weight: 700; }
.gm-tatrix-next { background: #1b1a24; border-radius: 8px; }
.gm-tatrix-stats { display: grid; grid-template-columns: 1fr; gap: 2px; text-align: center; margin-top: 6px; }
.gm-tatrix-stats span { font-size: 11px; color: var(--gm-muted); text-transform: uppercase; letter-spacing: .05em; }
.gm-tatrix-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.gm-tatrix-pad { display: flex; gap: 8px; margin-top: 12px; width: 100%; max-width: 360px; }
.gm-tatrix-btn { flex: 1; min-height: 52px; border-radius: var(--gm-r-md); border: 1px solid var(--gm-line); background: var(--gm-panel); font-size: 20px; touch-action: none; user-select: none; }
.gm-tatrix-btn:active { background: var(--gm-panel2); }

/* ═══ iBhloko Blast ═══ */
.gm-blox { width: 100%; max-width: 380px; --bx-empty: #232d63; --bx-border: #2c3878; }
.gm-blox-wrap { position: relative; touch-action: none; }
.gm-blox-board { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; background: #10163a; border: 1px solid var(--bx-border); border-radius: 14px; padding: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.gm-blox-cell { aspect-ratio: 1; border-radius: 22%; background: var(--bx-empty); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25); transition: background .08s; }
.gm-blox-filled { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), inset 0 3px 0 rgba(255, 255, 255, .32), 0 1px 3px rgba(0, 0, 0, .4); }
.gm-blox-ghost { filter: brightness(1.9) saturate(.6); opacity: .55; }
.gm-blox-glow:not(.gm-blox-filled) { background: #3d4d9e; }
.gm-blox-glow.gm-blox-filled { filter: brightness(1.45); }
.gm-blox-clearing { animation: gm-blast .3s ease-in forwards; }
@keyframes gm-blast { 0% { transform: scale(1); filter: brightness(1.9); } 100% { transform: scale(0); filter: brightness(2.5); opacity: 0; } }
.gm-blox-c0 { background: linear-gradient(180deg, #ffcf6b, #f5a623); } .gm-blox-c1 { background: linear-gradient(180deg, #ff7d8e, #f0455c); }
.gm-blox-c2 { background: linear-gradient(180deg, #64e39c, #2bb864); } .gm-blox-c3 { background: linear-gradient(180deg, #6db5ff, #3183e8); }
.gm-blox-c4 { background: linear-gradient(180deg, #c893ff, #9256e8); } .gm-blox-c5 { background: linear-gradient(180deg, #6ee7e0, #23b8b0); }
.gm-blox-c6 { background: linear-gradient(180deg, #ffa46b, #ef7024); } .gm-blox-c7 { background: linear-gradient(180deg, #f9e26b, #e3c522); }
.gm-blox-tray { display: flex; justify-content: space-around; align-items: center; gap: 8px; margin-top: 12px; min-height: 96px; touch-action: none; }
.gm-blox-slot { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 88px; }
.gm-blox-piece { display: grid; gap: 3px; cursor: grab; touch-action: none; transition: transform .15s, opacity .15s; }
.gm-blox-dragging { opacity: 0; pointer-events: none; }
.gm-blox-unusable { opacity: .35; filter: grayscale(.6); }
.gm-blox-pcell { border-radius: 22%; }
.gm-blox-on { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .32), 0 1px 3px rgba(0, 0, 0, .4); }
.gm-blox-off { background: transparent; box-shadow: none; }
.gm-blox-enter { animation: gm-piece-in .28s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes gm-piece-in { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.gm-blox-float { position: fixed; left: 0; top: 0; display: grid; gap: 4px; pointer-events: none; z-index: 47; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .45)); }
.gm-blox-float[hidden] { display: none; }
.gm-blox-popups { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 2; }
.gm-blox-pop { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 900; white-space: nowrap; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); animation: gm-float-up .9s ease-out forwards; }
.gm-blox-points { color: #fff; font-size: 26px; } .gm-blox-combo { color: #ffb83d; font-size: 30px; }
@keyframes gm-float-up { 0% { opacity: 0; margin-top: 10px; transform: translateX(-50%) scale(.6); } 20% { opacity: 1; transform: translateX(-50%) scale(1.15); } 100% { opacity: 0; margin-top: -60px; transform: translateX(-50%) scale(1); } }
.gm-blox-shake { animation: gm-shake .3s; }
@keyframes gm-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ═══ Snakes & Ladders ═══ */
.gm-snakes { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.gm-snakes-banner { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.gm-snakes-banner b { font-size: 18px; }
.gm-snakes-banner span { font-size: 12.5px; color: var(--gm-muted); }
.gm-snakes-boardwrap { background: var(--gm-panel); border: 1px solid var(--gm-line); border-radius: var(--gm-r-lg); padding: 8px; box-shadow: var(--gm-lift-1); }
.gm-snakes-svg { width: 100%; height: auto; display: block; }
.gm-snakes-sq { fill: #efe3c4; stroke: #e2d3ad; stroke-width: 1; }
.gm-snakes-sq-light { fill: #f9f3e3; }
.gm-snakes-num { font-size: 9px; fill: #8a7a58; font-family: var(--gm-mono); }
.gm-snakes-ladder { stroke: #2c6e34; stroke-width: 3; stroke-linecap: round; opacity: .85; }
.gm-snakes-rung { stroke: #2c6e34; stroke-width: 2; opacity: .85; }
.gm-snakes-snake { fill: none; stroke: #c23b3b; stroke-width: 6; stroke-linecap: round; opacity: .8; }
.gm-snakes-head { fill: #8e1f1f; }
.gm-snakes-token-ini { font-size: 11px; font-weight: 800; fill: #fff; font-family: inherit; }
.gm-snakes-token-turn circle { filter: drop-shadow(0 0 5px rgba(199, 154, 46, .9)); }
.gm-snakes-players { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
.gm-snakes-player { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: var(--gm-r-pill); background: var(--gm-panel2); }
.gm-snakes-player-turn { background: var(--gm-accent-soft); font-weight: 700; }
.gm-snakes-player i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.gm-snakes-player b { font-variant-numeric: tabular-nums; }
.gm-snakes-actions { display: flex; flex-direction: column; gap: 8px; }
.gm-snakes-wait { text-align: center; font-size: 13px; color: var(--gm-muted); }
.gm-snakes-log { font-size: 12.5px; color: var(--gm-muted); display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.gm-snakes-log li::before { content: '· '; }

@media (min-width: 720px) {
  .gm-tiles { grid-template-columns: repeat(3, 1fr); }
  .gm-tile-together { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .gm-root *, .gm-blox-float { animation: none !important; transition: none !important; }
}

/* ═══ Chess (games-play-chess.js) ═══ */
/* GoldChat Games — the Chess board.
   Every class is gm-chess-*; colours and radii come from the hub's tokens in games.css. The
   squares are the app's cream and gold; every mark on the board is a translucent overlay so it
   reads the same on a light square and a dark one. No asset, no font: the pieces are glyphs. */
.gm-chess { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.gm-chess-banner { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.gm-chess-banner b { font-size: 18px; }
.gm-chess-banner span { font-size: 12.5px; color: var(--gm-muted); line-height: 1.45; }

/* The panel keeps a slim 6px inset so eight 40px squares still fit a 375px phone. */
.gm-chess-boardwrap {
  position: relative; background: var(--gm-panel); border: 1px solid var(--gm-line);
  border-radius: var(--gm-r-lg); padding: 6px; box-shadow: var(--gm-lift-1);
}
.gm-chess-svg { width: 100%; height: auto; display: block; border-radius: var(--gm-r-sm); overflow: hidden; touch-action: manipulation; }
.gm-chess-sq-light { fill: #f2e8cf; }
.gm-chess-sq-dark { fill: #b9975b; }
.gm-chess-last { fill: rgba(120, 160, 60, .42); }
.gm-chess-check { fill: rgba(214, 48, 48, .62); }
.gm-chess-sel { fill: none; stroke: var(--gm-gold); stroke-width: 3; }
.gm-chess-dot { fill: rgba(59, 49, 34, .32); }
.gm-chess-ring { fill: none; stroke: rgba(59, 49, 34, .38); stroke-width: 4; }
.gm-chess-piece {
  font-size: 32px; fill: #2b2417; pointer-events: none; user-select: none; -webkit-user-select: none;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "DejaVu Sans", sans-serif;
}
.gm-chess-coord { font-size: 8.5px; font-weight: 700; font-family: var(--gm-mono); pointer-events: none; user-select: none; }
.gm-chess-coord-on-light { fill: #8f6a12; }
.gm-chess-coord-on-dark { fill: #f2e8cf; }
.gm-chess-tap { cursor: pointer; }
.gm-chess-tap:focus { outline: none; }
.gm-chess-tap:focus-visible > rect:first-child { stroke: var(--gm-accent); stroke-width: 3; }
.gm-chess-busy .gm-chess-svg { cursor: progress; opacity: .92; }

/* The promotion chooser floats over the board; the hub sets display per class, so [hidden]
   has to be spelt out here or the flex rule would win over the attribute. */
.gm-chess-chooser {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(59, 49, 34, .36); border-radius: var(--gm-r-lg); padding: 12px;
}
.gm-chess-chooser[hidden] { display: none !important; }
.gm-chess-chooser-card {
  background: var(--gm-panel); border-radius: var(--gm-r-lg); padding: 12px; box-shadow: var(--gm-lift-2);
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px;
}
.gm-chess-chooser-card > b { text-align: center; font-size: 14px; }
.gm-chess-chooser-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gm-chess-chooser-row .gm-btn { flex-direction: column; gap: 2px; min-height: 66px; padding: 8px 2px; font-size: 11.5px; }
.gm-chess-chooser-row .gm-btn i { font-style: normal; font-size: 30px; line-height: 1; }

.gm-chess-players { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; }
.gm-chess-player {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px;
  border-radius: var(--gm-r-pill); background: var(--gm-panel2);
}
.gm-chess-player-turn { background: var(--gm-accent-soft); font-weight: 700; }
.gm-chess-player-empty { color: var(--gm-muted); border: 1px dashed var(--gm-line); background: none; }
.gm-chess-player i { font-style: normal; font-size: 18px; line-height: 1; }

.gm-chess-actions { display: flex; flex-direction: column; gap: 8px; }
.gm-chess-row { display: flex; gap: 8px; align-items: center; }
.gm-chess-row .gm-btn { flex: 1 1 0; }
.gm-chess-row .gm-chess-wait { flex: 1 1 0; }
.gm-chess-wait { text-align: center; font-size: 13px; color: var(--gm-muted); margin: 0; line-height: 1.45; }
.gm-root .gm-chess-danger { color: var(--gm-danger); border-color: var(--gm-danger); }

/* The move list: pairs down the page, newest at the bottom, scrolling once it is long. */
.gm-root ol.gm-chess-moves {
  list-style: none; margin: 0; padding: 6px 10px; max-height: 168px; overflow-y: auto;
  background: var(--gm-panel2); border-radius: var(--gm-r-md);
  font-family: var(--gm-mono); font-size: 13px; display: flex; flex-direction: column; gap: 2px;
}
.gm-chess-moves li { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 6px; align-items: baseline; }
.gm-chess-moves li b { color: var(--gm-muted); font-weight: 600; }
.gm-chess-moves li span { padding: 1px 6px; border-radius: 4px; }
/* The empty line is prose, not a move row: one column, the hub's face. */
.gm-chess-moves li.gm-chess-empty { display: block; font-family: inherit; color: var(--gm-muted); }
.gm-chess-move-last { background: var(--gm-accent-soft); font-weight: 700; }
.gm-chess-empty { display: block; text-align: center; font-size: 12.5px; color: var(--gm-muted); font-family: inherit; }

/* ═══ Penalty Shootout (games-play-shootout.js) ═══ */
/* GoldChat Games — the penalty shootout pitch.
   Everything is prefixed gm-shoot- and reads the hub's tokens (--gm-panel, --gm-line,
   --gm-muted, --gm-ink, --gm-gold, --gm-r-lg, --gm-lift-1 …) so it follows the palette.
   The zone grid is HTML laid over the SVG goal by percentages of the SVG's 360×240 box:
   the goal mouth is x 44–316 (12.22% across, 75.56% wide) and y 44–190 (18.33% down,
   60.83% tall). Move those numbers in games-play-shootout.js and these must move too. */

.gm-shoot { width: 100%; display: flex; flex-direction: column; gap: 12px; }

/* banner */
.gm-shoot-banner { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.gm-shoot-banner b { font-size: 18px; }
.gm-shoot-banner span { font-size: 12.5px; color: var(--gm-muted); }
.gm-shoot-banner .gm-shoot-err { color: var(--gm-danger); font-weight: 600; }

/* scoreboard */
.gm-shoot-score {
  background: var(--gm-panel); border: 1px solid var(--gm-line); border-radius: var(--gm-r-lg);
  padding: 10px 12px; box-shadow: var(--gm-lift-1); display: flex; flex-direction: column; gap: 6px;
}
.gm-shoot-tally { display: flex; align-items: center; justify-content: center; gap: 8px; font-variant-numeric: tabular-nums; }
.gm-shoot-tally b { font-size: 28px; line-height: 1; }
.gm-shoot-tally em { font-style: normal; font-size: 20px; color: var(--gm-muted); line-height: 1; }
.gm-shoot-tally span { font-size: 13px; color: var(--gm-muted); max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-shoot-phase { text-align: center; font-size: 11px; color: var(--gm-muted); letter-spacing: .05em; text-transform: uppercase; font-weight: 700; }
.gm-shoot-player { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--gm-r-sm); font-size: 13px; }
.gm-shoot-player-owes { background: var(--gm-accent-soft); }
.gm-shoot-player-empty { color: var(--gm-muted); font-style: italic; justify-content: center; }
.gm-shoot-player > i { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.gm-shoot-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.gm-shoot-role { font-size: 11px; color: var(--gm-muted); white-space: nowrap; }
.gm-shoot-dots { display: inline-flex; align-items: center; gap: 3px; font-size: 15px; line-height: 1; flex: none; }
.gm-shoot-dot { font-weight: 400; }
.gm-shoot-dot-goal { color: var(--gm-ok); }
.gm-shoot-dot-miss { color: var(--gm-danger); }
.gm-shoot-dot-open { color: var(--gm-muted); opacity: .45; }
.gm-shoot-gap { width: 1px; height: 14px; background: var(--gm-line); margin: 0 3px; display: inline-block; }
.gm-shoot-goals { font-size: 16px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; flex: none; }

/* the goal */
.gm-shoot-pitch {
  background: var(--gm-panel); border: 1px solid var(--gm-line); border-radius: var(--gm-r-lg);
  padding: 6px 6px 8px; box-shadow: var(--gm-lift-1); display: flex; flex-direction: column; gap: 6px;
}
.gm-shoot-goalbox { position: relative; }
.gm-shoot-svg { width: 100%; height: auto; display: block; border-radius: var(--gm-r-md); }
.gm-shoot-sky { fill: var(--gm-bg2); }
.gm-shoot-grass { fill: #cfe0b4; }
.gm-shoot-line { stroke: #fff; stroke-width: 2; }
.gm-shoot-net line { stroke: #cdbf9c; stroke-width: 1; opacity: .8; }
.gm-shoot-post { fill: #fff; stroke: #b9a57a; stroke-width: 1.5; }
.gm-shoot-ball-skin { fill: #fff; stroke: var(--gm-ink); stroke-width: 1.5; }
.gm-shoot-ball-mark { fill: var(--gm-ink); }
.gm-shoot-word { font-size: 18px; font-weight: 900; font-family: inherit; letter-spacing: .02em; }
.gm-shoot-word-goal { fill: var(--gm-ok); }
.gm-shoot-word-saved { fill: var(--gm-danger); }
.gm-shoot-word-wide { fill: var(--gm-muted); }
.gm-shoot-last { font-size: 12.5px; color: var(--gm-muted); text-align: center; line-height: 1.45; padding: 0 4px; }
.gm-shoot-last[hidden] { display: none !important; }

/* the zone grid over the mouth of the goal */
.gm-shoot-zones {
  position: absolute; left: 12.22%; top: 18.33%; width: 75.56%; height: 60.83%;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 4px;
}
.gm-shoot-zones[hidden] { display: none !important; }
.gm-root .gm-shoot-zone {
  border: 2px dashed rgba(143, 106, 18, .55); background: rgba(255, 255, 255, .28); border-radius: 8px;
  padding: 0 0 4px; display: flex; align-items: flex-end; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--gm-gold-hover); line-height: 1.2;
  transition: background .12s;
}
.gm-shoot-zone:hover:not(:disabled) { background: rgba(255, 255, 255, .5); }
.gm-shoot-zone.on { background: rgba(143, 106, 18, .82); border-style: solid; border-color: var(--gm-gold); color: #fff; }
.gm-shoot-zone:disabled { cursor: default; }
.gm-shoot-zone:disabled:not(.on) { opacity: .35; }

/* choosing */
.gm-shoot-choose { display: flex; flex-direction: column; gap: 8px; }
.gm-shoot-power { display: flex; background: var(--gm-panel2); border-radius: var(--gm-r-pill); padding: 3px; gap: 2px; }
.gm-shoot-power button {
  flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: var(--gm-r-pill);
  font-size: 13.5px; font-weight: 700; color: var(--gm-muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.gm-shoot-power button small { font-size: 10.5px; font-weight: 600; opacity: .85; }
.gm-shoot-power button.on { background: var(--gm-panel); color: var(--gm-ink); box-shadow: var(--gm-lift-1); }
.gm-shoot-rule { font-size: 12.5px; color: var(--gm-muted); text-align: center; line-height: 1.5; }
.gm-shoot-note { text-align: center; font-size: 12.5px; color: var(--gm-gold-hover); font-weight: 600; }
.gm-shoot-hint { text-align: center; font-size: 12px; color: var(--gm-muted); }
.gm-shoot-go { font-size: 17px; min-height: 56px; }
.gm-shoot-chosen { text-align: center; font-weight: 700; font-size: 14px; }
.gm-shoot-yours { text-align: center; font-size: 12.5px; color: var(--gm-muted); }

/* actions and the log */
.gm-shoot-actions { display: flex; flex-direction: column; gap: 8px; }
.gm-shoot-wait { text-align: center; font-size: 13px; color: var(--gm-muted); }
.gm-root ol.gm-shoot-log {
  font-size: 12.5px; color: var(--gm-muted); display: flex; flex-direction: column; gap: 4px;
  padding: 0 4px; max-height: 220px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.gm-shoot-log li::before { content: '· '; }
.gm-shoot-log li b { font-variant-numeric: tabular-nums; color: var(--gm-ink); }
.gm-shoot-kick-goal b { color: var(--gm-ok); }
.gm-shoot-kick-saved b { color: var(--gm-danger); }

/* ═══ the game bar under the chat header ═══
   One strip that stays put while the chat scrolls — like a pinned message — saying whose go
   it is for each open match in this chat. Drawn in the reply bar's palette so it reads as
   part of the conversation's chrome rather than a banner. When it is YOUR go the entry is
   stronger gold and bold, because that is the one thing the strip exists to catch. */
.gm-bar {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 6px 10px; background: #faf6ec; border-bottom: 1px solid #eee3c9;
  -webkit-overflow-scrolling: touch;
}
.gm-bar::-webkit-scrollbar { display: none; }
.gm-bar.hidden, .gm-bar[hidden] { display: none; }
.gm-bar-row {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; max-width: 86%;
  padding: 5px 12px 5px 8px; border: 1px solid #eee3c9; border-left: 3px solid #d8c9a3;
  border-radius: 10px; background: #fffdf7; color: #3b3122; font: inherit; text-align: left; cursor: pointer;
}
.gm-bar-row:focus-visible { outline: 2px solid #c79a2e; outline-offset: 1px; }
.gm-bar-row:only-child { max-width: 100%; }
.gm-bar-art { font-size: 17px; line-height: 1; }
.gm-bar-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gm-bar-game { font-size: 11px; font-weight: 700; color: #8a7a58; letter-spacing: .01em; white-space: nowrap; }
.gm-bar-state { font-size: 13px; color: #4a4030; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-bar-mine { border-left-color: #c79a2e; background: #fdf3d6; }
.gm-bar-mine .gm-bar-state { color: #8a6410; font-weight: 800; }
.gm-bar-mine .gm-bar-state::after { content: ' ›'; }
