* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #ffd700;
  --felt1: #1a472a;
  --felt2: #2d6a4f;
  --red: #e74c3c;
  --green: #2ecc71;
  --blue: #3498db;
  --purple: #9b59b6;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 50% 20%, var(--felt2), var(--felt1));
  min-height: 100vh;
  color: #fff;
}

.hidden { display: none !important; }

.screen { min-height: 100vh; }

/* ---------- Auth ---------- */
#authScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.auth-card h1 { text-align: center; color: var(--gold); font-size: 2.2em; }

.subtitle { text-align: center; opacity: 0.7; margin-bottom: 24px; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 1em;
}

.tab.active { background: var(--gold); color: #1a472a; font-weight: bold; }

#authForm { display: flex; flex-direction: column; gap: 12px; }

#authForm input {
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-size: 1em;
}

.auth-msg { min-height: 22px; margin-top: 12px; text-align: center; color: var(--red); }
.auth-msg.ok { color: var(--green); }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--blue); }
.btn-hit { background: var(--red); }
.btn-stand { background: var(--green); }
.btn-double { background: var(--purple); }
.btn-ghost { background: rgba(255, 255, 255, 0.15); }
.btn-small { padding: 6px 12px; font-size: 0.85em; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.35);
}
.brand { font-size: 1.4em; color: var(--gold); font-weight: bold; }
.userbox { display: flex; align-items: center; gap: 12px; }
.chips {
  background: var(--gold);
  color: #1a472a;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: bold;
}
.user { opacity: 0.9; }

/* ---------- Table ---------- */
.table-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dealer-area, .player-seat {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
}

.area-head, .seat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.score {
  background: var(--gold);
  color: #1a472a;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: bold;
}

.cards-row { display: flex; gap: 10px; flex-wrap: wrap; min-height: 110px; }

.card {
  width: 76px;
  height: 110px;
  background: #fff;
  border-radius: 8px;
  position: relative;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  color: #2c3e50;
  animation: dealIn 0.3s ease;
}
.card.red { color: var(--red); }
.card .corner { position: absolute; font-size: 0.95em; font-weight: bold; line-height: 1.1; }
.card .tl { top: 6px; left: 8px; }
.card .br { bottom: 6px; right: 8px; transform: rotate(180deg); }
.card .center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2em;
}
.card.back {
  background: repeating-linear-gradient(45deg, #c0392b, #c0392b 8px, #e74c3c 8px, #e74c3c 16px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2em;
}

@keyframes dealIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

.players-area { display: flex; gap: 16px; flex-wrap: wrap; }

.player-seat { flex: 1 1 220px; border: 2px solid transparent; transition: border 0.2s; }
.player-seat.turn { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 0, 0.4); }
.player-seat.you .seat-name::after { content: " (you)"; color: var(--gold); font-size: 0.8em; }

.seat-meta { font-size: 0.85em; opacity: 0.85; display: flex; gap: 12px; }
.badge { padding: 2px 8px; border-radius: 12px; font-weight: bold; }
.badge.bj { background: var(--gold); color: #1a472a; }
.badge.bust { background: var(--red); }
.empty-seat { flex: 1 1 220px; text-align: center; opacity: 0.5; padding: 30px; border: 2px dashed rgba(255,255,255,0.2); border-radius: 16px; }

.message {
  text-align: center;
  font-size: 1.3em;
  min-height: 1.6em;
  color: var(--gold);
}

/* ---------- Controls ---------- */
.controls { display: flex; justify-content: center; gap: 14px; padding: 10px; }
.bet-controls, .action-controls, .join-controls { display: flex; gap: 12px; align-items: center; }
#betInput {
  padding: 12px;
  border-radius: 10px;
  border: none;
  width: 110px;
  font-size: 1em;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  transition: opacity 0.3s;
  max-width: 90%;
  text-align: center;
}

@media (max-width: 600px) {
  .card { width: 58px; height: 86px; }
  .card .center { font-size: 1.6em; }
}

/* ---------- Lobby ---------- */
.lobby { max-width: 1000px; margin: 0 auto; padding: 40px 24px; }
.lobby-title { text-align: center; color: var(--gold); font-size: 2em; margin-bottom: 30px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.game-card {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 215, 0, 0.25);
  border-radius: 20px;
  padding: 34px 22px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 12px 30px rgba(0,0,0,0.5); }
.game-card .gc-icon { font-size: 3.4em; line-height: 1; margin-bottom: 12px; }
.game-card h3 { color: var(--gold); font-size: 1.5em; margin-bottom: 8px; }
.game-card p { opacity: 0.8; font-size: 0.95em; }

/* ---------- Poker ---------- */
.poker-wrap { gap: 16px; }
.community-area { background: rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.player-area { background: rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.qual { font-size: 0.7em; font-style: normal; margin-left: 6px; }
.card.empty { background: rgba(255,255,255,0.08); box-shadow: none; border: 2px dashed rgba(255,255,255,0.2); }
.poker-controls label { opacity: 0.8; }
#anteInput { padding: 12px; border-radius: 10px; border: none; width: 110px; font-size: 1em; }

/* ---------- Roulette ---------- */
.roulette-wrap { max-width: 1200px; }
.wheel-panel { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wheel {
  width: 140px; height: 140px; border-radius: 50%;
  background: #222; border: 6px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.wheel.red { background: var(--red); }
.wheel.black { background: #111; }
.wheel.green { background: var(--green); }
.wheel.spin { animation: wheelSpin 0.7s ease; }
@keyframes wheelSpin { from { transform: rotate(0) scale(0.8); opacity: 0.4; } to { transform: rotate(360deg) scale(1); opacity: 1; } }
.wheel-num { font-size: 3em; font-weight: bold; color: #fff; }

.roulette-layout { display: flex; flex-direction: column; gap: 16px; }
.chip-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-label { opacity: 0.8; }
.chip {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.7);
  background: #555; color: #fff; font-weight: bold; cursor: pointer;
}
.chip[data-chip="10"] { background: #3498db; }
.chip[data-chip="50"] { background: #e74c3c; }
.chip[data-chip="100"] { background: #27ae60; }
.chip[data-chip="500"] { background: #8e44ad; }
.chip.active { outline: 3px solid var(--gold); transform: scale(1.1); }

.roulette-board { background: #14532d; border-radius: 12px; padding: 12px; }
.board-top { display: flex; gap: 6px; margin-bottom: 6px; }
.board-top .straight { flex: 0 0 44px; }
.dozens { display: flex; gap: 6px; flex: 1; }
.number-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.columns { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-top: 4px; }
.columns .column { grid-column: span 4; }
.outside-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 6px; }

.rb {
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 10px 4px;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.85em;
  transition: transform 0.1s ease, outline 0.1s ease;
}
.rb:hover { transform: translateY(-1px); }
.rb.num.red { background: var(--red); }
.rb.num.black { background: #1a1a1a; }
.rb.red-bet { background: var(--red); }
.rb.black-bet { background: #1a1a1a; }
.rb.staged { outline: 3px solid var(--gold); }

.bet-summary { background: rgba(0,0,0,0.35); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bet-summary-info { display: flex; justify-content: space-between; align-items: center; }
.staged-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 24px; }
.staged-chip { background: rgba(255,215,0,0.2); border: 1px solid var(--gold); border-radius: 12px; padding: 3px 10px; font-size: 0.85em; }
.spin-btn { align-self: center; min-width: 220px; }

@media (max-width: 600px) {
  .rb { font-size: 0.7em; padding: 6px 2px; min-height: 34px; }
  .wheel { width: 110px; height: 110px; }
  .wheel-num { font-size: 2.2em; }
}
