/* ============================================================
   Roulette table — mobile-first.
   Tokens come from /css/site.css, which loads first. Structural patterns
   (.app reset, statusbar, chips, overlay, log, buttons) copied forward
   from craps.css/blackjack.css so every game shares the same shell.
   ============================================================ */

body { user-select: none; -webkit-user-select: none; }
input, textarea { user-select: text; -webkit-user-select: text; }

main:has(.app) { max-width: none; padding: 0; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) var(--s-6);
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.18em;
  color: var(--mint);
  margin: 0 0 var(--s-3);
  text-align: center;
}

.no-real-money {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin: calc(var(--s-3) * -1) 0 var(--s-3);
}

/* ============================================================
   Sticky status bar
   ============================================================ */

.statusbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  margin: 0 calc(var(--s-4) * -1);
  background: linear-gradient(180deg, rgba(10, 28, 18, 0.98), rgba(8, 24, 16, 0.98));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--edge-mint);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--s-4);
}

.sb-cell { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.sb-k { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
.sb-cell b { font-size: 17px; font-weight: 600; color: var(--bone); font-variant-numeric: tabular-nums; white-space: nowrap; }
.positive { color: var(--win) !important; }
.negative { color: var(--lose) !important; }

#notice {
  color: var(--lose);
  font-weight: 600;
  font-size: 13.5px;
  text-align: center;
  min-height: 1.2em;
  padding: var(--s-2) 0 0;
}

/* ============================================================
   Wheel + result
   ============================================================ */

.rl-wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.rl-wheel {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid var(--rail);
  box-shadow: var(--shadow-lg), inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  transition: transform 2.2s cubic-bezier(0.15, 0.85, 0.35, 1);
  position: relative;
}

.rl-wheel::after {
  content: '';
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--felt-raised), var(--bg-deep));
  border: 2px solid var(--rail);
}

.rl-wheel-pointer {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid var(--mint-bright);
  margin-bottom: -8px;
}

.rl-result {
  min-width: 84px;
  min-height: 44px;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--edge);
  background: var(--felt-well);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rl-result.is-spinning { color: var(--mint); animation: rl-pulse 0.7s ease-in-out infinite; }
.rl-result.is-red { background: var(--lose); color: #2b0d0a; border-color: rgba(0, 0, 0, 0.2); font-size: 22px; }
.rl-result.is-black { background: #1a1a1a; color: var(--bone); border-color: rgba(255, 255, 255, 0.15); font-size: 22px; }
.rl-result.is-green { background: var(--mint); color: #081810; border-color: var(--mint-deep); font-size: 22px; }
.rl-result.is-landed { animation: rl-pop 0.35s ease-out; }

@keyframes rl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes rl-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

.rl-history {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  max-width: 100%;
}

.rl-history-chip {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rl-history-chip.is-red { background: var(--lose); color: #2b0d0a; }
.rl-history-chip.is-black { background: #1a1a1a; color: var(--bone); }
.rl-history-chip.is-green { background: var(--mint); color: #081810; }

/* ============================================================
   Bet mode toggle
   ============================================================ */

.mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 13.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}

.mode-toggle label { display: flex; align-items: center; gap: var(--s-2); min-height: 34px; cursor: pointer; }
.mode-toggle input { width: 18px; height: 18px; accent-color: var(--mint); }

.rl-combo-panel {
  background: var(--felt);
  border: 1px solid var(--edge-mint);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
}

.rl-combo-hint { margin: 0 0 var(--s-2); font-size: 13px; color: var(--text-muted); }
.rl-combo-hint b { color: var(--mint); }
.rl-combo-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ============================================================
   The felt — number grid
   ============================================================ */

.rl-table {
  background-color: var(--felt);
  background-image: var(--felt-sheen);
  border: 1px solid var(--edge-mint);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}

.rl-table.is-locked { pointer-events: none; opacity: 0.55; }

.rl-zero-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.rl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: var(--s-3);
}

.rl-cell {
  position: relative;
  min-height: 44px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--bone);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.rl-cell:active { transform: scale(0.95); }
.rl-cell.is-red { background: var(--lose); color: #2b0d0a; }
.rl-cell.is-black { background: #1a1a1a; }
.rl-cell.is-green { background: var(--mint); color: #081810; }
.rl-cell.is-selected { box-shadow: 0 0 0 3px var(--mint-bright); }

.rl-amt {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.55);
  color: var(--bone);
  border-radius: 4px;
  padding: 1px 3px;
  font-variant-numeric: tabular-nums;
}

.rl-dozens, .rl-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.rl-evens {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.rl-obox {
  min-height: 48px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rail);
  background: linear-gradient(180deg, var(--felt-raised), rgba(20, 67, 43, 0.9));
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: var(--s-1);
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.rl-obox:active { transform: scale(0.97); border-color: var(--mint); }
.rl-obox.is-red-box { color: var(--lose); }
.rl-obox.is-black-box { color: var(--bone); }
.rl-obox-label { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.rl-obox-pay { font-size: 9.5px; color: var(--text-dim); }
.rl-obox-amt { font-size: 12px; font-weight: 700; color: var(--mint); font-variant-numeric: tabular-nums; }

.rl-topline-wrap { margin-top: 3px; }
.rl-topline-wrap .rl-obox { min-height: 40px; }

/* ============================================================
   Active bets
   ============================================================ */

.rl-bets {
  background: var(--bg-deep);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}

.rl-bets-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--s-2);
}

.rl-bets-head b { color: var(--mint); font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: normal; }

.rl-no-bets { margin: 0; font-size: 13px; color: var(--text-dim); }

.rl-bet-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--edge);
  font-size: 13px;
}

.rl-bet-row:last-child { border-bottom: none; }
.rl-bet-label { flex: 1 1 auto; color: var(--text); }
.rl-bet-pay { color: var(--text-dim); font-size: 11.5px; }
.rl-bet-amt { color: var(--mint); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================
   Chips, action buttons, log — copied forward
   ============================================================ */

.chip-strip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 2px;
  margin-bottom: var(--s-3);
}

.chip-label {
  color: var(--text-dim);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-btn {
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed rgba(244, 238, 224, 0.5);
  background: radial-gradient(circle at 50% 35%, var(--felt-raised), #16311f);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.chip-btn:active { transform: scale(0.92); }
.chip-btn.selected {
  border-style: solid;
  border-color: var(--mint-bright);
  background: var(--mint);
  color: #081810;
  box-shadow: var(--shadow-md), 0 0 0 3px var(--mint-faint);
}

.table-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}

.btn-roll {
  flex: 1 1 auto;
  background: var(--mint);
  color: #081810;
  border: 1px solid var(--mint-deep);
  padding: 0 var(--s-5);
  min-height: 52px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-roll:hover { filter: brightness(1.07); }
.btn-roll:active { transform: translateY(1px); box-shadow: var(--shadow-sm); }
.btn-roll:disabled, .btn-outline:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--edge-mint);
  color: var(--mint);
  padding: 0 var(--s-3);
  min-height: 44px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.btn-outline:hover { background: var(--mint-faint); }
.btn-outline:active { transform: scale(0.97); }

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 var(--s-2);
  border: 1px solid var(--edge-mint);
  background: var(--felt-well);
  color: var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
}

.mini-btn:active { transform: scale(0.94); }

.log {
  background: var(--bg-deep);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: var(--s-3);
  height: 140px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: var(--s-4);
  font-variant-numeric: tabular-nums;
}

.log .roll-header { color: var(--mint); font-weight: 600; margin-top: var(--s-2); }
.log .win { color: var(--win); }
.log .lose { color: var(--lose); }
.log .neutral { color: var(--text-muted); }

.legend {
  background: var(--felt);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: 0 var(--s-4);
  font-size: 14px;
  margin-bottom: var(--s-2);
}

.legend summary {
  cursor: pointer;
  color: var(--mint);
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  list-style-position: outside;
}

.legend summary:hover { color: var(--mint-bright); }
.legend ul { margin: 0 0 var(--s-3); padding-left: var(--s-5); line-height: 1.65; }
.legend li { margin-bottom: var(--s-2); color: var(--text-muted); }
.legend li b { color: var(--text); }

.strategy-link { text-align: center; margin-top: var(--s-4); }
.strategy-link a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-3); }

.hidden { display: none !important; }

/* ============================================================
   Overlay
   ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  z-index: 60;
}

.overlay.hidden { display: none; }

.overlay-box {
  background: linear-gradient(180deg, var(--felt-raised), var(--felt));
  border: 1px solid var(--edge-mint);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-5);
  width: min(340px, 100%);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.overlay-box h2 { font-family: var(--font-display); color: var(--mint); margin: 0 0 var(--s-2); font-size: 24px; }
.overlay-box p { font-size: 13.5px; color: var(--text-muted); margin: 0 0 var(--s-4); }

.overlay-box input {
  width: 100%;
  padding: var(--s-3);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-sm);
  border: 1px solid var(--edge-mint);
  background: var(--felt-well);
  color: var(--bone);
  text-align: center;
  margin-bottom: var(--s-4);
}

.overlay-buttons { display: flex; gap: var(--s-2); justify-content: center; }
.overlay-buttons .btn-roll { flex: 1 1 auto; }

/* ============================================================
   Breakpoints
   ============================================================ */

@media (min-width: 701px) {
  .app { padding: var(--s-5) var(--s-5) var(--s-7); }
  .page-title { font-size: 32px; }
  .statusbar { margin: 0 0 var(--s-4); border-radius: var(--r-md); border: 1px solid var(--edge-mint); }
  .rl-table { padding: var(--s-5); }
  .rl-cell { min-height: 48px; font-size: 15px; }
  .log { height: 170px; }
}
