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

:root {
  /* Theme tokens live in themes.css; fallbacks if themes.css fails to load */
  --felt: #0d5c2e;
  --felt-dark: #094021;
  --felt-border: #c9a227;
  --gold: #d4af37;
  --gold-light: #f0d878;
  --red: #c41e3a;
  --black: #1a1a1a;
  --green: #228b22;
  --text: #f5f0e1;
  --text-muted: #b8b0a0;
  --panel: #122a1a;
  --shadow: rgba(0, 0, 0, 0.45);
  --page-bg: radial-gradient(ellipse at top, #1a3d2a 0%, #0a1510 70%);
}

body {
  min-height: 100vh;
  font-family: var(--font-body, "Segoe UI", system-ui, sans-serif);
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.4;
}

.app {
  max-width: min(1600px, 100%);
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
}

/* ── Header ── */
.header {
  margin-bottom: 0.75rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.header-brand {
  text-align: left;
}

.header-brand h1 {
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-light);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.header-menu-wrap {
  position: relative;
}

.btn-menu {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  background: var(--panel);
  border: 1px solid var(--panel-border, var(--felt-border));
  color: var(--text);
  border-radius: var(--radius-control, 6px);
  cursor: pointer;
}

.btn-menu:hover {
  border-color: var(--gold);
}

.header-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  min-width: 10.5rem;
  background: var(--panel);
  border: 1px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-control, 6px);
  box-shadow: 0 8px 24px var(--shadow);
  padding: 0.25rem;
}

.header-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
}

.header-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.header-stats-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.header-inline-stat strong {
  color: var(--gold-light);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.win-stat-inline strong {
  color: var(--win-color);
}

.header-rank-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(212, 175, 55, 0.45);
  text-underline-offset: 2px;
}

.header-rank-btn:hover strong {
  color: var(--gold);
}

.header-balance-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-balance-topup {
  padding: 0.15rem 0.45rem;
  font-size: 0.62rem;
  line-height: 1.2;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
}

.btn-balance-topup:hover {
  background: rgba(212, 175, 55, 0.12);
}

.header-stats-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.header-mini-stat strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.header-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}

.header-stat {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.header-stat[hidden] {
  display: none !important;
}

.header-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.header-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.win-stat .header-stat-value {
  color: var(--win-color);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.auth-slot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.auth-user-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input-sm {
  width: 6rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-control, 6px);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  flex: none;
}

/* ── Play area: outcome (left) + table ── */
.play-area {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.table-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.table-section {
  flex: 1;
  min-width: 0;
}

.table-wrapper {
  background: var(--panel);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
  padding: 0.5rem;
  box-shadow: 0 8px 32px var(--shadow);
  overflow: visible;
}

.roulette-table {
  display: grid;
  grid-template-columns: minmax(2.75rem, 4rem) repeat(12, 1fr) minmax(2.75rem, 4rem);
  grid-template-rows: repeat(5, clamp(50px, 5.5vh, 68px));
  gap: 2px;
  width: 100%;
  background: var(--felt-border);
  border: 3px solid var(--felt-border);
  border-radius: 4px;
  padding: 2px;
  position: relative;
}

.numbers-inner {
  grid-column: 1 / 14;
  grid-row: 1 / 4;
  display: grid;
  grid-template-columns: minmax(2.75rem, 4rem) repeat(12, 1fr);
  grid-template-rows: repeat(3, clamp(50px, 5.5vh, 68px));
  gap: 2px;
  position: relative;
}

.inside-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(2.75rem, 4rem) repeat(12, 1fr);
  grid-template-rows: repeat(3, clamp(50px, 5.5vh, 68px));
  gap: 2px;
  pointer-events: none;
  z-index: 5;
}

.inside-zone {
  pointer-events: auto;
  cursor: pointer;
  z-index: 6;
  border-radius: 2px;
  background: var(--inside-zone-bg);
  border: 1px solid var(--inside-zone-border);
  min-width: 10px;
  min-height: 10px;
}

.inside-zone:hover {
  background: var(--inside-zone-hover);
}

.inside-street,
.inside-sixline {
  background: var(--inside-zone-bg);
  opacity: 0.85;
}

.inside-corner {
  border-radius: 50%;
}

.bet-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--felt);
  font-weight: 700;
  font-size: clamp(0.8rem, 1.2vw, 1.05rem);
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s;
  min-height: 50px;
}

.bet-cell:hover:not(.disabled) {
  filter: brightness(1.15);
}

.bet-cell.red,
.bet-cell.black,
.bet-cell.green {
  color: var(--cell-pocket-text, #fff);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.bet-cell.red { background: var(--red); }
.bet-cell.black { background: var(--black); }
.bet-cell.green { background: var(--green); }

.bet-cell.outside {
  background: var(--felt-dark);
  font-size: clamp(0.6rem, 0.9vw, 0.78rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--cell-outside-text, var(--text));
}

.bet-cell.zero {
  grid-row: 1 / 4;
  grid-column: 1;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: clamp(0.9rem, 1.3vw, 1.15rem);
}

.bet-cell.col-bet {
  grid-column: 14;
  font-size: clamp(0.55rem, 0.8vw, 0.72rem);
}

.bet-cell.dozen {
  grid-column: span 4;
}

.bet-cell.even-money {
  grid-column: span 2;
}

.bet-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(22px, 2.5vw, 30px);
  height: clamp(22px, 2.5vw, 30px);
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #ddd);
  color: #222;
  font-size: clamp(0.5rem, 0.7vw, 0.62rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #888;
  box-shadow: 0 2px 6px var(--shadow);
  pointer-events: none;
  z-index: 2;
}

.bet-chip-sm {
  font-size: clamp(0.45rem, 0.55vw, 0.52rem);
}

.bet-cell.bet-win,
.inside-zone.bet-win {
  outline: 4px solid #ffd700;
  outline-offset: -2px;
  box-shadow:
    inset 0 0 18px rgba(255, 215, 0, 0.75),
    0 0 22px rgba(255, 215, 0, 0.95),
    0 0 44px rgba(255, 180, 0, 0.55);
  filter: brightness(1.4) saturate(1.25);
  animation: win-spot-pulse 0.65s ease-in-out infinite alternate;
  z-index: 7;
}

.bet-cell.result-landed:not(.bet-win) {
  outline: 3px solid #fff;
  outline-offset: -2px;
  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.55),
    0 0 16px rgba(255, 255, 255, 0.65);
  animation: result-landed-pulse 0.8s ease-in-out infinite alternate;
  z-index: 6;
}

.bet-cell.result-landed.bet-win {
  outline-color: #fff;
}

.bet-chip.bet-chip-win {
  border: 3px solid #ffd700;
  background: linear-gradient(145deg, #fff9c4, #ffd700);
  color: #1a1a1a;
  box-shadow:
    0 0 0 4px rgba(255, 215, 0, 0.75),
    0 0 18px rgba(255, 215, 0, 1);
  animation: win-chip-pulse 0.65s ease-in-out infinite alternate;
  z-index: 12;
}

@keyframes win-spot-pulse {
  from {
    box-shadow:
      inset 0 0 12px rgba(255, 215, 0, 0.6),
      0 0 16px rgba(255, 215, 0, 0.7);
    filter: brightness(1.25);
  }
  to {
    box-shadow:
      inset 0 0 24px rgba(255, 255, 200, 0.95),
      0 0 32px rgba(255, 215, 0, 1),
      0 0 56px rgba(255, 160, 0, 0.65);
    filter: brightness(1.55);
  }
}

@keyframes result-landed-pulse {
  from { box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.4), 0 0 10px rgba(255, 255, 255, 0.45); }
  to { box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.75), 0 0 24px rgba(255, 255, 255, 0.85); }
}

@keyframes win-chip-pulse {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.12); }
}

.result-phase .bet-chip:not(.bet-chip-win) {
  opacity: 0.72;
}

.result-phase .roulette-table,
.result-phase .numbers-inner,
.result-phase .inside-overlay {
  pointer-events: none;
}

/* ── Controls under table ── */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  padding: 0.6rem 0.75rem;
  background: var(--panel);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
}

.bet-hint-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.35rem 0.55rem;
  min-height: 44px;
  border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.15));
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--text-muted);
  text-transform: lowercase;
  max-width: 9.5rem;
}

.chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.chip {
  width: clamp(44px, 5vw, 52px);
  height: clamp(44px, 5vw, 52px);
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  font-weight: 700;
  font-size: clamp(0.7rem, 1vw, 0.82rem);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chip:hover { transform: scale(1.08); }

.chip.active {
  box-shadow: 0 0 0 3px var(--gold), 0 4px 12px var(--shadow);
  transform: scale(1.08);
}

.chip-1 { background: linear-gradient(145deg, #fff, #ccc); color: #333; }
.chip-5 { background: linear-gradient(145deg, #e53935, #b71c1c); }
.chip-10 { background: linear-gradient(145deg, #8e24aa, #4a148c); }
.chip-25 { background: linear-gradient(145deg, #43a047, #1b5e20); }
.chip-100 { background: linear-gradient(145deg, #1e88e5, #0d47a1); }
.chip-500 { background: linear-gradient(145deg, #ff8f00, #e65100); }
.chip-1000 { background: linear-gradient(145deg, #212121, #000); border: 2px solid var(--gold); }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.toggle-label input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--gold);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  min-width: 5rem;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #1a1a1a;
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--btn-secondary-border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Outcome (left of table; height synced to table via JS) ── */
.history-panel {
  width: min(168px, 20%);
  min-width: 130px;
  flex-shrink: 0;
  align-self: flex-start;
  background: var(--history-bg);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: min(420px, 52vh);
}

.history-title {
  margin: 0;
  padding: 0.4rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--history-title-color);
  background: var(--history-title-bg);
  flex-shrink: 0;
}

.history-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: var(--history-bg);
}

.history-empty {
  padding: 0.75rem 0.5rem;
  font-size: 0.72rem;
  color: var(--history-empty);
  text-align: center;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.45rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.75rem;
}

.history-row-red { background: var(--history-row-red); }
.history-row-black { background: var(--history-row-black); }
.history-row-green { background: var(--history-row-green); }

.history-row-warmup .history-stats {
  color: #666;
  font-style: italic;
}

.history-number {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}

.history-number.red { background: var(--red); }
.history-number.black { background: var(--black); }
.history-number.green { background: var(--green); }

.history-stats {
  color: var(--history-stats);
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
}

/* ── Bottom: wheel + dealer animation + charts ── */
.spin-area {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.spin-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 900px) {
  .spin-row {
    grid-template-columns: auto minmax(160px, 1fr) minmax(320px, 2fr);
    align-items: stretch;
  }
}

.spin-wheel-panel,
.dealer-stage,
.stats-hub {
  background: var(--panel);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
  padding: 0.65rem;
  box-shadow: 0 8px 32px var(--shadow);
}

.spin-wheel-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dealer-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
  min-height: 200px;
  background: var(--dealer-bg);
}

.dealer-placeholder {
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 2px dashed var(--dealer-frame-border);
  border-radius: 8px;
  padding: 1rem;
}

.dealer-placeholder-frame {
  width: 72px;
  height: 96px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.25rem;
}

.dealer-placeholder-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.04em;
}

.dealer-placeholder-note {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-hub {
  display: grid;
  grid-template-columns: 1fr min(200px, 42%);
  gap: 0.5rem;
  align-items: center;
  min-height: 220px;
}

.stats-hub-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.hotcold-block {
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
}

.hot-block {
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.35), rgba(80, 20, 30, 0.5));
  border: 1px solid rgba(255, 120, 80, 0.35);
}

.cold-block {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.25), rgba(13, 40, 80, 0.5));
  border: 1px solid rgba(100, 180, 246, 0.35);
}

.hotcold-block-title {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}

.hot-block .hotcold-block-title { color: #ffab91; }
.cold-block .hotcold-block-title { color: #90caf9; }

.hotcold-cards {
  display: flex;
  gap: 0.35rem;
}

.hotcold-card {
  flex: 1;
  text-align: center;
  padding: 0.15rem 0.1rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

.hotcold-card .hc-num {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.hotcold-card .hc-freq {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.1;
}

.last50-panel {
  margin-top: 0.15rem;
}

.last50-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-bar-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.stat-bar-pair {
  flex: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.stat-bar-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 2.2rem;
}

.stat-bar-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
}

.stat-bar-pct {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--gold-light);
  width: 1.6rem;
  text-align: right;
}

.stats-hub-chart {
  display: flex;
  align-items: center;
  justify-content: center;
}

.radial-chart {
  width: 100%;
  max-width: 220px;
  height: 220px;
  display: block;
}

.interval-strip-panel {
  background: var(--panel);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
  padding: 0.5rem 0.65rem;
  box-shadow: 0 8px 32px var(--shadow);
}

.interval-strip {
  width: 100%;
  height: clamp(52px, 8vh, 72px);
  display: block;
  border-radius: 6px;
}

.freq-footer {
  background: var(--freq-footer-bg);
  border: 2px solid var(--panel-border, var(--felt-border));
  border-radius: var(--radius-panel, 12px);
  padding: 0.65rem 0.75rem;
  box-shadow: 0 8px 32px var(--shadow);
}

.freq-footer .panel-title {
  color: var(--freq-footer-title);
}

.wheel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-pointer {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 20px solid var(--gold);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#wheel {
  border-radius: 50%;
  width: 280px;
  max-width: 100%;
  height: auto;
  margin-top: 0.25rem;
}

.result-display {
  margin-top: 0.5rem;
  text-align: center;
}

.result-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.result-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  margin-top: 0.2rem;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  border: 2px solid var(--gold);
}

.result-number.red { background: var(--red); }
.result-number.black { background: var(--black); }
.result-number.green { background: var(--green); }

.panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-align: center;
}

.stats-chart {
  width: 100%;
  display: block;
  border-radius: 6px;
}

.stats-chart-footer {
  height: clamp(170px, 22vh, 260px);
  width: 100%;
}

.chart-caption {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.35rem;
}

.spinning .roulette-table,
.spinning .numbers-inner,
.spinning .inside-overlay {
  pointer-events: none;
}

@media (max-width: 767px) {
  .table-row {
    flex-direction: column;
  }

  .history-panel {
    width: 100%;
    max-height: min(160px, 28vh);
  }

  .stats-hub {
    grid-template-columns: 1fr;
  }

  .radial-chart {
    max-width: 100%;
    height: 200px;
  }
}

@media (max-width: 600px) {
  .header-top {
    flex-wrap: wrap;
  }

  .header-stats-primary,
  .header-stats-secondary {
    gap: 0.3rem 0.55rem;
  }

  .controls-bar {
    flex-direction: column;
  }

  .bet-hint-box {
    max-width: none;
    width: 100%;
    text-align: center;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .btn {
    flex: 1;
  }

  .bet-cell {
    font-size: 0.68rem;
    min-height: 38px;
  }

  .roulette-table {
    grid-template-rows: repeat(5, 38px);
  }

  .numbers-inner,
  .inside-overlay {
    grid-template-rows: repeat(3, 38px);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: min(100%, 420px);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-panel, 12px);
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  box-shadow: 0 16px 48px var(--shadow);
}

.modal-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--gold);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: none;
  padding: 0;
}

.modal-field input[type="number"],
.modal-field input[type="email"],
.modal-field input[type="password"],
.modal-field select {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-control, 8px);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
}

.modal-field legend {
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.radio-row,
.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  color: var(--text);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  color: var(--text);
}

.theme-option input {
  flex-shrink: 0;
  accent-color: var(--gold);
}

.theme-swatch {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  flex-shrink: 0;
  border: 2px solid var(--panel-border, var(--felt-border));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.theme-swatch-classic {
  background: linear-gradient(135deg, #0d5c2e 50%, #d4af37 50%);
}

.theme-swatch-breeze {
  background: linear-gradient(135deg, #fce8ef 40%, #9d7b8a 40%, #b76e79 100%);
}

.theme-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.85rem;
}

.theme-option-text span:last-child {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.theme-option.theme-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.theme-option.theme-locked .theme-option-text span:last-child::after {
  content: " · unlock at 100 pts";
  color: var(--gold-light);
}

/* ── Legal gate ── */
body.legal-blocked .app {
  pointer-events: none;
  user-select: none;
  filter: blur(3px);
}

.legal-modal-overlay {
  z-index: 2000;
}

.legal-modal {
  width: min(100%, 520px);
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
}

.legal-lead {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.legal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  margin-bottom: 0.75rem;
  padding-right: 0.25rem;
}

.legal-section {
  margin-bottom: 0.85rem;
}

.legal-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  margin-bottom: 0.25rem;
}

.legal-section p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.legal-check {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.legal-recall-btn {
  width: 100%;
}

/* ── Dealer live animation during spin ── */
.dealer-stage.dealer-live .dealer-placeholder-frame {
  animation: dealer-deal 0.85s ease-in-out infinite;
}

.dealer-stage.dealer-live .dealer-placeholder-title::after {
  content: " · spinning";
  font-weight: 400;
  opacity: 0.85;
}

@keyframes dealer-deal {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(-4deg); }
  75% { transform: translateY(-3px) rotate(4deg); }
}

/* ── Dealer stage: animation + ads + leaderboard ── */
.dealer-live-view {
  flex-shrink: 0;
}

.dealer-ad-slot {
  flex-shrink: 0;
  min-height: 72px;
  border-radius: 8px;
  border: 1px dashed var(--panel-border, var(--felt-border));
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.ad-placeholder-inner {
  padding: 0.5rem 0.65rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ad-tag {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  margin-bottom: 0.2rem;
}

.leaderboard-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--panel-border, rgba(255,255,255,0.1));
  padding-top: 0.4rem;
}

.leaderboard-modal {
  width: min(100%, 420px);
}

.leaderboard-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -0.25rem 0 0.65rem;
}

.auth-modal {
  width: min(100%, 400px);
}

.auth-lead {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.25rem 0 0.85rem;
}

.auth-modal-actions {
  margin-bottom: 0.65rem;
}

.auth-google-btn {
  width: 100%;
}

.auth-signed-in-name {
  font-family: var(--font-display, inherit);
  font-size: 1.15rem;
  color: var(--gold);
  margin: 0 0 0.25rem;
}

.auth-signed-in-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.auth-error {
  font-size: 0.82rem;
  color: #f87171;
  margin: 0.75rem 0 0;
}

.auth-error[hidden] {
  display: none;
}

.leaderboard-modal .points-bar-track {
  margin-bottom: 0.5rem;
}

.leaderboard-modal .leaderboard-list {
  max-height: 280px;
  margin-bottom: 0.75rem;
}

.ad-gate-youtube {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.leaderboard-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-align: center;
}

.points-bar-track {
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  margin-bottom: 0.35rem;
  overflow: hidden;
}

.points-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.35s ease;
}

.leaderboard-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  font-size: 0.65rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.2rem 0.35rem;
  padding: 0.2rem 0.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  align-items: center;
}

.leaderboard-you {
  background: rgba(212, 175, 55, 0.12);
  border-radius: 4px;
}

.lb-rank { color: var(--gold-light); font-weight: 700; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-points { color: var(--text-muted); font-size: 0.6rem; grid-column: 2 / 4; }
.lb-net { display: none; }

.header-level {
  font-size: 0.85rem;
}

.premium-feature-btn.premium-trigger-locked::after {
  content: "";
}

/* ── Premium paywall ── */
[data-premium] {
  position: relative;
}

.premium-lock-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: inherit;
  text-align: center;
}

.premium-gated .premium-lock-overlay {
  display: flex;
}

.premium-gated > :not(.premium-lock-overlay) {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.premium-lock-title {
  font-weight: 700;
  color: var(--gold-light);
}

.premium-lock-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 16rem;
}

.premium-modal .premium-lead {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.premium-list {
  margin: 0 0 1rem 1.1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.premium-list li { margin-bottom: 0.35rem; }

.premium-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── Ad gate (new game) ── */
.ad-gate-overlay { z-index: 1500; }

.ad-gate-modal {
  width: min(100%, 480px);
}

.ad-gate-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ad-gate-video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.ad-gate-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-gate-video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.85rem;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.ad-gate-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.ad-gate-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 1s linear;
}

.ad-gate-countdown {
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
