/* Connect Fourtune — visual theme
   Green-baize casino board: walnut rails, brass fittings, enamel chips, playing-card faces.
   Typography: poster display for headings/logo/marquee, sans for body, mono for numbers. */

:root {
  --ink: #06100b;
  --velvet: #0b241a;
  --panel: #0d2f23;
  --panel-raised: #164534;
  --line: rgba(239, 220, 170, 0.19);
  --line-strong: rgba(239, 220, 170, 0.48);

  --brass: #d8a94e;
  --brass-hi: #ffe9b3;
  --brass-deep: #75501b;
  --brass-dim: #b7975c;

  --cyan: #58e0ca;
  --cyan-deep: #0a6558;
  --ruby: #e0445f;
  --ruby-deep: #7c1028;
  --green: #8ce8a8;
  --hazard: #c7a052;

  --ivory: #f7efd9;
  --muted: #c6d4c2;
  --dim: #a4b6a8;

  --felt: #0d4a37;
  --felt-deep: #05291e;
  --well: #061b14;

  --font-display: 'Impact', 'Haettenschweiler', 'Arial Narrow Bold', 'Arial Black', 'Segoe UI', sans-serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Cascadia Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ivory);
  height: 100vh;                 /* lock to the viewport... */
  max-height: 100vh;
  width: 100vw;
  overflow: hidden;              /* ...and never allow page scrolling */
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background:
    radial-gradient(ellipse 68% 50% at 50% 5%, rgba(42, 145, 108, 0.26), transparent 70%),
    radial-gradient(ellipse 100% 70% at 50% 112%, rgba(0, 0, 0, 0.72), transparent 65%),
    repeating-linear-gradient(45deg, rgba(247, 231, 188, 0.028) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(-45deg, rgba(247, 231, 188, 0.02) 0 1px, transparent 1px 16px),
    radial-gradient(ellipse at 50% 42%, #0c3829 0%, #062119 58%, #020b07 100%);
}

#app {
  width: min(96vw, 1060px);
  height: 100vh;
  max-height: 100vh;
  margin: auto;
  padding: clamp(8px, 1.4vh, 18px) clamp(10px, 1.4vw, 18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------- shared type ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.045em;
  line-height: 1.05;
  text-transform: uppercase;
}
h1 { font-size: clamp(2.4rem, 6vw, 4rem); color: var(--brass-hi); }
h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); color: var(--brass); }
h3 { font-size: 1.05rem; color: var(--brass); }

.mono { font-family: var(--font-mono); }
.taunt { color: var(--muted); font-style: italic; font-size: 0.95rem; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-dim);
}

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

button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ivory);
  background: linear-gradient(180deg, #65491f, #493114);
  border: 1px solid var(--brass);
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--brass-deep), 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--brass-deep); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button:focus-visible,
.cell:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
button.secondary {
  color: var(--ivory);
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border-color: var(--line-strong);
  box-shadow: 0 2px 0 #0b0712;
}
button.ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}

/* ---------- HUD ---------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.hud-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value { font-family: var(--font-mono); font-size: 1.05rem; color: var(--brass-hi); }
.stat.creds .stat-value { color: var(--green); }
.stat.take .stat-value { color: var(--cyan); }

.composure { display: inline-flex; gap: 5px; align-items: center; }
.composure .pip {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--brass-deep);
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass-deep));
}
.composure .pip.spent {
  background: transparent;
  border-color: #3a2f22;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.act-track { display: flex; align-items: center; gap: 6px; }
.act-track .step {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.act-track .step.current { color: var(--brass-hi); }
.act-track .bar {
  width: 22px; height: 2px;
  background: #3a2f22;
}
.act-track .bar.done { background: var(--brass-deep); }

#mute {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 999px;
}
.hud-quest {
  flex: 1 1 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
  font-size: 0.8rem;
  color: var(--ivory);
}
.hud-quest-text {
  display: block;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.4;
  color: var(--dim);
}
/* ---------- dealer nameplate ---------- */

.dealer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 12px;
}
.dealer-avatar {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--brass-hi);
  background: radial-gradient(circle at 35% 30%, #ff9ec0, var(--ruby) 60%, var(--ruby-deep));
  border: 2px solid var(--brass-hi);
  box-shadow: 0 0 14px rgba(227, 184, 102, 0.25);
}
img.dealer-avatar { object-fit: cover; background: var(--panel); }
.dealer-avatar.fallback { display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.3rem; color: var(--brass-hi);
  background: radial-gradient(circle at 35% 30%, #ff9ec0, var(--ruby) 60%, var(--ruby-deep)); }
.player-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line-strong);
}
/* Painted portrait atlas, with the original artwork underneath as a fallback. */
.portrait {
  display: inline-block;
  flex: 0 0 auto;
  background-image: url('../assets/avatars/casino-portraits.png'), var(--portrait-fallback);
  background-size: 400% 400%, cover;
  background-position: var(--portrait-position), center;
  background-repeat: no-repeat;
}
.portrait-dealer { --portrait-position: 0% 0%; --portrait-fallback: url('../assets/avatars/dealer.svg'); }
.portrait-penny { --portrait-position: 33.333% 0%; --portrait-fallback: url('../assets/avatars/penny.svg'); }
.portrait-rusty { --portrait-position: 66.667% 0%; --portrait-fallback: url('../assets/avatars/rusty.svg'); }
.portrait-bookie { --portrait-position: 100% 0%; --portrait-fallback: url('../assets/avatars/bookie.svg'); }
.portrait-twin { --portrait-position: 0% 33.333%; --portrait-fallback: url('../assets/avatars/twin.svg'); }
.portrait-cheat { --portrait-position: 33.333% 33.333%; --portrait-fallback: url('../assets/avatars/cheat.svg'); }
.portrait-shark { --portrait-position: 66.667% 33.333%; --portrait-fallback: url('../assets/avatars/shark.svg'); }
.portrait-bartender { --portrait-position: 100% 33.333%; --portrait-fallback: url('../assets/avatars/bartender.svg'); }
.portrait-madame { --portrait-position: 0% 66.667%; --portrait-fallback: url('../assets/avatars/madame.svg'); }
.portrait-the_house { --portrait-position: 33.333% 66.667%; --portrait-fallback: url('../assets/avatars/the_house.svg'); }
.portrait-player { --portrait-position: 66.667% 66.667%; --portrait-fallback: url('../assets/avatars/player.svg'); }
.dealer-name { color: var(--ivory); font-size: 1.35rem; }
.dealer-meta { margin-left: auto; text-align: right; }
.dealer-meta .mark {
  font-family: var(--font-mono);
  color: var(--brass-hi);
  font-size: 1.15rem;
}

.mark-track {
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  overflow: hidden;
}
.mark-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-deep), var(--cyan));
  box-shadow: 0 0 12px rgba(79, 232, 216, 0.5);
  transition: width 0.35s ease;
}

/* ---------- board ---------- */

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
  flex: 1 1 auto;       /* fill remaining height on a table screen... */
  min-height: 0;        /* ...and let children shrink instead of overflowing */
}
@media (max-width: 820px) {
  .table-layout { grid-template-columns: minmax(0, 1fr); }
}

.board-frame {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(247,217,154,.98) 0%, rgba(220,170,83,.72) 11%, rgba(93,53,13,.22) 48%, rgba(42,21,5,.68) 100%),
    url('../assets/board/antique-brass.png') center / cover,
    #80521f;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 240, 200, 0.5);
}
.board-frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 13px;
  border: 1px solid rgba(255, 235, 190, 0.25);
  pointer-events: none;
}
#board {
  --board-gap: 8px;
  --board-pad: 14px;
  --diagonal-gap: 11.314px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--board-gap);
  padding: var(--board-pad);
  border-radius: 12px;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, #1b3b58, var(--felt) 55%, var(--felt-deep));
  box-shadow: inset 0 4px 18px rgba(0, 0, 0, 0.65);
}
.cell {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(0.6rem, 1.8vw, 0.95rem);
  cursor: pointer;
  background: radial-gradient(circle at 50% 38%, #10253c, var(--well) 72%);
  box-shadow:
    inset 0 3px 7px rgba(0, 0, 0, 0.8),
    inset 0 -1px 2px rgba(120, 160, 200, 0.12);
  transition: box-shadow 0.12s ease, transform 0.12s ease, filter 0.12s ease;
}
.cell.col-hover {
  box-shadow:
    inset 0 3px 7px rgba(0, 0, 0, 0.8),
    0 0 0 2px rgba(79, 232, 216, 0.35);
}
.cell.ghost {
  background: radial-gradient(circle at 50% 35%, rgba(79, 232, 216, 0.35), rgba(79, 232, 216, 0.12) 70%);
  box-shadow: inset 0 0 0 2px rgba(79, 232, 216, 0.55);
}

.cell.player,
.cell.opponent {
  color: #fff6e4;
  text-shadow: 0 2px 2px rgba(46, 0, 10, 0.8);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.35),
    inset 0 -5px 8px rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.45);
}
.cell.player {
  background: radial-gradient(circle at 35% 28%, #c9fff8, var(--cyan) 42%, var(--cyan-deep) 100%);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.5),
    inset 0 -5px 8px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(79, 232, 216, 0.3);
}
.cell.opponent {
  background: radial-gradient(circle at 35% 28%, #ffd0e0, var(--ruby) 42%, var(--ruby-deep) 100%);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.4),
    inset 0 -5px 8px rgba(0, 0, 0, 0.35),
    0 0 16px rgba(255, 79, 139, 0.3);
}
/* chip rim */
.cell.player::after,
.cell.opponent::after {
  content: '';
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1.5px dashed rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.cell.house {
  color: #fff2cf;
  border-radius: 22%;
  background: linear-gradient(160deg, #c2b183, var(--hazard) 45%, #5a4c2c);
  box-shadow: inset 0 2px 4px rgba(255, 240, 200, 0.4), 0 3px 8px rgba(0, 0, 0, 0.5);
}
.cell.house.fragile { border: 2px dashed #efe0ab; }
.cell.loaded { box-shadow: inset 0 0 0 3px var(--brass), 0 0 14px rgba(227, 184, 102, 0.35); }
.cell.loaded::before {
  content: '★';
  position: absolute;
  top: 2px; right: 5px;
  font-size: 0.6rem;
  color: var(--brass-hi);
}
.cell.padlocked::before {
  content: '🔒';
  position: absolute;
  font-size: 0.85rem;
  filter: drop-shadow(0 1px 2px #000);
}
.cell.cursed:not(.player):not(.opponent) {
  background: repeating-linear-gradient(45deg, #140b18, #140b18 5px, #221028 5px, #221028 10px);
  box-shadow: inset 0 0 0 2px rgba(255, 79, 139, 0.35);
}
.cell.flipped:not(.player):not(.opponent) { border-radius: 22%; }
.cell.win {
  animation: winPulse 0.9s ease-in-out infinite alternate;
  outline: 3px solid #ffe4a2;
  outline-offset: 1px;
  z-index: 2;
}
@keyframes winPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.55) drop-shadow(0 0 10px var(--brass-hi)); }
}
.cell.drop-in { animation: dropIn 0.28s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes dropIn {
  from { transform: translateY(-26%); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- payout ---------- */

#payout-pop {
  min-height: 42px;
  margin-top: 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--green);
  text-shadow: 0 0 18px rgba(134, 227, 154, 0.35);
}
#payout-pop .payout-line { animation: payoutRise 0.5s ease-out; display: inline-block; }
#payout-pop .payout-mult { color: var(--brass-hi); }
@keyframes payoutRise {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- hand ---------- */

.hand-label {
  margin-top: 14px;
  text-align: center;
}
#hand {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.disc {
  position: relative;
  width: 88px; height: 88px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ivory);
  background: radial-gradient(circle at 35% 28%, #8a2630, var(--panel) 65%, #28070b);
  border: 2px solid var(--brass-dim);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.12);
}
.disc .disc-glyph {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--brass-hi);
}
.disc .disc-name {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.disc .disc-key {
  position: absolute;
  top: -6px; left: -4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ivory);
  background: #493114;
  border: 1px solid var(--brass);
}
.disc:hover { transform: translateY(-3px); border-color: var(--brass); }
.disc.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(79, 232, 216, 0.3), 0 0 22px rgba(79, 232, 216, 0.35);
}
.disc.selected .disc-glyph { color: var(--cyan); }
.disc-gold { border-color: #d8b04a; }
.disc-gold .disc-glyph { color: #ffd977; }
.disc-bomb .disc-glyph { color: #ff8a5c; }
.disc-key .disc-glyph { color: #ffe9a8; }
.disc-wild .disc-glyph { color: #c39bff; }
.disc-double .disc-glyph { color: #8fd0ff; }
.disc-bomb { border-color: #a8563a; }

/* ---------- side panel / table card ---------- */

#table-card {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  max-height: none;
  overflow: visible;
}
.board-area { min-height: 0; }
.hand-label, #hand, #stats, #dealer, #offer, #notice, #cheats { flex: none; }
#hand { flex: none; }
#table-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
#table-card .section-label {
  margin: 12px 0 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-dim);
}
.rule-list, .bet-list { display: flex; flex-direction: column; gap: 6px; }
.rule-chip, .bet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  color: var(--ivory);
}
.rule-chip .icon, .bet-chip .icon { color: var(--brass); }
.bet-chip .bonus {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 0.78rem;
}
.bet-chip.won { border-color: rgba(134, 227, 154, 0.5); }

/* ---------- first-table tutorial ---------- */

.tutorial-coach {
  border: 1px solid var(--brass);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(227, 182, 102, 0.07);
}
.tutorial-coach ol { margin: 8px 0 10px 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tutorial-step { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; color: var(--ivory); }
.tutorial-step .tutorial-num {
  flex: none;
  width: 1.3em; height: 1.3em;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--brass);
  border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--brass);
}
.tutorial-step.done .tutorial-num { background: #7a1020; color: var(--brass-hi); border-color: var(--brass); }
.tutorial-step.done { opacity: 0.75; }
.tutorial-coach { display: flex; flex-direction: column; }
#tutorial-hide {
  order: -1;
  align-self: flex-end;
  margin: 0;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.tutorial-banner {
  border: 1px dashed var(--brass);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 4px;
  text-align: left;
}
.tutorial-banner p { margin: 4px 0 0; }

/* ---------- overlays / menus ---------- */

.overlay {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px 12px;
  max-height: 100%;
  overflow: hidden;
}
.overlay-card {
  width: min(94vw, 640px);
  padding: 30px 30px 26px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(227, 184, 102, 0.08), transparent 60%),
    linear-gradient(180deg, var(--panel-raised), var(--velvet));
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 235, 190, 0.12);
}
.overlay-card h1 { margin-bottom: 6px; }
.overlay-card h2 { margin-bottom: 8px; }
.overlay-card .lede { color: var(--muted); margin-bottom: 20px; }
.overlay-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* logo mark: four glowing discs in a row */
.logo-mark { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.logo-mark .chip {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #c9fff8, var(--cyan) 42%, var(--cyan-deep));
  box-shadow: 0 0 18px rgba(79, 232, 216, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.logo-mark .chip:nth-child(even) {
  background: radial-gradient(circle at 35% 28%, #ffd0e0, var(--ruby) 42%, var(--ruby-deep));
  box-shadow: 0 0 18px rgba(255, 79, 139, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.35);
}
.logo-word {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3.1rem);
  white-space: nowrap;
  letter-spacing: 0.05em;
  color: var(--brass-hi);
}
/* The name is rendered in amethyst and brass. */
.connect-four {
  color: var(--brass-hi);
  text-shadow: 0 2px 0 #6b4c1c, 0 0 24px rgba(227, 184, 102, 0.25);
}
/* "tune" — gold with a sweeping shimmer, everywhere the name appears */
.tune {
  color: var(--brass);
  background: linear-gradient(105deg, #d5a955 25%, #fff2bd 45%, #d5a955 65%);
  background-size: 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}
@keyframes shimmer {
  from { background-position: 250% 0; }
  to { background-position: -250% 0; }
}

/* wager + reward cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) {
  .card-grid, .card-grid.three { grid-template-columns: minmax(0, 1fr); }
}
.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  color: var(--ivory);
  background: linear-gradient(180deg, #164a37, #0a2a1e);
  border: 1px solid var(--line);
  box-shadow: 0 4px 0 #07150e;
}
.choice-card:hover { border-color: var(--brass); }
.choice-card .choice-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--brass-hi);
  text-transform: uppercase;
}
.choice-card .choice-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.choice-card .choice-desc { font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.choice-card .choice-numbers {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ivory);
}
.choice-card.risk-high { border-color: rgba(255, 79, 139, 0.45); }
.choice-card.risk-high .choice-name { color: var(--brass-hi); }

.favors-total {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  color: var(--brass-hi);
}

/* ---------- cheats tray, notices, house offers ---------- */

#notice {
  margin: 12px auto 0;
  max-width: 640px;
}
.notice.error { color: #ffb3cc; }
#cheats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.cheats.empty { display: none; }
.cheats .section-label { margin-right: 6px; }
.cheat {
  font-size: 0.8rem;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ivory);
  background: linear-gradient(180deg, #1b4a35, #092519);
  border: 1px dashed rgba(227, 184, 102, 0.5);
  box-shadow: none;
}
.cheat:hover:not(:disabled) {
  border-style: solid;
  border-color: var(--brass);
  color: var(--brass-hi);
}

.offer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(ellipse 70% 55% at 50% 45%, rgba(28, 104, 77, 0.16), transparent 72%), rgba(2, 10, 7, 0.82);
  margin: 0;
}
.offer-card {
  position: relative;
  width: min(94vw, 520px);
  padding: 20px 22px 18px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid #bd9556;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(255, 228, 160, 0.1), transparent 68%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #164a37 0%, #0a2b21 58%, #061b14 100%);
  box-shadow:
    0 0 0 5px #29190d,
    0 0 0 7px #9f773a,
    0 0 0 8px #0b0704,
    0 18px 42px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 245, 210, 0.2);
}
.offer-card > :not(.table-suits) { position: relative; z-index: 1; }
.offer-card h3 {
  color: #ffe5aa;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: 0.035em;
  margin: 2px 0 6px;
}
.offer-card .taunt { color: #eadcba; font-size: 0.95rem; line-height: 1.45; }
.offer-card .offer-cost {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid rgba(255, 216, 139, 0.42);
  border-radius: 999px;
  font-family: var(--font-mono);
  color: #ffd98d;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.85rem;
  margin-top: 8px;
}
.offer-card .overlay-actions { margin-top: 12px; }
.offer-card .overlay-actions > button { min-width: 124px; }

/* ---------- misc ---------- */

#collect-table {
  display: block;
  margin: 16px auto 0;
  font-size: 1.05rem;
  padding: 13px 30px;
}
.notice {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 10px;
}
.notice.error { color: #ffb3cc; }

/* ---------- ambient atmosphere ---------- */

body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9998;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9998;
  background: radial-gradient(ellipse 130% 120% at 50% 45%, transparent 55%, rgba(0,0,0,0.5) 100%);
}
.motes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.mote {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(227,184,102,0.5);
  box-shadow: 0 0 6px rgba(227,184,102,0.4);
  animation: drift 18s linear infinite;
  opacity: 0;
}
.mote:nth-child(3n+1), .mote:nth-child(3n+2) { background: rgba(227,184,102,.45); box-shadow: 0 0 6px rgba(227,184,102,.35); }
.mote:nth-child(1) { left: 8%; top: 90%; animation-delay: -2s; animation-duration: 16s; }
.mote:nth-child(2) { left: 18%; top: 70%; animation-delay: -7s; animation-duration: 22s; }
.mote:nth-child(3) { left: 30%; top: 85%; animation-delay: -4s; animation-duration: 19s; }
.mote:nth-child(4) { left: 42%; top: 75%; animation-delay: -11s; animation-duration: 24s; }
.mote:nth-child(5) { left: 55%; top: 88%; animation-delay: -1s; animation-duration: 17s; }
.mote:nth-child(6) { left: 64%; top: 72%; animation-delay: -9s; animation-duration: 21s; }
.mote:nth-child(7) { left: 75%; top: 90%; animation-delay: -5s; animation-duration: 20s; }
.mote:nth-child(8) { left: 85%; top: 78%; animation-delay: -13s; animation-duration: 25s; }
.mote:nth-child(9) { left: 92%; top: 92%; animation-delay: -3s; animation-duration: 18s; }
.mote:nth-child(10) { left: 4%; top: 55%; animation-delay: -15s; animation-duration: 23s; }
.mote:nth-child(11) { left: 96%; top: 60%; animation-delay: -8s; animation-duration: 19s; }
.mote:nth-child(12) { left: 50%; top: 60%; animation-delay: -6s; animation-duration: 26s; }
@keyframes drift {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-45vh); opacity: 0; }
}

/* ---------- transitions, pulses, ripple, particles ---------- */

.overlay { animation: screenIn 0.35s ease both; position: relative; z-index: 1; }
.overlay-card { animation: cardIn 0.4s ease both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* The amethyst half stays still while the brass catches the light. */
.connect-four { animation: none; }
@keyframes neonGreen {
  0%, 100% { text-shadow: 0 2px 0 #2f6a3e, 0 0 24px rgba(134,227,154,0.35); }
  50% { text-shadow: 0 2px 0 #2f6a3e, 0 0 40px rgba(134,227,154,0.55); }
}

#board { animation: frameGlow 6s ease-in-out infinite; }
@keyframes frameGlow {
  0%, 100% { box-shadow: inset 0 4px 18px rgba(0,0,0,0.65); }
  50% { box-shadow: inset 0 4px 18px rgba(0,0,0,0.65), 0 0 0 1px rgba(227,184,102,0.06); }
}

.dealer-avatar { animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

#payout-pop { animation: payoutPop 0.5s ease; }
@keyframes payoutPop { from { transform: scale(0.85); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

#notice { animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.cell.drop-in { animation: dropIn 0.28s cubic-bezier(0.3,1.4,0.5,1); }

.cheat.flash { animation: flash 0.3s ease; }
@keyframes flash { 50% { background: #65491f; color: var(--ivory); } }

/* choice cards */
.choice-card { transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease; }
.choice-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,0.5); }

/* button ripple */
button { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  pointer-events: none;
  animation: rippleOut 0.65s ease-out forwards;
}
@keyframes rippleOut { from { transform: scale(0); opacity: 0.5; } to { transform: scale(14); opacity: 0; } }

/* payout chip particles */
.chip-particle {
  position: fixed;
  width: 11px; height: 11px;
  border-radius: 50%;
  pointer-events: none; z-index: 9999;
  background: var(--brass);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.4), 0 1px 3px rgba(0,0,0,0.4);
  animation: chipBurst 0.75s ease-out forwards;
}
@keyframes chipBurst {
  from { transform: translate(0,0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* composure shake when a pip is spent */
.composure .pip.spent { animation: shake 0.4s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ---------- extra gameplay juice ---------- */

/* screen shake */
@keyframes shakeScreen {
  0%,100% { transform: translate(0,0); }
  10% { transform: translate(-6px,3px); } 20% { transform: translate(6px,-3px); }
  30% { transform: translate(-5px,-2px); } 40% { transform: translate(5px,2px); }
  50% { transform: translate(-4px,3px); } 60% { transform: translate(4px,-2px); }
  70% { transform: translate(-3px,2px); } 80% { transform: translate(3px,-1px); } 90% { transform: translate(-1px,1px); }
}
#app.shaking { animation: shakeScreen 0.42s cubic-bezier(.36,.07,.19,.97); }
#app.shaking-loss { animation: shakeScreen 0.5s cubic-bezier(.36,.07,.19,.97); }

/* board flash */
@keyframes boardFlashWin { 0% { box-shadow: inset 0 0 0 0 transparent; } 25% { box-shadow: inset 0 0 40px 8px rgba(134,227,154,0.55); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
@keyframes boardFlashLoss { 0% { box-shadow: inset 0 0 0 0 transparent; } 25% { box-shadow: inset 0 0 40px 8px rgba(255,79,139,0.5); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.board-frame.flash-win { animation: boardFlashWin 0.55s ease; }
.board-frame.flash-loss { animation: boardFlashLoss 0.55s ease; }

/* landing ring on a freshly dropped disc */
.landing-ring {
  position: absolute; left: 50%; top: 50%;
  width: 60%; height: 60%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  transform: translate(-50%,-50%) scale(0.5);
  animation: ringExpand 0.55s ease-out forwards;
  pointer-events: none; z-index: 3;
}
@keyframes ringExpand { to { transform: translate(-50%,-50%) scale(2.4); opacity: 0; } }

/* full-screen splash ("FOUR!", "TABLE WON", "BLOCKED!") */
.splash {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.splash-text {
  font-family: var(--font-display);
  font-size: clamp(3rem, 13vw, 8rem);
  letter-spacing: 0.06em;
  line-height: 0.9;
  transform-origin: center;
  animation: splashPop 1.05s cubic-bezier(.2,1.4,.3,1) forwards;
}
.splash-sub { margin-top: 14px; font-family: var(--font-mono); letter-spacing: .2em; color: var(--muted); animation: splashSub 1.05s ease forwards; }
@keyframes splashPop {
  0% { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  18% { transform: scale(1.15) rotate(2deg); opacity: 1; }
  30% { transform: scale(1); opacity: 1; }
  75% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes splashSub { 0%,30% { opacity: 0; } 45%,75% { opacity: 1; } 100% { opacity: 0; } }
.splash-win .splash-text { color: #86e39a; text-shadow: 0 0 30px rgba(134,227,154,.6), 0 4px 0 #2f6a3e; }
.splash-loss .splash-text { color: #ff4f8b; text-shadow: 0 0 30px rgba(255,79,139,.6), 0 4px 0 #8c1c48; }
.splash-gold .splash-text { color: var(--brass-hi); text-shadow: 0 0 30px rgba(227,184,102,.6), 0 4px 0 var(--brass-deep); }
.splash-info .splash-text { color: var(--ivory); text-shadow: 0 0 24px rgba(255,255,255,.3); }

/* confetti */
.confetti {
  position: fixed; top: -14px;
  width: 9px; height: 9px; border-radius: 2px;
  pointer-events: none; z-index: 9999;
  animation: confettiFall var(--fall,1.1s) ease-in forwards;
}
@keyframes confettiFall {
  to { transform: translateY(108vh) rotate(var(--spin,360deg)); opacity: 0.85; }
}

/* floating "+N" text */
.float-text {
  position: absolute; left: 50%; top: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono); font-weight: 800; font-size: 0.95rem;
  color: var(--green); text-shadow: 0 1px 3px #000;
  pointer-events: none; z-index: 5;
  animation: floatUp 0.9s ease-out forwards;
}
.float-text.gold { color: var(--brass-hi); }
.float-text.bad { color: #ffb3cc; }
@keyframes floatUp { to { transform: translate(-50%, -26px); opacity: 0; } }

/* ---------- attention-grabbing UI ---------- */

/* pulsing glow on primary actions */
.glow-pulse { animation: glowPulse 1.3s ease-in-out infinite; }
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(227,184,102,0.5), 0 4px 14px rgba(0,0,0,.4); }
  50% { box-shadow: 0 0 0 7px rgba(227,184,102,0.12), 0 0 22px rgba(227,184,102,0.45); }
}

/* one-shot pop */
.pulse-once { animation: pulseOnce 0.55s ease; }
@keyframes pulseOnce { 0% { transform: scale(1); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* attention ping ring */
.ping::after {
  content: ''; position: absolute; inset: -4px; border-radius: inherit;
  border: 2px solid var(--brass); opacity: 0; pointer-events: none;
  animation: ping 1.2s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.25); opacity: 0; } }

/* sheen sweep across buttons */
button::before {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-18deg); pointer-events: none; transition: left 0.5s ease;
}
button:hover::before { left: 130%; }
button.attention::before { animation: sheen 2.2s ease-in-out infinite; }
@keyframes sheen { 0% { left: -120%; } 55% { left: 130%; } 100% { left: 130%; } }

/* wiggle to attract attention */
.wiggle { animation: wiggle 0.6s ease infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* stronger entrance for house offers + rewards */
.offer-card { animation: offerIn 0.5s cubic-bezier(.2,1.3,.3,1) both, borderPulse 1.8s ease-in-out infinite; }
@keyframes offerIn { from { opacity:0; transform: translateY(-18px) scale(.94); } to { opacity:1; transform:none; } }
@keyframes borderPulse { 0%,100% { border-color: rgba(255,79,139,.45); } 50% { border-color: rgba(255,79,139,.85); } }

/* collect payout button: attention */
#collect-table { font-size:1.05rem; padding:13px 30px; }
.collect { animation: glowPulse 1.2s ease-in-out infinite; }

/* notice states */
#notice { animation: slideIn .3s ease; }
#notice.error { animation: slideIn .3s ease, shakeScreen .35s ease; }

/* cheat flash + ping */
.cheat.flash { animation: flash .3s ease; }

/* Respect the OS "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .motes, body::before, body::after { display: none !important; }
  button::before { display: none !important; }
}

/* Make the table and menus usable at narrow widths, short heights and zoom. */
body { height: auto; max-height: none; min-height: 100vh; width: 100%; overflow-x: hidden; overflow-y: auto; }
#app { height: auto; max-height: none; min-height: 100vh; overflow: visible; }
.overlay { min-height: calc(100vh - 36px); max-height: none; overflow: visible; }
.overlay-card { max-width: 100%; }
.table-layout { flex: 0 0 auto; }
.eyebrow, #table-card .section-label { color: #d1b478; }
button.ghost { color: #e0d5e5; }
button:focus-visible, .cell:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; z-index: 4; }
.logo-word { white-space: normal; line-height: 1; }
.choice-card:hover:not(:disabled) { border-color: var(--brass); }
@media (max-width: 820px) {
  #app { width: min(100%, 680px); }
  .table-layout { gap: 12px; }
  #table-card { width: 100%; }
}
@media (max-width: 560px) {
  .overlay { padding: 20px 0; }
  .overlay-card { padding: 24px 18px; }
  .board-frame { padding: 10px; }
  #board { --board-pad: 8px; --board-gap: 5px; --diagonal-gap: 7.071px; }
  .hud { gap: 8px; }
  .dealer { flex-wrap: wrap; }
}
.hand-detail { flex-basis: 100%; max-width: 560px; margin: 0; color: var(--ivory); font-size: .9rem; line-height: 1.45; text-align: center; }
.rule-chip { align-items: flex-start; line-height: 1.4; }
.rule-chip strong { color: var(--brass-hi); }
.board-result { margin: 14px auto 8px; padding: 12px 18px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); text-align: center; color: var(--ivory); }
#next-board, #collect-table { align-self: center; margin: 8px 0 20px; }
.cheat-desc { display: block; max-width: 240px; margin-top: 4px; font-weight: 400; font-size: .75rem; line-height: 1.35; }
.cell.gate-edge { border-bottom: 4px solid #f7d99a; border-radius: 50% 50% 30% 30%; }
@media (min-width: 821px) {
  .board-area { width: min(100%, 64vh); margin-inline: auto; }
}
#payout-pop:empty { display: none; }
@media (min-width: 821px) {
  .board-area { width: min(100%, 58vh); }
}
/* Keep unavailable shop choices legible and explain why they cannot be selected. */
/* Symbols supplement colour and shape, including where multiple rules overlap. */
.cell.loaded::before, .cell.padlocked::before { content: none; }
.cell-marker { position: absolute; top: 1px; right: 2px; z-index: 3; color: #fff3c8; background: #3c1015; border-radius: 4px; font: 700 clamp(.82rem, 1vw, .9rem) var(--font-body); line-height: 1; padding: 1px 2px; pointer-events: none; }
.cell.gate-edge { border-bottom: 5px solid #ffe4a2; }
.cell.gate-edge { border-bottom: 0; border-radius: 50%; }
.cell.gate-edge::before { content: ''; position: absolute; left: -5px; right: -5px; bottom: -5px; height: 5px; z-index: 3; background: #ffe4a2; box-shadow: 0 2px 2px #35230f; pointer-events: none; }
.vice-action:disabled { opacity: 1; color: #d8ccdc; border-color: #8b7655; }
.how-to { margin-top: 20px; text-align: left; border-top: 1px solid var(--line); }
.how-to summary { padding: 14px 4px 4px; cursor: pointer; color: var(--brass-hi); font-weight: 700; }
.how-to summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; border-radius: 4px; }
.how-to-content { color: var(--ivory); line-height: 1.5; font-size: .9rem; }
.how-to-content p { margin-top: 12px; }
.how-to-content strong { color: var(--brass-hi); }
.vault { margin-top: 20px; text-align: left; border-top: 1px solid var(--line); color: var(--ivory); font-size: .9rem; line-height: 1.5; }
.vault summary { padding: 14px 4px 4px; color: var(--brass-hi); font-weight: 700; cursor: pointer; }
.vault summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; border-radius: 4px; }
.vault p { margin-top: 10px; }
.vault-options { display: grid; gap: 8px; margin-top: 12px; }
.vault-options button { text-align: left; }
.vault-description { display: block; margin-top: 3px; font-size: .8rem; font-weight: 400; line-height: 1.4; }
.vault-thresholds, .vault-total { color: #e3c6ba; font-size: .82rem; }
.vault-total { margin: 8px auto 0; max-width: 30rem; line-height: 1.5; }
.menu-credit { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; letter-spacing: .02em; text-align: center; }
.credit-just { color: var(--brass); font-family: var(--font-body); font-weight: 600; }
.credit-base { color: var(--brass-hi); font-family: var(--font-display); font-size: 1.05em; letter-spacing: .05em; }
.electric-word { color: var(--brass-hi); font-weight: 700; white-space: nowrap; text-shadow: 0 0 5px rgba(255, 214, 120, .8), 0 0 14px rgba(242, 185, 63, .4); animation: electric-glow 4s ease-in-out infinite; }
.floating-tagline { position: absolute; top: -59px; left: 8%; margin: 0; color: var(--ivory); font: italic 700 clamp(.85rem, 2.3vw, 1.12rem)/1.3 var(--font-body); transform: rotate(-7deg); transform-origin: left center; text-shadow: 0 2px 8px #21080b; white-space: nowrap; }
/* Gold neon and warm brass echo the casino sign. */
.logo-word .connect-four { color: #ffe9b0; text-shadow: 0 3px 0 #3b2a10, 0 0 26px rgba(242, 185, 63, .4); }
@keyframes electric-glow {
  0%, 100% { text-shadow: 0 0 5px rgba(255, 214, 120, .65), 0 0 12px rgba(242, 185, 63, .3); }
  50% { text-shadow: 0 0 7px rgba(255, 248, 216, .95), 0 0 19px rgba(242, 185, 63, .65); }
}
@media (prefers-reduced-motion: reduce) { .electric-word, .tune { animation: none; } }
@media (forced-colors: active) { .tune { background: none; -webkit-text-fill-color: currentColor; } }
.overlay-actions button:disabled { opacity: 1; color: #e8cfc2; background: var(--panel); border-color: #6e5a40; box-shadow: none; }
.column-labels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 0 14px 7px; color: var(--brass-hi); font: 700 clamp(.55rem, 1.2vw, .72rem) var(--font-mono); text-align: center; }
@media (max-width: 560px) { .column-labels { gap: 5px; padding: 0 8px 5px; } }
.payout-details { margin: 10px auto 0; max-width: 480px; padding: 9px 12px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ivory); text-align: left; text-shadow: none; font: .82rem/1.45 var(--font-body); }
.payout-details summary { cursor: pointer; color: var(--brass-hi); font-weight: 700; }
.payout-details summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; }
.payout-details ul { margin: 8px 0 0; padding-left: 20px; }
.table-receipt { margin: 14px auto; padding: 12px 14px; max-width: 560px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(0,0,0,.22); color: var(--ivory); text-align: left; line-height: 1.45; }
.table-receipt strong { color: var(--brass-hi); }
.table-receipt p { margin-top: 4px; font-size: .9rem; }
.table-receipt details { margin-top: 8px; font-size: .85rem; }
.table-receipt summary { cursor: pointer; color: var(--cyan); font-weight: 700; }
.table-receipt summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; }
.table-receipt ul { margin: 8px 0 0; padding-left: 20px; }
.move-preview { margin: 8px auto 0; max-width: 480px; color: #e7dcbf; text-align: center; font: .78rem/1.35 var(--font-body); min-height: 1.35em; }
.move-preview.preview-win, .move-preview.preview-loss { padding: 5px 10px; border: 1px solid #c9a65d; border-radius: 4px; color: #fff0ce; background: #4e171a; }
.move-preview.preview-loss { border-style: dashed; }
.board-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 10px auto 0; color: #e7dcbf; font: .75rem/1.4 var(--font-body); text-align: center; }
.board-legend b { color: var(--brass-hi); }
.disc-guide { margin-top: 14px; border-top: 1px solid var(--line); color: var(--ivory); font: .8rem/1.45 var(--font-body); }
.disc-guide summary { padding: 12px 2px; color: var(--brass-hi); font-weight: 700; cursor: pointer; }
.disc-guide summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; }
.disc-guide ul { padding-left: 20px; }
.disc-guide li { margin: 0 0 8px; }
.disc-guide strong { color: var(--brass-hi); }
#table-card .vices-block { margin: 0; }
#table-card .vices-block > summary { cursor: pointer; }
#table-card .vices-block > summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; border-radius: 4px; }
#table-card .vices-block .rule-list { margin-top: 2px; }
#table-card.vices-focus > :not(.vices-block) { display: none; }
#table-card.vices-focus .vices-block { margin-top: 0; border-top: 0; }
.deck-summary { margin: 12px auto 16px; max-width: 560px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(0,0,0,.2); color: var(--ivory); text-align: left; font: .85rem/1.45 var(--font-body); }
.deck-summary summary { color: var(--brass-hi); cursor: pointer; font-weight: 700; }
.deck-summary summary:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 3px; }
.deck-summary ul { margin: 10px 0 0; padding-left: 20px; }
.deck-summary li { margin-bottom: 5px; }
.change-notice { margin: 12px auto; max-width: 560px; padding: 10px 14px; border-left: 3px solid var(--cyan); border-radius: 4px; background: rgba(79,232,216,.09); color: var(--ivory); font-size: .9rem; text-align: left; }
.overlay-card h1:focus-visible, .overlay-card h2:focus-visible, .change-notice:focus-visible { outline: 3px solid #ffe8ad; outline-offset: 4px; border-radius: 4px; }
.cell.preview-target { outline: 3px dashed #ffe8ad; outline-offset: 2px; z-index: 4; }
.preview-cap { position: absolute; inset: 9%; z-index: 2; display: grid; place-items: center; border: 2px dashed currentColor; border-radius: 50%; color: #b9fff5; background: rgba(79,232,216,.22); font: 900 clamp(.72rem, 1.8vw, 1.05rem)/1 var(--font-mono); pointer-events: none; }
.preview-cap.preview-opponent { color: #ffd8e6; background: rgba(255,79,139,.25); }
.preview-cap.preview-house { color: #fff1ca; background: rgba(227,184,102,.28); border-radius: 22%; }
@media (forced-colors: active) { .preview-cap { color: Highlight; background: Canvas; } }

/* Casino chips: a light-catching edge, inset face and a non-colour owner mark. */
.cell.player, .cell.opponent { isolation: isolate; }
.cell.player {
  color: #fff6e4;
  background: radial-gradient(circle at 32% 23%, #e4fffa 0%, #85f8ea 23%, #29bcb3 68%, #096d6a 100%);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.8), inset 0 -4px 6px rgba(0,42,44,.5), 0 3px 7px rgba(0,0,0,.5);
}
.cell.opponent {
  color: #fff6e4;
  background: radial-gradient(circle at 32% 23%, #ffe3ea 0%, #ff9cba 23%, #ed427b 68%, #8c1c48 100%);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.8), inset 0 -4px 6px rgba(67,0,25,.5), 0 3px 7px rgba(0,0,0,.5);
}
.cell.player::after, .cell.opponent::after {
  inset: 13%; border: 2px solid rgba(0,40,40,.38);
  background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.28), transparent 60%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.18);
  z-index: -1;
}
.cell.opponent::after { border-style: dashed; border-color: rgba(80,4,34,.55); }
.token-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 52%; height: 52%; border-radius: 50%; background: rgba(13,20,28,.88); color: var(--ivory); font-size: clamp(.7rem, 1.8vw, 1.05rem); line-height: 1; font-weight: 900; text-shadow: none; pointer-events: none; }
.disc .disc-glyph { color: var(--brass-hi); }
.disc.selected .disc-glyph { color: var(--cyan); }
/* Empty openings have a raised metal lip and a shadowed recessed well. */
.cell:not(.player):not(.opponent):not(.house):not(.cursed):not(.ghost):not(.col-hover) {
  background: radial-gradient(circle at 50% 42%, #17314a 0%, #0b1c30 52%, #06101e 78%);
  box-shadow: inset 0 0 0 2px #081421, inset 0 4px 8px rgba(0,0,0,.85), inset 0 -2px 2px rgba(116,173,199,.28), 0 1px 0 rgba(145,201,220,.18);
}
.cell.player.win, .cell.opponent.win {
  box-shadow: inset 0 2px 2px rgba(255,255,255,.9), inset 0 -4px 6px rgba(0,0,0,.4), 0 0 0 2px #5e400e, 0 0 14px rgba(255,218,131,.8);
}
.win-link-layer { position: absolute; inset: var(--board-pad); z-index: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); gap: var(--board-gap); pointer-events: none; }
.win-segment { position: relative; }
.win-segment::after { content: ''; position: absolute; left: 50%; top: 50%; width: calc(100% + var(--board-gap)); height: 4px; border-radius: 999px; background: #ffe4a2; box-shadow: 0 0 8px rgba(255,218,131,.85); transform: translateY(-50%); transform-origin: 0 50%; }
.win-segment-down::after { transform: translateY(-50%) rotate(90deg); }
.win-segment-down-right::after, .win-segment-down-left::after { width: calc(141.421% + var(--diagonal-gap)); }
.win-segment-down-right::after { transform: translateY(-50%) rotate(45deg); }
.win-segment-down-left::after { transform: translateY(-50%) rotate(135deg); }
@media (forced-colors: active) {
  .cell.player, .cell.opponent { border: 2px solid CanvasText; }
  .cell.opponent { border-style: dashed; }
  .token-mark { color: CanvasText; }
  .win-segment::after { background: Highlight; }
}
.board-area #next-board, .board-area #collect-table { display: block; margin: 10px auto 18px; }
#payout-pop.payout-opponent { color: #ffb3cc; text-shadow: 0 0 18px rgba(255,79,139,.3); }

/* ---------- story breaks (cutscenes) ---------- */
.story-cast {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  margin: 18px auto 6px;
  max-width: 560px;
}
.story-player {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}
.story-avatar {
  width: 72px; height: 72px;
  font-size: 1.6rem;
}
.story-vs {
  align-self: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  color: var(--brass-hi);
  text-shadow: 0 0 14px rgba(227,184,102,0.4);
}
.story-name { color: var(--brass-hi); font-weight: 800; font-size: 0.92rem; text-align: center; }
.story-role { color: var(--muted); font-size: 0.78rem; line-height: 1.4; text-align: center; }
.story-next {
  margin: 10px auto 0;
  max-width: 560px;
  padding: 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ivory);
  font-size: 0.85rem;
  background: rgba(79,232,216,0.06);
}
.story-next strong { color: var(--cyan); }
.story-lines { margin: 14px auto 0; max-width: 560px; text-align: left; display: grid; gap: 10px; }
.story-line {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 8px 8px 0;
  background: rgba(0,0,0,0.22);
  color: var(--ivory);
  font-size: 0.9rem;
  line-height: 1.5;
}
.story-announcer { border-left-color: var(--cyan); background: rgba(79,232,216,0.08); }
.story-announcer strong { color: var(--cyan); }
.story-hint { margin: 12px 0 0; color: var(--dim); font-size: 0.75rem; letter-spacing: 0.06em; }
@media (max-width: 560px) {
  .story-cast { flex-direction: column; }
  .story-vs { padding: 2px 0; }
}
/* ---------- player profiles & run history ---------- */
.profiles, .run-history {
  margin-top: 16px;
  text-align: left;
  border-top: 1px solid var(--line);
  color: var(--ivory);
  font-size: 0.9rem;
  line-height: 1.5;
}
.profiles summary, .run-history summary {
  padding: 14px 4px 4px;
  color: var(--brass-hi);
  font-weight: 700;
  cursor: pointer;
}
.profiles summary:focus-visible, .run-history summary:focus-visible {
  outline: 3px solid #ffe8ad;
  outline-offset: 3px;
  border-radius: 4px;
}
.profile-list { display: grid; gap: 8px; margin-top: 12px; }
.profile-item { display: flex; gap: 8px; align-items: stretch; }
.profile-select {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}
.profile-item.active .profile-select { border-color: var(--cyan); }
.profile-delete { flex: 0 0 auto; padding: 11px 14px; }
.profile-create { margin-top: 12px; }
.profile-create .eyebrow { display: block; margin-bottom: 6px; }
.profile-create-row { display: flex; gap: 8px; }
.profile-create-row input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ivory);
  background: rgba(32, 2, 9, 0.72);
  border: 1px solid rgba(242, 185, 63, 0.42);
  border-radius: 10px;
  padding: 11px 14px;
}
.profile-create-row input::placeholder,
.profile-create-row input::-webkit-input-placeholder { color: #e2c1b2; opacity: 1; }
.profile-create-row input:focus-visible {
  outline: 3px solid #ffe8ad;
  outline-offset: 2px;
}
.run-history ul { margin: 10px 0 0; padding-left: 20px; }
.run-history li { margin-bottom: 5px; }
.season-log { margin: 6px 0 4px; padding-left: 18px; color: var(--dim); font-size: 0.82rem; }
.season-log li { margin-bottom: 2px; }
/* Season list: mid-run blocks and the table-win story recall. */
.season-log-block {
  margin-top: 12px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--ivory);
  font-size: 0.85rem;
  line-height: 1.45;
}
.season-log-block .eyebrow { margin: 0 0 4px; }
.season-log-block .season-goal { margin: 0 0 6px; color: var(--dim); font-size: 0.82rem; }
.season-log-block ul { margin: 0; padding-left: 18px; color: var(--dim); font-size: 0.82rem; max-height: 132px; overflow-y: auto; }
.season-log-block li { margin-bottom: 2px; }
/* Story recall reuses the list, centred under the dialogue. */
.story-overlay .season-log-block { max-width: 560px; margin-left: auto; margin-right: auto; }

/* ============================================================
   GREEN BAIZE — the casino boardroom
   Walnut rail, brass betting line, ivory enamel plaques and chip wells.
   Every screen sits on the same baize table; nothing is a menu card.
   ============================================================ */

/* No visible scrollbars anywhere; everything stays scrollable. */
html, body, #app, .overlay, #table-card, #hand, .season-log-block ul {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar, #app::-webkit-scrollbar,
.overlay::-webkit-scrollbar, #table-card::-webkit-scrollbar, #hand::-webkit-scrollbar,
.season-log-block ul::-webkit-scrollbar { width: 0; height: 0; display: none; }

body {
  background:
    radial-gradient(ellipse 62% 48% at 50% 2%, rgba(55, 160, 120, 0.22), transparent 70%),
    radial-gradient(ellipse 100% 70% at 50% 112%, rgba(0, 0, 0, 0.72), transparent 66%),
    repeating-linear-gradient(45deg, rgba(248, 232, 188, 0.028) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(-45deg, rgba(248, 232, 188, 0.02) 0 1px, transparent 1px 16px),
    radial-gradient(ellipse at 50% 42%, #0c3829 0%, #062119 58%, #020b07 100%);
}

/* Every rival gets their own table. The default is green baize under a
   walnut-and-brass rail; rival variants keep their signature felt. */
#app {
  --rival-sigil: "♠︎";
  --rival-accent: var(--brass);
  --rival-accent-hi: var(--brass-hi);
  --rival-soft: rgba(216, 169, 78, 0.18);
  --rival-border: #38604b;
  --rival-band: rgba(5, 28, 20, 0.78);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #146047, #0a3a2d 55%, #04261d);
  --rival-pattern: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 9px);
  --rival-rail: linear-gradient(180deg, #29190c 0%, #6f4c1e 5%, #d4a65a 9%, #7b561f 15%, #30200f 42%, #140b05 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #0b3022 0%, #04170f 52%, #010a06 78%);
}

/* The Dealer — the house's classic green baize and polished brass. */
#app[data-rival="dealer"] {
  --rival-sigil: "♠︎";
  --rival-accent: #f2b93f;
  --rival-accent-hi: #ffe49a;
  --rival-soft: rgba(242, 185, 63, 0.18);
  --rival-border: #6e1620;
  --rival-band: rgba(70, 6, 14, 0.62);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #12564a, #0a3a31 55%, #04211d);
  --rival-pattern: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 9px);
  --rival-rail: linear-gradient(180deg, #4a3410 0%, #a2731f 5%, #f4c65e 9%, #7c5516 15%, #2c1e0a 42%, #171007 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #0a2a22 0%, #04140f 52%, #020a07 78%);
}

/* Penny — mint baize with coin-print and old silver. */
#app[data-rival="penny"] {
  --rival-sigil: "¢";
  --rival-accent: #5ff0dd;
  --rival-accent-hi: #c9fff8;
  --rival-soft: rgba(79, 232, 216, 0.2);
  --rival-border: #1f5a54;
  --rival-band: rgba(6, 48, 44, 0.72);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #116a60, #06403a 55%, #021f1c);
  --rival-pattern: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.09) 0 2px, transparent 2.6px) 0 0 / 19px 19px, repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 9px);
  --rival-rail: linear-gradient(180deg, #2a3533 0%, #7a8a84 5%, #d9e6df 9%, #52615c 15%, #1c2624 42%, #0c1211 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #0b3a34 0%, #05201c 52%, #010c0a 78%);
}

/* Rusty — corroded copper rail over stained olive baize. */
#app[data-rival="rusty"] {
  --rival-sigil: "⬡";
  --rival-accent: #e0a060;
  --rival-accent-hi: #ffd9a8;
  --rival-soft: rgba(196, 122, 58, 0.22);
  --rival-border: #5a3020;
  --rival-band: rgba(58, 32, 12, 0.72);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #4a4a1e, #2a2a0e 55%, #121206);
  --rival-pattern: repeating-linear-gradient(115deg, rgba(255, 230, 180, 0.05) 0 2px, transparent 2px 11px), radial-gradient(circle at 40% 30%, rgba(196, 122, 58, 0.18), transparent 55%);
  --rival-rail: linear-gradient(180deg, #2a1608 0%, #6a3a18 5%, #c47a3a 9%, #5a2e12 15%, #2a1208 42%, #120802 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #2a2a0e 0%, #121206 52%, #080801 78%);
}

/* The Bookie — ledger-green felt ruled like an accounts page. */
#app[data-rival="bookie"] {
  --rival-sigil: "▤";
  --rival-accent: #9fe88f;
  --rival-accent-hi: #d8ffd0;
  --rival-soft: rgba(127, 214, 127, 0.18);
  --rival-border: #2a5a3a;
  --rival-band: rgba(6, 42, 24, 0.74);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #0a3a24, #041e12 55%, #010c07);
  --rival-pattern: repeating-linear-gradient(0deg, rgba(190, 255, 190, 0.07) 0 1px, transparent 1px 22px), repeating-linear-gradient(90deg, rgba(190, 255, 190, 0.06) 0 1px, transparent 1px 22px);
  --rival-rail: linear-gradient(180deg, #1e1a08 0%, #8a7a32 5%, #d8c46a 9%, #5a4a1a 15%, #2a2a12 42%, #0c0a04 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #041e12 0%, #020e08 52%, #010604 78%);
}

/* The Twin — mirrored lilac halves and cold silver. */
#app[data-rival="twin"] {
  --rival-sigil: "◑";
  --rival-accent: #d8b8ff;
  --rival-accent-hi: #f4e8ff;
  --rival-soft: rgba(195, 155, 255, 0.22);
  --rival-border: #4a3a6a;
  --rival-band: rgba(24, 18, 52, 0.75);
  --rival-felt: linear-gradient(90deg, #2a2455 0%, #161038 48%, #0c0828 52%, #2a2455 100%);
  --rival-pattern: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 12px), radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.12), transparent 55%);
  --rival-rail: linear-gradient(180deg, #241f2e 0%, #8f84a8 5%, #e6ddff 9%, #5a5270 15%, #2a2433 42%, #100c16 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #161038 0%, #08061a 52%, #04030c 78%);
}

/* The Cheat — ruby baize cut with crooked pinstripes. */
#app[data-rival="cheat"] {
  --rival-sigil: "♣︎";
  --rival-accent: #ff6f9a;
  --rival-accent-hi: #ffc9d8;
  --rival-soft: rgba(255, 79, 139, 0.2);
  --rival-border: #6a2038;
  --rival-band: rgba(58, 6, 28, 0.76);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #6a1038, #3a0620 55%, #1a0210);
  --rival-pattern: repeating-linear-gradient(115deg, rgba(255, 200, 210, 0.06) 0 2px, transparent 2px 13px), radial-gradient(circle at 70% 20%, rgba(255, 79, 139, 0.16), transparent 50%);
  --rival-rail: linear-gradient(180deg, #22030a 0%, #6e1428 5%, #c94a6a 9%, #6e1428 15%, #2a0610 42%, #120206 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #3a0620 0%, #1a0210 52%, #0a0106 78%);
}

/* The Shark — deep water, chrome rail, cold blood-in-the-water glow. */
#app[data-rival="shark"] {
  --rival-sigil: "▲";
  --rival-accent: #ffb3cc;
  --rival-accent-hi: #ffe0ea;
  --rival-soft: rgba(255, 179, 204, 0.18);
  --rival-border: #22505a;
  --rival-band: rgba(4, 30, 38, 0.76);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #123a4a, #082430 55%, #021018);
  --rival-pattern: repeating-radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 18px), linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%);
  --rival-rail: linear-gradient(180deg, #080e12 0%, #5a727c 5%, #c9dbe0 9%, #526a74 15%, #1a2a32 42%, #080e12 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #082430 0%, #04141c 52%, #01080c 78%);
}

/* The Bartender — whiskey-amber baize and a copper bar rail. */
#app[data-rival="bartender"] {
  --rival-sigil: "◍";
  --rival-accent: #e6b86a;
  --rival-accent-hi: #ffe8b0;
  --rival-soft: rgba(224, 163, 74, 0.2);
  --rival-border: #5a3a1a;
  --rival-band: rgba(42, 24, 8, 0.74);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #6a3a12, #3a1e08 55%, #1a0c04);
  --rival-pattern: radial-gradient(circle at 50% 50%, transparent 0 39%, rgba(255, 220, 160, 0.09) 39.6% 40.2%, transparent 40.8%), repeating-linear-gradient(90deg, rgba(255, 220, 160, 0.05) 0 2px, transparent 2px 9px), repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 22px);
  --rival-rail: linear-gradient(180deg, #2a1608 0%, #7a4a1a 5%, #e0a34a 9%, #7a4a1a 15%, #2a1608 42%, #120802 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #3a1e08 0%, #1a0c04 52%, #080401 78%);
}

/* Madame Lucky — plum velvet, rose-gold rail, a sky of small stars. */
#app[data-rival="madame"] {
  --rival-sigil: "✦";
  --rival-accent: #e6a8ff;
  --rival-accent-hi: #ffe0f4;
  --rival-soft: rgba(195, 155, 255, 0.22);
  --rival-border: #5a2a5a;
  --rival-band: rgba(36, 10, 42, 0.76);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #3a1640, #240a2a 55%, #120414);
  --rival-pattern: radial-gradient(circle at 18% 22%, rgba(255, 235, 255, 0.55) 0 1.2px, transparent 1.6px) 0 0 / 46px 46px, radial-gradient(circle at 72% 64%, rgba(255, 220, 240, 0.35) 0 1px, transparent 1.5px) 0 0 / 31px 31px, linear-gradient(160deg, rgba(255, 63, 111, 0.12), transparent 55%);
  --rival-rail: linear-gradient(180deg, #2a0a1a 0%, #8a4a6a 5%, #ffd0e0 9%, #8a4a6a 15%, #3a1626 42%, #160810 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #240a2a 0%, #120414 52%, #08020a 78%);
}

/* The House — crimson baize under a gold filigree, the boss table. */
#app[data-rival="the_house"] {
  --rival-sigil: "♛︎";
  --rival-accent: #ffd76a;
  --rival-accent-hi: #fff3c8;
  --rival-soft: rgba(255, 63, 111, 0.22);
  --rival-border: #7a1a24;
  --rival-band: rgba(52, 4, 12, 0.78);
  --rival-felt: radial-gradient(ellipse 120% 80% at 50% 0%, #5a0a16, #34040c 55%, #1a0206);
  --rival-pattern: repeating-linear-gradient(45deg, rgba(255, 215, 120, 0.06) 0 1px, transparent 1px 14px), repeating-linear-gradient(-45deg, rgba(255, 215, 120, 0.05) 0 1px, transparent 1px 14px), radial-gradient(ellipse at 50% 0%, rgba(255, 63, 111, 0.22), transparent 55%);
  --rival-rail: linear-gradient(180deg, #2a0408 0%, #a8762a 5%, #ffd76a 9%, #7a4a1a 15%, #3a0a10 42%, #160206 100%);
  --rival-well: radial-gradient(circle at 50% 42%, #34040c 0%, #1a0206 52%, #0a0103 78%);
}

/* ---------- type: boardroom poster, ivory on baize ---------- */
h1, h2, h3, .logo-word, .choice-card .choice-name, .story-name,
.dealer-name, .title-overlay .overlay-actions > button {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.035em;
}
h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  color: var(--ivory);
  background: none;
  -webkit-text-fill-color: currentColor;
  line-height: 0.96;
  text-shadow: 0 2px 0 rgba(3, 18, 12, 0.8), 0 0 24px rgba(255, 231, 174, 0.14);
  filter: none;
  animation: none;
}
h2 { color: #ffe5aa; text-shadow: 0 2px 0 #062016, 0 0 16px rgba(255, 210, 128, 0.12); }
h3 { color: #ffe5aa; }
.overlay-card h1 { margin-top: 6px; }
.eyebrow {
  color: #e0bc79;
  letter-spacing: 0.24em;
  text-shadow: 0 0 12px rgba(255, 213, 139, 0.14);
}
.story-overlay .eyebrow { color: #f2d699; font-size: 0.8rem; letter-spacing: 0.2em; }
.favors-total, .stat-value, .dealer-meta .mark { font-family: var(--font-mono); }
@media (forced-colors: active) {
  h1 { background: none; -webkit-text-fill-color: currentColor; }
}

/* ---------- the table: green baize, walnut rail, brass fittings ---------- */
.overlay {
  background:
    radial-gradient(ellipse 60% 50% at 50% 48%, rgba(40, 128, 95, 0.15), transparent 72%),
    radial-gradient(ellipse 100% 70% at 50% 108%, rgba(0, 0, 0, 0.5), transparent 64%);
}
.overlay-card {
  position: relative;
  text-align: center;
  border-radius: 18px;
  border: 1px solid #bd9556;
  background:
    linear-gradient(180deg, rgba(255, 243, 207, 0.08), transparent 18%),
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(69, 166, 130, 0.22), transparent 68%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #123c2e 0%, #0a2b21 56%, #061b14 100%);
  box-shadow:
    0 0 0 7px #29190d,
    0 0 0 10px #9f773a,
    0 0 0 11px #0b0704,
    0 28px 64px rgba(0, 0, 0, 0.74),
    inset 0 1px 0 rgba(255, 245, 210, 0.2),
    inset 0 0 58px rgba(0, 0, 0, 0.34);
  color: var(--ivory);
}
.overlay-card::before {
  content: '';
  display: block;
  width: min(620px, 82%);
  height: 8px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #8e6a36 8%, #f8dfa0 46%, #f8dfa0 54%, #8e6a36 92%, transparent);
  box-shadow: 0 1px 0 #04120c, 0 0 18px rgba(255, 220, 150, 0.18);
}
.overlay-card::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 11px;
  border: 1px solid rgba(247, 227, 175, 0.22);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.table-suits {
  position: absolute;
  inset: 8px;
  z-index: 3;
  pointer-events: none;
}
.table-suits i {
  position: absolute;
  font: 700 16px/1 Georgia, 'Times New Roman', serif;
  color: rgba(255, 232, 180, 0.72);
  text-shadow: 0 1px 2px #07130d;
  font-style: normal;
}
.table-suits i:nth-child(1) { top: 2px; left: 7px; }
.table-suits i:nth-child(2) { top: 2px; right: 7px; color: #e27883; }
.table-suits i:nth-child(3) { bottom: 2px; left: 7px; color: #e27883; }
.table-suits i:nth-child(4) { bottom: 2px; right: 7px; }
.overlay-card > :not(.table-suits) { position: relative; z-index: 1; }

/* ---------- controls: ivory enamel plungers and deep-green levers ---------- */
button {
  border-radius: 8px;
  border: 1px solid #cda75f;
  color: #14251b;
  background: linear-gradient(180deg, #f8e9bf 0%, #e4c78c 55%, #cba960 100%);
  box-shadow:
    inset 0 1px 0 #fff8df,
    inset 0 -2px 0 rgba(81, 57, 18, 0.3),
    0 4px 0 #3c2a11,
    0 8px 18px rgba(0, 0, 0, 0.34);
  text-shadow: none;
  font-weight: 800;
}
button:hover { filter: brightness(1.06); }
button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 #fff8df, 0 1px 0 #3c2a11;
}
button.secondary {
  color: #f7e7bc;
  background: linear-gradient(180deg, #1a4c37 0%, #0d3023 56%, #082218 100%);
  border-color: #b78e4e;
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.15), 0 4px 0 #07150e;
}
button.ghost {
  color: #f1dcae;
  background: rgba(0, 0, 0, 0.14);
  border-color: rgba(240, 215, 160, 0.38);
  box-shadow: none;
}
button:focus-visible, .cell:focus-visible { outline-color: #ffe7b0; }
.title-overlay .overlay-actions > button {
  min-width: 170px;
  min-height: 62px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 2px solid #f0d18c;
  color: #1b1208;
  background:
    radial-gradient(circle at 50% 50%, #fdf5d9 0 40%, #d9b566 41% 53%, #f7e4b0 54% 59%, #8c6428 60% 100%);
  box-shadow:
    0 0 0 3px #1c1208,
    0 0 0 6px #b98e47,
    0 8px 0 #241408,
    0 12px 22px rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(255, 246, 210, 0.5);
  font-size: 1.08rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: none;
}
.title-overlay .overlay-actions > button.secondary {
  color: #fff1ce;
  background:
    radial-gradient(circle at 50% 50%, #1a4e38 0 42%, #0a2a1d 43% 58%, #3b6c51 59% 63%, #06140d 64% 100%);
  border-color: #d3ae6a;
  box-shadow:
    0 0 0 3px #0c0a06,
    0 0 0 6px #80602d,
    0 8px 0 #180f08,
    0 12px 22px rgba(0, 0, 0, 0.45),
    inset 0 0 0 2px rgba(255, 239, 196, 0.22);
}
.title-overlay .overlay-actions > button::after { content: none; }
.overlay-actions button:disabled { color: #e6d7bd; background: #254438; border-color: #6c5836; box-shadow: none; }

/* ---------- HUD: score ledger on black-green leather ---------- */
.hud {
  border-radius: 8px;
  border-color: #3d6951;
  background:
    linear-gradient(180deg, var(--rival-soft), transparent 55%),
    linear-gradient(180deg, #133b2b, #071d15);
  box-shadow:
    inset 0 1px 0 rgba(255, 239, 197, 0.1),
    0 0 0 1px #05130d,
    0 0 0 2px rgba(216, 169, 78, 0.18),
    0 6px 16px rgba(0, 0, 0, 0.38);
}
.stat {
  border-radius: 4px;
  border-color: #315842;
  background: #061b13;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.66), inset 0 0 0 1px rgba(240, 218, 166, 0.06);
}
.stat-label { color: #c9d9c6; }
.stat-value { color: #ffe9b3; text-shadow: 0 0 10px rgba(255, 217, 139, 0.22); }
.stat.creds .stat-value { color: var(--green); text-shadow: 0 0 10px rgba(140, 232, 168, 0.2); }
.stat.take .stat-value { color: var(--rival-accent-hi); text-shadow: 0 0 10px var(--rival-soft); }
.composure .pip {
  border-color: #6b4a12;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.act-track .bar { background: #234c39; }
.act-track .bar.done { background: var(--rival-accent); box-shadow: 0 0 6px var(--rival-soft); }
.act-track .step.current { color: var(--rival-accent-hi); }

/* ---------- dealer placard ---------- */
.dealer {
  border-radius: 8px;
  border-color: #35634b;
  border-left: 4px solid var(--rival-accent);
  background:
    linear-gradient(90deg, var(--rival-soft), transparent 45%),
    linear-gradient(180deg, #143b2c, #071d15);
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.08), 0 4px 0 rgba(2, 10, 6, 0.6);
}
.dealer-avatar, .dealer-avatar.fallback { color: var(--rival-accent-hi); border-color: var(--rival-accent-hi); box-shadow: 0 0 14px var(--rival-soft); }
.dealer-name { color: var(--rival-accent-hi); }
.dealer-name::before {
  content: var(--rival-sigil);
  display: inline-block;
  margin-right: 8px;
  font-size: 0.9em;
  color: var(--rival-accent);
  text-shadow: 0 0 12px var(--rival-soft);
}
.dealer-meta .mark { color: var(--rival-accent-hi); text-shadow: 0 0 10px var(--rival-soft); }
.mark-fill { background: var(--rival-accent); }
.mark-track { border-radius: 2px; background: #07150f; }

/* ---------- board: a house table with a brass betting line ---------- */
.board-frame {
  border-radius: 14px;
  padding: 15px;
  background:
    linear-gradient(180deg, rgba(255, 235, 190, 0.22), transparent 10%),
    repeating-linear-gradient(90deg, rgba(255, 235, 190, 0.2) 0 1px, transparent 1px 19px) top 6px / 100% 3px no-repeat,
    var(--rival-rail);
  box-shadow:
    0 0 0 2px #0a0503,
    0 0 0 5px #2b1a0d,
    0 0 0 7px #b88b4a,
    0 0 0 8px #0a0503,
    0 0 26px rgba(255, 217, 139, 0.12),
    0 20px 44px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 240, 200, 0.45);
}
.board-frame::before {
  inset: 7px;
  border-radius: 7px;
  border-color: rgba(255, 235, 190, 0.2);
  box-shadow:
    inset 0 2px 0 rgba(255, 232, 171, 0.38),
    inset 0 -2px 0 rgba(255, 232, 171, 0.26),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.board-frame::after {
  content: var(--rival-sigil);
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--rival-accent);
  color: var(--rival-accent-hi);
  background: radial-gradient(circle at 38% 28%, #1d4d39, #06180f 72%);
  box-shadow: 0 0 0 4px #0a0503, 0 0 0 5px rgba(255, 240, 200, 0.35), 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 22px var(--rival-soft);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}
@media (max-width: 899px) { .board-frame::after { display: none; } }
#board {
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 44%, rgba(255, 236, 183, 0.055) 44.5% 46%, transparent 46.5%) 0 0 / 86px 86px,
    var(--rival-pattern),
    var(--rival-felt);
  box-shadow:
    inset 0 4px 20px rgba(0, 0, 0, 0.74),
    inset 0 0 0 2px rgba(0, 0, 0, 0.34),
    inset 0 0 28px rgba(0, 0, 0, 0.3);
}
.column-labels {
  color: #ffe9b3;
  padding: 3px 14px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #174532, #082117);
  box-shadow: inset 0 1px 0 rgba(255, 238, 191, 0.16), 0 2px 0 rgba(2, 10, 6, 0.65);
  text-shadow: none;
}
#table-card, .hud { border-color: var(--rival-border); }
.table-layout { border-radius: 14px; background: radial-gradient(ellipse at 42% 45%, var(--rival-soft), transparent 68%); }
#table-card {
  position: relative;
  --card-pad: 14px;
  border-radius: 8px;
  border: 1px solid #38604b;
  border-top: 4px solid var(--rival-accent);
  background:
    linear-gradient(180deg, var(--rival-soft), transparent 34%),
    linear-gradient(180deg, #123a2b, #061a12);
  box-shadow:
    0 0 0 1px #04110b,
    0 0 0 2px rgba(216, 169, 78, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.38);
}
#table-card::before {
  content: var(--rival-sigil);
  display: grid;
  place-items: center;
  height: 42px;
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 12px;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid var(--rival-accent);
  background:
    linear-gradient(90deg, var(--rival-soft), transparent 62%),
    repeating-linear-gradient(90deg, rgba(255, 238, 191, 0.07) 0 1px, transparent 1px 10px),
    #0a281c;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: var(--rival-accent-hi);
  text-shadow: 0 0 14px var(--rival-accent), 0 1px 2px #04110b;
  box-shadow: inset 0 1px 0 var(--rival-accent), inset 0 -1px 0 var(--rival-border), 0 4px 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 1;
}
#table-card > * { position: relative; z-index: 1; }
#table-card .section-label { color: var(--rival-accent-hi); }
#table-card .section-label::before, #table-card .eyebrow::before {
  content: var(--rival-sigil);
  margin-right: 6px;
  color: var(--rival-accent);
}
#table-card .eyebrow, .dealer .eyebrow { color: var(--rival-accent-hi); }
.tutorial-step .tutorial-num { border-color: var(--rival-accent); color: var(--rival-accent-hi); }
.rule-chip, .bet-chip {
  border-radius: 5px;
  border-color: #3d6049;
  background: linear-gradient(180deg, rgba(30, 80, 58, 0.7), rgba(5, 23, 16, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.07), inset 3px 0 0 rgba(216, 169, 78, 0.2);
}

/* ---------- player chips: gold against ruby, ivory marks ---------- */
.cell.player, .cell.opponent { color: #fff6e4; text-shadow: 0 2px 2px rgba(3, 18, 12, 0.65); }
.cell.player {
  background: radial-gradient(circle at 32% 23%, #fff8d4 0%, #ffdf85 23%, #eeb43c 66%, #8f5f12 100%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.85), inset 0 -4px 6px rgba(74, 40, 0, 0.5), 0 3px 7px rgba(0, 0, 0, 0.5);
}
.cell.player::after { border-color: rgba(74, 38, 0, 0.45); }
.cell.house { color: #fff2cf; text-shadow: 0 2px 2px rgba(3, 18, 12, 0.65); }
.cell:not(.player):not(.opponent):not(.house):not(.cursed):not(.ghost):not(.col-hover) {
  background: var(--rival-well);
  box-shadow:
    inset 0 0 0 2px #07150f,
    inset 0 4px 8px rgba(0, 0, 0, 0.85),
    inset 0 -2px 2px rgba(255, 222, 168, 0.1),
    0 1px 0 rgba(255, 218, 164, 0.12);
}
.cell.ghost { background: radial-gradient(circle at 50% 35%, var(--rival-soft), transparent 70%); box-shadow: inset 0 0 0 2px var(--rival-accent); }
.cell.preview-target { outline-color: var(--rival-accent-hi); }
.preview-cap { border-color: var(--rival-accent); color: var(--rival-accent-hi); background: var(--rival-soft); }
.token-mark { background: rgba(4, 24, 16, 0.9); color: var(--ivory); }
.disc {
  border-width: 3px;
  border-style: dashed;
  background: radial-gradient(circle at 35% 28%, #2f6148, #0c3022 68%, #05160f);
  box-shadow:
    0 6px 0 #04110b,
    0 12px 18px rgba(0, 0, 0, 0.45),
    inset 0 2px 4px rgba(255, 220, 160, 0.14);
}
.disc .disc-name { color: #f3e7c8; }
.disc:hover { transform: translateY(-4px); }
.disc.selected { border-color: var(--rival-accent-hi); box-shadow: 0 0 0 3px var(--rival-soft), 0 0 22px var(--rival-soft); }
.disc.selected .disc-glyph { color: var(--rival-accent-hi); }
.disc .disc-key { background: #071c13; border-color: var(--rival-accent); }
.cheat {
  color: #f8ebc9;
  background: linear-gradient(180deg, #1b4a35, #092519);
  border: 1px dashed #b9934e;
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.12), 0 3px 0 #04110b;
}
.cheat:hover:not(:disabled) { border-color: var(--brass-hi); color: var(--brass-hi); }
.board-legend b { color: var(--rival-accent-hi); }
.hand-label { color: var(--rival-accent-hi); }

/* ---------- playable cards: ivory stock with suit watermarks ---------- */
.choice-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #b58b4b;
  border-top: 4px solid #a52b3f;
  background: linear-gradient(180deg, #fff9e8 0%, #f4e6c4 62%, #e6d3aa 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 252, 235, 0.7),
    0 5px 0 #5e4a2a,
    0 10px 20px rgba(0, 0, 0, 0.34);
  color: #1a291f;
}
.choice-card::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(128, 93, 40, 0.24);
  border-radius: 5px;
  pointer-events: none;
}
.card-grid > .choice-card:nth-child(3n+2) { border-top-color: #284e3a; }
.card-grid > .choice-card:nth-child(3n+3) { border-top-color: #c29a4e; }
.choice-card:hover { border-color: #e3bc6d; border-top-color: #e3bc6d; background: #fffdf3; }
.choice-card .choice-name { color: #132d20; text-shadow: none; font-size: 1.35rem; line-height: 1; }
.choice-card .choice-tag { color: #8d2332; letter-spacing: 0.19em; }
.choice-card .choice-desc { color: #39463d; }
.choice-card .choice-numbers { color: #25362a; }
.choice-card.risk-high { border-top-color: #a52b3f; }
.choice-card:disabled {
  background: linear-gradient(180deg, #dcd6c2, #bfb79f);
  border-color: #897a58;
  border-top-color: #6c593b;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 235, 0.35), 0 4px 0 #4d4432;
}
.choice-card:disabled .choice-name { color: #3f4339; }
.choice-card:disabled .choice-tag { color: #655d49; }
.choice-card:disabled .choice-desc { color: #4e5348; }
.choice-card:disabled .choice-numbers { color: #4e4129; }

/* Quest choices read as a hand of cards, not a bill of fare. */
.quest-overlay .overlay-card { text-align: left; }
.quest-overlay .eyebrow, .quest-overlay h1, .quest-overlay .lede { text-align: center; }
.quest-overlay .card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.quest-option { min-height: 152px; padding: 18px 16px 14px; }
.card-corner {
  position: absolute;
  right: 11px;
  top: 7px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 0.9;
  pointer-events: none;
}
.card-corner b { font: 700 1.2rem/1 Georgia, 'Times New Roman', serif; }
.card-corner i { font: 700 1.05rem/1 Georgia, 'Times New Roman', serif; font-style: normal; }
.card-red { color: #9b2033; }
.card-black { color: #263e30; }
.card-suit {
  position: absolute;
  right: 10px;
  bottom: 4px;
  z-index: 0;
  opacity: 0.18;
  font: 700 3.4rem/1 Georgia, 'Times New Roman', serif;
  pointer-events: none;
}
.card-suit.card-red { color: #9b2033; }
.card-suit.card-black { color: #263e30; }
.quest-option .choice-tag { position: relative; z-index: 1; }
.quest-option .choice-name, .quest-option .choice-desc { position: relative; z-index: 1; }
.quest-option .choice-tag {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgba(141, 35, 50, 0.35);
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}
@media (max-width: 1100px) {
  .quest-overlay .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .quest-overlay .card-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- story: a felt table with ivory cue cards ---------- */
.story-cast { max-width: 790px; gap: 16px; }
.story-player {
  border-radius: 8px;
  border: 1px solid #b58a4a;
  background: linear-gradient(180deg, #fff9e8, #e8d6ae);
  box-shadow: inset 0 0 0 1px rgba(255, 253, 235, 0.7), 0 5px 0 #5e4a2a, 0 10px 20px rgba(0, 0, 0, 0.25);
  color: #17271d;
}
.story-name { color: #132d20; text-shadow: none; }
.story-role { color: #536057; }
.story-avatar { border-color: #b78e4e; box-shadow: 0 0 0 3px #f6e7c5, 0 0 0 5px #a47b3c; }
.story-vs {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px dashed #f4dfad;
  border-radius: 50%;
  color: #7d1526;
  background: radial-gradient(circle at 35% 30%, #fff2d7, #d8b46f 58%, #9a6b2d);
  box-shadow: 0 0 16px rgba(255, 221, 145, 0.25);
  font-family: var(--font-display);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  text-shadow: none;
}
.story-lines { max-width: 880px; gap: 10px; }
.story-line {
  position: relative;
  padding: 11px 32px 11px 14px;
  border-left: 4px solid #9d2c3e;
  border-radius: 3px 8px 8px 3px;
  background: linear-gradient(180deg, #fbf3dd, #ebdab5);
  color: #1c2c23;
  box-shadow: 0 3px 0 #5f4a25, 0 8px 16px rgba(0, 0, 0, 0.22);
}
.story-line strong { color: #7d1d2d; }
.story-announcer {
  border-left-color: #2d6a4b;
  background: linear-gradient(180deg, #e7d3a1, #d2b878);
}
.story-announcer strong { color: #174930; }
.story-next {
  max-width: 700px;
  padding: 8px 14px;
  border: 1px dashed #d0ac67;
  border-radius: 6px;
  color: #f2e5c7;
  background: rgba(4, 26, 17, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255, 239, 196, 0.06);
}
.story-next strong { color: #ffe3a3; }
.story-hint {
  color: #d8c79e;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---------- title: the house table, not a menu cover ---------- */
.title-overlay { padding-top: 64px; }
.title-overlay .overlay-card {
  text-align: left;
  background:
    radial-gradient(ellipse 52% 70% at 30% 44%, rgba(58, 160, 123, 0.24), transparent 70%),
    radial-gradient(ellipse 60% 55% at 86% 90%, rgba(0, 0, 0, 0.26), transparent 65%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px),
    linear-gradient(160deg, #164a37 0%, #0b2e22 58%, #061b14 100%);
}
.title-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(330px, 0.94fr);
  gap: 26px;
  align-items: center;
  text-align: left;
}
.title-crest {
  position: relative;
  text-align: center;
  padding: 0 20px 0 4px;
  border-right: 1px solid rgba(236, 215, 166, 0.24);
}
.title-crest .suit-row {
  display: block;
  margin-top: 14px;
  color: rgba(255, 235, 180, 0.58);
  font: 700 0.8rem/1 Georgia, 'Times New Roman', serif;
  letter-spacing: 0.72em;
  text-indent: 0.72em;
}
.floating-tagline {
  top: -50px;
  left: 50%;
  padding: 6px 18px;
  border: 1px solid #d8b06a;
  border-radius: 3px;
  background: linear-gradient(180deg, #1b4d37, #071d13);
  color: #ffe8ae;
  font: 800 0.82rem/1.2 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateX(-50%) rotate(-1deg);
  transform-origin: center;
  box-shadow: 0 0 0 2px #07130d, 0 0 18px rgba(255, 218, 139, 0.18);
  white-space: nowrap;
}
.logo-mark { margin-bottom: 12px; }
.logo-mark .chip {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #f2d492;
  color: #1a140a;
  background: radial-gradient(circle at 35% 28%, #fff8dd, #dfbd77 55%, #8b652a);
  box-shadow:
    0 0 0 2px #28190b,
    0 0 0 3px rgba(255, 233, 168, 0.6),
    0 0 18px rgba(242, 185, 63, 0.28),
    inset 0 2px 4px rgba(255, 255, 255, 0.55);
  font: 700 1.3rem/1 Georgia, 'Times New Roman', serif;
  text-shadow: 0 1px 0 rgba(255, 247, 215, 0.6);
}
.logo-mark .chip:nth-child(2),
.logo-mark .chip:nth-child(4) {
  color: #fff2da;
  border-color: #f1c58d;
  background: radial-gradient(circle at 35% 28%, #e5687d, #a3263c 66%, #5b0c1b);
  box-shadow:
    0 0 0 2px #28190b,
    0 0 0 3px rgba(255, 233, 168, 0.6),
    0 0 18px rgba(216, 68, 95, 0.34),
    inset 0 2px 4px rgba(255, 255, 255, 0.5);
}
.dice {
  position: absolute;
  right: -8px;
  top: -22px;
  display: flex;
  gap: 4px;
  transform: rotate(8deg);
  opacity: 0.9;
  pointer-events: none;
}
.dice i {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid #9e783b;
  background: #f4e4bd;
  box-shadow: 0 2px 0 #6b4b20, inset 0 1px 0 #fff8df;
}
.dice i::before,
.dice i::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #7e1b2d;
  box-shadow: 9px 0 #7e1b2d, 0 9px #7e1b2d, 9px 9px #7e1b2d;
  top: 5px;
  left: 5px;
}
.dice i::after {
  width: 3px;
  height: 3px;
  top: 12px;
  left: 12px;
  background: #1c3225;
  box-shadow: none;
}
.logo-word {
  color: var(--ivory);
  font-size: clamp(3rem, 4.8vw, 4.65rem);
  line-height: 0.9;
  letter-spacing: 0.035em;
  text-shadow:
    0 3px 0 #2a0b10,
    0 0 26px rgba(255, 231, 174, 0.18);
  white-space: normal;
}
.logo-word .connect-four { color: #fff0cf; text-shadow: 0 3px 0 #2a0b10, 0 0 26px rgba(255, 231, 174, 0.18); }
.logo-word .tune {
  color: #ffe0a0;
  background: linear-gradient(105deg, #b4233b 15%, #fb7c83 38%, #ffe8b1 52%, #d7973e 68%, #b4233b 90%);
  background-size: 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 7s ease-in-out infinite;
  text-shadow: none;
}
.title-crest > .eyebrow { margin-top: 14px; color: #f0d49a; }
.title-overlay .overlay-actions { margin-top: 24px; }
.title-ledger {
  position: relative;
  text-align: left;
  align-self: stretch;
  padding-left: 2px;
  border-left: 1px solid rgba(236, 215, 166, 0.2);
  padding-left: 24px;
}
.title-ledger::before {
  content: 'HOUSE LEDGER';
  display: block;
  margin-bottom: 8px;
  color: #e6c785;
  font: 700 0.84rem/1 var(--font-mono);
  letter-spacing: 0.2em;
}
.title-ledger .profiles,
.title-ledger .run-history,
.title-ledger .how-to,
.title-ledger .vault {
  margin-top: 10px;
  padding: 0 12px 8px;
  border: 1px solid rgba(236, 215, 166, 0.2);
  border-top: 1px solid rgba(236, 215, 166, 0.2);
  border-radius: 8px;
  background: rgba(3, 20, 13, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.06);
}
.title-ledger .profiles summary,
.title-ledger .run-history summary,
.title-ledger .how-to summary,
.title-ledger .vault summary {
  padding: 10px 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  color: #ffe5ac;
}
.title-ledger .ledger-suit { display: inline-block; margin-right: 5px; color: #d8a94e; }
.title-ledger .vault .ledger-suit { color: #e27883; }
.title-ledger .how-to-content,
.title-ledger .vault,
.title-ledger .profiles { font-size: 0.86rem; line-height: 1.42; }
.title-ledger .how-to { border-top: 1px solid rgba(236, 215, 166, 0.2); }
.title-ledger .profile-create { margin-top: 9px; }
.title-ledger .profile-create-row input { background: #061b13; color: #f7efd9; border-color: #7b6133; }
.title-ledger .profile-item.active .profile-select { border-color: #e0bb74; }
.title-ledger .run-history ul { margin-top: 6px; }
.menu-credit {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(236, 215, 166, 0.2);
  color: #cdbd99;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.84rem;
}
.menu-credit .suit-row {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 235, 180, 0.5);
  font: 700 0.66rem/1 Georgia, 'Times New Roman', serif;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
}
.credit-just { color: #e0be7d; font-family: var(--font-body); font-weight: 600; }
.credit-base { color: #ffe8b3; font-family: var(--font-display); font-size: 1.05em; letter-spacing: 0.05em; }

/* The Vault opens as a brass cashier cage, not a dropdown menu. */
.vault { color: #f0e4c5; font-size: 0.9rem; line-height: 1.5; }
.vault summary { color: #ffe5ac; }
.vault p { margin-top: 9px; }
.vault-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.vault-options button {
  min-height: 66px;
  text-align: left;
  color: #1a291f;
  background: linear-gradient(180deg, #fff9e8, #e7d6af);
  border-color: #b58b4b;
  box-shadow: inset 0 0 0 1px rgba(255, 252, 235, 0.7), 0 4px 0 #5e4a2a, 0 8px 16px rgba(0, 0, 0, 0.25);
}
.vault-options button:hover { background: #fffdf3; }
.vault-description { color: #465148; }
.vault-thresholds, .vault-total { color: #c7d3bf; font-size: 0.82rem; }
.vault-total { margin: 8px auto 0; max-width: 34rem; line-height: 1.5; }
.title-overlay:has(.vault[open]) .overlay-card {
  text-align: left;
  background:
    radial-gradient(ellipse 70% 70% at 50% 0%, rgba(72, 164, 127, 0.2), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px),
    linear-gradient(160deg, #164a37, #071d14);
}
.title-overlay:has(.vault[open]) .floating-tagline,
.title-overlay:has(.vault[open]) .title-crest,
.title-overlay:has(.vault[open]) .menu-credit,
.title-overlay:has(.vault[open]) .title-ledger > :not(.vault) { display: none; }
.title-overlay:has(.vault[open]) .title-stage { display: block; }
.title-overlay:has(.vault[open]) .title-ledger { border: 0; padding: 0; }
.title-overlay:has(.vault[open]) .title-ledger::before { display: none; }
.title-overlay:has(.vault[open]) .vault {
  margin: 0;
  padding: 2px 6px 4px;
  border: 0;
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 235, 180, 0.16) 0 2px, transparent 2.6px) 0 0 / 42px 42px,
    linear-gradient(180deg, rgba(8, 42, 29, 0.5), rgba(3, 20, 13, 0.3));
  box-shadow: inset 0 0 0 1px rgba(255, 237, 190, 0.12);
}
.title-overlay:has(.vault[open]) .vault summary {
  padding: 0 0 8px;
  color: #ffe9b6;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 2px 0 #061b13, 0 0 18px rgba(255, 226, 160, 0.16);
}
.title-overlay:has(.vault[open]) .vault summary::after {
  content: 'CASHIER CAGE · FAVORS KEPT UNDER THE HOUSE RAIL';
  display: block;
  margin-top: 6px;
  color: #d6bd8a;
  font: 700 0.84rem/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-shadow: none;
}
.overlay-card h1:focus-visible, .overlay-card h2:focus-visible, .change-notice:focus-visible { outline-color: #ffe7b0; }
@media (max-width: 1100px) {
  .title-stage { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .title-crest { border-right: 0; padding: 0 0 16px; border-bottom: 1px solid rgba(236, 215, 166, 0.24); }
  .title-ledger { border-left: 0; padding-left: 0; }
  .vault-options { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- desk layout: viewport-locked table, hand always on screen ---------- */
@media (min-width: 900px) and (min-height: 600px) {
  body { height: 100vh; max-height: 100vh; overflow: hidden; align-items: center; }
  #app {
    width: min(98vw, 1960px);
    --ledger-w: clamp(320px, min(45vw, calc(1800px - 80vh)), 900px);
    height: 100vh; max-height: 100vh; min-height: 0;
    overflow: hidden;
  }
  .overlay {
    min-height: 0; max-height: 100%;
    overflow-y: auto;
    justify-content: flex-start;
    padding: 16px 0;
  }
  .overlay-card { width: min(94vw, 1240px); padding: 32px 38px 26px; margin: auto; }
  .title-overlay .overlay-card { width: min(94vw, 1240px); }
  .title-overlay:has(.vault[open]) .overlay-card { width: min(94vw, 1040px); }
  .table-layout {
    flex: 1 1 auto; min-height: 0;
    grid-template-columns: auto var(--ledger-w);
    justify-content: center;
    align-items: start;
    gap: 18px;
  }
  #table-card { max-height: calc(100vh - 290px); overflow-y: auto; }
  .board-area {
    width: min(calc(100vh - 395px), 80vh,
      calc(98vw - var(--ledger-w) - 60px));
    align-self: start;
  }

  /* Tall rail: the ledger closes the column instead of ending as a stub. */
  @media (min-height: 1400px) {
    #table-card {
      align-self: stretch;
      background-image:
        repeating-linear-gradient(0deg, rgba(255, 240, 220, 0.024) 0 1px, transparent 1px 30px),
        linear-gradient(180deg, var(--rival-soft), transparent 34%),
        linear-gradient(180deg, #123a2b, #061a12);
    }
    #table-card::after {
      content: var(--rival-sigil);
      position: absolute;
      left: 50%;
      bottom: 6%;
      transform: translateX(-50%);
      font-family: var(--font-display);
      font-size: clamp(120px, 14vh, 230px);
      line-height: 1;
      color: var(--rival-accent);
      opacity: 0.06;
      text-shadow: 0 0 60px var(--rival-accent);
      pointer-events: none;
      z-index: 0;
    }
  }
  .story-cast { max-width: 790px; }
  .story-lines { max-width: 880px; }
  .story-next, .story-overlay .season-log-block { max-width: 700px; }
  .logo-word { font-size: clamp(3.2rem, 4.1vw, 4.65rem); }
  .title-overlay .overlay-actions > button { min-width: 170px; min-height: 62px; font-size: 1.08rem; }
  .story-avatar { width: 84px; height: 84px; }
}

/* ---------- readable table type: labels are UI, not fine print ---------- */
@media (min-width: 900px) and (min-height: 600px) {
  .stat-label { font-size: 0.86rem; letter-spacing: 0.1em; }
  .stat-value { font-size: 1.15rem; }
  .act-track .step { font-size: 0.82rem; }
  #mute-toggle { font-size: 0.9rem; }
  .hud-quest { font-size: 0.95rem; }
  .dealer .taunt { font-size: 1.05rem; }
  #table-card { padding: 11px; --card-pad: 11px; }
  .column-labels { font-size: 0.86rem; letter-spacing: 0.02em; }
  .board-legend { font-size: 0.88rem; line-height: 1.4; }
  .move-preview { font-size: 0.9rem; }
  #table-card h2 { font-size: 1.5rem; }
  #table-card .section-label { font-size: 0.84rem; letter-spacing: 0.13em; margin: 7px 0 3px; }
  .rule-chip, .bet-chip { font-size: 0.94rem; line-height: 1.45; padding: 6px 10px; }
  .bet-chip .bonus { font-size: 0.9rem; }
  .tutorial-step { font-size: 0.9rem; line-height: 1.38; }
  .tutorial-coach { padding: 7px 9px; }
  .tutorial-coach ol { gap: 3px; }
  .tutorial-step .tutorial-num { font-size: 0.82rem; }
  #tutorial-hide { font-size: 0.8rem; }
  .tutorial-coach .eyebrow { font-size: 0.84rem; }
  .disc-guide summary { font-size: 0.94rem; }
  .disc-guide li { font-size: 0.9rem; line-height: 1.45; }
  .hand-label { font-size: 0.86rem; letter-spacing: 0.14em; }
  .hand-detail { font-size: 1rem; }
  .disc { width: 92px; height: 92px; }
  .disc .disc-glyph { font-size: 1.8rem; }
  .disc .disc-name { font-size: 0.82rem; letter-spacing: 0.02em; }
  .disc .disc-key { width: 22px; height: 22px; font-size: 0.82rem; }
  .notice { font-size: 0.94rem; }
  .cheat { font-size: 0.9rem; }
  .cheat-desc { font-size: 0.82rem; max-width: 280px; }
}

/* Short laptop windows: compress the chrome instead of hiding the hand. */
@media (min-width: 900px) and (min-height: 600px) and (max-height: 860px) {
  #app { padding: 8px 12px; }
  .hud { padding: 6px 10px; gap: 6px; margin-bottom: 8px; }
  .hud-quest { display: none; }
  .stat { padding: 3px 9px; gap: 5px; }
  .stat-label { font-size: 0.82rem; }
  .stat-value { font-size: 1rem; }
  .dealer { padding: 8px 12px; gap: 10px; margin-bottom: 8px; }
  .dealer-avatar { width: 44px; height: 44px; font-size: 1.05rem; }
  .dealer-name { font-size: 1.15rem; }
  .hand-label { margin-top: 6px; font-size: 0.8rem; }
  #hand { gap: 10px; margin-top: 4px; }
  .disc { width: 72px; height: 72px; }
  .disc .disc-glyph { font-size: 1.35rem; }
  .disc .disc-name { font-size: 0.82rem; letter-spacing: 0.02em; }
  .disc .disc-key { width: 21px; height: 21px; font-size: 0.82rem; }
  .board-legend { font-size: 0.82rem; line-height: 1.3; }
  .move-preview { font-size: 0.86rem; }
  #table-card h2 { font-size: 1.25rem; }
  .hand-detail { display: none; }
  #table-card { --card-pad: 10px; padding: 10px; }
  .title-overlay { padding-top: 70px; }
  .title-overlay .overlay-card { padding: 26px 32px 22px; }
  .floating-tagline { top: -46px; font-size: 0.86rem; padding: 4px 12px; }
  .story-cast { gap: 10px; }
  .board-area { width: min(100%, 56vh, calc((100vh - 320px) * 1.12)); }
  .overlay-card { padding: 24px 32px 20px; }
  .overlay-card::before { margin-bottom: 10px; }
  .overlay-card h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); margin-top: 4px; }
  .story-cast { margin: 12px auto 4px; }
  .story-avatar { width: 64px; height: 64px; }
  .story-player { padding: 10px 8px; gap: 4px; }
  .story-role { font-size: 0.74rem; }
  .story-lines { gap: 8px; margin-top: 10px; }
  .story-line { padding: 8px 32px 8px 10px; font-size: 0.86rem; line-height: 1.45; }
  .story-next { margin-top: 8px; padding: 6px 10px; }
  .season-log-block { margin-top: 8px; }
  .story-hint { margin-top: 8px; }
}

/* ---------- readable labels outside the felt as well ---------- */
.eyebrow { font-size: 0.82rem; }
.story-overlay .eyebrow { font-size: 0.82rem; }
.choice-card .choice-tag { font-size: 0.84rem; }
.choice-card .choice-numbers { font-size: 0.86rem; }
.story-hint { font-size: 0.82rem; }
#tutorial-hide { font-size: 0.82rem; }
.story-role { font-size: 0.84rem; }
.story-vs { font-size: 1.1rem; }
.vault-description { font-size: 0.84rem; }
@media (max-height: 850px) {
  .disc-guide { margin-top: 0; border-top: 0; }
  .disc-guide summary { padding: 6px 2px; }
  .disc-guide li { margin-bottom: 3px; line-height: 1.3; }
}

/* Overflow-driven first-run coach: JS adds these only when the card needs them. */
#table-card.tutorial-only > :not(.tutorial-coach) { display: none; }
#table-card:has(.disc-guide[open]) > :not(.disc-guide) { display: none; }
#table-card:has(.disc-guide[open]) .disc-guide { margin-top: 0; border-top: 0; }
#table-card.tutorial-only .tutorial-coach { padding: 6px 8px; }
#table-card.tutorial-only .tutorial-coach ol { gap: 3px; }
.tutorial-coach { margin-bottom: 0; }
.tutorial-coach ol { margin-top: 4px; margin-bottom: 0; gap: 2px; }
#table-card.tutorial-condensed .tutorial-step { font-size: 0.84rem; line-height: 1.32; }
#table-card.tutorial-condensed .tutorial-coach .eyebrow { font-size: 0.84rem; }

/* Action tray: keep the table in the viewport when cheats/vice actions are present. */
@media (min-width: 900px) and (min-height: 600px) {
  #app:has(#cheats:not(.empty)) .board-area {
    width: min(calc(100vh - 410px), 80vh, calc(98vw - var(--ledger-w) - 60px));
  }
  #app:has(#cheats:not(.empty)) #cheats {
    margin-top: 2px;
    gap: 5px;
  }
  #app:has(#cheats:not(.empty)) .cheat {
    font-size: 0.82rem;
    padding: 4px 9px;
    line-height: 1.25;
  }
  #app:has(#cheats:not(.empty)) .cheat-desc { display: none; }
  #app:has(#cheats:not(.empty)) .cheats .section-label {
    margin: 0 2px;
    font-size: 0.82rem;
    line-height: 1.2;
  }
}

/* Compact action rail keeps full descriptions available in a deliberate disclosure. */
.cheat-details { display: none; }
@media (min-width: 900px) and (min-height: 600px) {
  #app:has(#cheats:not(.empty)) .cheat-details { display: block; position: relative; }
  #app:has(#cheats:not(.empty)) .cheat-details > summary {
    padding: 4px 9px;
    border: 1px dashed rgba(227, 184, 102, 0.55);
    border-radius: 999px;
    color: #ffe8ae;
    background: rgba(0, 0, 0, 0.16);
    font: 700 0.82rem/1.25 var(--font-mono);
    letter-spacing: 0.04em;
    cursor: pointer;
  }
  #app:has(#cheats:not(.empty)) .cheat-details[open] > summary { border-style: solid; color: #fff3cf; }
  #app:has(#cheats:not(.empty)) .cheat-details[open] > ul {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 60;
    transform: translate(-50%, -50%);
    width: min(92vw, 560px);
    max-height: 70vh;
    overflow: auto;
    margin: 0;
    padding: 18px 22px 18px 34px;
    border: 1px solid #bd9556;
    border-radius: 10px;
    color: #f5ead0;
    background: linear-gradient(180deg, #164a37, #071d15);
    box-shadow: 0 0 0 5px #29190d, 0 0 0 7px #9f773a, 0 18px 42px rgba(0, 0, 0, 0.72);
    font: 0.86rem/1.45 var(--font-body);
  }
  #app:has(#cheats:not(.empty)) .cheat-details[open] > ul li { margin-bottom: 8px; }
  #app:has(#cheats:not(.empty)) .cheat-details[open] > ul strong { color: #ffe8ae; }
}

/* On short viewports Vices opens as a readable table-side card instead of
   stretching the rail and hiding text behind an invisible scroll. */
@media (max-height: 850px) {
  #table-card .vices-block[open] > .rule-list {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 55;
    transform: translate(-50%, -50%);
    width: min(92vw, 540px);
    max-height: 70vh;
    overflow: auto;
    margin: 0;
    padding: 16px 18px;
    border: 1px solid #bd9556;
    border-radius: 10px;
    color: #f5ead0;
    background: linear-gradient(180deg, #164a37, #071d15);
    box-shadow: 0 0 0 5px #29190d, 0 0 0 7px #9f773a, 0 18px 42px rgba(0, 0, 0, 0.72);
  }
}

.vices-heading { display: none; }
@media (max-height: 850px) {
  #table-card .vices-block[open] .vices-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #ffe5aa;
    font: 700 0.86rem/1.2 var(--font-mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  #table-card .vices-heading .vices-close {
    font-size: 0.82rem;
    padding: 4px 10px;
    letter-spacing: 0.04em;
    text-transform: none;
  }
}

.account-panel form { display: grid; gap: .5rem; margin: .8rem 0; }
.account-panel label { display: grid; gap: .2rem; }
.account-panel input { width: 100%; padding: .45rem; }
.scoreboard-panel table { width: 100%; border-collapse: collapse; text-align: left; }
.scoreboard-panel th, .scoreboard-panel td { padding: .25rem; }
.scoreboard-viewer { font-weight: bold; }
