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

body {
  background: #0a0a0f;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

#app {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

/* Controls sidebar */
#controls {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: #0d0d18;
  border-right: 1px solid #1e1e30;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

/* Board area */
#board-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

#board-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0f1a;
  padding: 48px;
  overflow: hidden;
}

#plinko-board {
  display: block;
  border-radius: 6px;
  max-width: 100%;
  max-height: 100%;
}

#logo {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #7c3aed;
  text-align: center;
  text-shadow: 0 0 20px #7c3aed88;
  padding: 16px 0 16px;
  flex-shrink: 0;
}

.balance-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 2px;
}

#balance-display {
  font-size: 22px;
  font-weight: 700;
  color: #00ff88;
  font-variant-numeric: tabular-nums;
}

.control-group {
  background: #141420;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #1e1e30;
}

.control-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 6px;
}

/* Bet input */
.bet-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

#bet-amount {
  flex: 1;
  background: #0a0a0f;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  padding: 6px 8px;
  width: 0;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

#bet-amount:focus { outline: none; border-color: #7c3aed; }

.bet-quick {
  background: #1e1e30;
  border: 1px solid #333;
  border-radius: 5px;
  color: #aaa;
  font-size: 11px;
  padding: 5px 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bet-quick:hover { background: #2a2a44; color: #fff; }

/* Radio groups */
.radio-group {
  display: flex;
  gap: 6px;
}

.radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #0a0a0f;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.radio-label:has(input:checked) {
  background: #1e1030;
  border-color: #7c3aed;
  color: #c084fc;
}
.radio-label input { display: none; }

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  flex: 1;
  padding: 8px;
  background: #1e1e30;
  border: 1px solid #7c3aed;
  border-radius: 6px;
  color: #c084fc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #2a1a44; }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
  flex: 1;
  padding: 8px;
  background: #1e0a0a;
  border: 1px solid #7f1d1d;
  border-radius: 6px;
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #2a0f0f; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* History */
#history-section { overflow: hidden; }

#history-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.history-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.history-entry.win { background: #0a1f12; }
.history-entry.loss { background: #1a0a0a; }
.history-entry.pending { background: #141414; color: #555; }

.h-mult { color: #888; }
.win .h-payout { color: #00ff88; font-weight: 600; }
.loss .h-payout { color: #ff4444; font-weight: 600; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e1e30;
  border: 1px solid #7c3aed;
  color: #c084fc;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 600px) {
  body { overflow: auto; height: auto; }
  #app { flex-direction: column; height: auto; }
  #controls { width: 100%; border-right: none; border-bottom: 1px solid #1e1e30; overflow-y: visible; }
  #board-area { width: 100%; }
}
