/* Lichago — dark felt-table redesign.
   Source: design handoff "Poker Score Keeper Redesign" (docs/design/).
   Single fixed dark theme — the handoff specifies one final palette with
   no light variant, so the previous prefers-color-scheme light/dark
   toggle was dropped rather than kept as an unspecified guess.
   Fonts are substituted for system stacks (Playfair Display -> serif,
   Work Sans -> sans, IBM Plex Mono -> mono) per the handoff README's own
   allowance ("Substitute equivalents if the codebase already ships a
   serif/sans/mono trio") — this project is offline-first with no
   external requests, so loading Google Fonts was never an option. */

:root {
  --ink: #000000;
  --felt-base: #0b1410;
  --felt-raised: #0d1a14;
  --green-top: #10261c;
  --green-top-2: #12301f;

  --surface: #101d17;
  --surface-hover: #132218;
  --surface-alt: #0e1a14;
  --surface-active: #122a20;
  --green-primary: #15503a;

  --border: #24352c;
  --border-hover: #2f4239;
  --border-soft: #1c2a23;
  --border-soft-2: #1e2c25;
  --border-soft-3: #243329;
  --border-dim: #22302a;
  --border-dim-2: #2b3a32;

  --gold: #d6b25c;
  --gold-bright: #e7c877;
  --gold-btn-border: #b8933f;
  --gold-deep: #a9832f;
  --gold-deep-2: #8a6f2c;
  --gold-muted: #a98f52;
  --gold-muted-2: #c9a860;
  --gold-selected-pts: #f0dda8;

  --text-primary: #f2e9d4;
  --text-on-green: #f6efdd;
  --text-body: #d3ddd6;
  --text-body-2: #dfe7e0;
  --text-body-3: #e6ede7;
  --text-muted: #93a79b;
  --text-muted-2: #8ea295;
  --text-dim: #6f8378;
  --text-dim-2: #71857a;
  --text-disabled: #5f7369;

  --danger-text: #a86b6b;
  --danger-border: #4a2b2b;

  --card-face-bg: #f2ede1;
  --card-face-border: #c9c2b2;
  --card-red: #a32020;
  --card-black: #15181a;
  --card-back-bg: #143024;
  --card-back-stripe: #1b3d2e;
  --card-back-border: #2c4a3c;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { background: var(--felt-base); height: 100%; }

/* body fills the viewport (flex column: header, then #app) so a screen
   shorter than the viewport can still pin its footer CTA to the bottom
   via margin-top:auto on .footer-actions; taller screens simply overflow
   and scroll normally, same as any other page. */
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text-body-2);
  background: linear-gradient(180deg, var(--green-top) 0%, var(--felt-base) 42%) fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.app-header { flex: 0 0 auto; }

h1, h2, h3 { margin: 0; }
p { margin: 0; }

/* ---------- app header: wordmark row + underline tabs ---------- */

.app-header {
  background: var(--ink);
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--gold-deep);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h1 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold-bright);
}
.suit-glyphs {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

#nav {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  overflow-x: auto;
}
.nav-btn {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim-2);
  padding: 0 0 10px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-btn.active {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom-color: var(--gold);
}
.nav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- screen body ---------- */

#app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1 0 auto;
}

.section-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.section-label.gold { color: var(--gold-bright); letter-spacing: 0.2em; }

.page-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-subcopy {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- buttons ---------- */

button { font-family: var(--sans); }

button.primary {
  width: 100%;
  height: 54px;
  border-radius: 12px;
  background: var(--green-primary);
  border: 1px solid var(--gold);
  color: var(--text-on-green);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
button.primary .delta { font-family: var(--mono); font-size: 13px; color: var(--gold-bright); }
button.primary:disabled {
  background: var(--surface);
  border-color: var(--border-dim-2);
  color: var(--text-disabled);
  cursor: not-allowed;
}

button.secondary {
  height: 46px;
  border-radius: 11px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

button.danger {
  height: 48px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}

button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (hover: hover) {
  .choice:hover:not(.selected):not(:disabled),
  button.secondary:hover,
  button.danger:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
  }
}
button:active, .choice:active { opacity: 0.85; }

.footer-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-deep-2), transparent);
}
.footer-actions { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

.footer-row { display: flex; gap: 10px; }
.footer-row > button { flex: 1; width: auto; }

/* ---------- inputs ---------- */

label { display: block; margin: 0 0 10px; font-size: 0.85rem; color: var(--text-dim); }

input[type="text"] {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  font-family: var(--sans);
}
input[type="text"]::placeholder { color: var(--text-dim); }
input[type="text"]:focus { outline: none; border-color: var(--gold); }

/* ---------- setup: seat rows + mode segmented control ---------- */

.player-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.player-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  height: 54px;
}
.seat-badge {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #55452a;
  color: var(--gold-muted-2);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-list input[type="text"] {
  height: auto;
  padding: 0;
  border: none;
  background: none;
  flex: 1;
}
.player-list input[type="text"]:focus { outline: none; }
/* Placeholder ("Player 1" etc.) hides the instant the field is focused,
   not just once the first character is typed (the native behavior) --
   the attribute/value itself is untouched, so it's still there to guide
   an empty seat if the field loses focus unedited. */
.player-list input[type="text"]:focus::placeholder { opacity: 0; }

/* ---------- in-game header block ---------- */

.game-header-block {
  background: var(--felt-raised);
  margin: -26px -20px 0;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-soft-2);
}
.game-header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.game-header-title-row h2 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.game-header-title-row h2 .sep { color: #4d5f56; }
.game-header-title-row h2 .phase-name { color: var(--gold-bright); }
.game-header-title-row h2 .step-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
}

.phase-progress { display: flex; gap: 5px; margin-top: 12px; }
.phase-progress .bar { flex: 1; height: 3px; border-radius: 2px; background: var(--border-soft-3); }
.phase-progress .bar.filled { background: var(--gold); }

/* ---------- flat score row (Phase 3 -- no player-column grid to attach
   scores to the way the announce screens do; see .ag-score there) ---------- */

.score-strip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.score-strip-row .ss-cell {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.score-strip-row .ss-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-strip-row .ss-cell.dealer .ss-name { color: #c8d6cc; }
.score-strip-row .ss-score {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--text-body-2);
  font-variant-numeric: tabular-nums;
}
.score-strip-row .ss-cell.dealer .ss-score { color: var(--text-primary); }
.score-strip-row .ss-restricted { font-size: 9px; color: var(--danger-text); }

.badge {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--felt-base);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- game body panels ---------- */

.game-body { display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- dropdown-free choice pickers (docs/ui-guidelines.md) ---------- */

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.choice {
  appearance: none;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-body-2);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.3;
}
.choice.selected {
  background: var(--green-primary);
  border-color: var(--gold);
  font-weight: 600;
  color: var(--text-on-green);
}
.choice:disabled {
  opacity: 1;
  background: none;
  border-color: var(--border-dim);
  color: var(--text-disabled);
  font-size: 12.5px;
  padding: 8px 13px;
  cursor: not-allowed;
}
.choice .choice-points { font-family: var(--mono); margin-left: 0.35em; }

/* ---------- mini playing card ---------- */

.hand-cards { display: inline-flex; gap: 3px; width: 96px; flex: 0 0 auto; }
.card {
  width: 16px;
  height: 22px;
  border-radius: 2px;
  background: var(--card-face-bg);
  border: 1px solid var(--card-face-border);
  color: var(--card-black);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.card.card-red { color: var(--card-red); }
.card.card-blank {
  background: repeating-linear-gradient(45deg, var(--card-back-stripe), var(--card-back-stripe) 2px, var(--card-back-bg) 2px, var(--card-back-bg) 4px);
  border-color: var(--card-back-border);
}

/* ---------- announce grid: player columns x hand-type rows ---------- */

.announce-grid-wrap { overflow-x: auto; }
.announce-grid {
  display: grid;
  row-gap: 3px;
  column-gap: 4px;
  align-items: stretch;
}
.ag-cell { min-width: 0; }
.ag-corner { background: none; }
.ag-colhead {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: end;
  padding-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-body-3);
  min-width: 0;
}
.ag-colhead-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ag-colhead .badge { flex: 0 0 auto; }

/* Score row: sits above the "One Pair" row, aligned to the player
   columns, replacing the old header score-strip boxes. */
/* align-self: stretch (not center) so every cell in the row fills the
   same height -- a player with "No exchanges" has taller content than
   the others, and centering shorter cells within that taller row left
   their border-bottoms at different heights, a jagged divider across the
   row (reported, with a screenshot: "the table is a bit broken"). Each
   cell centers its own content internally via flex instead. */
.ag-scorelabel {
  align-self: stretch;
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 6px 6px 0;
  border-bottom: 1px solid var(--border-soft-2);
}
.ag-score {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border-soft-2);
}
.ag-restricted {
  display: block;
  font-family: var(--sans);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--danger-text);
}

/* A score that just changed since the last render (see scoreFlashFlags in
   app.js) briefly pulses/glows -- scale+text-shadow rather than a color
   swap so it works regardless of the element's base color (.ag-score,
   .ss-score, dealer or not). */
@keyframes score-flash {
  0% {
    transform: scale(1.3);
    text-shadow: 0 0 10px var(--gold-bright);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 transparent;
  }
}
.score-flash { display: inline-block; animation: score-flash 0.6s ease-out; }

/* ---------- game screen transitions ---------- */

/* A hand's phase advancing/rewinding (a step recorded, undo, redo) --
   orchestrated in JS (animateViewChange): fade #app out, swap content
   while invisible, fade back in. 0.15s each way, 0.3s total. A slide was
   tried here first but felt jumpy in practice. */
@keyframes view-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes view-fade-in { from { opacity: 0; } to { opacity: 1; } }
.view-fade-out { animation: view-fade-out 0.15s ease-in forwards; }
.view-fade-in { animation: view-fade-in 0.15s ease-out; }

/* Tab switches (Game/Score/Hands/History/Rules) -- orchestrated in JS
   (animateTabSlide): #app slides fully off-screen in the direction of
   travel, content swaps once it's off-screen, then the new content
   slides in from the opposite side. 0.15s each way, 0.3s total. */
@keyframes tab-exit-forward { to { transform: translateX(-100%); } }
@keyframes tab-exit-backward { to { transform: translateX(100%); } }
@keyframes tab-enter-forward { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes tab-enter-backward { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.tab-exit-forward { animation: tab-exit-forward 0.15s ease-in forwards; }
.tab-exit-backward { animation: tab-exit-backward 0.15s ease-in forwards; }
.tab-enter-forward { animation: tab-enter-forward 0.15s ease-out; }
.tab-enter-backward { animation: tab-enter-backward 0.15s ease-out; }
.ag-rowhead {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 6px 4px 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
}
.ag-rowhead .hand-cards { width: 60px; gap: 2px; }
.ag-rowhead .card { width: 10px; height: 14px; font-size: 6.5px; }
.ag-hand-cards-row { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.ag-hand-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ag-hand-pts { font-family: var(--mono); font-size: 10.5px; color: var(--gold-muted); flex: 0 0 auto; }

.ag-pick {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  min-height: 34px;
  cursor: pointer;
  position: relative;
}
.ag-pick.selected {
  background: var(--green-primary);
  border-color: var(--gold);
}
.ag-pick.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-bright);
}

/* ---------- declare chicago card ---------- */

.chicago-card {
  border: 1px solid var(--border-soft-3);
  border-radius: 14px;
  padding: 18px 16px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chicago-card.disabled { opacity: 0.72; }
.chicago-card h3 { font-family: var(--serif); font-size: 19px; font-weight: 700; color: #cfd9d1; }
.chicago-card .chicago-sub { font-size: 12.5px; line-height: 1.55; color: #7e9288; margin-top: 6px; }
.chicago-card .status-line { font-family: var(--mono); font-size: 11px; color: var(--text-disabled); }

/* ---------- score table ---------- */

.score-table { display: flex; flex-direction: column; }
.score-row {
  display: grid;
  grid-template-columns: 3.5rem 7rem 1fr 1fr 11rem 1fr 9rem;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.2rem;
  border-top: 1px solid var(--border-soft);
  align-items: start;
  font-size: 0.92rem;
  color: var(--text-body-2);
}
.score-row.header {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-top: none;
}
.score-row .field-label { display: none; }
.table-hand-text { display: block; font-size: 13px; }

@media (max-width: 640px) {
  .score-row { grid-template-columns: 1fr 1fr; row-gap: 0.3rem; padding: 0.85rem 0.4rem; }
  .score-row.header { display: none; }
  .sr-phase, .sr-scores { grid-column: 1 / -1; }
  .score-row .field-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
  }
}

/* ---------- hands reference + rules hand-value tables ---------- */

.hand-guide-row, .rule-hand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  border-top: 1px solid var(--border-soft);
}
.hand-guide-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 2px 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hand-guide-header .col-cards { width: 96px; }
.hand-guide-header .col-hand { flex: 1; }
.hand-guide-row .hand-guide-label { flex: 1; font-size: 15px; font-weight: 500; color: var(--text-body-3); }
.hand-guide-row .hand-guide-points {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.hand-guide-closing-rule { height: 1px; background: var(--gold-deep-2); margin-top: 2px; }

/* ---------- history ---------- */

.history-list { display: flex; flex-direction: column; }
.history-row { padding: 0.75rem 0.2rem; border-top: 1px solid var(--border-soft); }
.history-row:first-child { border-top: none; }
.history-when { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--text-dim); }
.history-players { font-weight: 600; margin: 0.25rem 0; color: var(--text-body-3); }
.history-outcome { font-weight: 600; }
.history-outcome.won { color: var(--gold-bright); }
.history-outcome.tied { color: var(--text-muted); }
.history-outcome.aborted { color: var(--danger-text); }
.history-scores { font-family: var(--mono); font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }

/* ---------- rules page ---------- */

.rules-content { display: flex; flex-direction: column; gap: 26px; }
.rules-content h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
}
/* Gold underline rule below the page title -- a pseudo-element rather
   than markup, since RULES_HTML comes from a generic markdown-to-HTML
   converter (scripts/generate-rules-html.mjs) that has no notion of this
   design-specific decoration. */
.rules-content h1::after {
  content: "";
  display: block;
  width: 52px;
  height: 2px;
  background: var(--gold);
  margin-top: 14px;
}
.rules-content h2 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.rules-content ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: rule-item; }
.rules-content li {
  display: flex;
  gap: 12px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-body);
  counter-increment: rule-item;
}
/* Numbered index (01, 02, ...) via CSS counters, same reasoning as the
   h1 rule above -- no per-item markup available to hang a number on. */
.rules-content li::before {
  content: counter(rule-item, decimal-leading-zero);
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 2px;
}
.rules-content p { font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }
.rules-content a { color: var(--gold-bright); }
.rules-content table { width: 100%; border-collapse: collapse; }
.rules-content td { padding: 0; height: 48px; border-top: 1px solid var(--border-soft); font-size: 14px; color: var(--text-body); }
.rules-content td:last-child { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--gold-bright); width: 40px; }

/* ---------- game over ---------- */

.winner-card {
  border: 1px solid var(--gold-deep);
  border-radius: 16px;
  padding: 24px 20px;
  background: #0f2018;
  text-align: center;
}
.winner-card .eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8a9d91;
}
.winner-card .winner-name {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-top: 8px;
}
.winner-card .winner-points {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 2px;
}
.winner-card.tied .winner-name { font-size: 26px; }

.settlement-list, .standings-list { display: flex; flex-direction: column; }
.settlement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  border-top: 1px solid var(--border-soft);
  font-size: 14.5px;
  color: var(--text-body);
}
.settlement-row .amount { font-family: var(--mono); color: var(--gold-bright); }
.standings-list { gap: 8px; }
.standing-row {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-body-2);
}
.standing-row.first { background: var(--surface-active); border-color: var(--gold-deep); color: var(--text-primary); }
.standing-row .rank { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.standing-row .name { flex: 1; font-size: 15px; font-weight: 500; }
.standing-row .score {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- abort / clear-history inline confirm ---------- */

.abort-confirm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--danger-text);
}
.abort-confirm button { flex: 0 0 auto; }

.banner {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-body-2);
}
.banner.danger { border-color: var(--danger-border); color: var(--danger-text); }

/* ---------- tie-break popup ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 6, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--felt-raised);
  border: 1px solid var(--border-soft-3);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-body { font-size: 13.5px; line-height: 1.55; color: var(--text-body-2); }
.modal-hand-visual { display: flex; justify-content: center; padding: 4px 0; }
.modal-hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  border-left: 2px solid var(--gold-deep-2);
  padding-left: 10px;
}
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ---------- tutorial mode ---------- */

.tutorial-replay-row { display: flex; justify-content: flex-end; margin-bottom: 12px; }

#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 500; /* above everything but a real .modal-overlay, which suppresses it entirely */
  pointer-events: none;
}
/* Dims the whole screen except a hole matching the target control's own
   rect -- a huge box-shadow spread on a div sized/positioned to that
   rect, rather than a full-screen scrim with a literal cut-out, so it
   naturally follows the target's rounded corners. */
.tutorial-highlight {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(4, 8, 6, 0.45);
  border: 2px solid var(--gold);
  pointer-events: none;
}
.tutorial-scrim {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 6, 0.45);
  pointer-events: none;
}
.tutorial-card {
  position: fixed;
  width: min(300px, calc(100% - 24px));
  background: var(--felt-raised);
  border: 1px solid var(--gold-deep-2);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  /* The card itself stays click-through -- it can end up positioned over
     a real control (e.g. the announce grid, when the pop-up it's
     showing points at the button below instead), and that control must
     still be reachable. Only its own buttons opt back in. */
  pointer-events: none;
}
.tutorial-card button {
  pointer-events: auto;
}
.tutorial-card.centered {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.tutorial-title { font-family: var(--serif); font-size: 16px; color: var(--gold-bright); }
.tutorial-text { font-size: 13.5px; line-height: 1.55; color: var(--text-body-2); }
.tutorial-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tutorial-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}

@media (max-width: 360px) {
  #app { padding: 16px 16px 26px; }
  .score-strip-row { gap: 4px 10px; }
}
@media (min-width: 430px) {
  #app { max-width: 430px; }
}
