:root {
  color-scheme: dark;
  --felt: #0b5d45;
  --felt-dark: #06392f;
  --gold: #f4c35d;
  --red: #d91f35;
  --black: #101217;
  --ink: #f8f1df;
  --muted: #b5b0a3;
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(8, 14, 20, 0.74);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 24% 10%, rgba(244, 195, 93, 0.14), transparent 28%),
    linear-gradient(135deg, #07100f 0%, #12251d 42%, #160d12 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 8px;
  --board-scale: 1;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(244, 195, 93, 0.18), transparent 34%),
    linear-gradient(160deg, #06110f 0%, #0b3028 48%, #09070a 100%);
}

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

.third-party-entry-pending .join-screen {
  display: none;
}

.third-party-entry-pending .loading-overlay[hidden] {
  display: grid;
}

.loading-panel {
  width: min(460px, 92vw);
  color: var(--ink);
  text-align: center;
}

.loading-mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 195, 93, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 34px rgba(244, 195, 93, 0.22);
  color: var(--gold);
  font-size: 2rem;
  font-weight: 900;
}

.loading-panel h1 {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1.05;
}

.loading-panel p {
  margin: 10px 0 0;
  color: rgba(248, 241, 223, 0.72);
  font-size: 15px;
}

.loading-bar {
  height: 12px;
  margin-top: 26px;
  overflow: hidden;
  border: 1px solid rgba(244, 195, 93, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #fff1a8, var(--gold));
  transition: width 220ms ease;
}

.loading-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: rgba(248, 241, 223, 0.7);
  font-size: 13px;
}

.loading-error {
  min-height: 20px;
  margin-top: 14px;
  color: #ff9da7;
  font-size: 14px;
}

.join-screen {
  min-height: calc(100vh - 20px);
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid rgba(244, 195, 93, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(244, 195, 93, 0.16), transparent 38%),
    linear-gradient(160deg, rgba(2, 36, 30, 0.96), rgba(11, 93, 69, 0.74));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
}

.join-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(244, 195, 93, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
}

.join-form {
  display: grid;
  gap: 14px;
}

.join-form input {
  width: 100%;
}

.join-error {
  min-height: 20px;
  margin: 0;
  color: #ff9da7;
  font-size: 13px;
}

.game-root[hidden],
.join-screen[hidden] {
  display: none;
}
.arena {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 16px);
  border: 1px solid rgba(244, 195, 93, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 40px),
    linear-gradient(160deg, rgba(2, 36, 30, 0.96), rgba(11, 93, 69, 0.74));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
}

.table-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 52% 42%, rgba(244, 195, 93, 0.2), transparent 38%);
  pointer-events: none;
}

.topbar,
.game-surface,
.betting,
.history {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 6px 14px 2px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 2.9vw, 40px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
}

.identity {
  display: inline-flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.identity span {
  max-width: 100%;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
}

.identity strong {
  color: var(--gold);
  font-size: 17px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.sound-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid rgba(244, 195, 93, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.sound-control button {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
  font-size: 12px;
}

.sound-control input {
  width: 84px;
  min-height: 20px;
  padding: 0;
  accent-color: var(--gold);
}

.exit-game {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
  border-color: rgba(255, 122, 122, 0.45);
  color: #ffb0b0;
  font-size: 12px;
}

.game-surface {
  display: grid;
  grid-template-columns: minmax(584px, 0.62fr) minmax(600px, 1fr);
  gap: 28px;
  align-items: start;
  padding: 0 14px 8px;
}

.left-rail {
  display: grid;
  grid-template-columns: minmax(304px, auto) minmax(180px, 1fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
}

.wheel-wrap {
  display: grid;
  place-items: center;
  gap: 8px;
}

.wheel {
  position: relative;
  --label-radius: clamp(132px, 12.3vw, 174px);
  width: clamp(304px, 25vw, 400px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 9px #f2cb6b,
    inset 0 0 0 18px #5a3317,
    inset 0 0 0 31px rgba(255, 242, 178, 0.2),
    inset 0 0 35px rgba(0, 0, 0, 0.72),
    0 24px 52px rgba(0, 0, 0, 0.54);
  transition: transform 4.5s cubic-bezier(0.13, 0.78, 0.12, 1);
  will-change: transform;
  transform: translateZ(0);
}

.wheel::before,
.wheel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.wheel::before {
  inset: 30px;
  border: 2px solid rgba(255, 244, 203, 0.72);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.32),
    0 0 18px rgba(244, 195, 93, 0.36);
}

.wheel::after {
  inset: 72px;
  border: 10px solid rgba(97, 54, 23, 0.92);
  box-shadow:
    inset 0 0 0 2px rgba(244, 195, 93, 0.54),
    0 0 0 2px rgba(0, 0, 0, 0.34);
}

.wheel.spinning {
  filter: brightness(1.12);
}

.wheel.live-spin {
  animation: liveWheelSpin 2.4s linear infinite;
}

.wheel-ring {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle, #2c1b0e 0 38%, transparent 39%),
    conic-gradient(from 4deg, rgba(255,255,255,0.2), transparent 10%, rgba(255,255,255,0.14) 20%, transparent 30%);
  border: 4px solid rgba(244, 195, 93, 0.78);
  z-index: 2;
}

.wheel-number {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 24px;
  height: 18px;
  color: #fff8e4;
  font-size: 10px;
  font-weight: 900;
  text-shadow: 0 1px 2px #000;
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(calc(-1 * var(--label-radius)))
    rotate(calc(-1 * var(--angle)));
}

.wheel-number.green {
  color: #d7ffef;
}

.ball {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 18px;
  aspect-ratio: 1;
  margin-left: 0;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 0 18px white;
  transition: box-shadow 180ms ease, filter 180ms ease;
  will-change: transform;
  backface-visibility: hidden;
  transform: translate(-50%, -50%) translate3d(0, calc(-1 * var(--label-radius)), 0);
}

.wheel.live-spin .ball {
  animation: idleBallRoll 0.86s linear infinite reverse;
}

.wheel.live-spin .ball.launched,
.wheel.live-spin .ball.decelerating,
.wheel.live-spin .ball.pocketing,
.ball.launched,
.ball.decelerating,
.ball.pocketing {
  animation: none;
}

.ball.launched {
  box-shadow: 0 0 22px white, 0 0 24px rgba(101, 199, 255, 0.46);
  filter: brightness(1.12);
}

.ball.decelerating {
  box-shadow: 0 0 18px white, 0 0 16px rgba(244, 195, 93, 0.32);
}

.ball.pocketing {
  box-shadow: 0 0 14px white;
}

.ball.settled {
  filter: brightness(0.98);
}

.hub {
  position: absolute;
  inset: 36%;
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.42), transparent 0 11%, transparent 12%),
    radial-gradient(circle at 50% 58%, #17100a 0 28%, transparent 29%),
    linear-gradient(145deg, #ffe49a 0 12%, #b87920 13% 28%, #3b2411 29% 42%, #f4c35d 43% 56%, #6b3d18 57% 72%, #120b07 73% 100%);
  border: 4px solid #f8d779;
  box-shadow:
    inset 0 3px 12px rgba(255, 255, 255, 0.22),
    inset 0 -10px 22px rgba(0, 0, 0, 0.56),
    0 0 0 5px rgba(61, 34, 16, 0.94),
    0 0 0 8px rgba(244, 195, 93, 0.42),
    0 12px 24px rgba(0, 0, 0, 0.42);
}

.hub::before,
.hub::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.hub::before {
  inset: 10%;
  background:
    repeating-conic-gradient(from 7deg, rgba(255, 255, 255, 0.18) 0 7deg, transparent 7deg 18deg),
    radial-gradient(circle, transparent 0 45%, rgba(255, 245, 194, 0.18) 46% 49%, transparent 50%);
  mix-blend-mode: screen;
  animation: hub-shine 3.6s ease-in-out infinite;
}

.hub::after {
  inset: 28%;
  background:
    radial-gradient(circle at 38% 28%, #fff6c7 0 10%, transparent 12%),
    radial-gradient(circle at 50% 58%, #0b0806 0 42%, #3c2410 44% 58%, #e7b552 60% 72%, #211006 74% 100%);
  border: 1px solid rgba(255, 239, 180, 0.68);
  box-shadow:
    inset 0 4px 9px rgba(255, 255, 255, 0.18),
    inset 0 -7px 10px rgba(0, 0, 0, 0.58);
}

.hub span {
  position: relative;
  z-index: 2;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 900;
  color: #fff5d3;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.74), 0 0 12px rgba(244, 195, 93, 0.34);
}

.hub small {
  position: relative;
  z-index: 2;
  color: #f8d779;
  text-shadow: 0 1px 4px #000;
}

.ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: min(160px, 100%);
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
}

.ticker strong {
  color: var(--gold);
  font-size: 22px;
}

.message {
  min-height: 48px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
}

.message:empty {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.player-notice {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 40;
  width: min(460px, calc(100vw - 28px));
  transform: translateX(-50%);
  padding: 13px 16px;
  border: 1px solid rgba(244, 195, 93, 0.62);
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.96);
  color: var(--ink);
  text-align: center;
  font-weight: 800;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.48);
}

.player-notice[hidden] {
  display: none;
}

.betting,
.history {
  margin-top: 0;
}

.betting {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input {
  width: 96px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #07090c;
  color: var(--ink);
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #161b21;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  isolation: isolate;
  min-width: 54px;
  aspect-ratio: 1;
  min-height: 54px;
  border-radius: 50%;
  border: 3px solid #f9df8a;
  color: #160b05;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.86), transparent 0 13%, transparent 14%),
    radial-gradient(circle at center, #fff3b0 0 34%, #f4c35d 35% 43%, transparent 44%),
    repeating-conic-gradient(from 8deg, #fff3c1 0 10deg, #b91f2b 10deg 23deg, #6f0d18 23deg 31deg, #fff3c1 31deg 40deg),
    linear-gradient(145deg, #e43b48, #610b16);
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 5px 9px rgba(255, 255, 255, 0.28),
    inset 0 -5px 0 rgba(57, 5, 12, 0.62),
    0 5px 0 rgba(35, 4, 9, 0.84),
    0 10px 16px rgba(0, 0, 0, 0.42);
}

.chip::before,
.chip::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 0;
}

.chip span {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  min-width: 31px;
  min-height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 244, 190, 0.92);
  color: #130b05;
  box-shadow: inset 0 0 0 1px rgba(58, 28, 6, 0.35);
}

.chip::before {
  inset: 8px;
  border: 2px dashed rgba(255, 244, 190, 0.88);
}

.chip::after {
  inset: 16px;
  border: 1px solid rgba(255, 248, 215, 0.72);
  background: radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.34), transparent 0 24%, rgba(0, 0, 0, 0.18) 72%);
}

.chip.active {
  outline: 2px solid #fff5cc;
  outline-offset: 2px;
}

.chip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.chip-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-chip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.72);
  box-shadow: 0 3px 8px rgba(0,0,0,0.32);
}

.legend-chip.own {
  background: radial-gradient(circle at 35% 30%, #fff5b8, var(--gold) 58%, #b67b21);
}

.legend-chip.other {
  background: radial-gradient(circle at 35% 30%, #d9f4ff, #65c7ff 58%, #1a5a97);
}

.primary {
  border-color: #51e5a8;
  background: #0d7d56;
  font-weight: 800;
}

.secondary {
  background: #202734;
}

.secondary.exit-game {
  border-color: rgba(255, 130, 130, 0.72);
  background: linear-gradient(180deg, #a52d3a, #711d29);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(75, 8, 18, 0.34);
}

.layout {
  display: grid;
  grid-template-columns: minmax(600px, 1fr) minmax(190px, 220px);
  gap: 8px;
  margin-top: 0;
  align-items: start;
  min-width: 0;
}

.board {
  display: grid;
  grid-template-columns: 54px repeat(12, minmax(42px, 1fr));
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(244, 195, 93, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(244, 195, 93, 0.12), transparent 35%),
    linear-gradient(135deg, var(--felt-dark), var(--felt));
  align-self: start;
  transform: scale(var(--board-scale));
  transform-origin: top left;
}

.bet-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(34px, 5.2vh, 43px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.bet-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 245, 204, 0.7);
}

.bet-label {
  position: relative;
  z-index: 1;
}

.bet-cell.red {
  background: linear-gradient(160deg, #e73644, #8d0f1f);
}

.bet-cell.black {
  background: linear-gradient(160deg, #252b34, #050608);
}

.bet-cell.green {
  grid-row: span 3;
  background: linear-gradient(160deg, #14a06c, #075238);
}

.bet-cell.wide {
  min-height: clamp(32px, 4.6vh, 39px);
}

.chip-stack {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  display: flex;
  gap: 2px;
  align-items: center;
}

.chip-badge {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px dashed rgba(255, 255, 255, 0.74);
  color: #15100a;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.36);
}

.chip-badge.own {
  background: radial-gradient(circle at 35% 30%, #fff5b8, var(--gold) 58%, #b67b21);
}

.chip-badge.other {
  background: radial-gradient(circle at 35% 30%, #d9f4ff, #65c7ff 58%, #1a5a97);
}

.has-own-chip,
.has-other-chip {
  box-shadow: inset 0 0 0 2px rgba(244, 195, 93, 0.2);
}

.bet-cell.result-hit {
  border-color: #fff0a8;
  box-shadow:
    inset 0 0 0 2px rgba(255, 240, 168, 0.72),
    0 0 18px rgba(244, 195, 93, 0.48);
}

.wheel-number.result-hit {
  width: 30px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 240, 168, 0.92);
  color: #170f07;
  text-shadow: none;
  box-shadow: 0 0 16px rgba(244, 195, 93, 0.7);
}

.ticket {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  min-height: 190px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.ticket-head strong {
  color: var(--gold);
  font-size: 20px;
}

.ticket-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.ticket-stats div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
}

.ticket-stats span {
  color: var(--muted);
  font-size: 11px;
}

.ticket-stats strong {
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.players-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.players-panel h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.players-list {
  display: grid;
  gap: 6px;
  max-height: 112px;
  overflow: auto;
}

.player-item,
.player-empty {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
}

.player-item span,
.player-empty {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ticket-list {
  display: grid;
  gap: 6px;
  max-height: 170px;
  overflow: auto;
  padding: 8px;
}

.ticket-item,
.order {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.ticket-empty {
  color: var(--muted);
  font-size: 13px;
}

.confirm-bet {
  position: fixed;
  z-index: 10;
  display: grid;
  gap: 10px;
  min-width: 220px;
  padding: 12px;
  border: 1px solid rgba(244, 195, 93, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.08), transparent 34%),
    rgba(8, 12, 16, 0.96);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.confirm-bet[hidden] {
  display: none;
}

.confirm-bet span {
  color: var(--ink);
  font-weight: 800;
}

.confirm-bet div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.round-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

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

.round-overlay-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: min(520px, 92vw);
  padding: 30px 34px;
  overflow: hidden;
  border: 1px solid rgba(244, 195, 93, 0.58);
  border-radius: 8px;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.14), transparent 34%),
    rgba(8, 12, 16, 0.94);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(12px);
  animation: overlayPop 220ms ease-out;
}

.round-overlay-title {
  position: relative;
  z-index: 1;
  color: #fff5c7;
  font-size: clamp(34px, 6vw, 74px);
  line-height: 1;
  font-weight: 950;
  text-transform: none;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
}

.round-overlay-text {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: clamp(15px, 2.2vw, 22px);
  font-weight: 700;
}

.round-overlay.win .round-overlay-card {
  border-color: rgba(255, 236, 151, 0.9);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 230, 122, 0.32), transparent 52%),
    linear-gradient(145deg, rgba(255,255,255,0.16), transparent 34%),
    rgba(43, 26, 6, 0.96);
}

.round-overlay.lose .round-overlay-card {
  border-color: rgba(255, 157, 167, 0.58);
}

.round-overlay.start .round-overlay-card {
  border-color: rgba(81, 229, 168, 0.7);
}

.round-overlay.closed .round-overlay-card {
  border-color: rgba(101, 199, 255, 0.72);
}

.round-overlay.result .round-overlay-card {
  border-color: rgba(255, 240, 168, 0.84);
}

.round-overlay-sparkles span {
  position: absolute;
  width: 10px;
  height: 32px;
  border-radius: 999px;
  background: var(--gold);
  opacity: 0;
  animation: sparkleBurst 980ms ease-out infinite;
}

.round-overlay-sparkles span:nth-child(1) {
  left: 16%;
  top: 18%;
}

.round-overlay-sparkles span:nth-child(2) {
  left: 78%;
  top: 20%;
  animation-delay: 120ms;
}

.round-overlay-sparkles span:nth-child(3) {
  left: 20%;
  top: 72%;
  animation-delay: 220ms;
}

.round-overlay-sparkles span:nth-child(4) {
  left: 84%;
  top: 70%;
  animation-delay: 320ms;
}

.round-overlay-sparkles span:nth-child(5) {
  left: 50%;
  top: 10%;
  animation-delay: 420ms;
}

.round-overlay.lose .round-overlay-sparkles,
.round-overlay.closed .round-overlay-sparkles {
  display: none;
}

.history {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(280px, 1.25fr);
  gap: 8px;
  margin-top: 0;
}

.history > div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
}

.history h2 {
  font-size: 15px;
}

.result-strip,
.orders {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.orders {
  max-height: 88px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.result-pill {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-weight: 900;
  border: 2px solid rgba(255,255,255,0.32);
}

.dealer-stage {
  position: relative;
  height: clamp(304px, 25vw, 400px);
  display: grid;
  place-items: end center;
  isolation: isolate;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dealer-stage::before {
  display: none;
}

.dealer-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  z-index: 0;
  width: min(286px, 108%);
  height: 82px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(244, 195, 93, 0.18) 0 18%, rgba(5, 22, 17, 0.6) 38%, transparent 72%);
  filter: blur(9px);
  opacity: 0.88;
  pointer-events: none;
}

.dealer-image {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  display: block;
  width: min(302px, 120%);
  max-height: 302px;
  object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 74% 92% at 50% 50%, #000 58%, rgba(0, 0, 0, 0.9) 70%, rgba(0, 0, 0, 0.48) 87%, transparent 100%);
  mask-image: radial-gradient(ellipse 74% 92% at 50% 50%, #000 58%, rgba(0, 0, 0, 0.9) 70%, rgba(0, 0, 0, 0.48) 87%, transparent 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  filter:
    saturate(0.92)
    contrast(0.96)
    brightness(0.97)
    drop-shadow(0 18px 24px rgba(0, 0, 0, 0.54))
    drop-shadow(0 0 18px rgba(244, 195, 93, 0.12));
  transform-origin: bottom center;
  transition: transform 220ms ease, opacity 220ms ease;
}

.message {
  grid-column: 1 / -1;
}

.dealer-stage.betting .dealer-image {
  transform: translateX(-50%);
}

.dealer-stage.spinning .dealer-image,
.dealer-stage.result .dealer-image,
.dealer-stage.waiting .dealer-image {
  transform: translateX(-50%) scale(0.98);
}

.dealer-stage.win .dealer-image {
  transform: translateX(-50%) translateY(-4px) scale(1.03);
}

.dealer-stage.lose .dealer-image {
  opacity: 0.95;
  transform: translateX(-50%) translateY(2px) scale(0.98);
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.coin-fall,
.confetti-pop {
  position: absolute;
  top: -36px;
  opacity: 0;
  animation-duration: 3200ms;
  animation-timing-function: cubic-bezier(0.15, 0.72, 0.22, 1);
  animation-fill-mode: forwards;
}

.coin-fall {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff7b8, #f4c35d 48%, #b8751c 76%);
  border: 2px solid #fff0a8;
  box-shadow: 0 6px 18px rgba(244, 195, 93, 0.34);
  animation-name: coinFall;
}

.confetti-pop {
  width: 10px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #51e5a8, #65c7ff);
  animation-name: confettiFall;
}

.result-pill.red {
  background: var(--red);
}

.result-pill.black {
  background: var(--black);
}

.result-pill.green {
  background: #0a8f61;
}

.order {
  width: 100%;
  font-size: 13px;
}

.won {
  color: #85ffc8;
}

.lost {
  color: #ff9da7;
}

@keyframes liveWheelSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes idleBallRoll {
  from {
    transform: translate(-50%, -50%) rotate(0deg) translateY(calc(-1 * var(--label-radius)));
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg) translateY(calc(-1 * var(--label-radius)));
  }
}

@keyframes hub-shine {
  0%,
  100% {
    opacity: 0.45;
    transform: rotate(0deg) scale(1);
  }

  50% {
    opacity: 0.78;
    transform: rotate(18deg) scale(1.04);
  }
}

@keyframes overlayPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sparkleBurst {
  0% {
    opacity: 0;
    transform: translateY(18px) rotate(0deg) scale(0.7);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-42px) rotate(120deg) scale(1);
  }
}

@keyframes coinFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0) rotate(0deg) scale(0.7);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 112vh, 0) rotate(var(--spin)) scale(1);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  14% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 104vh, 0) rotate(var(--spin));
  }
}

@media (max-width: 1350px) and (min-width: 1121px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .ticket {
    min-height: 0;
    max-height: 154px;
  }

  .players-list {
    max-height: 42px;
  }

  .ticket-list {
    max-height: 70px;
  }
}

@media (max-width: 1120px) {
  .game-surface {
    grid-template-columns: 1fr;
  }

  
.join-screen {
  min-height: calc(100vh - 20px);
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid rgba(244, 195, 93, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(244, 195, 93, 0.16), transparent 38%),
    linear-gradient(160deg, rgba(2, 36, 30, 0.96), rgba(11, 93, 69, 0.74));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
}

.join-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(244, 195, 93, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
}

.join-form {
  display: grid;
  gap: 14px;
}

.join-form input {
  width: 100%;
}

.join-error {
  min-height: 20px;
  margin: 0;
  color: #ff9da7;
  font-size: 13px;
}

.game-root[hidden],
.join-screen[hidden] {
  display: none;
}
  .arena {
    min-height: auto;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
  }

  .identity {
    min-width: 0;
  }

  .game-surface {
    padding: 0 10px 10px;
  }

  .left-rail {
    grid-template-columns: minmax(288px, 390px) minmax(194px, 1fr);
    align-items: stretch;
  }

  .wheel {
    width: min(51vw, 378px);
    --label-radius: clamp(118px, 19.2vw, 164px);
  }

  .dealer-stage {
    height: auto;
    min-height: 112px;
  }

  .dealer-image {
    width: min(259px, 120%);
    max-height: 247px;
  }

  .message {
    grid-column: 1 / -1;
  }

  .layout,
  .history {
    grid-template-columns: 1fr;
  }

  .board {
    grid-template-columns: 54px repeat(12, minmax(40px, 1fr));
  }

  .ticket {
    min-height: 0;
  }

  .ticket-list {
    max-height: 130px;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 6px;
    --board-scale: 1;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    padding: 5px 7px 3px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 19px;
    line-height: 1;
  }

  .identity {
    display: inline-flex;
    justify-items: end;
    gap: 7px;
    min-width: 0;
    width: auto;
    padding: 0;
  }

  .identity #displayName {
    max-width: 118px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  .identity strong {
    font-size: 13px;
    white-space: nowrap;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    justify-self: stretch;
    gap: 7px;
  }

  .sound-control {
    gap: 5px;
    padding: 3px 4px;
  }

  .sound-control button {
    min-height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .sound-control input {
    width: 54px;
  }

  .exit-game {
    min-height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .game-surface {
    padding: 0 6px 6px;
    gap: 5px;
  }

  .left-rail {
    grid-template-columns: minmax(184px, 52vw) minmax(126px, 0.66fr);
    align-items: start;
    gap: 5px;
  }

  .wheel-wrap {
    align-content: start;
  }

  .wheel {
    width: min(52vw, 202px);
    --label-radius: clamp(72px, 18.2vw, 90px);
    box-shadow:
      inset 0 0 0 5px #f2cb6b,
      inset 0 0 0 11px #5a3317,
      inset 0 0 0 18px rgba(255, 242, 178, 0.2),
      inset 0 0 22px rgba(0, 0, 0, 0.72),
      0 14px 26px rgba(0, 0, 0, 0.44);
  }

  .wheel::before {
    inset: 16px;
  }

  .wheel::after {
    inset: 38px;
    border-width: 5px;
  }

  .wheel-number {
    width: 14px;
    height: 11px;
    font-size: 7px;
  }

  .wheel-ring {
    inset: 34%;
    border-width: 2px;
  }

  .ball {
    top: 50%;
    width: 9px;
    margin-left: 0;
    box-shadow: 0 0 9px rgba(255, 255, 255, 0.9);
  }

  .hub span {
    font-size: 23px;
  }

  .hub small {
    display: none;
  }

  .ticker {
    min-width: 0;
    width: 100%;
    padding: 4px 7px;
  }

  .ticker strong {
    font-size: 15px;
  }

  .dealer-stage {
    height: min(52vw, 202px);
    min-height: 0;
    align-self: start;
    place-items: end center;
    justify-items: end;
    padding-left: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .dealer-image {
    width: 166px;
    max-height: 166px;
  }

  .message {
    display: none;
  }

  .controls {
    align-items: center;
    gap: 4px;
    padding: 5px;
  }

  .controls label {
    grid-template-columns: auto 58px;
    align-items: center;
  }

  .controls input {
    width: 58px;
    min-height: 31px;
    padding: 0 6px;
  }

  .chip {
    min-width: 43px;
    min-height: 43px;
    padding: 0;
    border-width: 2px;
    font-size: 11px;
  }

  .chip span {
    min-width: 27px;
    min-height: 21px;
    padding: 0 3px;
  }

  #repeatBtn {
    min-width: 0;
    min-height: 31px;
    padding: 0 8px;
    font-size: 12px;
  }

  .chip-legend {
    display: none;
    width: 100%;
    margin-left: 0;
  }

  .layout {
    display: block;
    overflow: visible;
  }

  .board {
    width: 100%;
    grid-template-columns: 34px repeat(12, minmax(0, 1fr));
    gap: 2px;
    padding: 4px 3px;
    margin-bottom: 0;
    scrollbar-width: thin;
  }

  .bet-cell {
    min-height: 38px;
    font-size: 10px;
    line-height: 1;
    padding: 0 2px;
  }

  .bet-cell.wide {
    min-height: 36px;
  }

  .bet-label {
    overflow-wrap: anywhere;
  }

  .chip-badge {
    min-width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .ticket-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket {
    max-height: none;
    min-height: 0;
    margin-top: 5px;
  }

  .ticket-head,
  .ticket-list {
    display: none;
  }

  .ticket-stats {
    gap: 4px;
    padding: 5px;
  }

  .ticket-stats div {
    padding: 4px;
  }

  .ticket-stats span {
    font-size: 10px;
  }

  .ticket-stats strong {
    font-size: 13px;
  }

  .players-panel {
    display: none;
  }

  .history {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 0;
  }

  .history > div {
    padding: 5px 7px;
  }

  .history > div:last-child {
    display: block;
  }

  .history h2 {
    font-size: 12px;
  }

  .result-strip {
    max-height: 54px;
    overflow: auto;
    gap: 4px;
    margin-top: 4px;
    scrollbar-width: thin;
  }

  .orders {
    max-height: 54px;
    gap: 4px;
    margin-top: 4px;
  }

  .order {
    padding: 5px 6px;
    font-size: 11px;
  }

  .round-overlay-card {
    min-width: min(360px, 92vw);
    padding: 24px 18px;
  }

  .round-overlay-title {
    font-size: clamp(30px, 10vw, 48px);
  }

  .coin-fall {
    width: 18px;
    height: 18px;
  }

  .confetti-pop {
    height: 20px;
  }
}

@media (max-width: 430px) {
  .left-rail {
    grid-template-columns: minmax(170px, 1.25fr) minmax(124px, 0.75fr);
  }

  .wheel {
    width: min(50vw, 196px);
  }

  .dealer-stage {
    height: min(50vw, 196px);
    min-height: 0;
    padding-left: 0;
    overflow: visible;
  }

  .dealer-image {
    width: 154px;
    max-height: 154px;
  }

  .board {
    grid-template-columns: 32px repeat(12, minmax(0, 1fr));
  }

  .ticket-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
