:root {
  --felt: #184d32;
  --felt-light: #247243;
  --felt-dark: #0d261a;
  --gold: #d8b45b;
  --gold-soft: #f2d685;
  --cream: #f4ead2;
  --ink: #050708;
  --muted: #b6a77f;
  --red: #b91c1c;
  --black: #111827;
  --green: #15803d;
  --line: rgba(244, 234, 210, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--cream);
  background: #050807;
  font-family: "DM Mono", Consolas, monospace;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 3px;
}

.casino-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 10%, rgba(216, 180, 91, 0.12), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(36, 114, 67, 0.22), transparent 32%),
    linear-gradient(135deg, #030605, #08130d 42%, #050807);
}

.nav-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.78);
  border-bottom: 2px solid rgba(216, 180, 91, 0.45);
  backdrop-filter: blur(10px);
}

.nav-logo {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold-soft);
  text-shadow: 0 0 18px rgba(216, 180, 91, 0.35);
}

.nav-links {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--gold-soft);
}

.nav-home {
  padding-right: 16px;
  border-right: 1px solid rgba(216, 180, 91, 0.4);
}

.bankroll-display {
  color: var(--gold-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.roulette-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 18px;
}

.wheel-panel,
.table-panel,
.history-panel {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(216, 180, 91, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.wheel-panel {
  padding: 18px;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  margin: 0 auto 18px;
}

.wheel,
.ball-track,
.wheel-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.wheel {
  border: 10px solid #3b240d;
  background:
    radial-gradient(circle, #1b1008 0 18%, transparent 19%),
    conic-gradient(from -4.864deg, var(--green) 0deg 9.73deg, var(--red) 9.73deg 19.46deg, var(--black) 19.46deg 29.19deg, var(--red) 29.19deg 38.92deg);
  /* Rotation is driven per animation-frame from JS (roulette.js), not a
     CSS transition, since the wheel spins continuously and indefinitely. */
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #4b2a0e 0 8%, #9f7a32 9% 18%, #191008 19% 44%, #6b4619 45% 49%, #0b0b0b 50%);
  border: 2px solid rgba(242, 214, 133, 0.4);
}

.wheel-ring {
  z-index: 2;
  transition: transform 4.6s cubic-bezier(0.12, 0.72, 0.12, 1);
}

.wheel-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 16px;
  color: #fff7dd;
  font-size: 0.64rem;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
  text-shadow: 0 1px 3px #000;
  transform:
    translate(-50%, -50%)
    rotate(var(--slot-angle))
    translateY(var(--slot-radius))
    rotate(90deg);
  transform-origin: center;
  pointer-events: none;
}

.wheel-slot.outer {
  --slot-radius: calc(-1 * clamp(125px, 40vw, 174px));
  z-index: 3;
  font-size: 0.72rem;
  color: #fffbed;
}

.wheel-center {
  position: absolute;
  inset: 34%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, #23140a, #050505);
  border: 2px solid rgba(242, 214, 133, 0.5);
}

.wheel-title {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 2px;
}

.wheel-number {
  font-size: clamp(2rem, 8vw, 3.7rem);
  font-weight: 900;
  color: var(--gold-soft);
}

.ball-track {
  inset: -4px;
  z-index: 6;
  border: 2px solid rgba(255, 255, 255, 0.12);
  /* Rotation is driven per animation-frame from JS (roulette.js). */
}

.ball {
  position: absolute;
  left: 50%;
  top: 13px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #c9c9c9 62%, #777);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
}

.spin-panel {
  display: grid;
  gap: 12px;
}

.result-card {
  min-height: 82px;
  padding: 14px;
  border: 1px solid rgba(216, 180, 91, 0.35);
  background: rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.result-card.status-red {
  border-color: rgba(248, 113, 113, 0.6);
}

.result-card.status-black {
  border-color: rgba(148, 163, 184, 0.55);
}

.result-card.status-green {
  border-color: rgba(74, 222, 128, 0.65);
}

.result-card.status-win {
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.18);
}

.result-card.status-loss {
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.12);
}

.result-label,
#last-detail {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

#last-result {
  display: block;
  margin: 4px 0;
  color: var(--cream);
  font-size: 1.25rem;
}

.chip-row,
.control-row,
.mode-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip,
.action-btn,
.text-btn,
.tool-toggle,
.bet-cell {
  cursor: pointer;
}

.chip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px dashed rgba(255, 255, 255, 0.75);
  background: var(--gold);
  color: #191008;
  font-weight: 900;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.18);
}

.chip.active {
  outline: 3px solid #fff;
}

.action-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(216, 180, 91, 0.5);
  color: var(--cream);
  background: rgba(0, 0, 0, 0.36);
  font-weight: 700;
}

.action-btn.primary {
  background: linear-gradient(180deg, #e4c161, #9f7524);
  color: #120b04;
}

.action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.mode-row {
  align-items: center;
}

.tool-toggle {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(216, 180, 91, 0.45);
  color: var(--cream);
  background: rgba(255, 255, 255, 0.05);
}

.tool-toggle.active {
  color: #120b04;
  background: var(--gold-soft);
}

.mode-note {
  color: var(--muted);
  font-size: 0.72rem;
}

.quick-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-guide div {
  padding: 10px;
  border: 1px solid rgba(216, 180, 91, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.quick-guide strong,
.quick-guide span {
  display: block;
}

.quick-guide span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.table-panel {
  padding: 18px;
}

.table-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 14px;
}

h1,
h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 1px;
}

.table-topline p {
  margin: 6px 0 0;
  color: var(--muted);
}

.table-bankroll {
  color: var(--gold-soft);
  font-size: 1.4rem;
  font-weight: 900;
}

.betting-board {
  display: grid;
  grid-template-columns: 72px minmax(420px, 1fr) 62px;
  grid-template-areas:
    "zero numbers columns"
    "zero dozens columns"
    "zero even columns";
  gap: 8px;
  padding: 12px;
  background: linear-gradient(135deg, var(--felt-dark), var(--felt));
  border: 2px solid rgba(216, 180, 91, 0.45);
  overflow-x: auto;
  scrollbar-color: var(--gold) rgba(0, 0, 0, 0.35);
}

.zero {
  grid-area: zero;
}

.number-grid {
  grid-area: numbers;
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  grid-template-rows: repeat(3, 54px);
  gap: 4px;
  position: relative;
}

.column-bets {
  grid-area: columns;
  display: grid;
  grid-template-rows: repeat(3, 54px);
  gap: 4px;
}

.dozen-bets {
  grid-area: dozens;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.even-money-bets {
  grid-area: even;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.bet-cell {
  position: relative;
  min-height: 48px;
  border: 1px solid var(--line);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 900;
  letter-spacing: 0.5px;
  touch-action: manipulation;
}

.bet-cell.red {
  background: linear-gradient(180deg, #cf2929, #7f1010);
}

.bet-cell.black {
  background: linear-gradient(180deg, #26313f, #070a0f);
}

.bet-cell.green,
.zero {
  background: linear-gradient(180deg, #1ea95a, #0f582f);
}

.bet-cell.outside {
  color: var(--cream);
  background: rgba(0, 0, 0, 0.22);
}

.red-bet {
  background: linear-gradient(180deg, #cf2929, #7f1010) !important;
}

.black-bet {
  background: linear-gradient(180deg, #26313f, #070a0f) !important;
}

.bet-cell:hover,
.bet-cell.has-bet {
  box-shadow: inset 0 0 0 2px var(--gold-soft), 0 0 12px rgba(216, 180, 91, 0.4);
}

.bet-cell.winning-number {
  box-shadow:
    inset 0 0 0 3px var(--gold-soft),
    0 0 18px rgba(242, 214, 133, 0.65);
}

.bet-cell:active {
  transform: translateY(1px);
}

.bet-marker {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #120b04;
  font-size: 0.68rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.win-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 30% 30%, #fff, #d9d9d9 62%, #8a8a8a);
  color: #111;
  font-size: 0.46rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.85);
  pointer-events: none;
  z-index: 3;
}

/* Combo-bet hotspots come after all .bet-cell rules above so their small
   15px circle (not the 48px min-height / near-white background meant for
   full-size number/outside cells) wins the equal-specificity cascade. */
.combo-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.combo-hotspot {
  position: absolute;
  width: 18px;
  height: 18px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  box-shadow: none;
}

.combo-hotspot:hover,
.combo-hotspot:focus-visible {
  background: rgba(242, 214, 133, 0.26);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 12px rgba(242, 214, 133, 0.72);
  opacity: 1;
}

.combo-hotspot.has-bet {
  background: rgba(216, 180, 91, 0.38);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 12px rgba(216, 180, 91, 0.65);
  opacity: 1;
}

.combo-hotspot .bet-marker {
  right: auto;
  bottom: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 24px;
  height: 24px;
  font-size: 0.58rem;
  padding: 0 4px;
  z-index: 6;
}

.table-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.bet-slip {
  margin-top: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(216, 180, 91, 0.3);
}

.slip-header,
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#total-bet {
  color: var(--gold-soft);
  font-weight: 900;
}

.slip-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.slip-row,
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
}

.history-money {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  text-align: right;
}

.empty-slip {
  color: var(--muted);
  padding: 10px 0;
}

.history-panel {
  grid-column: 1 / -1;
  padding: 16px;
}

.text-btn {
  border: none;
  color: var(--gold-soft);
  background: transparent;
  text-decoration: underline;
}

.text-btn:disabled {
  color: #70654b;
  cursor: not-allowed;
}

.recent-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-height: 34px;
}

.recent-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
}

.history-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.win {
  color: #86efac;
}

.loss {
  color: #fca5a5;
}

.history-number {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  border-radius: 50%;
  color: #fff;
}

.recent-chip.red,
.history-number.red {
  background: var(--red);
}

.recent-chip.black,
.history-number.black {
  background: var(--black);
}

.recent-chip.green,
.history-number.green {
  background: var(--green);
}

@media (max-width: 980px) {
  .nav-strip {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .nav-links {
    justify-content: center;
  }

  .nav-home {
    border-right: none;
    padding-right: 0;
  }

  .roulette-shell {
    grid-template-columns: 1fr;
  }

  .wheel-wrap {
    width: min(86vw, 390px);
  }
}

@media (max-width: 680px) {
  .roulette-shell {
    padding: 10px;
  }

  .table-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .betting-board {
    grid-template-columns: 52px minmax(560px, 1fr) 50px;
    padding: 8px;
  }

  .betting-board::after {
    content: "Swipe table sideways for every number";
    position: sticky;
    left: 8px;
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.68rem;
    padding-top: 4px;
  }

  .number-grid {
    grid-template-columns: repeat(12, 44px);
  }

  .even-money-bets,
  .dozen-bets {
    min-width: 560px;
  }

  .chip {
    width: 48px;
    height: 48px;
    font-size: 0.78rem;
  }

  .action-btn {
    flex: 1 1 130px;
  }

  .quick-guide {
    grid-template-columns: 1fr;
  }

  .mode-note {
    flex-basis: 100%;
  }
}
