/* app.css — noir-pulp design system (mirrors docs/design-guide.html) + the
   screen/table layouts. One global sheet, light-DOM class styling. */

:root {
  --bg: #14100c;
  --bg-soft: #191410;
  --surface: #221c16;
  --surface-raised: #2b241c;
  --felt: #0e3b2c;
  --felt-dark: #092a1f;
  --felt-rail: #3a2416;
  --felt-rail-dark: #241609;

  --gold: #c6a15b;
  --gold-bright: #e7c67d;
  --gold-dim: rgba(198, 161, 91, 0.35);
  --gold-line: rgba(198, 161, 91, 0.2);
  --gold-wash: rgba(198, 161, 91, 0.08);

  --text: #ede4d3;
  --text-muted: #a4998a;
  --text-faint: #6d6353;

  --danger: #a8453a;
  --danger-bright: #d06a54;
  --success: #5b9e76;

  --card-face: #ece3ce;
  --card-ink: #1c1712;
  --card-red: #a3352a;

  --line: rgba(198, 161, 91, 0.16);

  --font-display: "Bookman Old Style", "Rockwell", "URW Bookman", "Book Antiqua", Georgia, serif;
  --font-ui: "Avenir Next", "Century Gothic", Futura, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Courier New", Courier, ui-monospace, SFMono-Regular, monospace;

  --fs-display: clamp(2.3rem, 1.3rem + 4.4vw, 4.6rem);
  --fs-h1: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem);
  --fs-h2: clamp(1.3rem, 1.1rem + 1vw, 1.7rem);
  --fs-h3: 1.12rem;
  --fs-body: 1rem;
  --fs-small: 0.8125rem;
  --fs-micro: 0.6875rem;

  --gutter: clamp(20px, 5vw, 56px);
  --r: 2px;
}

/* --- reset + base --------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  margin: 0 0 0.4em;
  color: var(--text);
  line-height: 1.15;
}
p {
  margin: 0 0 1em;
  color: var(--text-muted);
}
a {
  color: var(--gold-bright);
}
button {
  font: inherit;
  color: inherit;
}
::selection {
  background: var(--gold-dim);
  color: #fff;
}
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.mono {
  font-family: var(--font-mono);
}
.faint {
  color: var(--text-faint);
}

/* --- texture -------------------------------------------------------------- */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 400;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
}
.lattice {
  background-image: repeating-linear-gradient(45deg, rgba(198, 161, 91, 0.1) 0 1.5px, transparent 1.5px 11px),
    repeating-linear-gradient(-45deg, rgba(198, 161, 91, 0.1) 0 1.5px, transparent 1.5px 11px),
    linear-gradient(160deg, #221a10, #0d0a06);
}

/* --- app shell + top bar -------------------------------------------------- */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #100c09, var(--bg));
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-link {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  text-shadow: 1.5px 1.5px 0 var(--danger);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar-user {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-muted);
}
.screen-host {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- generic screen + pulp card ------------------------------------------ */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(24px, 5vw, 64px) var(--gutter);
  gap: 22px;
}
.pulp-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(22px, 4vw, 34px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.result-card, .runend-card, .auth-card {
  max-width: 420px;
  align-items: center;
  text-align: center;
}
.history-card { max-width: 540px; }
.settings-card { max-width: 500px; }
.crop {
  position: relative;
}
.crop::before, .crop::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 1px solid var(--gold-dim);
  pointer-events: none;
}
.crop::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
.crop::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

/* --- buttons -------------------------------------------------------------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  padding: 11px 17px;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.08s linear, color 0.08s linear, border-color 0.08s linear, opacity 0.08s linear;
  white-space: nowrap;
}
.btn-primary { background: var(--gold); color: #1b140a; border-color: var(--gold); }
.btn-primary:hover { background: var(--bg); color: var(--gold-bright); }
.btn-secondary { background: transparent; color: var(--gold-bright); border-color: var(--gold-dim); }
.btn-secondary:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.btn-danger { background: transparent; color: var(--danger-bright); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--card-face); }
.btn-allin { background: var(--danger); color: var(--card-face); border-color: var(--danger); }
.btn-allin:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--gold-dim); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row .btn { flex: 1; }
.text-link {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: var(--fs-small);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px;
}
.text-link:hover { color: var(--gold-bright); }
.logout-link { align-self: flex-end; }

/* --- typography helpers --------------------------------------------------- */
.wordmark {
  font-size: var(--fs-display);
  line-height: 0.95;
  margin: 0 0 0.15em;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.reg-shift {
  color: var(--gold-bright);
  text-shadow: 2px 2px 0 var(--danger), -1px -1px 0 rgba(237, 228, 211, 0.12);
}
.brand-block { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; }
.brand-tagline {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0;
}
.helper-text {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-faint);
  letter-spacing: 0.06em;
  margin: 0;
  text-align: center;
}
.big-figure {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 1.6rem + 3vw, 3.4rem);
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1;
}
.overline, .section-label, .kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.section-label { margin-top: 8px; color: var(--gold); border-top: 1px solid var(--line); padding-top: 12px; }
.result-headline { font-size: var(--fs-h1); }
.gain-line { color: var(--success); font-family: var(--font-mono); font-size: var(--fs-small); margin: 0; }
.danger-line { color: var(--danger-bright); font-family: var(--font-mono); font-size: var(--fs-small); margin: 0; }
.result-line { margin: 0; color: var(--text); }
.peak-line { margin: 0; color: var(--text-muted); font-size: var(--fs-small); }
.run-status { margin: 0; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-faint); }
.run-status--on { color: var(--gold-bright); }

.stamp {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 2px solid currentColor;
  border-radius: 2px;
  padding: 3px 12px;
  position: relative;
  font-size: 0.95rem;
}
.stamp::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid currentColor;
  opacity: 0.35;
  transform: rotate(1.2deg);
  border-radius: 2px;
}
.stamp.gold { color: var(--gold); }
.stamp.red { color: var(--danger-bright); }
.stamp.win { color: var(--success); }
.stamp.lose { color: var(--danger-bright); }
.result-card .stamp.win, .result-card .stamp.lose,
.runend-card .stamp.win, .runend-card .stamp.lose { transform: rotate(-4deg); }

.state-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.05em;
  color: var(--danger-bright);
  border: 1px solid var(--danger);
  padding: 3px 9px;
}
.identity-row { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--text-muted); font-size: var(--fs-small); }
.badge-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  padding: 2px 6px;
  margin-left: 6px;
}
.badge-status {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-status .dot {
  width: 5px;
  height: 5px;
  background: var(--gold);
  animation: blink 1.2s steps(1) infinite;
}
.badge-status .dot:nth-child(2) { animation-delay: 0.4s; }
.badge-status .dot:nth-child(3) { animation-delay: 0.8s; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.15; } }
.badge-new {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  font-weight: 700;
  background: var(--danger);
  color: var(--card-face);
  padding: 2px 6px;
  transform: rotate(-3deg);
  display: inline-block;
  margin-left: 6px;
}

/* --- auth ----------------------------------------------------------------- */
.or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--gold-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
}
.or-divider::before, .or-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
.or-divider span { padding: 0 12px; text-transform: uppercase; }

/* --- card topbar + ledger (lobby/ladder/history) -------------------------- */
.card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.card-topbar-user { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted); }
.stack-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}
.stack-value .stack-label {
  font-weight: 400;
  color: var(--text-faint);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-small);
}
.ledger-main { color: var(--text); }
.ledger-sub { color: var(--text-faint); font-family: var(--font-mono); font-size: var(--fs-micro); white-space: nowrap; }
.empty-state { color: var(--text-faint); font-style: italic; font-family: var(--font-display); }

/* --- avatar + mask + qmark ------------------------------------------------ */
.avatar {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 32% 28%, #3a2f22, #150f0a 70%);
  box-shadow: 0 0 0 1px var(--gold-line), 0 0 0 4px var(--bg), 0 0 0 5px var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar--sm { width: 44px; height: 44px; }
.avatar--lg { width: 88px; height: 88px; }
.avatar-mask { width: 56%; display: flex; }
.mask-icon { width: 100%; height: auto; color: var(--gold-dim); opacity: 0.9; }
.avatar-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #2c2013, #100c07 72%);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold);
}
.avatar--sm .avatar-badge { width: 18px; height: 18px; right: -3px; bottom: -3px; }
.avatar--lg .avatar-badge { width: 28px; height: 28px; }
.avatar-badge > span { width: 60%; display: flex; }
.qmark-icon { width: 1em; height: 1em; color: var(--gold-bright); }
.avatar-badge .qmark-icon { width: 100%; }
.qmark-glyph { font-family: var(--font-display); font-weight: 800; }
.mask-mini { display: inline-flex; width: 20px; color: var(--text-faint); }
.mask-mini .mask-icon { color: var(--text-faint); }

/* --- ladder --------------------------------------------------------------- */
.ladder-track {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.ladder-slot {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  border: 1.5px solid var(--line);
  color: var(--text-faint);
  clip-path: polygon(50% 0, 95% 20%, 95% 80%, 50% 100%, 5% 80%, 5% 20%);
}
.ladder-slot.cleared { border-color: var(--gold); color: var(--gold-bright); background: rgba(198, 161, 91, 0.1); }
.ladder-slot.current { border-color: var(--gold-bright); color: var(--bg); background: var(--gold-bright); }
.ladder-slot.locked { background: var(--felt-rail-dark); }
.ladder-slot .mask-mini { width: 18px; }
.next-opponent {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--gold-line);
  background: var(--bg-soft);
}
.next-opponent-name { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h3); color: var(--text); }
.next-opponent-stake { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted); margin-top: 4px; }

/* --- playing cards -------------------------------------------------------- */
.card-row { display: flex; gap: 8px; }
.card-row--mini { gap: 5px; }
playing-card { display: inline-flex; }
.card {
  width: 56px;
  height: 78px;
  border-radius: 3px;
  background: var(--card-face);
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  position: relative;
  flex-shrink: 0;
  font-family: var(--font-ui);
  display: block;
}
.card-corner { position: absolute; top: 5px; left: 6px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.card-corner--br { top: auto; left: auto; bottom: 5px; right: 6px; transform: rotate(180deg); }
.card .rank { font-weight: 800; font-size: 14px; color: var(--card-ink); }
.card .suit-glyph { font-size: 13px; margin-top: 1px; }
.card-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 25px; opacity: 0.9; }
.card.suit-red .rank, .card.suit-red .card-center, .card.suit-red .suit-glyph { color: var(--card-red); }
.card.suit-black .rank, .card.suit-black .card-center, .card.suit-black .suit-glyph { color: var(--card-ink); }
.card--mini { width: 33px; height: 46px; border-radius: 2px; }
.card--mini .rank { font-size: 10px; }
.card--mini .suit-glyph { font-size: 9px; }
.card--mini .card-center { font-size: 14px; }
.card--mini .card-corner { top: 3px; left: 3px; }
.card--mini .card-corner--br { bottom: 3px; right: 3px; top: auto; left: auto; }
.card--empty { background: transparent; border: 1.5px dashed var(--gold-line); box-shadow: none; }
.card--back { background: var(--felt-rail-dark); border: 1px solid var(--gold-line); }
.card-back-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card--back .avatar-badge { position: static; width: 22px; height: 22px; box-shadow: 0 0 0 1.5px var(--gold); }
.card--mini.card--back .avatar-badge { width: 16px; height: 16px; }
.card--win { box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 2px var(--success), 0 0 14px rgba(91, 158, 118, 0.6); }

/* --- felt table ----------------------------------------------------------- */
.table-shell {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 24px);
  align-items: flex-start;
}
.table-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.table-loading { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 60px; }
.felt {
  background: radial-gradient(circle, var(--felt) 0%, var(--felt-dark) 100%);
  border: 9px solid var(--felt-rail);
  border-radius: 190px / 85px;
  padding: clamp(18px, 3vw, 30px) clamp(16px, 3vw, 34px);
  position: relative;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.5vw, 22px);
}
.felt::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 180px / 76px;
  border: 1px solid rgba(198, 161, 91, 0.14);
  pointer-events: none;
}
.opponent-zone, .player-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.opponent-info, .player-info { display: flex; flex-direction: column; gap: 6px; }
.player-info { align-items: flex-start; }
.opponent-name { display: flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 800; color: var(--text); }
.opponent-meta, .player-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opponent-meta { flex-direction: row; }
.opponent-info { flex-direction: column; align-items: flex-start; }
.bet-tag {
  color: var(--gold-bright);
  background: rgba(198, 161, 91, 0.1);
  border: 1px solid var(--gold-line);
  padding: 1px 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}
.fold-tag {
  color: var(--card-face);
  background: var(--danger);
  border: 1px solid var(--danger-bright);
  padding: 2px 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: foldtag-in 0.3s ease-out;
}
@keyframes foldtag-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
/* pot-pulse: a brief flash as the bot's chips land in the pot. */
.pot-display.pot-pulse { animation: pot-pulse 0.45s ease-out; }
@keyframes pot-pulse {
  0% { transform: none; border-color: var(--gold-line); }
  40% { transform: scale(1.07); border-color: var(--gold-bright); }
  100% { transform: none; border-color: var(--gold-line); }
}
/* opp-decision: the single persistent indicator under the opponent zone — their
   MOST RECENT public decision this hand (street · 상대 <action>), with a
   beginner-plain gloss beneath. Replaces the old accumulating trail: only the
   last opponent move, never a running log, never the player's moves. Redrawn
   from this.lastOpp each render so it persists through the player's turn; a
   subtle entrance marks the moment the opponent just acted. Facts only
   (reading charter §3.0): verb + amount + street + plain gloss. */
.opp-decision {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: -6px; /* ponytail: tuck under the opponent zone; the felt gap would otherwise float it */
  max-width: 100%;
  text-align: center;
  animation: opp-decision-in 0.25s ease-out;
}
@keyframes opp-decision-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.opp-decision-line {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}
.opp-decision-street {
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--fs-micro);
}
.opp-decision-move { color: var(--gold-bright); font-weight: 700; letter-spacing: 0.02em; }
.opp-decision-gloss { font-size: var(--fs-micro); color: var(--text-muted); line-height: 1.4; }

/* my-hand: names the player's CURRENT best hand (원 페어 / 플러시 …) live under
   their cards, so a beginner always knows what they're holding while deciding. */
.my-hand {
  align-self: center;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
  padding: 3px 12px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--gold-wash);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  animation: opp-decision-in 0.25s ease-out;
}
.my-hand-label {
  color: var(--text-muted);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.my-hand-cat { color: var(--gold-bright); font-weight: 700; letter-spacing: 0.02em; }

/* opp-action-cue: a transient "상대가 방금 · <action>" callout in the opponent's
   under-zone slot, shown for the action beat so even a check (no chip move) is
   legible in the moment. Cleared by the next render. */
.opp-action-cue {
  align-self: center;
  margin-top: -6px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 12px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--gold-wash);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  white-space: nowrap;
}
.opp-action-cue-label {
  color: var(--text-muted);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.opp-action-cue-move { color: var(--gold-bright); font-weight: 700; letter-spacing: 0.02em; }

/* street-cue: a brief transient badge above the board when a new community-card
   street opens a FRESH betting round mid-hand — so a beginner sees a call
   (closing one street) and a later check (opening the next) are different
   rounds, not a contradiction. Active play only, never the finished run-out. */
.street-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--gold-wash);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
}
.street-cue-street {
  color: var(--gold-bright);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.street-cue-label { color: var(--text-muted); }
.community-zone { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pot-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--gold-line);
  padding: 7px 15px;
}
.pot-display .pot-amount { font-weight: 800; color: var(--gold-bright); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.pot-display .pot-label { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.chip-stack { display: inline-flex; align-items: flex-end; height: 20px; }
.chip { width: 20px; height: 8px; border-radius: 50%; background: var(--gold); border: 1px solid rgba(0, 0, 0, 0.4); margin-top: -4px; }
.chip:nth-child(2) { background: var(--danger); }
.chip:nth-child(3) { background: var(--success); }
.chip:first-child { margin-top: 0; }
.blind-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.blind-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  padding: 6px 12px;
}
.blind-pill b { color: var(--gold-bright); font-weight: 700; }
.abandon-link { color: rgba(208, 106, 84, 0.7); }
.zone--win { animation: winpulse 1.1s ease-out; }
.zone--win .stack-value { color: var(--success); }
.zone--split .stack-value { color: var(--gold-bright); }
@keyframes winpulse { 0% { filter: brightness(1); } 40% { filter: brightness(1.5); } 100% { filter: brightness(1); } }

/* --- action bar ----------------------------------------------------------- */
.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0;
}
.action-bar .btn { flex: 1 1 auto; min-width: 88px; }
.action-bar--wait { min-height: 46px; align-items: center; }
.wait-label { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--gold-dim); letter-spacing: 0.05em; }
/* coach-hint — one muted line above the action bar, only on the player's turn. */
.coach-hint {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 6px;
  font-size: var(--fs-small);
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
}
.coach-phase {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  white-space: nowrap;
}

/* --- lead panel (dock desktop / sheet mobile) ----------------------------- */
.lead-panel-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
}
.lead-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.lead-summary::-webkit-details-marker { display: none; }
.lead-panel { display: flex; flex-direction: column; }
.lead-content { padding: 12px; overflow-y: auto; max-height: 460px; }
.lead-section-label {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 10px;
}
/* 라인업 as a secondary collapsible below the (primary) history. */
.lead-lineup { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.lead-lineup-summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--gold-bright);
  padding: 4px 0 8px;
  user-select: none;
}
.lead-lineup-summary::-webkit-details-marker { display: none; }
.lead-lineup-summary::after { content: " ▾"; color: var(--gold-dim); }
.lead-lineup[open] .lead-lineup-summary::after { content: " ▴"; }
.lineup-list { display: flex; flex-direction: column; gap: 10px; }
.lineup-row { display: flex; gap: 10px; align-items: flex-start; }
.lineup-mono {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
  border: 1px solid var(--gold-line);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.lineup-name { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.lineup-tag { font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); border: 1px solid var(--line); padding: 1px 5px; }
.lineup-line { font-size: var(--fs-small); color: var(--text-muted); margin-top: 2px; }
.lead-empty { padding: 8px; text-align: center; }
.showdown-list { display: flex; flex-direction: column; gap: 10px; }
.showdown-row { background: var(--card-face); color: var(--card-ink); padding: 11px 12px; position: relative; }
.showdown-row:nth-child(odd) { transform: rotate(-0.4deg); }
.showdown-row:nth-child(even) { transform: rotate(0.35deg); }
.showdown-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.showdown-head .stamp { font-size: 0.7rem; padding: 1px 8px; }
.showdown-matchup { font-weight: 700; font-size: 12px; color: var(--card-ink); margin-bottom: 4px; }
.showdown-line { font-family: var(--font-mono); font-size: 11px; color: #3a3226; line-height: 1.5; }
.showdown-pot { font-family: var(--font-mono); font-size: 10px; color: #6b5f4c; margin-top: 4px; }
.lead-hint { margin-top: 12px; font-size: var(--fs-micro); line-height: 1.5; text-align: center; }

/* --- result summary ------------------------------------------------------- */
.result-summary-box {
  background: var(--bg-soft);
  border: 1px solid var(--gold-line);
  padding: 14px 16px;
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-summary-box .kicker { color: var(--gold); }
.showdown-summary-line { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text); }
.showdown-board { color: var(--text-faint); }

/* --- settings ------------------------------------------------------------- */
.settings-title { text-align: center; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.settings-label { display: flex; flex-direction: column; gap: 2px; }
.settings-sub { font-size: var(--fs-micro); color: var(--text-faint); }
.settings-value { color: var(--text-muted); }
.settings-value.mono { font-family: var(--font-mono); font-size: var(--fs-small); }
input.accent { accent-color: var(--gold); cursor: pointer; }
input[type="range"].accent { width: 140px; }

/* --- toast + modal + loading --------------------------------------------- */
.toast-host {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface-raised);
  border: 1px solid var(--gold-line);
  color: var(--text);
  padding: 10px 18px;
  font-size: var(--fs-small);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease-out;
}
.toast--error { border-color: var(--danger); color: var(--danger-bright); }
.toast--out { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-host { position: relative; z-index: 600; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 600;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--gold-line);
  padding: 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.55);
}
.modal-title { margin-bottom: 8px; }
.modal-body { font-size: var(--fs-small); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.loading-block, .error-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}
.error-block { color: var(--danger-bright); flex-wrap: wrap; }
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gold-dim);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- glossary tooltip + "?" help sheet ------------------------------------ */
[data-term] { cursor: help; }
button[data-term] { cursor: pointer; }
.glossary-pop {
  position: fixed;
  z-index: 700;
  max-width: 260px;
  background: var(--card-face);
  color: var(--card-ink);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 9px 11px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  font-size: var(--fs-small);
  line-height: 1.45;
  pointer-events: none;
}
.glossary-pop[hidden] { display: none; }
.glossary-pop-term {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 2px;
  color: var(--card-red);
}
.glossary-pop-desc { display: block; color: #3a3226; }
.help-btn {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--gold-dim);
  background: transparent;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.help-btn:hover { border-color: var(--gold); background: var(--gold-wash); }
.help-sheet { max-width: 460px; max-height: calc(100vh - 48px); overflow-y: auto; }
.help-sheet .overline { margin-top: 6px; }
.help-para { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.55; margin: 6px 0 12px; }
.help-guide { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 16px; }
.help-guide-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-small);
}
.help-guide-row .hg-name { color: var(--gold-bright); font-weight: 700; white-space: nowrap; }
.help-guide-row .hg-line { color: var(--text-muted); text-align: right; }
.help-terms { display: flex; flex-direction: column; gap: 8px; }
.help-terms .kicker { color: var(--gold); }
.help-term-row { font-size: var(--fs-small); line-height: 1.5; }
.help-term-row b { color: var(--text); }
.help-term-row span { color: var(--text-muted); }

/* --- showdown result banner ----------------------------------------------- */
.result-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--gold-line);
  background: rgba(0, 0, 0, 0.42);
  padding: 8px 16px;
  text-align: center;
}
.result-banner-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.result-banner-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h3);
  color: var(--text);
}
.result-banner--win { border-color: var(--success); }
.result-banner--win .result-banner-text { color: var(--success); }
.result-banner--lose { border-color: var(--danger); }
.result-banner--lose .result-banner-text { color: var(--danger-bright); }
.result-banner--split .result-banner-text { color: var(--gold-bright); }
.result-banner-sub {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--gold-bright);
  letter-spacing: 0.02em;
}

/* Fold banner: the non-showdown outcome, made unmistakable — bigger, centered,
   high-contrast, with a display-type headline (cause) over a subline (result). */
.result-banner--fold {
  gap: 8px;
  padding: 16px 30px;
  border-width: 2px;
  background: rgba(0, 0, 0, 0.74);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
}
.result-banner--fold .result-banner-label {
  color: var(--card-face);
  background: var(--danger);
  border: 1px solid var(--danger-bright);
  padding: 3px 12px;
  font-weight: 700;
}
.result-banner-headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h1);
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-align: center;
}
.result-banner--fold.result-banner--win .result-banner-headline { color: var(--gold-bright); }
.result-banner--fold.result-banner--win .result-banner-sub { color: var(--success); font-weight: 700; }
.result-banner--fold.result-banner--lose .result-banner-headline { color: var(--danger-bright); }
.result-banner--fold.result-banner--lose .result-banner-sub { color: var(--danger-bright); }
.result-banner--fold .result-banner-sub { font-size: var(--fs-body); }

/* Walk beat: a preflop walk the engine auto-played (bot folded its SB before the
   player could act). A small transient event — deliberately quieter than the fold
   climax: a body-sized headline (not the fs-h1 display size) in the win tone. */
.result-banner--walk .result-banner-headline { font-size: var(--fs-h3); color: var(--gold-bright); }
.result-banner--walk .result-banner-sub { color: var(--success); }

/* --- archetype reveal (screen E) ------------------------------------------ */
.reveal-archetype {
  width: 100%;
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--gold-line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reveal-archetype .kicker { color: var(--gold); }
.reveal-arche-head { display: flex; align-items: center; gap: 14px; }
.reveal-arche-mono {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #3a2f22, #150f0a 70%);
}
.reveal-arche-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h3);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.reveal-arche-persona {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--gold);
  margin-top: 2px;
}
.reveal-arche-tie { font-size: var(--fs-small); color: var(--text-muted); }
.reveal-arche-tend {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reveal-arche-tend li { color: var(--text); font-size: var(--fs-small); }
.reveal-arche-tip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.reveal-tip-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.reveal-arche-tip span:last-child { color: var(--text-muted); font-size: var(--fs-small); }

/* --- responsive: lead dock (desktop) vs bottom sheet (mobile) ------------- */
@media (min-width: 1024px) {
  .lead-panel-wrap {
    width: 300px;
    flex-shrink: 0;
    align-self: stretch;
  }
  .lead-summary { display: none; }
  .lead-panel-wrap .lead-panel { display: flex !important; }
}
@media (max-width: 1023px) {
  /* Column layout: cross-axis is now horizontal, so stretch (not flex-start)
     makes table-main + lead panel fill the width → felt spans it and centers. */
  .table-shell { flex-direction: column; align-items: stretch; }
  .lead-panel-wrap { width: 100%; }
  .lead-panel-wrap:not([open]) .lead-panel { display: none; }
}
@media (max-width: 640px) {
  .felt { border-radius: 16px; border-width: 6px; padding: 16px 14px; }
  .felt::before { border-radius: 12px; inset: 6px; }
  .card { width: 46px; height: 64px; }
  .card .rank { font-size: 12px; }
  .card .card-center { font-size: 20px; }
  .action-bar .btn { min-width: 0; padding: 9px 10px; font-size: 0.78rem; }
  .topbar { padding: 10px 16px; }
  .topbar-user { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  .badge-status .dot { animation: none; opacity: 0.6; }
}
