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

:root {
  --bg-dark: #0a0e17;
  --bg-panel: #121a2b;
  --bg-card: rgba(18, 26, 43, 0.7);
  --accent-red: #e30613;
  --accent-gold: #f5c518;
  --accent-green: #28a745;
  --accent-orange: #f39c12;
  --text-primary: #ffffff;
  --text-secondary: #8b95a8;
  --text-muted: #5a6478;
  --border: rgba(255, 255, 255, 0.08);
  --glow-red: rgba(227, 6, 19, 0.2);
  --glow-green: rgba(40, 167, 69, 0.2);
  --sidebar-width: 320px;
  --bets-grid-cols: minmax(0, 1.1fr) 1fr 56px 1fr;
  --bets-table-pad-x: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.logo-icon {
  width: 32px;
  height: 32px;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text .accent {
  color: var(--accent-gold);
}

.balance-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  min-width: 108px;
}

.balance-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.1;
  white-space: nowrap;
}

.balance-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-green);
  font-variant-numeric: tabular-nums;
}

.balance-code {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Game Area Layout */
.game-area {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.game-area > * {
  min-height: 0;
  min-width: 0;
}

/* Sidebars */
.sidebar {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.right-sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
  --bets-grid-cols: 48px 1fr 52px 1fr;
}

body.spectate-mode .spectate-hidden,
body.spectate-mode .right-sidebar {
  display: none;
}

body.spectate-mode .game-area {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bet-count {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.bets-list-header {
  display: grid;
  grid-template-columns: var(--bets-grid-cols);
  column-gap: 8px;
  padding: 8px var(--bets-table-pad-x);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bets-list-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.bets-list-header span:first-child {
  text-align: left;
}

.bets-list-header span:not(:first-child) {
  text-align: right;
}

.bets-list, .my-bets-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 6px;
}

.bet-entry {
  display: grid;
  grid-template-columns: var(--bets-grid-cols);
  column-gap: 8px;
  align-items: center;
  padding: 7px var(--bets-table-pad-x);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 0 4px;
  font-size: 0.7rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  animation: slideIn 0.3s ease;
}

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

.bet-entry .player-name,
.bet-entry .result-label {
  justify-self: start;
  text-align: left;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-entry .player-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.bet-entry:not(.lost) .result-label {
  color: var(--accent-green);
}

.bet-entry.lost .result-label {
  color: var(--accent-red);
}

.bet-entry > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-entry .bet-amount,
.bet-entry .cashout-mult,
.bet-entry .cashout-win,
.bet-entry .lost-text {
  justify-self: end;
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bet-entry .bet-amount {
  color: var(--text-primary);
  font-weight: 500;
}

.bet-entry .cashout-mult {
  color: var(--accent-green);
  font-weight: 600;
}

.bet-entry .cashout-win {
  color: var(--accent-green);
  font-weight: 700;
}

.bet-entry .cashout-mult.pending,
.bet-entry .cashout-win.pending {
  color: var(--text-muted);
  font-weight: 400;
}

.bet-entry.lost .bet-amount,
.bet-entry.lost .lost-text {
  color: var(--accent-red);
}

.bet-entry.lost .cashout-win.lost-text {
  color: var(--text-muted);
}

.bet-entry.partial .cashout-win {
  color: var(--accent-gold);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 20px;
}

/* Center Panel */
.center-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, #1a0a0a 0%, var(--bg-dark) 70%);
}

.history-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  align-items: center;
  min-height: 34px;
  max-height: 34px;
}

.history-bar::-webkit-scrollbar {
  display: none;
}

.history-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-pill {
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
  transition: transform 0.15s;
}

.history-pill[data-round-id] {
  cursor: pointer;
}

.history-pill:hover {
  transform: scale(1.05);
}

.history-pill.low {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.history-pill.mid {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
}

.history-pill.high {
  background: rgba(231, 76, 60, 0.2);
  color: var(--accent-red);
}

/* Game Canvas */
.game-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.game-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.countdown.visible {
  display: flex;
}

.countdown-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.countdown-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.multiplier-display {
  display: none;
  flex-direction: column;
  align-items: center;
}

.multiplier-display.visible {
  display: flex;
}

.multiplier-value {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
  transition: color 0.2s;
}

.multiplier-value.rising {
  color: var(--accent-green);
  text-shadow: 0 0 40px var(--glow-green);
}

.crashed-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.crashed-overlay.visible {
  display: flex;
}

.crashed-overlay.instant .crashed-text {
  font-size: 1.1rem;
  letter-spacing: 3px;
}

.crashed-overlay.instant .crashed-multiplier {
  font-size: 3.5rem;
  animation: flashCrash 0.4s ease;
}

@keyframes flashCrash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.crashed-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-red);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.crashed-multiplier {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent-red);
  text-shadow: 0 0 30px var(--glow-red);
}

/* Bet Panels */
.bet-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}

.bet-panel {
  background: var(--bg-panel);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  min-height: 0;
}

.bet-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.tab {
  flex: 1;
  padding: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.bet-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.amount-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.amount-btn:hover {
  background: var(--border);
}

.bet-input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  border-radius: 8px;
  outline: none;
  -moz-appearance: textfield;
}

.bet-input::-webkit-outer-spin-button,
.bet-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.quick-amounts {
  display: flex;
  gap: 4px;
}

.quick-btn {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.auto-cashout-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.auto-cashout-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.auto-suffix {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.auto-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 2px;
  border-top: 1px solid var(--border);
}

.auto-section.hidden {
  display: none;
}

.auto-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}

.auto-presets .quick-btn {
  font-variant-numeric: tabular-nums;
}

.auto-presets .quick-btn.is-active {
  border-color: var(--accent-green);
  color: var(--text-primary);
  background: rgba(40, 167, 69, 0.12);
}

.auto-rounds-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auto-rounds-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.auto-rounds-input {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  outline: none;
  -moz-appearance: textfield;
}

.auto-rounds-input::-webkit-outer-spin-button,
.auto-rounds-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.rounds-btn {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

.action-btn {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.2s;
  font-family: inherit;
}

.action-btn .btn-label {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-btn .btn-amount {
  font-size: 0.75rem;
  opacity: 0.85;
}

.action-btn.bet-btn {
  background: var(--accent-green);
  color: #fff;
  box-shadow: 0 4px 15px var(--glow-green);
}

.action-btn.bet-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.action-btn.bet-btn:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.action-btn.deposit-btn {
  background: var(--accent-orange);
  color: #fff;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.action-btn.deposit-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.action-btn.cashout-btn {
  background: var(--accent-orange);
  color: #fff;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.action-btn.cashout-btn:not(:disabled) {
  animation: pulse 1s infinite;
}

.action-btn.cashout-btn:disabled {
  display: none;
}

.action-btn.cashout-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4); }
  50% { box-shadow: 0 4px 25px rgba(243, 156, 18, 0.7); }
}

.action-btn.cancel-btn {
  background: var(--accent-red);
  color: #fff;
}

.action-btn.cancel-btn:hover {
  filter: brightness(1.1);
}

.action-btn.won-btn {
  background: rgba(40, 167, 69, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(40, 167, 69, 0.4);
  cursor: not-allowed;
}

.action-btn.lost-btn {
  background: rgba(231, 76, 60, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(231, 76, 60, 0.3);
  cursor: not-allowed;
}

.action-btn.waiting-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 5px 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.separator {
  opacity: 0.3;
}

/* Scrollbar */
.bets-list::-webkit-scrollbar,
.my-bets-list::-webkit-scrollbar {
  width: 4px;
}

.bets-list::-webkit-scrollbar-thumb,
.my-bets-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Auth page */
.auth-body {
  overflow: auto;
  background: radial-gradient(ellipse at 50% 0%, #121a2b 0%, var(--bg-dark) 60%);
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 8px;
}

.auth-logo .accent { color: var(--accent-gold); }

.logo-icon--auth {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

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

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--accent-red);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-form input {
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent-red);
}

.auth-submit {
  margin-top: 12px;
  padding: 14px;
  border: none;
  background: var(--accent-green);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;
}

.auth-submit:hover { filter: brightness(1.1); }

.auth-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 12px;
}

.auth-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 16px;
}

/* Live game extras */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.live-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.player-count, .username-display {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .player-count {
    display: none;
  }
}

.logout-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}

.logout-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.connection-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: rgba(243, 156, 18, 0.95);
  color: #000;
  text-align: center;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}

.fair-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 12px;
  font-size: 0.68rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.fair-hash {
  font-family: monospace;
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fair-hash:hover {
  color: var(--text-primary);
}

.toast {
  background: var(--accent-red);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Responsive */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 272px;
  }
}

@media (max-width: 1050px) {
  :root {
    --sidebar-width: 248px;
  }
}

.mobile-tab-bar {
  display: none;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.mobile-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-tab.active {
  color: var(--accent-gold);
  box-shadow: inset 0 -2px 0 var(--accent-gold);
}

.fair-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.fair-modal-card {
  width: min(520px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.fair-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.fair-modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.fair-modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.fair-modal-body {
  padding: 18px;
}

.fair-modal-body h3 {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.fair-details {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  font-size: 0.8rem;
}

.fair-details dt {
  color: var(--text-secondary);
}

.fair-details dd {
  margin: 0;
  word-break: break-all;
}

.fair-mono {
  font-family: monospace;
  font-size: 0.72rem;
}

.fair-valid {
  color: var(--accent-green);
  font-weight: 600;
}

.fair-invalid {
  color: var(--accent-red);
  font-weight: 600;
}

.fair-note,
.fair-loading,
.fair-error {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fair-error {
  color: var(--accent-red);
}

.fair-verify-btn {
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  cursor: pointer;
}

.fair-verify-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

@media (max-width: 900px) {
  .game-area {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .game-area.view-bets .center-panel {
    display: none;
  }

  .game-area.view-bets .sidebar.left-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }

  .mobile-tab-bar {
    display: flex;
  }

  .multiplier-value {
    font-size: 3.5rem;
  }

  .bet-panels {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-height: 800px) {
  .header {
    padding: 8px 12px;
  }

  .logo-text {
    font-size: 1.15rem;
  }

  .logo-icon {
    width: 26px;
    height: 26px;
  }

  .history-bar {
    min-height: 30px;
    max-height: 30px;
    padding: 4px 10px;
  }

  .history-pill {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .multiplier-value {
    font-size: 3.5rem;
  }

  .crashed-multiplier {
    font-size: 3rem;
  }

  .countdown-value {
    font-size: 2.4rem;
  }

  .bet-panels {
    padding: 6px 10px;
    gap: 6px;
  }

  .bet-panel {
    padding: 6px 8px;
  }

  .amount-btn,
  .bet-input {
    height: 32px;
  }

  .action-btn {
    padding: 8px 10px;
  }

  .action-btn .btn-label {
    font-size: 0.9rem;
  }

  .footer span:nth-child(5),
  .footer .separator:nth-child(4) {
    display: none;
  }
}

@media (max-height: 700px) {
  /* Hide bet chips to save vertical space — keep Auto round presets visible */
  .quick-amounts:not(.auto-presets) {
    display: none;
  }

  .auto-presets {
    display: flex;
  }

  .footer {
    display: none;
  }
}

.platform-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.platform-nav-link,
.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  white-space: nowrap;
  background: transparent;
}

.platform-nav-link:hover,
.nav-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.history-body {
  overflow: auto;
}

.history-page {
  min-height: 100vh;
  background: var(--bg-dark);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.history-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.history-main h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.history-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.history-table th {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 28px !important;
}

.history-empty a {
  color: var(--accent-red);
}

.history-win {
  color: var(--accent-green);
  font-weight: 600;
}

.history-loss {
  color: var(--accent-red);
  font-weight: 600;
}

/* ─── Fast Games (SkyCrash suite) ─── */
.fast-games-badge {
  background: linear-gradient(135deg, var(--accent-gold), #d4a017);
  color: #0a0e17;
  font-weight: 800;
}

.platform-nav-link.nav-item {
  cursor: pointer;
  font-family: inherit;
}

.platform-nav-link.nav-item.active {
  color: var(--accent-gold);
  border-color: rgba(245, 197, 24, 0.45);
  background: rgba(245, 197, 24, 0.08);
}

.skycrash-link {
  color: var(--accent-red) !important;
  border-color: rgba(227, 6, 19, 0.35) !important;
}

.game-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: radial-gradient(ellipse at 50% 80%, #1a0a0a 0%, var(--bg-dark) 70%);
}

.bets-history-header {
  --bets-grid-cols: minmax(0, 1fr) 1fr 52px 1fr;
}

.seeds-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.seed-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seed-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.seed-value {
  font-family: monospace;
  font-size: 0.68rem;
  word-break: break-all;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--text-secondary);
}

.seed-rotate-btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  cursor: pointer;
}

.fair-modal-copy {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}

.fair-fields code {
  display: block;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  margin-top: 6px;
}

/* Top-center — keeps Drop Ball / Roll / Spin clear at the bottom */
.toast-container {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.toast-container .toast {
  position: static;
  transform: none;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.28s ease, toastOut 0.35s ease 2.4s forwards;
}

.toast.success {
  background: var(--accent-green);
  animation: toastIn 0.28s ease, toastOut 0.35s ease 2.3s forwards;
}
.toast.error { background: var(--accent-red); }
.toast.info { background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-primary); }

.toast-emoji {
  font-size: 1.15rem;
  line-height: 1;
  animation: toastEmojiPop 0.45s ease;
}

.toast-msg {
  line-height: 1.25;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes toastEmojiPop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.win-burst {
  position: fixed;
  top: 78px;
  left: 50%;
  width: 0;
  height: 0;
  z-index: 1999;
  pointer-events: none;
}

.win-burst-bit {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0;
  animation: winBurstFly 1.05s ease-out var(--delay, 0s) forwards;
}

@keyframes winBurstFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot));
  }
}

/* Dice */
.dice-stage {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.dice-hero {
  position: relative;
  width: min(300px, 78vw);
  height: min(240px, 42vh);
  display: grid;
  place-items: center;
}

.dice-gl {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.dice-hud {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  z-index: 2;
  min-width: 118px;
  padding: 8px 14px 7px;
  border-radius: 12px;
  text-align: center;
  background: rgba(10, 14, 23, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.dice-hud.is-win {
  border-color: rgba(40, 167, 69, 0.65);
  box-shadow: 0 0 24px rgba(40, 167, 69, 0.28);
}

.dice-hud.is-loss {
  border-color: rgba(227, 6, 19, 0.6);
  box-shadow: 0 0 24px rgba(227, 6, 19, 0.22);
}

.dice-hud.is-rolling {
  border-color: rgba(245, 197, 24, 0.45);
}

.dice-roll {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f5f7fb;
  line-height: 1;
}

.dice-hud.is-win .dice-roll { color: #3ddc84; }
.dice-hud.is-loss .dice-roll { color: #ff6b6b; }

.dice-roll-caption {
  margin-top: 3px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.dice-hud.is-win .dice-roll-caption { color: rgba(61, 220, 132, 0.9); }
.dice-hud.is-loss .dice-roll-caption { color: rgba(255, 107, 107, 0.9); }

.dice-slider-wrap {
  width: 100%;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dice-slider-track {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.dice-win-zone {
  position: absolute;
  left: 0;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(46, 196, 160, 0.15), rgba(46, 196, 160, 0.55));
  box-shadow: 0 0 12px rgba(46, 196, 160, 0.35);
  pointer-events: none;
  z-index: 1;
  transition: left 0.12s ease, width 0.12s ease;
}

.dice-win-zone.under {
  background: linear-gradient(90deg, rgba(46, 196, 160, 0.55), rgba(46, 196, 160, 0.15));
}

.dice-result-pin {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  transform: translateY(-50%);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  z-index: 3;
  pointer-events: none;
}

.dice-result-pin.win { background: var(--accent-green); }
.dice-result-pin.loss { background: var(--accent-red); }

.dice-slider {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 6px;
  margin: 0;
  background: #2a3142;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.dice-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 4px;
  background: transparent;
}

.dice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(245, 197, 24, 0.45);
  cursor: grab;
}

.dice-slider::-moz-range-track {
  height: 6px;
  border-radius: 4px;
  background: #2a3142;
  border: none;
}

.dice-slider::-moz-range-progress {
  height: 6px;
  border-radius: 4px;
  background: var(--accent-gold);
  border: none;
}

.dice-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(245, 197, 24, 0.45);
  cursor: grab;
}

.dice-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
}

.dice-meta strong { color: var(--accent-gold); }

.condition-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.condition-tab {
  flex: 1;
  padding: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.condition-tab.active {
  background: var(--bg-card);
  color: var(--accent-gold);
}

.dice-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.dice-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.dice-stat .val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-green);
}

.dice-stat .lbl {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Mines */
.mines-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.mines-mult-display {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 30px rgba(245, 197, 24, 0.25);
}

.mines-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 340px;
  width: 100%;
}

.mine-tile {
  aspect-ratio: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.mine-tile:hover:not(.revealed):not(.disabled):not(.exploding) {
  border-color: var(--accent-gold);
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.2);
}

.mine-tile.revealed.safe {
  background: rgba(40, 167, 69, 0.15);
  border-color: var(--accent-green);
  animation: gemPop 0.35s ease;
}

.mine-tile.revealed.mine {
  background: rgba(227, 6, 19, 0.2);
  border-color: var(--accent-red);
  animation: minePop 0.35s ease;
}

.mine-tile.exploding {
  overflow: visible;
  z-index: 5;
  background: radial-gradient(circle at 40% 35%, #ff8a3d 0%, #e30613 48%, #5a0410 100%);
  border-color: #ffcc66;
  box-shadow:
    0 0 0 2px rgba(255, 200, 80, 0.55),
    0 0 28px rgba(255, 60, 40, 0.75),
    0 0 48px rgba(255, 140, 0, 0.35);
  animation: mineExplode 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.mine-tile.exploding .mine-glyph {
  animation: mineGlyphBoom 0.75s ease forwards;
  filter: drop-shadow(0 0 8px rgba(255, 220, 120, 0.9));
}

.mine-blast {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.mine-flash {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 200, 0.95) 0%, rgba(255, 120, 40, 0.55) 35%, transparent 70%);
  animation: mineFlash 0.45s ease-out forwards;
}

.mine-shard {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: var(--shard-color, #ffd166);
  box-shadow: 0 0 6px var(--shard-color, #ffd166);
  animation: mineShard 0.55s ease-out forwards;
  --dx: 0px;
  --dy: 0px;
}

.mine-tile.mine-echo {
  animation: mineEcho 0.45s ease both;
}

.mines-stage.is-boom .mines-mult-display {
  color: var(--accent-red);
  text-shadow: 0 0 28px rgba(227, 6, 19, 0.45);
  animation: boomShake 0.45s ease;
}

.mine-tile.disabled,
.mine-tile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.mine-tile.exploding:disabled,
.mine-tile.revealed.mine:disabled {
  opacity: 1;
}

@keyframes gemPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes minePop {
  0% { transform: scale(0.7); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes mineExplode {
  0% { transform: scale(0.85) rotate(0deg); }
  18% { transform: scale(1.28) rotate(-6deg); }
  40% { transform: scale(1.08) rotate(4deg); }
  70% { transform: scale(1.02) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes mineGlyphBoom {
  0% { transform: scale(0.4); opacity: 0.2; }
  25% { transform: scale(1.45); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes mineFlash {
  0% { opacity: 1; transform: scale(0.2); }
  100% { opacity: 0; transform: scale(1.8); }
}

@keyframes mineShard {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

@keyframes mineEcho {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.06); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes boomShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.action-btn.forfeit-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  box-shadow: none;
  margin-top: 4px;
  font-size: 0.8rem;
  padding: 8px 12px;
}

.action-btn.forfeit-btn:hover {
  color: #ff6b8a;
  border-color: rgba(255, 107, 138, 0.45);
}

.mines-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mines-field-row label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 2.75rem;
}

.mines-field-row .mines-count-controls {
  flex: 1;
  min-width: 0;
}

.mines-field-row .mines-count-controls .bet-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 700;
}

.mines-field-row .mines-step {
  min-width: 40px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

/* Plinko */
.plinko-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 0;
}

.plinko-heading {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  flex-shrink: 0;
}

.plinko-heading__eyebrow {
  color: var(--accent-gold);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.plinko-heading strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 650;
}

#plinko-canvas,
.plinko-gl {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  flex: 1;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(180, 210, 255, 0.12);
  background: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 48px rgba(0, 0, 0, 0.4);
}

/* Plinko cockpit — same side-rail pattern as Wheel */
body[data-game="plinko"] .center-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  grid-template-rows: auto auto minmax(0, 1fr);
}

body[data-game="plinko"] .history-bar,
body[data-game="plinko"] .fair-bar {
  grid-column: 1 / -1;
}

body[data-game="plinko"] .game-stage {
  grid-column: 1;
  grid-row: 3;
  overflow: hidden;
  padding: 10px 8px 12px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  flex: unset;
}

body[data-game="plinko"] .bet-panels,
body[data-game="plinko"] .bet-panels.single-panel {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 12px 12px 8px;
  min-height: 0;
  overflow: auto;
}

body[data-game="plinko"] .plinko-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: 0;
  padding: 0;
}

body[data-game="plinko"] .plinko-heading {
  display: none;
}

body[data-game="plinko"] #plinko-canvas {
  max-width: none;
  height: 100%;
  border-radius: 14px;
}

body[data-game="plinko"] .plinko-bet-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px;
  background: rgba(18, 26, 43, 0.96);
  border: 1px solid var(--border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 12px;
}

body[data-game="plinko"] .plinko-bet-panel .bet-controls {
  gap: 8px;
}

body[data-game="plinko"] .action-btn {
  padding: 12px;
  margin-top: 4px;
}

body[data-game="plinko"] .auto-section {
  padding: 6px 0 0;
  gap: 6px;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  body[data-game="plinko"] .center-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(210px, 1fr) auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[data-game="plinko"] .game-stage {
    grid-column: 1;
    grid-row: 3;
    min-height: 210px;
    padding: 8px;
  }

  body[data-game="plinko"] .bet-panels,
  body[data-game="plinko"] .bet-panels.single-panel {
    grid-column: 1;
    grid-row: 4;
    padding: 6px 10px 10px;
    overflow: visible;
  }

  body[data-game="plinko"] .plinko-bet-panel {
    height: auto;
    padding: 8px 10px;
    justify-content: flex-start;
  }

  body[data-game="plinko"] .quick-amounts:not(.auto-presets) {
    display: none;
  }

  body[data-game="plinko"] .auto-rounds-controls,
  body[data-game="plinko"] .auto-status {
    display: flex;
  }

  body[data-game="plinko"] .auto-status {
    justify-content: center;
  }
}

@media (max-height: 620px) {
  .plinko-heading {
    display: none;
  }
}

.risk-row {
  display: flex;
  gap: 4px;
}

.risk-btn {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.risk-btn.active.low { border-color: var(--accent-green); color: var(--accent-green); }
.risk-btn.active.medium { border-color: var(--accent-gold); color: var(--accent-gold); }
.risk-btn.active.high { border-color: var(--accent-red); color: var(--accent-red); }

.rows-select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 6px;
  font-weight: 600;
  font-family: inherit;
}

/* Wheel */
.wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: 14px;
  position: relative;
}

.wheel-arena {
  position: relative;
  width: min(340px, 78vw);
  height: min(340px, 78vw);
  display: grid;
  place-items: center;
}

.wheel-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 197, 24, 0.18) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.3s;
}

.wheel-arena.spinning .wheel-glow {
  opacity: 1;
  animation: wheelPulse 1.2s ease-in-out infinite;
}

.wheel-arena.win .wheel-glow {
  background: radial-gradient(circle, rgba(40, 167, 69, 0.35) 0%, transparent 70%);
}

.wheel-arena.loss .wheel-glow {
  background: radial-gradient(circle, rgba(227, 6, 19, 0.3) 0%, transparent 70%);
}

.wheel-arena.partial .wheel-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.28) 0%, transparent 70%);
}

@keyframes wheelPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

.wheel-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(245, 197, 24, 0.35);
  box-shadow:
    0 0 0 6px rgba(18, 26, 43, 0.9),
    0 0 0 8px rgba(245, 197, 24, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 2;
}

.wheel-container {
  position: relative;
  width: 88%;
  height: 88%;
  z-index: 1;
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  width: 28px;
  height: 34px;
  filter: drop-shadow(0 4px 10px rgba(245, 197, 24, 0.55));
}

.wheel-pointer svg {
  width: 100%;
  height: 100%;
  display: block;
}

#wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* Rotation is driven by requestAnimationFrame — avoid CSS transition fights */
  transition: none;
  will-change: transform;
}

.wheel-hub-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s;
}

.wheel-hub-result.visible {
  opacity: 1;
  animation: hubPop 0.45s ease;
}

@keyframes hubPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.wheel-hub-mult {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
  line-height: 1;
}

.wheel-hub-mult.win { color: var(--accent-green); }
.wheel-hub-mult.loss { color: var(--accent-red); }
.wheel-hub-mult.partial { color: #f59e0b; }
.wheel-hub-mult.mid { color: var(--accent-gold); }

.wheel-hub-payout {
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.wheel-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: min(340px, 90vw);
}

.wheel-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 4px;
  border-radius: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.wheel-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wheel-chip.highlight {
  border-color: var(--accent-gold);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.wheel-chip-odds {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wheel-arena.spinning .wheel-glow {
  opacity: 1;
  animation: wheelPulse 1.1s ease-in-out infinite;
}

.wheel-arena.partial .wheel-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
}

.segment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.segment-pill {
  padding: 5px 2px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.bet-panels.single-panel {
  grid-template-columns: 1fr;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

/* Wheel cockpit — stage left, controls as a side rail (no stacked overlap) */
body[data-game="wheel"] .center-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  grid-template-rows: auto auto minmax(0, 1fr);
}

body[data-game="wheel"] .history-bar,
body[data-game="wheel"] .fair-bar {
  grid-column: 1 / -1;
}

body[data-game="wheel"] .game-stage {
  grid-column: 1;
  grid-row: 3;
  overflow: hidden;
  padding: 16px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: unset;
}

body[data-game="wheel"] .bet-panels,
body[data-game="wheel"] .bet-panels.single-panel {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 12px 12px 8px;
  min-height: 0;
  overflow: auto;
}

body[data-game="wheel"] .wheel-wrap {
  min-height: 0;
  height: 100%;
  width: 100%;
  gap: 10px;
  justify-content: center;
  overflow: visible;
}

body[data-game="wheel"] .wheel-heading {
  display: none; /* odds chips carry the context; frees vertical room */
}

body[data-game="wheel"] .wheel-arena {
  position: relative;
  aspect-ratio: 1 / 1;
  width: min(320px, 86%, 100%);
  height: auto;
  max-height: calc(100% - 56px);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  margin-inline: auto;
  perspective: 900px;
  perspective-origin: 50% 45%;
}

body[data-game="wheel"] .wheel-ring {
  inset: 0;
  border: 2px solid rgba(245, 197, 24, 0.55);
  box-shadow:
    0 0 0 4px rgba(18, 26, 43, 0.95),
    0 0 0 6px rgba(245, 197, 24, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.55);
}

body[data-game="wheel"] .wheel-container {
  aspect-ratio: 1 / 1;
  width: 88%;
  height: auto;
  max-height: 88%;
  transform: rotateX(16deg);
  transform-style: preserve-3d;
  /* Soft “table” shadow so the tilt reads clearly */
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.45));
}

body[data-game="wheel"] #wheel-canvas {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 50%;
}

.wheel-pointer {
  top: -10px;
  width: 24px;
  height: 30px;
}

.wheel-hub-static,
.wheel-hub-result {
  position: absolute;
  inset: 38%;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 2px solid rgba(245, 197, 24, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #243047, #0a0e17 72%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.wheel-hub-static span {
  color: var(--accent-gold);
  font-size: clamp(0.58rem, 1.4vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.wheel-hub-static.hidden {
  opacity: 0;
}

.wheel-hub-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inset: 34%;
}

.wheel-hub-mult {
  font-size: clamp(0.72rem, 2.3vw, 1.05rem);
}

.wheel-hub-payout {
  margin-top: 2px;
  font-size: clamp(0.48rem, 1.25vw, 0.68rem);
}

body[data-game="wheel"] .wheel-legend {
  width: min(340px, 94%);
  gap: 4px;
  flex-shrink: 0;
  margin-inline: auto;
}

.wheel-chip {
  padding: 4px 3px;
  border-radius: 999px;
  background: rgba(18, 26, 43, 0.8);
  font-size: 0.64rem;
}

.wheel-chip-dot {
  width: 6px;
  height: 6px;
}

body[data-game="wheel"] .wheel-bet-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px;
  background: rgba(18, 26, 43, 0.96);
  border: 1px solid var(--border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 12px;
}

body[data-game="wheel"] .wheel-bet-panel .bet-controls {
  gap: 8px;
}

.wheel-bet-label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body[data-game="wheel"] .action-btn {
  padding: 12px;
  margin-top: 4px;
}

body[data-game="wheel"] .action-btn .btn-label {
  font-size: 0.95rem;
}

body[data-game="wheel"] .auto-section {
  padding: 6px 0 0;
  gap: 6px;
  border-top: 1px solid var(--border);
}

body[data-game="wheel"] .auto-rounds-row {
  gap: 6px;
}

body[data-game="wheel"] .auto-status {
  font-size: 0.7rem;
}

/* Narrow / mobile: stack again, but keep controls below (never over) the wheel */
@media (max-width: 900px) {
  body[data-game="wheel"] .center-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  body[data-game="wheel"] .game-stage {
    grid-column: 1;
    grid-row: 3;
    padding: 10px 8px 6px;
  }

  body[data-game="wheel"] .bet-panels,
  body[data-game="wheel"] .bet-panels.single-panel {
    grid-column: 1;
    grid-row: 4;
    padding: 6px 10px 10px;
    overflow: visible;
  }

  body[data-game="wheel"] .wheel-arena {
    width: min(240px, 72vw, 100%);
    max-height: min(240px, calc(100% - 8px));
  }

  body[data-game="wheel"] .wheel-legend {
    display: none; /* odds stay on the wheel labels */
  }

  body[data-game="wheel"] .wheel-bet-panel {
    height: auto;
    padding: 8px 10px;
    justify-content: flex-start;
  }

  body[data-game="wheel"] .quick-amounts:not(.auto-presets) {
    display: none;
  }

  body[data-game="wheel"] .auto-rounds-controls {
    display: none; /* presets 10/25/50/100 are enough on mobile */
  }

  body[data-game="wheel"] .auto-status {
    display: none;
  }
}

@media (max-height: 620px) and (min-width: 901px) {
  body[data-game="wheel"] .wheel-legend {
    display: none;
  }

  body[data-game="wheel"] .wheel-arena {
    max-height: 92%;
  }
}

@media (max-width: 900px) {
  .platform-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .header {
    flex-wrap: wrap;
  }

  .wheel-legend {
    grid-template-columns: repeat(4, 1fr);
  }
}
/* Low-balance quick deposit (SkyCrash parity) */
.quick-deposit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}

.quick-deposit-overlay.hidden {
  display: none;
}

.quick-deposit-modal {
  position: relative;
  width: min(100%, 390px);
  padding: 26px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: #121a2b;
  color: var(--text-primary);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
}

.quick-deposit-modal h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.quick-deposit-lead,
.quick-deposit-note {
  color: var(--text-secondary);
  line-height: 1.5;
}

.quick-deposit-balance {
  display: flex;
  justify-content: space-between;
  margin: 18px 0;
  padding: 12px 0;
  border-block: 1px solid var(--border);
  color: var(--text-secondary);
}

.quick-deposit-balance strong {
  color: var(--accent-orange);
}

.quick-deposit-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.quick-deposit-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
}

.quick-deposit-submit {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.quick-deposit-note {
  margin: 12px 0 0;
  font-size: 0.76rem;
  text-align: center;
}

.quick-deposit-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
}
