.roulette-body {
  min-height: 100vh;
  background: #0d202b;
}

.roulette-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
  padding: 0.75rem max(1rem, calc((100vw - 1220px) / 2));
  background: #132c39;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.roulette-topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.roulette-topbar h1,
.roulette-topbar p {
  margin: 0;
}

.roulette-topbar h1 {
  font-size: 1.35rem;
  line-height: 1.1;
}

.roulette-topbar p {
  color: var(--muted);
  font-size: 0.82rem;
}

.roulette-topbar .status-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.roulette-topbar .status-strip > div {
  padding: 0.45rem 0.8rem;
  border-radius: 0.45rem;
  background: #0f2532;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.roulette-topbar .button {
  min-height: 2.75rem;
  border-radius: 0.45rem;
}

.roulette-game-layout {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  max-width: 1220px;
  min-height: calc(100vh - 4.25rem);
  margin: 0 auto;
  padding: 1.25rem 0;
}

.roulette-game-layout.stats-open {
  grid-template-columns: 18rem 18rem minmax(0, 1fr);
  max-width: 1510px;
}

.live-stats-drawer {
  display: none;
  min-height: 100%;
  padding: 0.85rem;
  background: #203946;
  border-radius: 0.35rem 0 0 0.35rem;
}

.roulette-game-layout.stats-open .live-stats-drawer {
  display: block;
}

.roulette-side {
  display: flex;
  flex-direction: column;
  background: #203946;
  border-radius: 0.35rem 0 0 0.35rem;
  overflow: hidden;
}

.roulette-game-layout.stats-open .roulette-side {
  border-radius: 0;
}

.roulette-stage {
  min-width: 0;
  padding: 0.9rem 0.9rem 0.75rem;
  background: #0b1c28;
  border-radius: 0 0.35rem 0.35rem 0;
}

.bet-panel,
.wheel-panel,
.table-panel,
.fairness-panel {
  border: 0;
  box-shadow: none;
}

.bet-panel {
  flex: 1;
  padding: 0.85rem;
  background: transparent;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.3rem;
  margin-bottom: 0.95rem;
  border-radius: 999px;
  background: #102532;
}

.segmented button {
  min-height: 2.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.segmented button.active {
  background: #496a7c;
}

.segmented button[aria-pressed="false"] {
  color: #b6c6d1;
}

.control-label {
  display: grid;
  gap: 0.35rem;
  color: #9fd7f3;
  font-size: 0.88rem;
  font-weight: 850;
}

.control-label input {
  min-height: 2.55rem;
  border-radius: 0.4rem;
  border: 1px solid #3d5b6e;
  background: #0b1c28;
  color: var(--text);
  font-weight: 800;
}

.chip-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin: 0.8rem 0 0.9rem;
  padding: 0.55rem;
  border-radius: 0.4rem;
  background: #3a596b;
}

.chip-button,
.bet-chip {
  display: grid;
  place-items: center;
  border-radius: 50%;
  aspect-ratio: 1;
  border: 3px dashed rgba(255, 255, 255, 0.86);
  background:
    radial-gradient(circle at 50% 50%, #ffd35f 0 34%, #ff9b24 35% 66%, #d86413 67%);
  color: #17120a;
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.35);
}

.chip-button {
  border-style: solid;
}

.chip-button.active {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.stake-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.9rem 0;
}

.stake-row > div {
  min-height: 4.45rem;
  padding: 0.75rem;
  border-radius: 0.45rem;
  background: #18303d;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stake-row strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1rem;
}

.bet-action {
  width: 100%;
  min-height: 2.8rem;
  margin-top: 0.2rem;
  border-radius: 0.45rem;
  background: #1f7ae0;
  color: #fff;
}

.mode-panel[hidden],
.auto-advanced[hidden] {
  display: none;
}

.auto-panel {
  display: grid;
  gap: 0.9rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #9fd7f3;
  font-size: 0.88rem;
  font-weight: 850;
}

.custom-switch-row input {
  position: absolute;
  right: 0;
  opacity: 0;
  pointer-events: none;
}

.switch-control {
  position: relative;
  flex: 0 0 2.8rem;
  width: 2.75rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #102532;
  border: 1px solid #3d5b6e;
}

.switch-control::before {
  content: "";
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 1.12rem;
  height: 1.12rem;
  border-radius: 50%;
  background: #b6c6d1;
  transition: transform 0.16s ease, background 0.16s ease;
}

.custom-switch-row input:checked + .switch-control {
  background: #1f7ae0;
  border-color: #1f7ae0;
}

.custom-switch-row input:checked + .switch-control::before {
  background: #fff;
  transform: translateX(1.2rem);
}

.auto-pacing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.turbo-row {
  min-height: 2.55rem;
  margin-bottom: 0.02rem;
}

.auto-advanced {
  display: grid;
  gap: 0.8rem;
}

.auto-rule {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.auto-rule legend {
  margin-bottom: 0.35rem;
  color: #9fd7f3;
  font-size: 0.88rem;
  font-weight: 850;
}

.auto-rule-row {
  display: grid;
  grid-template-columns: 4.4rem 1fr 6rem;
  gap: 0.35rem;
  align-items: stretch;
}

.rule-choice {
  min-height: 2.55rem;
  border: 0;
  border-radius: 0.35rem;
  background: #102532;
  color: #b6c6d1;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.rule-choice.active {
  background: #496a7c;
  color: var(--text);
}

.auto-rule-row label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.55rem;
  padding: 0 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid #3d5b6e;
  background: #18303d;
  color: #b6c6d1;
  font-weight: 900;
}

.auto-rule-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.tool-row,
.table-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
}

.text-button {
  border: 0;
  padding: 0.35rem 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.text-button:hover,
.text-button:focus,
.text-button.active {
  color: var(--accent);
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: #b7c9d6;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 700;
}

.options-button {
  width: 2.25rem;
  padding: 0;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.05);
}

.icon-button:hover,
.icon-button:focus {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.game-options {
  position: relative;
}

.game-options-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.65rem);
  z-index: 12;
  width: 14rem;
  padding: 0.75rem 0;
  border-radius: 0.45rem;
  background: #1b3543;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.36);
}

.game-options-menu::after {
  content: "";
  position: absolute;
  right: 1rem;
  bottom: -0.45rem;
  width: 0.9rem;
  height: 0.9rem;
  background: #1b3543;
  transform: rotate(45deg);
}

.volume-control,
.option-toggle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.volume-control span,
.option-toggle span:first-child {
  flex: 0 0 2.3rem;
  color: #bde0f3;
  text-align: left;
  font-size: 0.84rem;
}

.volume-control input {
  flex: 1;
  min-width: 0;
  accent-color: #6eb8ff;
}

.option-toggle:hover,
.option-toggle:focus,
.option-toggle.active {
  background: #243f4d;
}

.option-toggle:not(.active) {
  color: #8ea0ad;
}

.live-stats-header,
.stats-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.live-stats-header {
  margin-bottom: 1rem;
}

.live-stats-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.15rem;
}

.live-stats-header h2 span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.25rem;
  background: #9fc3d7;
  color: #18303d;
  font-size: 0.9rem;
}

.stats-filter-row {
  margin-bottom: 0.9rem;
}

.stats-filter-row select {
  min-width: 5rem;
  min-height: 2.55rem;
  padding: 0 2rem 0 0.85rem;
  border: 0;
  border-radius: 0.45rem;
  background: #496a7c;
  color: var(--text);
  font-weight: 900;
}

.live-stats-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.9rem;
  margin-bottom: 0.85rem;
  border-radius: 0.45rem;
  background: #162d3a;
}

.live-stats-metrics > div {
  min-height: 3.2rem;
  padding: 0.15rem 0.85rem;
}

.live-stats-metrics > div:nth-child(odd) {
  border-right: 1px solid #3d5b6e;
}

.live-stats-metrics strong {
  display: inline-block;
  margin-top: 0.05rem;
  font-size: 1.05rem;
}

.credit-dot {
  display: inline-grid;
  place-items: center;
  width: 1.08rem;
  height: 1.08rem;
  margin-left: 0.25rem;
  border-radius: 50%;
  background: #e9f7ff;
  color: #7b55c9;
  font-size: 0.48rem;
  font-weight: 950;
  vertical-align: 0.12rem;
}

#winsMetric {
  color: #14f46a;
}

#lossesMetric {
  color: #ff5b74;
}

.stats-chart {
  border-radius: 0.45rem;
  background: #102532;
}

.stats-chart {
  height: 14rem;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}

.stats-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-fill {
  fill: rgba(20, 244, 106, 0.24);
}

.chart-loss-fill {
  fill: rgba(255, 40, 84, 0.22);
}

.chart-line {
  fill: none;
  stroke: #14f46a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-loss-line {
  fill: none;
  stroke: #ff2854;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-zero {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 2;
}


.wheel-panel {
  position: relative;
  min-height: 18.25rem;
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(16rem, 19.5rem) minmax(6rem, 1fr);
  gap: 1rem;
  align-items: center;
  justify-items: center;
  padding: 1.35rem 1.25rem 1rem;
  overflow: hidden;
  background: #0b1c28;
}

.result-tile {
  display: grid;
  place-items: center;
  width: 4.05rem;
  height: 4.05rem;
  border-radius: 0.45rem;
  background: #ff2854;
  color: white;
  font-size: 1.45rem;
  font-weight: 950;
  box-shadow: 0 13px 30px rgba(255, 40, 84, 0.22);
}

.result-tile.is-empty {
  background: #243f4d;
  color: transparent;
  box-shadow: none;
}

.result-tile.black {
  background: #243f4d;
  box-shadow: 0 13px 30px rgba(8, 14, 18, 0.35);
}

.result-tile.green {
  background: #2f9848;
  box-shadow: 0 13px 30px rgba(47, 152, 72, 0.24);
}

.wheel-shell {
  position: relative;
  width: min(19.5rem, 34vw);
  aspect-ratio: 1;
}

.wheel-rotor {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #071923;
  border: 1.05rem solid #071923;
  box-shadow:
    inset 0 0 0 0.35rem rgba(255, 255, 255, 0.04),
    0 16px 38px rgba(0, 0, 0, 0.44);
  transition: transform 2.75s cubic-bezier(0.09, 0.72, 0.12, 1);
}

.wheel-rotor.spinning {
  animation: roulette-wheel-spin 2.75s cubic-bezier(0.22, 0.62, 0.18, 1);
}

@keyframes roulette-wheel-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

.wheel-rotor::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border-radius: 50%;
  border: 0.16rem solid rgba(255, 255, 255, 0.14);
}

.wheel-centre {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #0b1c28;
  box-shadow: inset 0 0 0 0.32rem #ffc20e;
}

.wheel-centre::before,
.wheel-centre::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -44%;
  width: 0.32rem;
  height: 188%;
  border-radius: 999px;
  background: #ffc20e;
  transform: translateX(-50%) rotate(45deg);
}

.wheel-centre::after {
  transform: translateX(-50%) rotate(-45deg);
}

.wheel-labels {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.wheel-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wheel-segment {
  stroke: #102d3b;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.wheel-segment-ring text {
  color: white;
  fill: white;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 1px;
}

.wheel-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.78rem;
  height: 0.78rem;
  margin: -0.39rem 0 0 -0.39rem;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.85);
  transform: rotate(-70deg) translateY(-8.35rem);
  transition: transform 2.75s cubic-bezier(0.09, 0.72, 0.12, 1);
}

.wheel-ball.instant {
  transition-duration: 0s;
}

.recent-pockets {
  display: grid;
  gap: 0.65rem;
  justify-self: center;
}

.recent-pocket {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: white;
  font-weight: 950;
  background: #ff2854;
}

.recent-pocket.black {
  background: #2f4656;
}

.recent-pocket.green {
  background: #2f9848;
}

.table-panel {
  padding: 0 1rem 0.85rem;
  background: #0b1c28;
}

.roulette-board-wrap {
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.roulette-board {
  display: grid;
  grid-template-columns: repeat(14, minmax(3.25rem, 1fr));
  grid-template-rows: repeat(5, 3.25rem);
  gap: 0.25rem;
  min-width: 48rem;
}

.roulette-spot {
  position: relative;
  min-height: 3rem;
  border: 2px solid #294655;
  border-radius: 0.25rem;
  padding: 0.35rem;
  color: white;
  font-weight: 900;
  text-align: center;
  background: #112a37;
}

.roulette-spot:hover,
.roulette-spot:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 215, 119, 0.18);
}

.roulette-spot.winning {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.roulette-spot .bet-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2rem;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  font-size: 0.62rem;
}

.roulette-red {
  background: #ff2854;
}

.roulette-black {
  background: #253f4f;
}

.roulette-green {
  background: #37a74e;
}

.roulette-board .roulette-red:not(.selected),
.roulette-board .roulette-black:not(.selected),
.roulette-board .roulette-green:not(.selected) {
  filter: saturate(0.88) brightness(0.86);
}

.roulette-board .selected {
  filter: none;
}

.table-actions {
  margin: 0.7rem 0 0;
}

#latestPocketMetric {
  color: var(--muted);
  font-weight: 800;
}

.fairness-panel {
  margin-top: 0.75rem;
  background: #102532;
}

.fairness-panel summary {
  padding: 1rem;
  font-weight: 900;
}

.fairness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 1rem 1rem;
}

.fairness-grid .seed-hash-box,
.fairness-grid .button-row {
  grid-column: 1 / -1;
}

.fairness-panel pre {
  margin: 1rem;
  max-height: 18rem;
  overflow: auto;
  white-space: pre-wrap;
  color: #d9f2ff;
  font-size: 0.84rem;
}

.history-wrap {
  margin: 1rem;
}

.roulette-num-0 { grid-area: 1 / 1 / 4 / 2; }
.roulette-num-3 { grid-area: 1 / 2 / 2 / 3; }
.roulette-num-6 { grid-area: 1 / 3 / 2 / 4; }
.roulette-num-9 { grid-area: 1 / 4 / 2 / 5; }
.roulette-num-12 { grid-area: 1 / 5 / 2 / 6; }
.roulette-num-15 { grid-area: 1 / 6 / 2 / 7; }
.roulette-num-18 { grid-area: 1 / 7 / 2 / 8; }
.roulette-num-21 { grid-area: 1 / 8 / 2 / 9; }
.roulette-num-24 { grid-area: 1 / 9 / 2 / 10; }
.roulette-num-27 { grid-area: 1 / 10 / 2 / 11; }
.roulette-num-30 { grid-area: 1 / 11 / 2 / 12; }
.roulette-num-33 { grid-area: 1 / 12 / 2 / 13; }
.roulette-num-36 { grid-area: 1 / 13 / 2 / 14; }
.roulette-num-2 { grid-area: 2 / 2 / 3 / 3; }
.roulette-num-5 { grid-area: 2 / 3 / 3 / 4; }
.roulette-num-8 { grid-area: 2 / 4 / 3 / 5; }
.roulette-num-11 { grid-area: 2 / 5 / 3 / 6; }
.roulette-num-14 { grid-area: 2 / 6 / 3 / 7; }
.roulette-num-17 { grid-area: 2 / 7 / 3 / 8; }
.roulette-num-20 { grid-area: 2 / 8 / 3 / 9; }
.roulette-num-23 { grid-area: 2 / 9 / 3 / 10; }
.roulette-num-26 { grid-area: 2 / 10 / 3 / 11; }
.roulette-num-29 { grid-area: 2 / 11 / 3 / 12; }
.roulette-num-32 { grid-area: 2 / 12 / 3 / 13; }
.roulette-num-35 { grid-area: 2 / 13 / 3 / 14; }
.roulette-num-1 { grid-area: 3 / 2 / 4 / 3; }
.roulette-num-4 { grid-area: 3 / 3 / 4 / 4; }
.roulette-num-7 { grid-area: 3 / 4 / 4 / 5; }
.roulette-num-10 { grid-area: 3 / 5 / 4 / 6; }
.roulette-num-13 { grid-area: 3 / 6 / 4 / 7; }
.roulette-num-16 { grid-area: 3 / 7 / 4 / 8; }
.roulette-num-19 { grid-area: 3 / 8 / 4 / 9; }
.roulette-num-22 { grid-area: 3 / 9 / 4 / 10; }
.roulette-num-25 { grid-area: 3 / 10 / 4 / 11; }
.roulette-num-28 { grid-area: 3 / 11 / 4 / 12; }
.roulette-num-31 { grid-area: 3 / 12 / 4 / 13; }
.roulette-num-34 { grid-area: 3 / 13 / 4 / 14; }
.roulette-col-3 { grid-area: 1 / 14 / 2 / 15; }
.roulette-col-2 { grid-area: 2 / 14 / 3 / 15; }
.roulette-col-1 { grid-area: 3 / 14 / 4 / 15; }
.roulette-dozen-1 { grid-area: 4 / 2 / 5 / 6; }
.roulette-dozen-2 { grid-area: 4 / 6 / 5 / 10; }
.roulette-dozen-3 { grid-area: 4 / 10 / 5 / 14; }
.roulette-low { grid-area: 5 / 2 / 6 / 4; }
.roulette-even { grid-area: 5 / 4 / 6 / 6; }
.roulette-red-bet { grid-area: 5 / 6 / 6 / 8; }
.roulette-black-bet { grid-area: 5 / 8 / 6 / 10; }
.roulette-odd { grid-area: 5 / 10 / 6 / 12; }
.roulette-high { grid-area: 5 / 12 / 6 / 14; }

@media (max-width: 1080px) {
  .roulette-game-layout {
    grid-template-columns: 1fr;
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .roulette-game-layout.stats-open {
    grid-template-columns: 1fr;
  }

  .live-stats-drawer,
  .roulette-side,
  .roulette-stage {
    border-radius: 0.35rem;
  }

  .live-stats-drawer {
    min-height: auto;
  }

  .roulette-side {
    overflow: visible;
  }

  .bet-panel {
    flex: none;
  }

  .wheel-panel {
    grid-template-columns: 1fr;
  }

  .recent-pockets {
    grid-auto-flow: column;
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .roulette-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .roulette-topbar .status-strip {
    width: 100%;
    justify-content: space-between;
  }

  .wheel-shell {
    width: min(16rem, 82vw);
  }

  .fairness-grid,
  .stake-row {
    grid-template-columns: 1fr;
  }
}
