:root {
  --bg: #0d0f14;
  --bg-2: #151925;
  --panel: #1a1f2e;
  --panel-2: #222839;
  --line: #2a3145;
  --text: #e7ecf5;
  --muted: #8b95ad;
  --accent: #4ade80;   /* money green */
  --accent-2: #38bdf8; /* travel blue */
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1b2233 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.app { max-width: 780px; margin: 0 auto; padding: 0 14px 40px; }
.content { padding-top: 14px; }

/* ---- HUD ---- */
.hud {
  position: sticky; top: 0; z-index: 30;
  background: rgba(13,15,20,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin: 0 -14px 8px;
  padding: 8px 14px;
}
.hud-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hud-brand { font-weight: 800; letter-spacing: 2px; font-size: 12px; color: var(--muted); }
.sound-toggle {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 11px; color: var(--muted); user-select: none;
}
.sound-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sound-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
#sound-toggle-icon { font-size: 14px; line-height: 1; }
.sound-toggle-label { display: none; }
.btn-mini { padding: 6px 10px; font-size: 12px; }
.hud-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px;
}
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; }
.stat-label { display: block; font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
.stat-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-val.pulse { animation: pulse .35s ease; }
.stat.cash .stat-val { color: var(--accent); }
.stat.debt .stat-val { color: var(--danger); }
.stat-tooltip { position: relative; cursor: help; }
.stat-tooltip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.stat-tooltip-box {
  position: absolute; left: 50%; top: calc(100% + 8px); z-index: 80;
  width: max-content; min-width: 190px; max-width: min(280px, 88vw);
  transform: translateX(-50%) translateY(-4px); opacity: 0; pointer-events: none;
  background: #111827; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 9px 10px; transition: opacity .12s ease, transform .12s ease;
}
.stat-tooltip:hover .stat-tooltip-box,
.stat-tooltip:focus .stat-tooltip-box {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.tooltip-title { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.tooltip-row { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; white-space: nowrap; padding: 3px 0; }
.tooltip-row strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.tooltip-empty, .tooltip-foot { color: var(--muted); font-size: 12px; }
.tooltip-foot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
@media (min-width: 560px) { .hud-stats { grid-template-columns: repeat(7, 1fr); } }

/* ---- Screens / panels ---- */
.screen { animation: fade .25s ease; }
.card, .panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.hint { color: var(--muted); font-size: 12px; }

.title { font-size: 34px; font-weight: 900; letter-spacing: 1px; margin: 4px 0 8px; }
.lede { color: var(--muted); }
.start-card { overflow: hidden; }
.start-actions { display: grid; gap: 10px; margin-top: 8px; }
.game-logo { margin: -2px 0 12px; }
.game-logo-img {
  display: block; width: 100%; height: auto; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.logo-tag {
  text-align: center; color: #a5b4fc; margin: 10px 0 0;
  font-size: 13px; font-weight: 800; letter-spacing: 3px;
}
.auth-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px; margin: 0 0 14px;
}
.auth-panel .btn { padding: 8px 10px; white-space: nowrap; }
.auth-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-actions-wrap { position: relative; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.auth-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.auth-menu-toggle { display: none; font-size: 18px; line-height: 1; padding: 8px 12px; }

/* Below this width the four account buttons (Scores/Achievements/Skillz/Sign
   out) no longer fit next to the email on one line and were wrapping onto
   several ragged rows above the fold. Collapse them behind a single "..."
   toggle instead: the dropdown itself is positioned by app.js's openDropdown
   helper, which flips it open/closed and closes it on an outside click. */
@media (max-width: 560px) {
  .auth-menu-toggle { display: inline-flex; }
  .auth-actions {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow); padding: 6px; min-width: 160px; z-index: 20;
  }
  .auth-actions.open { display: flex; }
  .auth-actions .btn { justify-content: flex-start; text-align: left; }
}

.docs-screen { padding: 18px; }
.docs-head { margin-bottom: 16px; }
.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.docs-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
}
.docs-card h3 { margin: 0 0 8px; font-size: 14px; }
.docs-card p { margin: 0 0 8px; color: var(--text); }
.docs-card p:last-child { margin-bottom: 0; }
.docs-list { margin: 0; padding-left: 18px; color: var(--text); }
.docs-list li + li { margin-top: 6px; }

.profile-screen { padding: 18px; }
.profile-head { margin-bottom: 16px; }
.profile-summary {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.profile-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px;
}
.profile-card label {
  display: block; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .8px; margin-bottom: 6px;
}
.profile-card strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.profile-card small { display: block; color: var(--muted); margin-top: 4px; }
.profile-panel { padding: 14px; }
.profile-bonuses { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.profile-bonus {
  background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.26);
  color: #c6f6d5; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 700;
}
.profile-skills { display: grid; gap: 24px; }
.skill-group {
  padding-top: 20px; border-top: 1px solid var(--line);
}
.skill-group:first-child { padding-top: 0; border-top: none; }
.skill-group-head { margin-bottom: 12px; }
.skill-group-head h3 { margin: 0 0 4px; font-size: 14px; }
.skill-group-head p { margin: 0; color: var(--muted); font-size: 12px; }
.skill-group-grid { display: grid; gap: 12px; }
.skill-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.skill-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.skill-top strong { display: block; margin-bottom: 4px; }
.skill-rank { color: var(--accent); font-size: 13px; font-weight: 800; white-space: nowrap; }
.skill-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.skill-reqs, .skill-blocked { color: var(--muted); font-size: 12px; margin-top: 8px; }
.skill-card .btn { min-width: 120px; }
.profile-games { display: grid; gap: 8px; }
.profile-game {
  display: grid; grid-template-columns: minmax(0, 1.5fr) auto auto;
  gap: 10px; align-items: center; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
.profile-game-main { min-width: 0; }
.profile-game-main strong, .profile-game-main small { display: block; }
.profile-game-main small { color: var(--muted); }
.profile-game-score { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.profile-game-status {
  justify-self: end; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px;
}
.profile-empty { color: var(--muted); margin: 0; }
.profile-achievements { display: grid; gap: 8px; }
.achievement-card {
  display: flex; align-items: flex-start; gap: 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
.achievement-icon { font-size: 20px; line-height: 1; }
.achievement-body strong { display: block; margin-bottom: 2px; }
.achievement-locked { opacity: .55; }
.achievement-unlocked { border-color: var(--accent); }
@media (max-width: 640px) {
  .docs-grid { grid-template-columns: 1fr; }
  .profile-summary { grid-template-columns: 1fr; }
  .profile-game { grid-template-columns: 1fr; }
  .profile-game-status { justify-self: start; }
}

/* ---- Buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 14px;
  font-weight: 600; cursor: pointer; touch-action: manipulation;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: #3a4568; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #4ade80, #22c55e); color: #06240f; border: none; }
.btn-lg { padding: 14px 20px; font-size: 16px; width: 100%; margin-top: 8px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: linear-gradient(180deg, #f87171, #ef4444); color: #2a0606; border: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Market cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.drug {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.drug-name { font-weight: 700; }
.drug-price { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.drug-band {
  align-self: flex-start; background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.26);
  color: #93c5fd; border-radius: 999px; padding: 3px 8px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .7px; font-weight: 800;
}
.drug-held { font-size: 12px; color: var(--muted); }
.drug-held.pl-up { color: var(--accent); }
.drug-held.pl-down { color: var(--danger); }
.drug-chg { display: inline-block; margin-left: 4px; font-size: 11px; vertical-align: middle; }
.drug-chg.up { color: var(--accent); }
.drug-chg.down { color: var(--danger); }
.drug-chg.flat { color: var(--muted); }
.drug-actions { display: flex; gap: 8px; margin-top: auto; }
.drug-actions .btn { flex: 1; padding: 8px; }

/* ---- Travel chips ---- */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 999px; padding: 10px 12px; font-weight: 600; cursor: pointer;
  text-align: center;
}
.chip.here { border-color: var(--accent-2); color: var(--accent-2); }
.chip:active { transform: translateY(1px); }
.chip-heat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.chip-heat.heat-low { color: #fbbf24; }
.chip-heat.heat-warm { color: #fb923c; }
.chip-heat.heat-hot { color: var(--danger); }
.chip.heat-low { border-color: #fbbf2444; }
.chip.heat-warm { border-color: #fb923c66; }
.chip.heat-hot { border-color: var(--danger); }

/* ---- Heat / wanted level ---- */
.heat-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); margin-left: 6px; vertical-align: middle; }
.heat-badge.heat-low { color: #fbbf24; border-color: #fbbf2455; }
.heat-badge.heat-warm { color: #fb923c; border-color: #fb923c66; }
.heat-badge.heat-hot { color: var(--danger); border-color: var(--danger); }
.heat-note { color: var(--warn); }
.dirty { color: var(--warn); font-weight: 700; }
.btn-warn { border-color: var(--warn); color: var(--warn); }
.services { display: flex; gap: 8px; flex-wrap: wrap; }
.services .btn { flex: 1; min-width: 120px; }

/* ---- Gang standings ---- */
.gang-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.gang-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.gang-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.gang-status.gang-friendly { color: var(--accent); border-color: var(--accent); }
.gang-status.gang-hostile { color: var(--danger); border-color: var(--danger); }
.gang-status.gang-neutral { color: var(--muted); }
.gang-bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.gang-bar-fill { height: 100%; background: var(--muted); transition: width .2s ease; }
.gang-bar-fill.gang-friendly { background: var(--accent); }
.gang-bar-fill.gang-hostile { background: var(--danger); }
.gang-bar-fill.gang-neutral { background: var(--accent-2); }
.gang-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.gang-pair { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.gang-vs { text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 10px 0; }

/* ---- Loan sharks ---- */
.loan-shark-list { display: flex; flex-direction: column; gap: 12px; }
.loan-shark-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.loan-shark-card.loan-shark-here { border-color: var(--accent); }
.loan-shark-card .btn { width: 100%; margin-top: 8px; }
/* An existing balance on a shark should read as urgent, not like ordinary
   hint text — bold amber while still within the payback window, escalating
   to the same red used for the HUD's debt stat once it's actually overdue. */
.loan-owed { font-weight: 700; color: var(--warn); }
.loan-owed.dirty { color: var(--danger); }

/* ---- Log ---- */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.log li { color: var(--muted); font-size: 13px; border-left: 2px solid var(--line); padding-left: 8px; }
.log li:first-child { color: var(--text); border-color: var(--accent); }

/* ---- Banners ---- */
.banners { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.banner { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.4); color: var(--warn);
  border-radius: 10px; padding: 10px 12px; font-weight: 600; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center;
  justify-content: center; padding: 18px; z-index: 50; animation: fade .15s ease; overscroll-behavior: contain; }
/* The explicit display:flex above beats the UA [hidden] rule, so hidden must be
   re-asserted or the overlay stays up and swallows every click. */
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); width: 100%; max-width: 420px;
  /* Extra bottom padding (beyond the 18px on every other side) so the close/OK
     button never lands flush against the bottom edge of the phone when a long
     modal is scrolled all the way down — plus the safe-area inset on phones
     with a home indicator or gesture bar. */
  padding: 18px 18px calc(18px + 24px + env(safe-area-inset-bottom, 0px));
  max-height: calc(100vh - 36px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; }
.modal-box h3 { margin: 0 0 10px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
/* The blackjack modal re-renders in place on every hit/stand/double/split —
   its action row goes from 2 buttons (Deal/Exit) up to 5 (Hit/Stand/Double/
   Split/Surrender) and back down within the same session. Since .modal is
   vertically centered, a shorter action row made the whole box visibly jump
   position on every render. Reserving max-case height keeps it stable. */
.modal-box:has(.casino-table) .modal-actions { min-height: 96px; align-content: flex-start; }
/* Beyond the action row, dealer/hand card counts and the resolved-hand
   message text also vary in height across a single continuous blackjack
   session (unlike other modals, which reopen fresh instead of updating in
   place) — reserving a stable minimum for the whole box keeps it from
   visibly jumping position (it's vertically centered) on every render. */
.modal-box:has(.casino-table) { min-height: 660px; }
.modal-actions .btn { flex: 1 1 120px; min-height: 44px; }
.modal-actions .btn-wide { flex-basis: 100%; }

/* ---- Modal scene art ---- */
.modal-scene {
  display: block; width: 100%; max-width: 340px; aspect-ratio: 16 / 9; height: auto;
  margin: 0 auto 14px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: scene-in .25s ease;
}
@keyframes scene-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.cop-scene-hit { animation: scene-in .25s ease, scene-shake .4s ease-in-out .1s; }
@keyframes scene-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-1deg); }
  40% { transform: translateX(5px) rotate(1deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* ---- City picker (start screen) ---- */
.city-pick, .difficulty-pick { margin: 4px 0 14px; text-align: left; }
.city-pick > label, .start-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; }
.city-select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font-size: 16px; font-weight: 600; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-option input { position: absolute; opacity: 0; pointer-events: none; }
.seg-option span {
  display: block; text-align: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 8px; font-weight: 800; cursor: pointer;
}
.seg-option input:checked + span { background: rgba(74,222,128,.16); border-color: var(--accent); color: var(--accent); }
.seg-option.disabled span { opacity: .5; cursor: not-allowed; }

/* ---- Price chart (buy/sell modal) ---- */
.chart-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.chart-wrap { background: #0f131c; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 12px; }
.pchart { width: 100%; height: auto; display: block; }
.pchart .axis { stroke: #2a3145; stroke-width: 1; }
.pchart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.pchart .area { fill: rgba(74,222,128,.12); stroke: none; }
.pchart .ylab, .pchart .xlab { fill: var(--muted); font-size: 9px; font-family: system-ui, sans-serif; }
.pchart .avg-cost-line { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pchart .avg-cost-label { fill: var(--danger); font-size: 9px; font-family: system-ui, sans-serif; font-weight: 700; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 14px 8px; text-align: center; }

.field { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px; font-size: 16px; }
.google-signin-button { display: flex; justify-content: center; margin-bottom: 4px; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: 12px; margin: 14px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pin-field { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 6px; }
.setup-label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 5px; }
.row { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 6px 0; }
.row + .row { border-top: 1px solid var(--line); }
.heal-picker { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.heal-picker label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.heal-picker input[type="range"] { width: 100%; accent-color: var(--accent); }
.amount-picker { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.amount-picker label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.amount-picker input[type="range"] { width: 100%; accent-color: var(--accent); }
.gear-section { margin-top: 12px; }
.gear-section:first-child { margin-top: 0; }
.gear-section > .btn { width: 100%; margin-top: 8px; }
.mini-action { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.stash-row {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  background: var(--panel-2); margin-bottom: 8px;
}
.stash-row:last-child { margin-bottom: 0; }
.stash-row .amount-picker { margin-top: 10px; padding-top: 10px; }
.stash-row .mini-action { margin-top: 8px; }
.stash-row .stash-action { flex: 1; }
/* ---- Casino table (blackjack; reused by baccarat later) ---- */
.casino-table {
  /* padding-top clears the absolutely-positioned shoe (top:10px, 42px tall)
     in the same corner — without it, the dealer's total (also top-right,
     via .bj-label's space-between) renders directly underneath the shoe. */
  position: relative; background: radial-gradient(120% 140% at 50% -10%, #0f5c3c 0%, #0b4a30 55%, #093c27 100%);
  border: 1px solid #0a3d28; border-radius: var(--radius); padding: 56px 14px 12px;
  box-shadow: inset 0 0 0 6px rgba(212,175,55,.14), inset 0 2px 10px rgba(0,0,0,.35);
  margin-bottom: 4px; overflow: hidden; min-height: 90px;
}
.casino-shoe {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 42px;
  border-radius: 5px; background: linear-gradient(135deg, #2a3145, #1a1f2e);
  border: 1px solid rgba(212,175,55,.5);
  box-shadow: 2px 2px 0 rgba(0,0,0,.25), 4px 4px 0 rgba(0,0,0,.2), 6px 6px 0 rgba(0,0,0,.15);
}
.bj-count {
  font-size: 12px; font-weight: 700; color: #d4af37; margin-bottom: 8px;
  max-width: calc(100% - 46px); /* stay clear of the shoe icon in the corner */
}
.bj-count .hint { color: #cfe9d8; font-weight: 500; }
.bj-dealer, .bj-hand {
  border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
  background: rgba(0,0,0,.18);
}
.bj-hand-row { display: flex; gap: 8px; flex-wrap: wrap; }
.bj-hand-row .bj-hand { flex: 1 1 140px; }
.bj-hand-active { box-shadow: 0 0 0 2px var(--accent-2) inset; }
.bj-label { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: #cfe9d8; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.bj-total { color: #fff; font-weight: 700; font-size: 14px; }
.bj-cards { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; min-height: 56px; align-items: flex-start; }
.bj-cards-empty { border: 1px dashed rgba(212,175,55,.3); border-radius: 6px; width: 100%; }
.bj-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  color: #3a2c05; background: linear-gradient(135deg, #ffd766, #d4af37);
  border-radius: 999px; padding: 2px 8px; box-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.bj-result {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 6px; padding: 2px 6px; margin-left: 6px;
}
.bj-result-win, .bj-result-blackjack, .bj-result-even_money { background: rgba(74,222,128,.18); color: var(--accent); }
.bj-result-bust, .bj-result-loss { background: rgba(248,113,113,.18); color: var(--danger); }
.bj-result-push { background: rgba(251,191,36,.18); color: var(--warn); }
.bj-result-surrender { background: rgba(139,149,173,.18); color: var(--muted); }
/* Marks a Free Bet Blackjack hand whose double/split cost no extra wager. */
.free-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  border-radius: 6px; padding: 2px 6px; margin-left: 4px;
  background: rgba(74,222,128,.18); color: var(--accent);
}

/* ---- Baccarat side bet spots — click to toggle, like tapping a betting
   circle painted on the felt. ---- */
.side-bets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 10px 0; }
.side-spot {
  border: 1px solid rgba(212,175,55,.35); border-radius: 10px; padding: 8px 10px;
  background: rgba(0,0,0,.18); cursor: pointer; text-align: center; user-select: none;
  transition: box-shadow .15s, background .15s;
}
.side-spot:active { transform: translateY(1px); }
.side-spot.selected { box-shadow: 0 0 0 2px var(--accent-2) inset; background: rgba(96,165,250,.14); }
.side-spot-label { display: block; font-size: 12px; font-weight: 700; color: #fff; }
.side-spot-odds { display: block; font-size: 11px; color: #cfe9d8; margin-top: 2px; }

/* ---- Slot machine ---- */
.slot-machine {
  position: relative; background: radial-gradient(120% 140% at 50% -10%, #3a2a12 0%, #241a0c 55%, #1a1206 100%);
  border: 1px solid #4a3a1a; border-radius: var(--radius); padding: 22px 14px 18px;
  box-shadow: inset 0 0 0 6px rgba(212,175,55,.14), inset 0 2px 10px rgba(0,0,0,.35);
  margin-bottom: 4px;
}
.slot-grid { position: relative; display: flex; flex-direction: column; gap: 6px; width: max-content; margin: 0 auto; }
.slot-row { display: flex; gap: 6px; justify-content: center; }
.slot-cell {
  width: 50px; height: 50px; display: flex; align-items: center; justify-content: center;
  background: #0d0d0f; border: 2px solid rgba(212,175,55,.5); border-radius: 8px;
  font-size: 24px; box-shadow: inset 0 2px 6px rgba(0,0,0,.6); transition: box-shadow .15s, background .15s;
}
.slot-cell.win { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, inset 0 2px 6px rgba(0,0,0,.6); background: rgba(74,222,128,.14); }
.slot-cell.spinning span { display: inline-block; animation: slot-spin .09s linear infinite; }
@keyframes slot-spin {
  0% { transform: translateY(-6px); opacity: .5; filter: blur(1px); }
  50% { transform: translateY(0); opacity: 1; filter: blur(0); }
  100% { transform: translateY(6px); opacity: .5; filter: blur(1px); }
}
/* Lines drawn through the cells each winning payline actually paid on —
   clearer than lit-up squares alone, especially with several lines hitting
   on the same spin (each gets its own color). Absolutely positioned over
   the grid; viewBox math in app.js's SLOT_CELL_PX/SLOT_GAP_PX must match
   .slot-cell's size and .slot-row/.slot-grid's gap above. */
.slot-paylines-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.slot-result-tag { text-align: center; margin-top: 12px; min-height: 22px; }
/* Result message sits inside the fixed machine frame (not a separate
   paragraph below it) so the modal doesn't resize between an idle machine,
   a loss, and a multi-line win message. */
.slot-result-message { text-align: center; margin-top: 4px; min-height: 34px; font-size: 13px; color: var(--muted); padding: 0 4px; }
.modal-box:has(.slot-machine) .modal-actions { min-height: 96px; align-content: flex-start; }

/* ---- Slots pay lines & pays modal ---- */
.paytable-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin: 12px 0; }
.payline-mini { text-align: center; }
.payline-mini-grid {
  display: inline-flex; flex-direction: column; gap: 2px; padding: 6px;
  background: rgba(255,255,255,.04); border-radius: 6px;
}
.payline-mini-row { display: flex; gap: 2px; }
.payline-dot { width: 10px; height: 10px; border-radius: 2px; background: rgba(255,255,255,.12); }
.payline-dot.active { background: var(--accent); }
.payline-mini-label { font-size: 10px; color: var(--muted); margin-top: 4px; text-transform: capitalize; }
.paytable-symbols { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.paytable-symbols th, .paytable-symbols td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.paytable-symbols th:first-child, .paytable-symbols td:first-child { text-align: left; }
.paytable-symbol-cell { font-size: 18px; }

.pcard {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 56px; border-radius: 6px; background: #fdfdf8; color: #1a1a1a;
  font-weight: 700; font-size: 16px; box-shadow: 0 2px 4px rgba(0,0,0,.35); flex: 0 0 auto;
}
.pcard-red { color: #c62828; }
.pcard-back {
  background: repeating-linear-gradient(45deg, #1a1f2e, #1a1f2e 4px, #232a40 4px, #232a40 8px);
  color: transparent; border: 1px solid rgba(212,175,55,.4);
}
.pcard-deal { animation: deal-card .32s ease-out backwards; }
@keyframes deal-card {
  from { transform: translate(90px, -46px) scale(.55) rotate(8deg); opacity: 0; }
  to { transform: translate(0, 0) scale(1) rotate(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pcard-deal { animation: none; }
}
.bribe-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bribe-box input[type="range"] { width: 100%; accent-color: var(--warn); }

/* ---- Scores ---- */
.scores { margin-top: 16px; }
.scores h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 8px; }
.score-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.score-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.score-rank { color: var(--accent-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.score-player { min-width: 0; display: flex; flex-direction: column; }
.score-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-player small { color: var(--muted); font-size: 11px; }
.score-value { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-empty { color: var(--muted); margin: 0; }

.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 12px; }
.foot-links { display: flex; justify-content: center; gap: 12px; margin-top: 4px; }
.foot-links a { color: var(--muted); text-decoration: underline; }
.foot-links a:hover { color: var(--text); }

.cookie-banner {
  position: sticky; top: 0; z-index: 200;
  background: color-mix(in srgb, var(--accent-2) 14%, var(--bg));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.cookie-banner-inner {
  max-width: 900px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.cookie-banner-copy { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); }
.cookie-banner-copy a { color: var(--accent-2); }
.cookie-banner-button { flex-shrink: 0; }

.legal-card { max-width: 640px; margin: 40px auto; line-height: 1.6; }
.legal-card h1 { margin-bottom: 4px; }
.legal-card h2 { font-size: 16px; margin: 22px 0 6px; }
.legal-card p { color: var(--text); }
.legal-card .back-link { display: inline-block; margin-top: 24px; }
/* No anchor rule existed anywhere for these pages' body text, so links here
   fell back to the browser's default blue/purple — unreadably low-contrast
   against this dark background. */
.legal-card a:not(.btn) { color: var(--accent-2); }
.legal-card a:not(.btn):visited { color: var(--accent-2); }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); color: var(--warn); }
  100% { transform: scale(1); }
}
