/* European Roulette — Casino Dark Theme */
:root {
  --felt: #1a472a;
  --felt-dark: #112d1a;
  --felt-light: #1e5433;
  --gold: #c9a84c;
  --gold-light: #e8c76a;
  --red: #c0392b;
  --black: #1a1a1a;
  --green: #27ae60;
  --white: #f5f5f0;
  --text-dim: #aaa;
  --border: rgba(201, 168, 76, 0.3);
  --shadow: rgba(0, 0, 0, 0.5);
  --chip-size: 48px;
}

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

html, body {
  height: 100%;
  background: #0d0d0d;
  color: var(--white);
  font-family: 'Georgia', serif;
  overflow-x: hidden;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #111;
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 20px; }
.logo {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 1px;
}
.back-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: sans-serif;
}
.back-link:hover { color: var(--white); }
.header-right { display: flex; align-items: center; gap: 12px; }
.balance {
  color: var(--gold);
  font-size: 1rem;
  font-weight: bold;
  font-family: sans-serif;
}
.username {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: sans-serif;
}

/* ── Buttons ── */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-gold {
  background: var(--gold);
  color: #111;
}
.btn-gold:hover:not(:disabled) { background: var(--gold-light); }
.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-ghost:hover:not(:disabled) { background: rgba(201,168,76,0.1); }

/* ── Game Layout ── */
.game-layout {
  display: flex;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

/* ── Wheel Section ── */
.wheel-section {
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.wheel-container {
  position: relative;
  width: 320px;
  height: 320px;
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(0,0,0,0.8), 0 0 60px rgba(201,168,76,0.1);
}

.ball-container {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.ball {
  position: absolute;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #fff, #ccc);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.ball.visible { opacity: 1; }

/* ── Round Info ── */
.round-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.round-status {
  font-size: 1.1rem;
  color: var(--gold);
  text-align: center;
  font-family: sans-serif;
}

.countdown-container {
  text-align: center;
  font-family: sans-serif;
}
.countdown-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.countdown {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--white);
  line-height: 1;
}
.countdown.urgent { color: #e74c3c; animation: pulse 0.5s infinite alternate; }

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

.result-display {
  text-align: center;
}
.result-number {
  font-size: 4rem;
  font-weight: bold;
  line-height: 1;
}
.result-number.color-red { color: var(--red); }
.result-number.color-black { color: #ccc; }
.result-number.color-green { color: var(--green); }
.result-color {
  font-size: 1rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: sans-serif;
}

.player-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: sans-serif;
}

/* ── Table Section ── */
.table-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Chip Selector ── */
.chip-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chip-selector-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: sans-serif;
  white-space: nowrap;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  width: var(--chip-size);
  height: var(--chip-size);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.75rem;
  color: #fff;
  transition: all 0.15s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
}
.chip::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
}
.chip.active {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  transform: scale(1.1);
}
.chip-10  { background: #3498db; }
.chip-50  { background: #e67e22; }
.chip-100 { background: #9b59b6; }
.chip-500 { background: #e74c3c; }
.chip-1k  { background: #2c3e50; border-color: var(--gold); }

/* ── Betting Table ── */
.betting-table {
  background: var(--felt-dark);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 16px;
  user-select: none;
  position: relative;
  overflow-x: auto;
}

.table-grid {
  display: grid;
  grid-template-columns: 60px repeat(12, 1fr) 90px;
  grid-template-rows: repeat(3, 52px) 40px 40px;
  gap: 3px;
  min-width: 700px;
}

/* Zero cell */
.cell-zero {
  grid-column: 1;
  grid-row: 1 / 4;
  background: var(--green);
  border: 1px solid var(--gold);
  border-radius: 4px 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

/* Number cells */
.cell-number {
  background: var(--black);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.cell-number.red { background: var(--red); }
.cell-number.black { background: #222; }

.cell-number:hover, .cell-zero:hover { filter: brightness(1.3); }
.cell-number.has-bet, .cell-zero.has-bet {
  box-shadow: inset 0 0 0 2px var(--gold);
}
.cell-number.locked, .cell-zero.locked { cursor: not-allowed; opacity: 0.7; }
.cell-number.winning-highlight {
  animation: winPulse 1.5s ease-in-out 3;
  box-shadow: 0 0 20px 4px gold;
}

@keyframes winPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(2); }
}

/* Outside bet rows */
.outside-row {
  display: contents;
}

.cell-outside {
  grid-column: 2 / 14;
  background: var(--felt);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--white);
  transition: all 0.15s;
  position: relative;
}
.cell-outside:hover { background: var(--felt-light); filter: brightness(1.2); }
.cell-outside.has-bet { box-shadow: inset 0 0 0 2px var(--gold); }
.cell-outside.locked { cursor: not-allowed; opacity: 0.7; }
.cell-outside.red-cell { background: var(--red); opacity: 0.85; }
.cell-outside.black-cell { background: #333; }

/* Column bets (right column) */
.cell-column {
  grid-column: 14;
  background: var(--felt);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: sans-serif;
  font-weight: 600;
  color: var(--white);
  transition: all 0.15s;
  position: relative;
}
.cell-column:hover { background: var(--felt-light); }
.cell-column.has-bet { box-shadow: inset 0 0 0 2px var(--gold); }
.cell-column.locked { cursor: not-allowed; opacity: 0.7; }

/* Chip stack on cell */
.chip-stack {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--gold);
  color: #111;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.6rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  pointer-events: none;
}

/* Heat map overlay */
.heat-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 165, 0, var(--heat, 0));
  border-radius: inherit;
  transition: background 0.5s;
}

/* ── Bet Footer ── */
.bet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  font-family: sans-serif;
}
.bet-summary { font-size: 0.95rem; color: var(--gold); }
.bet-count { color: var(--text-dim); font-size: 0.8rem; margin-left: 12px; }

/* ── Win Notification ── */
.win-notification {
  background: linear-gradient(135deg, #1a3a1a, #2d5a2d);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.win-header { font-size: 1.3rem; color: var(--gold); margin-bottom: 6px; }
.win-detail { font-size: 1rem; color: var(--white); font-family: sans-serif; }

/* ── Spectator Banner ── */
.spectator-banner {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 10px 24px;
  font-family: sans-serif;
  font-size: 0.9rem;
  color: var(--text-dim);
  z-index: 200;
}
.spectator-banner a { color: var(--gold); }

/* ── Connection Status ── */
.connection-status {
  position: fixed;
  bottom: 12px;
  right: 12px;
  font-size: 0.75rem;
  font-family: sans-serif;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 200;
}
.connection-status.connected { background: rgba(39,174,96,0.2); color: #27ae60; }
.connection-status.disconnected { background: rgba(231,76,60,0.2); color: #e74c3c; }
.connection-status.connecting { background: rgba(241,196,15,0.2); color: #f1c40f; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .game-layout { flex-direction: column; padding: 12px; }
  .wheel-section { flex: none; width: 100%; }
  .wheel-container { width: 260px; height: 260px; margin: 0 auto; }
  #wheel-canvas { width: 260px; height: 260px; }
}

@media (max-width: 600px) {
  .header { padding: 10px 12px; }
  .logo { font-size: 1rem; }
  .chip-selector { flex-wrap: wrap; }
}
