/* ============================================================
   PETTY CUP — "THE TROPHY CLUB — FINAL CUT" shell styles.
   Game-board styles live in games.css.
   A century-old members' institution that happens to adjudicate
   Wordle. Racing-green clubhouse band, aged-ivory cardstock,
   brushed brass spent only where ceremony is earned.
   Plaque-gradient budget (exactly four): .seg-btn.active,
   .g-toggle.on, .cta, dialog::before.
   Loop budget (exactly two): .dot.going pulse, lastCall breath.
   RULE: every color-mix() is preceded by an rgba() fallback.
   ============================================================ */
:root {
  /* — the metal (the cup itself) — */
  --gold-hi:     #f4cd6f;
  --gold:        #d9942b;            /* = legacy --crust */
  --gold-deep:   #a8690f;
  --gold-shade:  #7a4c08;
  --gold-text:   #8a5f06;            /* text-gold: 5.4:1 on --card */
  --plaque:      linear-gradient(168deg, var(--gold-hi) 0%, var(--gold) 34%, var(--gold-deep) 68%, #e7b653 100%);
  --plaque-edge: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(0,0,0,.22);
  --on-gold:     #3a2706;            /* engraved text on mid-gold ≈5.1:1 */

  /* — the clubhouse — */
  --club:        #234534;            /* racing green */
  --club-deep:   #16301f;
  --club-band:   linear-gradient(180deg, #2a5440 0%, #1d3a2b 100%);
  --claret:      #7e2a33;            /* oxblood — danger / last call */
  --alt-fill:    linear-gradient(180deg, #2a5440, var(--club));
  --on-club:     #f6ecd6;

  /* — the room — */
  --bg:          #f3ebdb;            /* aged ivory */
  --card:        #fdfaf2;            /* cardstock */
  --well:        #f1e8d4;            /* recessed wells: inputs, chips, seg track */
  --ink:         #2b2013;            /* walnut */
  --ink-soft:    #84715e;
  --line:        #e6d9c0;
  --line-strong: #cab690;
  --engrave:     0 1px 0 rgba(255,255,255,.5);

  /* — semantics — */
  --good:        #2e7d4f;
  --bad:         var(--claret);

  /* — shape & depth — */
  --radius:      12px;               /* cards, dialogs */
  --radius-ctl:  9px;                /* buttons, inputs, tiles, chips */
  --shadow:      0 1px 2px rgba(43,32,19,.06), 0 6px 18px rgba(43,32,19,.09);
  --shadow-press:0 1px 3px rgba(43,32,19,.18);
  --frame:       inset 0 0 0 4px var(--card), inset 0 0 0 5px var(--line); /* engraved double rule — cards & dialogs ONLY */
  --inset-well:  inset 0 1px 3px rgba(43,32,19,.08);
  --inset-track: inset 0 1px 3px rgba(43,32,19,.12);
  --sheen:       inset 0 1px 0 rgba(255,255,255,.5);

  /* — type — */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* — motion — */
  --ease-velvet: cubic-bezier(.22,.7,.25,1);     /* entrances */
  --ease-stamp:  cubic-bezier(.34,1.56,.64,1);   /* the FINAL stamp only */
  --t-press: 90ms;  --t-ui: 260ms;  --t-ceremony: 450ms;

  /* — legacy aliases (DO NOT DELETE) — */
  --crust: var(--gold);
  --crust-deep: var(--gold-deep);
  --crumb: var(--club);              /* .cta.alt pours racing green */
}

@media (prefers-color-scheme: dark) { :root {
  /* "after hours" — same room, lamps low, brass catches the light */
  --gold-hi:     #f6d27c;
  --gold:        #e2a93e;
  --gold-deep:   #b97f17;
  --gold-shade:  #8a5c0d;
  --gold-text:   #e9b65c;            /* role-inverts: 8.9:1 on dark card */
  --plaque:      linear-gradient(168deg, #e8bb56 0%, #c98f25 36%, #966c12 70%, #d4a847 100%);
  --plaque-edge: inset 0 1px 0 rgba(255,255,255,.30), inset 0 -1px 0 rgba(0,0,0,.45);
  --on-gold:     #2c1d04;
  --club:        #3c6e51;
  --club-deep:   #20402e;
  --club-band:   linear-gradient(180deg, #1e3527 0%, #142318 100%);
  --claret:      #c96a74;            /* lightened for text/border roles on dark */
  --alt-fill:    linear-gradient(180deg, var(--club-deep), #142318);
  --on-club:     #e9dcb9;
  --bg:          #181410;
  --card:        #221c13;
  --well:        #1c1610;
  --ink:         #eee3cd;
  --ink-soft:    #a4937a;
  --line:        #3a3122;
  --line-strong: #52452e;
  --engrave:     0 -1px 0 rgba(0,0,0,.6);        /* emboss flips under lamp-light */
  --good:        #5cae82;
  --shadow:      0 2px 6px rgba(0,0,0,.40), 0 10px 28px rgba(0,0,0,.35);
  --shadow-press:0 1px 3px rgba(0,0,0,.5);
  --inset-well:  inset 0 1px 3px rgba(0,0,0,.35);
  --inset-track: inset 0 1px 3px rgba(0,0,0,.4);
  --sheen:       inset 0 1px 0 rgba(255,255,255,.06);
}}

/* ---------- foundation ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* iOS rubber-band fix: green shows on top overscroll (behind the
   masthead band), ivory on bottom overscroll. No torn doors. */
html {
  font-size: 16px;
  background: var(--club-deep);
  background: linear-gradient(var(--club-deep) 0 50%, var(--bg) 50% 100%);
}
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* every score and timer in tabular figures */
.scoreboard td b, .scoreboard td.tot, .scoreboard th.tot,
.g-timer, .g-score, .log-ago, .room-date, .room-code, .code-in, .hist-win {
  font-variant-numeric: tabular-nums;
}

main { width: 100%; max-width: 720px; margin: 0 auto; padding: 10px 14px 30px; flex: 1; }

.screen { display: none; }
.screen.active { display: block; animation: rise var(--t-ui) var(--ease-velvet); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- masthead: the clubhouse door ---------- */
.top {
  text-align: center;
  background: var(--club-deep);
  background: var(--club-band);
  border-bottom: 4px double var(--gold-deep);
  margin: calc(env(safe-area-inset-top, 0px) * -1) calc(env(safe-area-inset-right, 0px) * -1) 0 calc(env(safe-area-inset-left, 0px) * -1);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
}
.top .tag {
  margin: 4px 0 0;
  font: italic 500 .9rem var(--font-display);
  color: rgba(243,232,205,.85);
}
.est-line {
  font: 600 .58rem var(--font-ui);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(244,205,111,.55);
  margin: 8px 0 0;
}

/* ---------- refresh title button ---------- */
.top-title {
  font: 900 1.9rem/1.1 var(--font-display);
  color: var(--gold-hi);
  text-shadow: 0 1px 0 rgba(0,0,0,.45), 0 0 18px rgba(244,205,111,.22);
  background: none; border: none; cursor: pointer;
  padding: 4px 10px; border-radius: var(--radius);
  display: inline-flex; align-items: center; gap: 8px;
}
.top-title:active { transform: scale(.97); }
.top-emoji {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2f5a43, #1a3325 70%);
  box-shadow: inset 0 0 0 2px var(--gold-deep), inset 0 0 0 3px rgba(244,205,111,.35), 0 1px 4px rgba(0,0,0,.3);
  font-size: 1.3rem;
}
.refresh-glyph { font-size: 1rem; color: rgba(246,210,124,.55); transition: transform .2s ease; }
.top-title:hover .refresh-glyph { color: var(--gold-hi); }
.top-title.spin .refresh-glyph { animation: spin360 .6s ease; }
@keyframes spin360 { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- cards: cardstock plates ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--frame);
  padding: 16px;
  margin: 12px 0;
}
.card h2 {
  font: 700 1.02rem/1.2 var(--font-display);
  letter-spacing: .01em;
  color: var(--ink);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.card h2::before {
  content: ''; display: inline-block;
  width: 7px; height: 7px;
  background: var(--gold);
  margin-right: 8px;
}
.card h2 .hint-txt { font: 600 .72rem var(--font-ui); letter-spacing: 0; border: none; color: var(--ink-soft); }
.hint-txt { color: var(--ink-soft); font-size: .8rem; line-height: 1.55; font-weight: 400; margin: 8px 0 0; }
.err { color: var(--claret); font-weight: 600; margin: 8px 0 0; }

/* ---------- inputs: recessed brass-rimmed wells ---------- */
.big-in {
  width: 100%;
  font-size: 1.15rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  background: var(--well);
  color: var(--ink);
  caret-color: var(--gold-deep);
  box-shadow: var(--inset-well);
  outline: none;
}
.big-in:focus, .game-card textarea:focus, dialog textarea:focus {
  border-color: var(--gold-deep);
  box-shadow: var(--inset-well), 0 0 0 3px rgba(217,148,43,.28);
  box-shadow: var(--inset-well), 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent);
}
.big-in::placeholder, .game-card textarea::placeholder, dialog textarea::placeholder {
  color: var(--ink-soft); opacity: .7;
}
.code-in {
  font: 700 1.3rem var(--font-display);
  text-transform: uppercase; letter-spacing: .35em; text-align: center;
}

/* ---------- buttons ---------- */
.cta, .ghost, .mini-btn {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-ctl);
  border: none;
  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease, filter .15s ease;
}
.ghost:active, .mini-btn:active { transform: scale(.97); }
.cta {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 13px;
  font: 600 1.05rem var(--font-display);
  letter-spacing: .01em;
  color: var(--on-gold);
  background: var(--plaque);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  box-shadow: var(--plaque-edge), 0 2px 6px rgba(43,32,19,.22);
  text-align: center;
  text-decoration: none;
}
.cta:active { transform: translateY(1px); box-shadow: var(--plaque-edge), var(--shadow-press); }
.cta.alt {
  background: var(--crumb);
  background: var(--alt-fill);
  color: var(--on-club);
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 6px rgba(43,32,19,.22);
}
.cta.alt:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), var(--shadow-press); }
.ghost {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 12px;
  font: 600 1rem var(--font-ui);
  background: transparent;
  border: 1.5px solid var(--line-strong);
  color: var(--ink-soft);
}
.ghost:hover, .ghost:active { border-color: var(--gold-deep); color: var(--ink); }
.ghost.danger {
  color: var(--claret);
  border-color: rgba(126,42,51,.55);
  border-color: color-mix(in srgb, var(--claret) 55%, var(--line-strong));
  max-width: 720px; margin: 4px auto 20px;
}
.ghost.danger:hover, .ghost.danger:active { border-color: var(--claret); color: var(--claret); }
.mini-btn {
  padding: 8px 12px;
  font: 600 .8rem var(--font-ui);
  background: var(--well);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 8px;
  box-shadow: var(--sheen);
}
.mini-btn.danger { color: var(--claret); border-color: var(--claret); }
.join-row { display: flex; gap: 8px; margin-top: 10px; }
.join-row .code-in { flex: 1; }
.join-row .cta { width: auto; margin: 0; padding: 12px 22px; }

/* ---------- avatars: member portraits in the tray ---------- */
/* the portrait span (inline svg) — sized by context, baseline-tuned for text rows */
.av { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.32em; }
.av svg { display: block; width: 100%; height: 100%; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.ava {
  padding: 7px 0 4px;
  background: var(--well);
  border: 2px solid var(--line);
  border-radius: var(--radius-ctl);
  cursor: pointer;
  line-height: 0;
  transition: transform var(--t-ui) var(--ease-velvet), box-shadow var(--t-ui), border-color var(--t-ui), background var(--t-ui);
}
.ava .av { width: 52px; height: 52px; vertical-align: 0; }
.ava:active { transform: scale(.94); }
/* picked up off the table — the shadow GROWS as the piece lifts */
.ava.sel {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  background: rgba(217,148,43,.14);
  background: color-mix(in srgb, var(--gold) 14%, var(--well));
  box-shadow: inset 0 0 0 1px var(--gold-hi), 0 4px 10px -2px rgba(43,32,19,.35);
}

/* ---------- room head: the locker plate ---------- */
.room-code-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.room-code-row .lbl {
  display: block;
  font: 700 .62rem var(--font-ui);
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--ink-soft);
}
.room-code {
  font: 900 1.6rem var(--font-display);
  letter-spacing: .26em;
  color: var(--gold-text);
  text-shadow: var(--engrave);
  background: none; border: none; cursor: pointer; padding: 0 0 1px;
  border-bottom: 2px dotted rgba(138,95,6,.45);
  border-bottom-color: color-mix(in srgb, var(--gold-text) 45%, transparent);
}
.room-date { font: 600 1.05rem var(--font-display); }
.room-code-row .mini-btn { margin-left: auto; }
.net-status {
  margin-top: 8px;
  font: 600 .74rem var(--font-ui);
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft);
}

/* ---------- player chips: member badges ---------- */
.players-strip { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
/* Center the chips when they fit (1 player = dead center) but stay scrollable
   when 7-8 chips overflow — plain justify-content:center would clip the left edge. */
.players-strip .p-chip:first-child { margin-left: auto; }
.players-strip .p-chip:last-child { margin-right: auto; }
.p-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 64px; padding: 8px 6px;
  background: var(--well); border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
}
.p-chip.me { border-color: var(--gold-deep); box-shadow: inset 0 0 0 1px var(--gold-hi); }
.p-chip.away { opacity: .5; }
.p-chip.away .p-ava { filter: saturate(.25); }
.p-ava { font-size: 1.5rem; line-height: 0; }
.p-ava .av { width: 36px; height: 36px; vertical-align: 0; }
.p-name { font: 600 .72rem var(--font-ui); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-dots { display: flex; gap: 3px; margin-top: 2px; }
.p-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.p-dots .dot.going { background: var(--gold); animation: pulse 1.2s infinite; }
.p-dots .dot.done { background: var(--good); }
@keyframes pulse { 50% { opacity: .4; } }

/* ---------- launcher: the fixtures board ---------- */
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
.g-tile {
  position: relative;
  background: var(--card);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  box-shadow: 0 1px 2px rgba(43,32,19,.08);
  transition: transform var(--t-press) ease, border-color .15s ease, opacity .15s ease;
}
.g-tile-body {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; padding: 14px 8px; font: inherit; cursor: pointer;
  background: none; border: none; color: inherit; border-radius: 7px;
}
.g-tile:active { transform: translateY(1px); }
.g-tile.open {
  border-color: var(--gold-deep);
  background: rgba(217,148,43,.10);
  background: color-mix(in srgb, var(--gold) 10%, var(--card));
  box-shadow: inset 0 0 0 1px var(--gold-hi), 0 1px 2px rgba(43,32,19,.08);
}
.g-tile.played { border-color: var(--good); }
.g-tile.off { opacity: .45; border-style: dashed; filter: saturate(.4); }
.g-emoji { font-size: 1.8rem; }
.g-name { font: 700 .88rem var(--font-display); }
.g-score { font-size: .75rem; color: var(--ink-soft); font-weight: 600; }
.g-tile.played .g-score { color: var(--good); font-weight: 700; }
/* THE RESULT IS FINAL — the clerk's stamp slams down once, overshoots, settles.
   Top-LEFT is mandatory: the host's ⚙ toggle owns top-right. */
.g-tile.played::after {
  content: 'FINAL';
  position: absolute; top: 6px; left: 6px;
  transform: rotate(-6deg);
  font: 800 .5rem var(--font-ui);
  letter-spacing: .12em;
  color: var(--gold-text);
  border: 1.5px solid currentColor;
  border-radius: 3px;
  padding: 2px 5px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(43,32,19,.25);
  animation: stampIn var(--t-ceremony) var(--ease-stamp) backwards;
}
@keyframes stampIn { from { transform: rotate(-6deg) scale(1.7); opacity: 0; } }
.g-timer {
  font: 600 .64rem/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft);
}
/* Family build (config.js puts .fam on <html>): a lobby-less clubhouse locked
   to one standing room — joining, inviting, practicing, and pinning have no
   meaning there, so their chrome never renders. */
.fam .join-row, .fam #btn-solo, .fam #btn-share, .fam #btn-pin { display: none !important; }

/* Already played: the countdown to the NEXT puzzle — informational, no urgency. */
.g-timer.next { opacity: .62; }
/* LAST CALL (<1h): oxblood pill breathing slowly — opacity only. */
.g-timer.urgent {
  color: #fff;
  background: var(--claret);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .06em;
  display: inline-block;
  animation: lastCall 1.8s ease-in-out infinite;
}
@keyframes lastCall { 50% { opacity: .78; } } /* trough stays legible (~4:1) in both schemes */
/* FRESH FIXTURES (rolled over): a calm gold notice, no alarm.
   (Requires the additive 'rolled' token in arena-app.js; degrades
   to the claret pill — current shipping behavior — without it.) */
.g-timer.urgent.rolled {
  background: rgba(217,148,43,.16);
  background: color-mix(in srgb, var(--gold) 16%, var(--card));
  color: var(--gold-text);
  animation: none;
}
.g-tile:has(.g-timer.urgent:not(.rolled)) {
  border-color: rgba(126,42,51,.55);
  border-color: color-mix(in srgb, var(--claret) 55%, var(--line-strong));
}
/* dark mode lightens claret for border/text roles, so the pill needs dark
   ink on it instead of white (#fff on #c96a74 measures ~3.2:1 — fails AA) */
@media (prefers-color-scheme: dark) {
  .g-timer.urgent { color: #2b1014; font-weight: 700; }
}
/* host on/off switch — a 26px brass coin, top-right corner of a tile */
.g-toggle {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  font: inherit; font-size: .9rem; line-height: 1; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.g-toggle.on {
  background: var(--plaque);
  border-color: var(--gold-shade);
  color: var(--on-gold);
  box-shadow: var(--plaque-edge);
}
.g-toggle.on:active { transform: translateY(1px); }

.game-card { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 14px; }
.game-card textarea {
  width: 100%; margin-top: 10px; padding: 10px; font: inherit;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-ctl);
  background: var(--well); color: var(--ink);
  caret-color: var(--gold-deep);
  box-shadow: var(--inset-well);
  outline: none;
}
.entry-head .cta { margin: 0; }

/* ---------- scoreboard: the honours board ---------- */
.scoreboard { overflow-x: auto; }
.scoreboard table { width: 100%; border-collapse: collapse; font-size: .9rem; border-top: 3px solid var(--ink); }
.scoreboard th {
  font: 700 .66rem var(--font-ui);
  color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .12em;
  padding: 6px 8px; text-align: center;
}
.scoreboard td { padding: 9px 8px; text-align: center; border-top: 1px solid var(--line); }
.scoreboard td.who { text-align: left; font: 600 .98rem var(--font-display); white-space: nowrap; }
.scoreboard td b { display: block; font: 800 1.02rem var(--font-ui); }
.scoreboard td i { display: block; font-style: normal; font-size: .68rem; color: var(--ink-soft); }
.scoreboard td.tot, .scoreboard th.tot { font-weight: 800; color: var(--gold-text); }
.scoreboard td.tot { font: 900 1.1rem var(--font-display); text-shadow: var(--engrave); }
.scoreboard tr.me td { background: rgba(217,148,43,.07); background: color-mix(in srgb, var(--gold) 7%, transparent); }
.scoreboard tr.me td.who { box-shadow: inset 3px 0 0 var(--gold); }
/* the TOTAL never leaves the page — sticky against horizontal scroll
   (opaque background so scrolled columns can't bleed through) */
.scoreboard td.tot, .scoreboard th.tot {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--card);
  border-left: 1px solid var(--line);
}
.scoreboard tr.me td.tot {
  background: var(--card);
  background: color-mix(in srgb, var(--gold) 7%, var(--card));
}
/* pocket edition: 5 games + TOTAL fit a 375px phone with zero scroll */
@media (max-width: 430px) {
  .scoreboard th { padding: 6px 5px; }
  .scoreboard td { padding: 9px 5px; }
  .scoreboard td.who { font-size: .9rem; }
  /* the agate drops to a second line under the leader's name */
  #scoreboard tbody tr:first-child:not(:only-child) td.who::after { content: 'LEADS' / ''; display: block; margin: 1px 0 0; }
  #season-board tbody tr:first-child:not(:only-child) td.who::after,
  #home-season-board tbody tr:first-child:not(:only-child) td.who::after { content: 'HOLDER' / ''; display: block; margin: 1px 0 0; }
}
/* THE HOLDER — the JS crowns (👑/🏆); CSS only dresses the seat.
   :not(:only-child) so Practice-solo never self-crowns. */
.scoreboard tbody tr:first-child:not(:only-child) {
  background: rgba(217,148,43,.14);
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 16%, transparent), transparent 75%);
}
.scoreboard tbody tr:first-child:not(:only-child) td.tot {
  color: var(--gold-text);
  text-shadow: var(--engrave);
  font-weight: 900;
}
/* agate notation beside the crown — announced on purpose: it's information */
#scoreboard tbody tr:first-child:not(:only-child) td.who::after {
  content: ' · LEADS';
  font: 800 .56rem var(--font-ui);
  letter-spacing: .1em;
  color: var(--gold-text);
  margin-left: 6px;
  vertical-align: 1px;
}
#season-board tbody tr:first-child:not(:only-child) td.who::after,
#home-season-board tbody tr:first-child:not(:only-child) td.who::after {
  content: ' · HOLDER';
  font: 800 .56rem var(--font-ui);
  letter-spacing: .1em;
  color: var(--gold-text);
  margin-left: 6px;
  vertical-align: 1px;
}
/* ceremonial caption — slash alt syntax keeps screen readers silent;
   suppressed over the empty state (no standings to announce yet) */
#season-board:not(:has(table))::before,
#home-season-board:not(:has(table))::before { content: none; }
#season-board::before, #home-season-board::before {
  content: 'PERPETUAL STANDINGS' / '';
  display: block;
  font: 700 .6rem var(--font-ui);
  letter-spacing: .22em;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 6px;
}
.tab-pane[data-pane="season"] .hint-txt { font-size: .68rem; margin-top: 10px; }
.swap-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.swap-row .mini-btn { flex: 1 1 auto; } /* wrapped pairs become full-width bars, not ragged pills */

/* ---------- toast / dialog / footer ---------- */
/* announcement from the chair — identical after hours; objects don't recolor */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #16301f; color: #f3e8cd;
  border: 1px solid var(--gold-deep);
  padding: 10px 18px; border-radius: 999px;
  font: 600 .9rem var(--font-ui);
  box-shadow: inset 0 1px 0 rgba(244,205,111,.18), 0 8px 24px rgba(0,0,0,.35);
  z-index: 50; max-width: 90vw; text-align: center;
  width: max-content; /* shrink-to-fit vs left:50% would cap it at half the viewport */
}
/* a summons from the committee */
dialog {
  border: none; border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  box-shadow: 0 18px 50px rgba(20,14,6,.35), var(--frame);
  padding: 18px; width: min(440px, 92vw);
  overflow: hidden;
}
/* gold bar across the head of the writ (plaque budget slot 4 — spent) */
dialog::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--plaque);
}
dialog[open] { animation: rise var(--t-ui) var(--ease-velvet); }
dialog::backdrop { background: rgba(20,15,8,.55); }
@supports (backdrop-filter: blur(2px)) {
  dialog::backdrop { backdrop-filter: blur(2px); }
}
dialog h2 { margin: 0 0 10px; font: 700 1.1rem var(--font-display); }
dialog textarea {
  width: 100%; font: inherit; font-size: .85rem; padding: 10px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-ctl);
  background: var(--well); color: var(--ink);
  caret-color: var(--gold-deep);
  box-shadow: var(--inset-well);
  outline: none;
}
dialog .swap-row .cta { flex: 1; margin: 0; }
dialog .swap-row .ghost { flex: 1; margin: 0; }

/* fine print on the underside of the base */
.foot { text-align: center; border-top: 1px solid var(--line); margin-top: 8px; padding: 16px 18px 26px; }
.foot::before {
  content: ''; display: block;
  width: 56px; height: 2px;
  margin: 0 auto 12px;
  background: var(--gold-deep);
  opacity: .5; border-radius: 1px;
}
.foot p { margin: 0 auto; max-width: 560px; color: var(--ink-soft); font-size: .72rem; line-height: 1.55; }

/* ---------- segmented tabs: brass switch plate ---------- */
.seg {
  display: flex; gap: 4px;
  background: var(--well);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 4px; margin-bottom: 14px;
  box-shadow: var(--inset-track);
}
.seg-btn {
  flex: 1; min-width: 0;
  font: 700 .82rem var(--font-ui);
  padding: 9px 2px; border: none; border-radius: 8px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-ui) var(--ease-velvet), color var(--t-ui);
}
.seg-btn:active { transform: scale(.97); }
/* a raised brass nameplate in a recessed track (plaque budget slot 1) */
.seg-btn.active {
  background: var(--plaque);
  color: var(--on-gold);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  box-shadow: var(--plaque-edge), 0 1px 3px rgba(43,32,19,.25);
}
.seg-btn.active:active { transform: translateY(1px); }
.seg-btn[hidden] { display: none; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: rise var(--t-ui) var(--ease-velvet); }
@media (max-width: 430px) {
  .seg-btn { font-size: .76rem; padding: 8px 1px; }
}

/* ---------- history: the archive, bound volumes ---------- */
.hist-detail { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.hist-detail h3 { margin: 10px 0 8px; font: 700 1.05rem var(--font-display); }
.hist-detail .cta { margin-top: 12px; }
.sk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; margin: 4px 0 10px;
  background: var(--well); border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
  font-size: .85rem; font-weight: 600;
  box-shadow: var(--inset-well);
}
#history-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px; font: inherit; text-align: left; cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-ctl);
  color: inherit;
  transition: transform var(--t-press) ease;
}
.hist-row:active { transform: translateY(1px); }
.hist-date { font: 700 .95rem var(--font-display); }
.hist-room { font-size: .72rem; color: var(--ink-soft); }
.hist-win { font-size: .82rem; font-weight: 600; color: var(--gold-text); text-align: right; white-space: nowrap; }

.detail-edit { margin-top: 12px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.edit-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.edit-name { flex: 1; font-weight: 600; font-size: .9rem; }
.replay-bar { margin-top: 12px; }
#replay-slot { margin-top: 8px; }

/* ---------- activity log: the club ledger ----------
   STATIC by design — renderLog() rebuilds via innerHTML on a 30s
   interval; any entrance animation becomes a metronomic strobe.
   The newest entry is flagged by state, not motion. */
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.log-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-left: 3px solid var(--line);
  border-radius: 0;
  font-size: .82rem;
}
.log-row:first-child {
  border-left-color: var(--gold);
  background: rgba(217,148,43,.06);
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.log-icon {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: .95rem;
}
.log-text { font: 600 .82rem var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-ago { font: italic 500 .68rem var(--font-display); color: var(--ink-soft); white-space: nowrap; }

/* ---------- reduced motion: theater off, information intact.
   MUST stay the LAST block so cascade order guarantees it wins. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* pinned-room toggle: brass when engaged */
#btn-pin.on { background: rgba(217,148,43,.16); background: color-mix(in srgb, var(--gold) 16%, var(--well)); border-color: var(--gold-deep); color: var(--gold-text); }
