:root {
  color-scheme: dark;
  --bg: #0b0e0c;
  --panel: #141a16;
  --panel-2: #1b241e;
  --border: #2c3a31;
  --text: #f5f7f5;
  --muted: #9daf9f;
  --accent: #78e04c;
  --accent-2: #3cae31;
  --red: #c83e3e;
  --black: #111;
  --gold: #e4c66b;
}

* { 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 top, rgba(83, 153, 63, .16), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }

button {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  padding: .8rem 1rem;
  cursor: pointer;
  transition: .16s ease;
}

button:hover { transform: translateY(-1px); border-color: #4a6251; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

button.primary {
  background: var(--accent);
  color: #081006;
  border-color: transparent;
  font-weight: 800;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 50px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.badge {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--accent);
  color: #071006;
  font-weight: 950;
  font-size: 1.3rem;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.sub, .hint { color: var(--muted); }
.eyebrow { margin-bottom: 3px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .16em; }

.panel {
  background: rgba(20, 26, 22, .95);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
}

.home-grid, .game-grid { display: grid; gap: 18px; }
.home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); margin-top: 18px; }

.card {
  padding: 20px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

label { display: grid; gap: 7px; margin: 14px 0; color: var(--muted); font-size: .9rem; }

input, select {
  width: 100%;
  min-height: 48px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #0d120f;
  color: var(--text);
  padding: 0 13px;
  font-size: 16px;
}

.hidden { display: none !important; }

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

.room-code {
  display: block;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  letter-spacing: .12em;
}

.status-wrap { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.status, .role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: .75rem;
  font-weight: 900;
}
.status.open { background: rgba(120, 224, 76, .16); color: #a4f783; }
.status.closed { background: rgba(200, 62, 62, .17); color: #ff8c8c; }
.role-pill { background: #26332b; color: var(--muted); }

.wheel-wrap { display: grid; place-items: center; padding: 18px 0 28px; }
.wheel {
  position: relative;
  width: min(330px, 76vw);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 24px;
  background:
    conic-gradient(
      #176b39 0deg 10deg,
      #9d2929 10deg 20deg,
      #101010 20deg 30deg,
      #9d2929 30deg 40deg,
      #101010 40deg 50deg,
      #9d2929 50deg 60deg,
      #101010 60deg 70deg,
      #9d2929 70deg 80deg,
      #101010 80deg 90deg,
      #9d2929 90deg 100deg,
      #101010 100deg 110deg,
      #9d2929 110deg 120deg,
      #101010 120deg 130deg,
      #9d2929 130deg 140deg,
      #101010 140deg 150deg,
      #9d2929 150deg 160deg,
      #101010 160deg 170deg,
      #9d2929 170deg 180deg,
      #101010 180deg 190deg,
      #9d2929 190deg 200deg,
      #101010 200deg 210deg,
      #9d2929 210deg 220deg,
      #101010 220deg 230deg,
      #9d2929 230deg 240deg,
      #101010 240deg 250deg,
      #9d2929 250deg 260deg,
      #101010 260deg 270deg,
      #9d2929 270deg 280deg,
      #101010 280deg 290deg,
      #9d2929 290deg 300deg,
      #101010 300deg 310deg,
      #9d2929 310deg 320deg,
      #101010 320deg 330deg,
      #9d2929 330deg 340deg,
      #101010 340deg 350deg,
      #9d2929 350deg 360deg
    );
  box-shadow: inset 0 0 0 8px #795f28, 0 18px 45px rgba(0, 0, 0, .35);
}

.wheel-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0e1511;
  border: 2px solid #876d36;
}

.wheel-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #202b23;
  border: 4px solid #93783e;
  text-align: center;
}

.wheel-center span { font-size: 3rem; font-weight: 950; line-height: 1; }
.wheel-center small { margin-top: 7px; color: var(--muted); font-weight: 900; letter-spacing: .08em; }

.wheel.spinning { animation: spin .85s linear 3; }
@keyframes spin { to { transform: rotate(360deg); } }

.bet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bet.red { background: #812c2c; }
.bet.black { background: #080808; }
.bet.selected { outline: 3px solid var(--accent); border-color: transparent; }

.stake-row, .dealer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar-head span {
  min-width: 38px;
  text-align: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--panel-2);
}

.players-list { display: grid; gap: 10px; }

.player-row {
  padding: 12px;
  border-radius: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.player-main, .player-sub { display: flex; justify-content: space-between; gap: 12px; }
.player-main { font-weight: 800; }
.player-sub { margin-top: 5px; color: var(--muted); font-size: .82rem; }

.message { min-height: 24px; margin: 16px 2px 0; color: var(--gold); }

@media (max-width: 780px) {
  .home-grid, .game-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
}

@media (max-width: 480px) {
  .shell { width: min(100% - 18px, 1180px); padding-top: 15px; }
  .panel { padding: 15px; border-radius: 16px; }
  .brand { align-items: flex-start; }
  .badge { width: 52px; height: 52px; border-radius: 14px; }
  .bet-grid { grid-template-columns: repeat(2, 1fr); }
  .stake-row, .dealer-actions { grid-template-columns: 1fr; }
}

.number-bet-row, .manual-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.number-bet-row label, .manual-result label {
  margin: 0;
}

@media (max-width: 480px) {
  .number-bet-row, .manual-result { grid-template-columns: 1fr; }
}

.roulette-board {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: stretch;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(34px, 1fr));
  gap: 6px;
}

.number-cell {
  min-height: 46px;
  padding: 0;
  border-radius: 9px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.09);
}

.number-cell.red { background: #812c2c; }
.number-cell.black { background: #080808; }
.number-cell.green { background: #176b39; }
.number-cell.zero { min-height: 100%; font-size: 1.15rem; }
.number-cell.selected { outline: 3px solid var(--accent); border-color: transparent; }

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chip {
  width: 54px;
  height: 54px;
  min-height: 54px;
  border-radius: 50%;
  padding: 0;
  font-weight: 900;
  border: 4px double #8d7440;
  background: #242b26;
}

.chip.selected {
  outline: 3px solid var(--accent);
  transform: translateY(-2px);
}

.stake-display {
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #0d120f;
}

.stake-display span {
  color: var(--muted);
  font-size: .78rem;
}

@media (max-width: 780px) {
  .number-grid { grid-template-columns: repeat(6, minmax(42px, 1fr)); }
}

@media (max-width: 480px) {
  .roulette-board { grid-template-columns: 44px 1fr; }
  .number-grid { grid-template-columns: repeat(4, minmax(46px, 1fr)); }
  .number-cell { min-height: 48px; }
}

.player-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.danger-small {
  min-height: 36px;
  padding: 6px 10px;
  border-color: rgba(255, 92, 92, .35);
  background: rgba(160, 38, 38, .18);
  color: #ff9b9b;
  font-size: .8rem;
}

.dealer-extras {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.history-head {
  margin-bottom: 10px;
}

.round-history {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
}

.history-pill.red { background: #812c2c; }
.history-pill.black { background: #080808; }
.history-pill.green { background: #176b39; }

.history-pill span {
  font-size: .7rem;
  color: rgba(255,255,255,.72);
}
