/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #0c0c1d;
  --bg-darker: #08081a;
  --bg-card: #111128;
  --felt-green: #0a5427;
  --felt-light: #0c6630;
  --felt-dark: #073d1c;
  --wood-brown: #6d3a0a;
  --wood-light: #8B4513;
  --wood-dark: #4a2800;
  --gold: #ffd700;
  --gold-light: #ffe44d;
  --gold-dark: #b8960f;
  --gold-glow: rgba(255, 215, 0, 0.3);
  --neon-green: #00ff88;
  --neon-red: #ff3355;
  --neon-blue: #4488ff;
  --neon-purple: #aa55ff;
  --text-light: #e8e8f0;
  --text-muted: #8888aa;
  --text-dim: #555577;
  --win-green: #00ff88;
  --lose-red: #ff3355;
  --chip-red: #dc3545;
  --chip-blue: #2563eb;
  --chip-green: #16a34a;
  --chip-black: #333355;
  --chip-purple: #7c3aed;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(255, 215, 0, 0.2);
  --shadow-heavy: 0 8px 32px rgba(0,0,0,0.6);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  -webkit-font-smoothing: antialiased;
}

/* ===== PARTICLES CANVAS ===== */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  animation: fadeIn 0.5s ease;
}

.modal-content {
  background: linear-gradient(160deg, #16163a, #0e0e28);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  padding: 48px 44px;
  text-align: center;
  min-width: 380px;
  box-shadow: 0 0 80px rgba(255, 215, 0, 0.08), var(--shadow-heavy);
  animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-logo {
  margin-bottom: 36px;
}

.dice-logo {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dice-icon {
  font-size: 3rem;
  filter: drop-shadow(0 0 20px var(--gold-glow));
  animation: diceFloat 3s ease-in-out infinite alternate;
}

.dice-icon:nth-child(2) {
  animation-delay: -1.5s;
}

.modal-title {
  font-family: 'Russo One', sans-serif;
  font-size: 3.5rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.3), 0 0 80px rgba(255, 215, 0, 0.1);
  line-height: 1;
}

.lol {
  color: var(--neon-green);
  font-size: 0.6em;
  text-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 8px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form input {
  padding: 16px 20px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-light);
  font-size: 1.1rem;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: all 0.3s;
}

.modal-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.modal-form input::placeholder {
  color: var(--text-dim);
}

.table-code-display {
  color: var(--gold);
  font-size: 0.9rem;
  margin-top: 4px;
}

.modal-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.sound-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.sound-toggle-label input {
  accent-color: var(--gold);
}

.sound-icon { font-size: 1.1rem; }

/* ===== BUTTONS ===== */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #e6ac00);
  color: #0c0c1d;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-clear {
  padding: 8px 16px;
  font-size: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 51, 85, 0.15);
  color: var(--neon-red);
  border: 1px solid rgba(255, 51, 85, 0.2);
}

.btn-clear:hover {
  background: rgba(255, 51, 85, 0.25);
}

/* ===== COMBINATION BET SHORTCUTS ===== */
.combo-bets {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.btn-combo {
  padding: 7px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(68, 136, 255, 0.1);
  color: var(--neon-blue);
  border: 1px solid rgba(68, 136, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.btn-combo:hover:not(:disabled) {
  background: rgba(68, 136, 255, 0.22);
  border-color: rgba(68, 136, 255, 0.5);
  box-shadow: 0 0 8px rgba(68, 136, 255, 0.2);
}

.btn-combo:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-bets-toggle {
  padding: 7px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(255, 140, 0, 0.1);
  color: #ff8c00;
  border: 1px solid rgba(255, 140, 0, 0.25);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.btn-bets-toggle:hover:not(:disabled) {
  background: rgba(255, 140, 0, 0.22);
  border-color: rgba(255, 140, 0, 0.5);
  box-shadow: 0 0 8px rgba(255, 140, 0, 0.2);
}

.btn-bets-toggle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-press {
  padding: 8px 16px;
  font-size: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s;
}

.btn-press:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-press.press-on {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
}

.btn-chat-send {
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 8px;
  background: var(--gold);
  color: var(--bg-dark);
  border: none;
  min-width: 36px;
}

.btn-chat-send:hover {
  background: var(--gold-light);
}

.btn-roll {
  font-family: 'Russo One', sans-serif;
  font-size: 1.3rem;
  padding: 18px 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), #e6ac00);
  color: var(--bg-dark);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
  animation: rollBtnPulse 2s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.05em;
}

.btn-roll:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 40px rgba(255, 215, 0, 0.5);
  animation: none;
}

.btn-roll:active {
  transform: translateY(0) scale(0.98);
}

.btn-roll:disabled {
  opacity: 0.5;
  animation: none;
  cursor: not-allowed;
  transform: none;
}

.roll-btn-dice {
  font-size: 1.5rem;
  animation: rollBtnDiceSpin 3s linear infinite;
}

.btn-roll:hover .roll-btn-dice {
  animation-duration: 0.5s;
}

/* ===== TOP BAR ===== */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 10;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mini {
  font-family: 'Russo One', sans-serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.logo-mini .lol {
  font-size: 0.7em;
}

.table-id {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.phase-text {
  font-family: 'Russo One', sans-serif;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
  transition: all 0.4s;
}

.balance-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.balance-text {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--neon-green);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
  transition: all 0.3s;
}

.balance-text.balance-up {
  animation: balanceUp 0.6s ease;
}

.balance-text.balance-down {
  animation: balanceDown 0.6s ease;
}

.on-table-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.12);
  margin-right: 4px;
}

.on-table-text {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 15px var(--gold-glow);
}

.btn-reup {
  padding: 4px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--neon-green), #0a9);
  color: var(--bg-dark);
  border: none;
  letter-spacing: 0.05em;
  animation: rollBtnPulse 2s ease-in-out infinite;
}

.btn-leave {
  color: var(--text-muted);
  font-size: 0.7rem;
  gap: 4px;
}

.btn-leave:hover {
  color: var(--neon-red);
}

/* Desktop: show leave button as icon only */
.leave-btn-label {
  display: none;
}

/* Low-balance bar — hidden on desktop, shown on mobile when broke */
.low-balance-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 51, 85, 0.12);
  border: 1px solid rgba(255, 51, 85, 0.3);
  border-radius: 12px;
  width: 100%;
}

.low-balance-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--neon-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-reup-large {
  padding: 8px 20px;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--neon-green), #0a9);
  color: var(--bg-dark);
  border: none;
  letter-spacing: 0.05em;
  cursor: pointer;
  animation: rollBtnPulse 2s ease-in-out infinite;
}

.btn-reset-bankroll {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 6px;
  background: rgba(255, 51, 85, 0.15);
  color: var(--neon-red);
  border: 1px solid rgba(255, 51, 85, 0.35);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-reset-bankroll:hover {
  background: rgba(255, 51, 85, 0.3);
  border-color: rgba(255, 51, 85, 0.6);
}

/* ===== POINT PUCK ===== */
.puck {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.puck-off {
  background: linear-gradient(135deg, #2a2a44, #1a1a33);
  color: var(--text-dim);
  border: 2px solid #3a3a55;
}

.puck-on {
  background: linear-gradient(135deg, #fff, #e0e0e0);
  color: #111;
  border: 2px solid #fff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 0 40px rgba(255, 255, 255, 0.2);
  animation: puckGlow 2s ease-in-out infinite alternate;
}

/* ===== GAME LAYOUT ===== */
.game-layout {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
  min-height: 0;
}

/* ===== SIDEBARS ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-darker);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 4px;
  border-right: 1px solid var(--border-subtle);
}

.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.sidebar-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-title svg { opacity: 0.5; }

.sidebar-section {
  margin-bottom: 16px;
}

/* ===== PLAYER LIST ===== */
.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.player-item {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  transition: all 0.3s;
  animation: playerSlideIn 0.3s ease;
}

.player-item.is-current {
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
}

.player-item .player-name {
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-item .player-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-item .shooter-badge {
  font-size: 0.6rem;
  background: var(--gold);
  color: var(--bg-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-left: auto;
}

.player-item .player-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.player-item.player-me {
  border-color: var(--neon-blue);
  background: rgba(37, 99, 235, 0.08);
}

.player-item.player-me.player-shooter {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.06);
}

.player-item.player-shooter .player-name {
  color: var(--gold);
}

.player-balance {
  color: var(--neon-green);
  font-weight: 700;
}

.player-bets-total {
  color: var(--text-dim);
}

/* ===== CHAT ===== */
.chat-messages {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.chat-msg {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  word-break: break-word;
}

.chat-msg-name {
  font-weight: 700;
  margin-right: 4px;
}

.chat-input-row {
  display: flex;
  gap: 6px;
}

.chat-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-light);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--gold);
}

.chat-input::placeholder { color: var(--text-dim); }

/* ===== CENTER AREA ===== */
.center-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-height: 0;
}

/* When content overflows, don't center — start from top */
@supports (overflow: auto) {
  .center-area {
    justify-content: safe center;
  }
}

/* ===== CRAPS TABLE ===== */
.craps-table {
  width: 100%;
  max-width: 1100px;
  border-radius: 20px;
  border: 7px solid var(--wood-brown);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.5),
    0 0 0 2px var(--wood-dark),
    0 0 0 5px var(--wood-light),
    0 12px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: box-shadow 0.5s;
}

.table-felt {
  background:
    radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt-green) 50%, var(--felt-dark) 100%);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}

/* Felt texture overlay */
.table-felt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='6' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' fill='rgba(0,0,0,0.03)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ===== BET AREAS ===== */
.bet-area {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
}

.bet-area:hover {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.15), inset 0 0 20px rgba(255, 215, 0, 0.05);
  transform: translateY(-1px);
}

.bet-area.has-bet {
  border-color: var(--gold);
  box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.08);
}

.bet-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.bet-payout {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
}

/* Place numbers row */
.place-numbers-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.bet-place .bet-label {
  font-family: 'Russo One', sans-serif;
  font-size: 1.8rem;
  font-weight: 400;
}

/* Props row (hardways, yo, any craps) */
.props-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.bet-hard {
  background: rgba(170, 85, 255, 0.08);
  border-color: rgba(170, 85, 255, 0.25);
}

.bet-hard .bet-label {
  font-size: 0.7rem;
  color: var(--neon-purple);
}

.bet-yo {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.25);
}

.bet-yo .bet-label {
  font-size: 0.75rem;
  color: var(--gold);
}

.bet-any-craps {
  background: rgba(255, 51, 85, 0.08);
  border-color: rgba(255, 51, 85, 0.25);
}

.bet-any-craps .bet-label {
  font-size: 0.65rem;
  color: var(--neon-red);
}

/* Middle row */
.middle-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 6px;
}

.bet-come .bet-label {
  font-size: 1rem;
  letter-spacing: 0.15em;
}

.field-numbers {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.65);
  font-weight: 700;
  margin-top: 2px;
}

.field-payouts {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}

/* Bottom rows */
.bottom-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 6px;
}

.pass-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 6px;
}

.bet-pass-line {
  border-color: rgba(255, 215, 0, 0.3);
  background: rgba(255, 215, 0, 0.06);
}

.bet-pass-line .bet-label {
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.12em;
}

.bet-dont-pass .bet-label {
  font-size: 0.75rem;
}

/* Odds bets - hidden until point phase */
.bet-odds-hidden {
  opacity: 0.2;
  pointer-events: none;
  transform: scale(0.97);
}

.bet-odds-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* ===== BET CHIPS ON TABLE ===== */
.bet-chips {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

.table-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.45rem;
  font-weight: 900;
  color: #fff;
  border: 2px dashed rgba(255,255,255,0.5);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  animation: chipLand 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.table-chip.my-chip {
  border-style: solid;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4), 0 2px 6px rgba(0,0,0,0.5);
}

/* Come bets that have traveled to a number get a distinct ring */
.table-chip.come-chip {
  outline: 2px solid var(--neon-blue);
  outline-offset: 1px;
}

/* Bets that are turned off (not working) */
.table-chip.bet-off {
  opacity: 0.4;
  filter: grayscale(80%);
}

/* ===== DICE AREA ===== */
#dice-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 140px;
}

.dice-container {
  display: flex;
  gap: 24px;
  perspective: 600px;
}

.die {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #fff 0%, #f0f0f0 50%, #e8e8e8 100%);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 9px;
  gap: 2px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.9), inset 0 -1px 2px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.die.rolling {
  animation: diceRoll 0.6s cubic-bezier(0.45, 0, 0.55, 1);
}

.dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #444, #111);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.dot.hidden {
  background: transparent;
  box-shadow: none;
}

.roll-total {
  font-family: 'Russo One', sans-serif;
  font-size: 1.8rem;
  color: var(--gold);
  min-height: 38px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px var(--gold-glow);
  transition: all 0.3s;
}

.roll-total.total-seven {
  color: var(--neon-red);
  text-shadow: 0 0 20px rgba(255, 51, 85, 0.5);
}

.roll-total.total-point {
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.roll-result-banner {
  font-family: 'Russo One', sans-serif;
  font-size: 1.2rem;
  padding: 6px 24px;
  border-radius: 8px;
  animation: bannerPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.roll-result-banner.banner-win {
  background: rgba(0, 255, 136, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.roll-result-banner.banner-lose {
  background: rgba(255, 51, 85, 0.15);
  color: var(--neon-red);
  border: 1px solid rgba(255, 51, 85, 0.3);
  text-shadow: 0 0 10px rgba(255, 51, 85, 0.4);
}

.roll-result-banner.banner-yo {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.4);
  text-shadow: 0 0 20px var(--gold-glow);
  font-size: 2rem;
}

.roll-result-banner.banner-point {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.3);
  text-shadow: 0 0 10px var(--gold-glow);
}

.waiting-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  animation: waitingPulse 2s ease-in-out infinite;
}

/* ===== CHIP SELECTOR ===== */
#chip-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(0,0,0,0.4);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
}

.chip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.4);
  font-size: 0.75rem;
  font-weight: 900;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  position: relative;
}

.chip::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}

.chip:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.chip.selected {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 0 25px var(--gold-glow), 0 8px 24px rgba(0,0,0,0.5);
  border-color: var(--gold);
  border-style: solid;
}

.chip-5 { background: radial-gradient(circle at 35% 35%, #ef4444, #b91c1c); }
.chip-10 { background: radial-gradient(circle at 35% 35%, #3b82f6, #1d4ed8); }
.chip-25 { background: radial-gradient(circle at 35% 35%, #22c55e, #15803d); }
.chip-50 { background: radial-gradient(circle at 35% 35%, #555577, #2a2a44); }
.chip-100 { background: radial-gradient(circle at 35% 35%, #a855f7, #7c3aed); }

/* Drag and drop */
.chip.dragging {
  opacity: 0.4;
  transform: scale(0.85);
}

.bet-area.drop-hover {
  border-color: var(--gold) !important;
  background: rgba(255, 215, 0, 0.2) !important;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), inset 0 0 30px rgba(255, 215, 0, 0.1) !important;
  transform: scale(1.03);
}

.chip-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
  transform: translate(-50%, -50%);
  opacity: 0.9;
}

/* ===== ROLL HISTORY ===== */
.roll-history-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.roll-history-list::-webkit-scrollbar { width: 3px; }
.roll-history-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.roll-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.03);
  animation: historySlideIn 0.3s ease;
}

.roll-history-item .roll-dice {
  color: var(--text-dim);
  font-size: 0.7rem;
}

.roll-history-item .roll-number {
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

.roll-number.is-seven { color: var(--neon-red); }
.roll-number.is-point { color: var(--neon-green); }
.roll-number.is-craps { color: var(--neon-red); }
.roll-number.is-natural { color: var(--neon-green); }

/* ===== HOUSE PROFIT ===== */
.house-profit {
  font-family: 'Russo One', sans-serif;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  transition: all 0.3s;
}

.house-profit.profit-positive {
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.house-profit.profit-negative {
  color: var(--neon-red);
  text-shadow: 0 0 10px rgba(255, 51, 85, 0.3);
}

/* ===== MESSAGES ===== */
.messages-area {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.75rem;
}

.messages-area::-webkit-scrollbar { width: 3px; }
.messages-area::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.message {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  animation: messageSlideIn 0.25s ease;
}

.message-win {
  color: var(--neon-green);
  background: rgba(0, 255, 136, 0.06);
}

.message-lose {
  color: var(--neon-red);
  background: rgba(255, 51, 85, 0.06);
}

.message-system {
  color: var(--gold);
  background: rgba(255, 215, 0, 0.04);
}

/* ===== POINT MARKER ON TABLE ===== */
.bet-place.point-marker {
  border-color: #fff !important;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3), inset 0 0 12px rgba(255, 255, 255, 0.08) !important;
}

.bet-place.point-marker::after {
  content: 'ON';
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.5rem;
  font-weight: 900;
  color: #111;
  background: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255,255,255,0.5);
  animation: puckGlow 2s ease-in-out infinite alternate;
}

/* ===== DISABLED BET AREAS ===== */
.bet-area.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  z-index: 2000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-info {
  background: rgba(20, 20, 50, 0.9);
  color: var(--gold);
  border: 1px solid var(--border-glow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast-error {
  background: rgba(50, 10, 20, 0.9);
  color: var(--neon-red);
  border: 1px solid rgba(255, 51, 85, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast-win {
  background: rgba(10, 50, 30, 0.9);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ===== BET FLASH ===== */
.bet-flash {
  animation: betFlash 0.35s ease;
}

/* ===== PHASE CHANGE FLASH ===== */
.phase-changed {
  animation: phaseFlash 1.5s ease;
}

/* ===== TABLE SHAKE ===== */
.table-shake {
  animation: tableShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ===== WIN CELEBRATION ===== */
.win-glow {
  animation: winGlow 1s ease;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes diceFloat {
  from { transform: translateY(0) rotate(-5deg); }
  to { transform: translateY(-8px) rotate(5deg); }
}

@keyframes diceRoll {
  0% { transform: rotateX(0) rotateY(0) rotateZ(0) scale(1); }
  20% { transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg) scale(1.15); }
  40% { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg) scale(0.9); }
  60% { transform: rotateX(540deg) rotateY(270deg) rotateZ(135deg) scale(1.1); }
  80% { transform: rotateX(680deg) rotateY(340deg) rotateZ(160deg) scale(0.95); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg) scale(1); }
}

@keyframes chipLand {
  0% { transform: scale(0.2) translateY(-20px); opacity: 0; }
  60% { transform: scale(1.15) translateY(0); }
  80% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes rollBtnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 4px 35px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.15); }
}

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

@keyframes betFlash {
  0% { box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.2); }
  100% { box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
}

@keyframes winGlow {
  0%, 100% { box-shadow: inset 0 0 40px rgba(0, 255, 136, 0), 0 0 0 rgba(0, 255, 136, 0); }
  30% { box-shadow: inset 0 0 40px rgba(0, 255, 136, 0.15), 0 0 40px rgba(0, 255, 136, 0.3); }
  60% { box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.08), 0 0 20px rgba(0, 255, 136, 0.15); }
}

@keyframes phaseFlash {
  0%, 100% { text-shadow: 0 0 20px var(--gold-glow); }
  25% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.3); transform: scale(1.08); }
  50% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.5); transform: scale(1.04); }
}

@keyframes puckGlow {
  from { box-shadow: 0 0 15px rgba(255, 255, 255, 0.4); }
  to { box-shadow: 0 0 25px rgba(255, 255, 255, 0.6), 0 0 50px rgba(255, 255, 255, 0.2); }
}

@keyframes tableShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-4px) rotate(-0.3deg); }
  20% { transform: translateX(4px) rotate(0.3deg); }
  30% { transform: translateX(-3px) rotate(-0.2deg); }
  40% { transform: translateX(3px) rotate(0.2deg); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
}

@keyframes bannerPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes waitingPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes balanceUp {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); color: var(--neon-green); }
  100% { transform: scale(1); }
}

@keyframes balanceDown {
  0% { transform: scale(1); }
  30% { transform: scale(0.9); color: var(--neon-red); }
  100% { transform: scale(1); }
}

@keyframes playerSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes historySlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== BANKROLL GRAPH ===== */
.bankroll-graph-container {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
}

.bankroll-graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bankroll-graph-legend {
  display: flex;
  gap: 12px;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bankroll-canvas {
  width: 100%;
  height: 100px;
  display: block;
  cursor: pointer;
}

.bankroll-graph-container:hover {
  border-color: var(--gold);
}

/* Enlarged bankroll overlay */
.bankroll-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.bankroll-overlay.active {
  display: flex;
}

.bankroll-overlay-inner {
  background: var(--felt-dark, #0a1628);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 20px;
  width: min(90vw, 700px);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
}

.bankroll-overlay-inner .bankroll-graph-legend {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.bankroll-overlay-inner canvas {
  width: 100%;
  height: min(50vh, 350px);
  display: block;
}

/* ===== LOBBY ===== */
.lobby-section {
  width: 100%;
  margin-top: 4px;
}

.lobby-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.lobby-table-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.lobby-table-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lobby-table-item:hover {
  background: rgba(255, 215, 0, 0.08);
  border-color: var(--gold);
}

.lobby-table-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lobby-table-players {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.lobby-table-names {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lobby-table-status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(0, 255, 136, 0.15);
  color: var(--neon-green);
}

.lobby-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 12px 0;
}

/* ===== MOBILE TAB BAR & PANELS ===== */
.mobile-tab-bar {
  display: none;
}

.mobile-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
}

.mobile-panel-overlay.active {
  display: block;
}

.mobile-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 910;
  background: var(--bg-darker);
  border-top: 1px solid var(--gold-dark);
  border-radius: 16px 16px 0 0;
  max-height: 65vh;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
}

.mobile-panel.active {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

.mobile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mobile-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
}

.mobile-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.mobile-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

/* Cloned content styling inside panels */
.mobile-panel-content .roll-history-list {
  max-height: none;
}

.mobile-panel-content .chat-messages {
  max-height: 40vh;
}

.mobile-panel-content .chat-input-row {
  margin-top: 8px;
}

.mobile-panel-content .bankroll-canvas {
  height: 200px;
}

.mobile-panel-content .player-list {
  max-height: none;
}

/* Mobile menu panel items */
.mobile-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.mobile-menu-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.mobile-menu-item svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.mobile-menu-danger {
  color: var(--neon-red);
  border-color: rgba(255, 51, 85, 0.2);
}

.mobile-menu-danger svg {
  stroke: var(--neon-red);
}

/* ===== SHORT VIEWPORT ===== */
@media (max-height: 750px) {
  .table-felt {
    padding: 8px;
    gap: 4px;
  }

  .bet-area {
    min-height: 44px;
    padding: 6px 6px;
  }

  .bet-place .bet-label {
    font-size: 1.3rem;
  }

  .bet-label {
    font-size: 0.7rem;
  }

  .bet-payout {
    font-size: 0.5rem;
  }

  #dice-area {
    gap: 6px;
  }

  .die {
    width: 52px;
    height: 52px;
  }

  .center-area {
    padding: 8px;
    gap: 8px;
  }

  .craps-table {
    border-width: 5px;
    border-radius: 14px;
  }

  #chip-selector {
    gap: 6px;
    padding: 6px;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .sidebar {
    width: 200px;
    min-width: 200px;
    padding: 12px;
  }
}

@media (max-width: 900px) {
  /* Hide sidebars, show everything in one screen */
  .sidebar {
    display: none;
  }

  html, body {
    overflow: hidden;
    height: 100%;
  }

  .game-layout {
    flex-direction: column;
    height: calc(100dvh - 44px - env(safe-area-inset-top));
    overflow: hidden;
  }

  #top-bar {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 10px;
    padding-top: max(6px, env(safe-area-inset-top));
    min-height: 44px;
  }

  .top-bar-left {
    gap: 6px;
  }

  /* Hide share, sound, notification, leave, and logo on mobile to save space */
  #share-btn, #sound-btn, #notif-btn, #leave-btn, .logo-mini {
    display: none;
  }

  /* Hide table ID code on mobile — saves top bar space */
  .table-id {
    display: none;
  }

  /* With left items hidden, hide the empty left section and let center+right fill the bar */
  .top-bar-left {
    display: none;
  }

  #top-bar {
    justify-content: center;
  }

  .top-bar-center {
    flex: 1;
    justify-content: center;
  }

  .phase-text {
    font-size: 0.85rem;
  }

  /* Hide "Balance" label text — the $ amount is self-explanatory */
  .balance-label {
    display: none;
  }

  /* Prevent balance from shrinking off-screen */
  .top-bar-right {
    flex-shrink: 0;
  }

  .balance-text {
    font-size: 1rem;
  }

  .on-table-text {
    font-size: 1rem;
  }

  /* Show the low-balance bar on mobile */
  .low-balance-bar {
    display: flex;
  }

  .puck {
    width: 32px;
    height: 32px;
    font-size: 0.6rem;
  }

  .center-area {
    flex: 1;
    overflow: hidden;
    padding: 4px;
    gap: 4px;
    justify-content: flex-start;
  }

  /* Compact table - fills all available vertical space */
  .craps-table {
    border-width: 4px;
    border-radius: 14px;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-shadow:
      inset 0 0 30px rgba(0, 0, 0, 0.5),
      0 0 0 1.5px var(--wood-dark),
      0 0 0 3.5px var(--wood-light),
      0 6px 20px rgba(0, 0, 0, 0.5);
  }

  .table-felt {
    flex: 1;
    padding: 4px;
    gap: 4px;
    background:
      radial-gradient(ellipse at 50% 40%, #0d7534 0%, var(--felt-green) 50%, var(--felt-dark) 100%);
  }

  .bet-area {
    min-height: 0;
    padding: 4px 3px;
    border-radius: 6px;
    border-width: 1.5px;
    backdrop-filter: brightness(1.05);
  }

  .bet-label {
    font-size: 0.65rem;
    letter-spacing: 0.05em;
  }

  .bet-payout {
    font-size: 0.5rem;
  }

  .bet-place .bet-label {
    font-family: 'Russo One', sans-serif;
    font-size: 1.3rem;
  }

  .bet-hard .bet-label {
    font-size: 0.55rem;
  }

  .bet-yo .bet-label {
    font-size: 0.6rem;
  }

  .bet-any-craps .bet-label {
    font-size: 0.5rem;
  }

  .bet-come .bet-label {
    font-size: 0.75rem;
  }

  .field-numbers {
    font-size: 0.55rem;
  }

  .field-payouts {
    font-size: 0.45rem;
  }

  .bet-pass-line .bet-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
  }

  .bet-pass-line {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.35);
  }

  .bet-dont-pass .bet-label {
    font-size: 0.6rem;
  }

  .bet-chips {
    margin-top: 2px;
    gap: 1px;
  }

  .table-chip {
    width: 20px;
    height: 20px;
    font-size: 0.35rem;
    border-width: 1.5px;
  }

  .place-numbers-row,
  .props-row {
    flex: 1.5;
    min-height: 0;
    gap: 3px;
    grid-template-rows: 1fr;
  }

  .middle-row {
    flex: 1;
    min-height: 0;
    gap: 3px;
    grid-template-rows: 1fr;
  }

  /* Don't pass bar smaller on mobile — pass line gets more space */
  .bottom-row {
    flex: 0.6;
    min-height: 0;
    gap: 3px;
    grid-template-rows: 1fr;
  }

  .pass-row {
    flex: 1;
    min-height: 0;
    gap: 3px;
    grid-template-rows: 1fr;
  }

  .bet-place.point-marker::after {
    width: 18px;
    height: 18px;
    font-size: 0.4rem;
    top: 2px;
    right: 2px;
  }

  /* Compact dice area - inline layout */
  #dice-area {
    min-height: auto;
    gap: 6px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
  }

  .dice-container {
    gap: 10px;
  }

  .die {
    width: 46px;
    height: 46px;
    padding: 6px;
    border-radius: 9px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.9);
  }

  .roll-total {
    font-size: 1.4rem;
    min-height: auto;
  }

  .roll-result-banner {
    font-size: 0.9rem;
    padding: 4px 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
  }

  .roll-result-banner.banner-yo {
    font-size: 1.5rem;
  }

  .btn-roll {
    font-size: 0.95rem;
    padding: 10px 28px;
    border-radius: 12px;
    gap: 8px;
  }

  .roll-btn-dice {
    font-size: 1.1rem;
  }

  .waiting-text {
    font-size: 0.75rem;
  }

  /* Compact chip selector */
  #chip-selector {
    gap: 5px;
    padding: 6px 10px;
    border-radius: 12px;
    flex-wrap: nowrap;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
  }

  .chip {
    width: 36px;
    height: 36px;
    font-size: 0.55rem;
    border-width: 2px;
  }

  .chip::after {
    inset: 2px;
  }

  .btn-press {
    font-size: 0.6rem;
    padding: 4px 8px;
    white-space: nowrap;
  }

  .btn-clear {
    font-size: 0.6rem;
    padding: 4px 8px;
    white-space: nowrap;
  }

  .combo-bets {
    padding: 5px 8px;
    gap: 5px;
  }

  .btn-combo {
    font-size: 0.6rem;
    padding: 4px 8px;
  }

  .btn-bets-toggle {
    font-size: 0.6rem;
    padding: 4px 8px;
  }

  .chat-messages { max-height: 100px; }

  /* Bankroll graph on mobile - hide in sidebar since sidebars are hidden */
  .bankroll-graph-container {
    display: none;
  }

  /* Mobile tab bar */
  .mobile-tab-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-subtle);
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    flex-shrink: 0;
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.55rem;
    padding: 4px 8px;
    cursor: pointer;
    transition: color 0.15s;
    font-family: inherit;
    letter-spacing: 0.3px;
  }

  .mobile-tab:active,
  .mobile-tab.active {
    color: var(--gold);
  }

  .mobile-tab svg {
    opacity: 0.7;
  }

  .mobile-tab:active svg,
  .mobile-tab.active svg {
    opacity: 1;
    stroke: var(--gold);
  }

  .game-layout {
    height: calc(100dvh - 44px - 46px - env(safe-area-inset-top)); /* top bar + tab bar + safe area */
  }
}

@media (max-width: 480px) {
  .place-numbers-row,
  .props-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-content {
    min-width: unset;
    margin: 16px;
    padding: 32px 24px;
  }

  .modal-title {
    font-size: 2.5rem;
  }

  .chip {
    width: 32px;
    height: 32px;
    font-size: 0.5rem;
  }

  .btn-roll {
    font-size: 0.85rem;
    padding: 8px 20px;
  }

  .bet-area {
    min-height: 0;
    padding: 3px 2px;
  }

  .die {
    width: 38px;
    height: 38px;
    padding: 4px;
  }
}

/* ===== LANDSCAPE PHONE ===== */
@media (orientation: landscape) and (max-height: 500px) {
  /* Hide tab bar — maximize game area */
  .mobile-tab-bar {
    display: none !important;
  }

  /* Compact top bar */
  #top-bar {
    padding: 2px 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    min-height: 32px;
    gap: 4px;
  }

  .puck {
    width: 24px;
    height: 24px;
    font-size: 0.5rem;
  }

  .phase-text {
    font-size: 0.7rem;
  }

  .balance-text {
    font-size: 0.85rem;
  }

  .logo-mini {
    font-size: 0.85rem;
  }

  /* Game layout: no tab bar, side-by-side */
  .game-layout {
    height: calc(100dvh - 32px);
    flex-direction: column;
    overflow: hidden;
  }

  /* Center area uses CSS grid for side-by-side layout */
  .center-area {
    display: grid;
    grid-template-columns: 1fr 150px;
    grid-template-rows: 1fr auto;
    overflow: hidden;
    padding: 2px 4px;
    padding-left: max(4px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    gap: 2px;
    align-content: stretch;
    max-height: 100%;
  }

  /* Table fills the left column, scrollable if needed */
  .craps-table {
    grid-column: 1;
    grid-row: 1 / -1;
    overflow-y: auto;
    border-width: 3px;
    border-radius: 10px;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    align-self: stretch;
  }

  .table-felt {
    min-height: 100%;
    justify-content: space-between;
  }

  /* Dice area in right column top */
  #dice-area {
    grid-column: 2;
    grid-row: 1;
    flex-direction: column;
    min-height: auto;
    gap: 4px;
    padding: 2px 0;
    justify-content: center;
  }

  .die {
    width: 36px;
    height: 36px;
    padding: 5px;
    border-radius: 7px;
  }

  .dice-container {
    gap: 6px;
  }

  .roll-total {
    font-size: 1rem;
    min-height: auto;
  }

  .btn-roll {
    font-size: 0.7rem;
    padding: 6px 10px;
    border-radius: 8px;
    gap: 4px;
  }

  .roll-btn-dice {
    font-size: 0.85rem;
  }

  .waiting-text {
    font-size: 0.65rem;
  }

  /* Chip selector in right column bottom */
  #chip-selector {
    grid-column: 2;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    justify-content: center;
    border-radius: 8px;
    align-content: center;
  }

  .chip {
    width: 26px;
    height: 26px;
    font-size: 0.42rem;
    border-width: 2px;
  }

  .chip::after {
    inset: 2px;
  }

  .btn-press, .btn-clear {
    display: none;
  }

  .combo-bets {
    display: none;
  }

  /* Low-balance bar in right column */
  .low-balance-bar {
    grid-column: 2;
    grid-row: 3;
  }

  /* Ultra-compact table rows */
  .table-felt {
    padding: 4px;
    gap: 2px;
  }

  .bet-area {
    min-height: 26px;
    padding: 2px 2px;
    border-radius: 4px;
  }

  .bet-label {
    font-size: 0.5rem;
  }

  .bet-payout {
    font-size: 0.4rem;
  }

  .bet-place .bet-label {
    font-size: 0.95rem;
  }

  .bet-hard .bet-label {
    font-size: 0.45rem;
  }

  .bet-yo .bet-label,
  .bet-any-craps .bet-label {
    font-size: 0.45rem;
  }

  .bet-come .bet-label {
    font-size: 0.6rem;
  }

  .field-numbers {
    font-size: 0.4rem;
  }

  .field-payouts {
    display: none;
  }

  .bet-pass-line .bet-label {
    font-size: 0.6rem;
  }

  .bet-dont-pass .bet-label {
    font-size: 0.5rem;
  }

  .place-numbers-row,
  .props-row {
    gap: 2px;
  }

  .middle-row,
  .bottom-row,
  .pass-row {
    gap: 2px;
  }

  .bet-chips {
    margin-top: 1px;
    gap: 1px;
  }

  .table-chip {
    width: 16px;
    height: 16px;
    font-size: 0.3rem;
    border-width: 1px;
  }

  .bet-place.point-marker::after {
    width: 14px;
    height: 14px;
    font-size: 0.35rem;
    top: 1px;
    right: 1px;
  }

  .roll-result-banner {
    font-size: 0.8rem;
    padding: 3px 10px;
  }
}

/* ===== TOUR / LEARN TO PLAY ===== */
#tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}

#tour-spotlight {
  position: fixed;
  z-index: 10001;
  border: 2px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15), 0 0 24px rgba(255, 215, 0, 0.45);
  pointer-events: none;
  transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease;
}

#tour-card {
  position: fixed;
  z-index: 10002;
  background: linear-gradient(160deg, #1a1a3e, #111130);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.1), 0 12px 40px rgba(0, 0, 0, 0.7);
  max-width: 400px;
  animation: tourCardIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tourCardIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tour-progress {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tour-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s;
}

.tour-close:hover {
  color: var(--text-light);
}

.tour-title {
  font-family: 'Russo One', sans-serif;
  font-size: 1.05rem;
  color: var(--text-light);
  margin-bottom: 10px;
  line-height: 1.3;
}

.tour-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 18px;
}

.tour-body strong {
  color: var(--gold);
}

.tour-body em {
  color: var(--neon-green);
  font-style: normal;
}

.tour-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tour-skip {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.15s;
  white-space: nowrap;
}

.tour-skip:hover {
  color: var(--text-muted);
}

.tour-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tour-prev,
.tour-next {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.tour-prev {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.tour-prev:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text-light);
}

.tour-next {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #000;
}

.tour-next:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.tour-next.tour-done {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
}

/* Tour button in top bar */
#tour-btn {
  display: flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 768px) {
  #tour-btn {
    display: none;
  }

  #tour-card {
    padding: 16px 16px 14px;
  }

  .tour-title {
    font-size: 0.95rem;
  }

  .tour-body {
    font-size: 0.83rem;
  }
}
