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

:root {
  --bg: #0d1b2a;
  --panel: #112038;
  --card: #162840;
  --card-dark: #0e1e30;
  --border: #1e3a5f;
  --border-light: #2a4f7a;
  --blue: #1b6ef3;
  --blue-bright: #3a8bff;
  --green: #00c97b;
  --green-glow: rgba(0,201,123,0.3);
  --text: #c8dff0;
  --text-dim: #5a7a9a;
  --text-bright: #e8f4ff;
  --win-border: #00c97b;
  --win-bg: rgba(0,201,123,0.08);
  --lose-border: #e84040;
  --lose-bg: rgba(232,64,64,0.08);
  --current-bg: rgba(27,110,243,0.15);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ─────────────────────────────────────────────────── */
header {
  background: #0a1525;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.logo {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 2px;
}
.logo span { color: var(--blue-bright); }

.header-center { display: flex; align-items: center; gap: 12px; }

.balance {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

.wallet-btn {
  background: var(--blue);
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}
.wallet-btn:hover { background: var(--blue-bright); }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tab-row {
  display: flex;
  background: var(--card-dark);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active { background: var(--blue); color: white; }

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.bet-input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bet-input-wrap { position: relative; flex: 1; }

.bet-input-wrap .prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
}

input[type="number"] {
  width: 100%;
  background: var(--card-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 10px 10px 28px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  outline: none;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type="number"]:focus { border-color: var(--blue); }

.half-btn, .double-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.half-btn:hover, .double-btn:hover { border-color: var(--blue); color: var(--text-bright); }

.payout-box {
  background: var(--card-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.payout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.payout-label  { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.payout-multiplier { font-size: 14px; font-weight: 700; color: var(--blue-bright); }

.payout-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  font-family: 'Space Mono', monospace;
}

.btn-primary {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1b6ef3 0%, #3a8bff 40%, #1b6ef3 60%, #0d4fcf 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(27,110,243,0.5), 0 0 0 0 rgba(58,139,255,0.4);
  animation: placeBetPulse 2.4s ease-in-out infinite;
  transition: transform 0.15s, box-shadow 0.15s;
}

/* Shiny sweep overlay */
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.08) 40%,
    rgba(255,255,255,0.35) 50%,
    rgba(255,255,255,0.08) 60%,
    transparent 100%
  );
  animation: shineSweep 2.4s ease-in-out infinite;
  pointer-events: none;
}

/* Subtle top edge glint */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  pointer-events: none;
}

@keyframes shineSweep {
  0%   { left: -75%; }
  60%  { left: 125%; }
  100% { left: 125%; }
}

@keyframes placeBetPulse {
  0%, 100% {
    box-shadow: 0 4px 18px rgba(27,110,243,0.5), 0 0 0 0 rgba(58,139,255,0.4);
    background-position: 0% 50%;
  }
  50% {
    box-shadow: 0 6px 28px rgba(27,110,243,0.7), 0 0 0 6px rgba(58,139,255,0);
    background-position: 100% 50%;
  }
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 32px rgba(27,110,243,0.7);
}
.btn-primary:active {
  transform: translateY(0px) scale(0.98);
}
.btn-primary:disabled {
  background: #1a2a3a;
  color: var(--text-dim);
  cursor: not-allowed;
  transform: none;
  animation: none;
  box-shadow: none;
}
.btn-primary:disabled::before { display: none; }

.btn-secondary {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--blue); color: var(--text-bright); }

.btn-cashout {
  width: 100%;
  background: linear-gradient(135deg, #00a864, #00c97b);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(0,201,123,0.3);
}
.btn-cashout:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,201,123,0.45); }

.info-text {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 0;
}

.result-banner {
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  display: none;
}
.result-banner.win {
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  color: var(--green);
  display: block;
}
.result-banner.lose {
  background: var(--lose-bg);
  border: 1px solid var(--lose-border);
  color: #e84040;
  display: block;
}

/* ── GAME AREA ────────────────────────────────────────────────── */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-bright);
}

.game-title-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
}

.fairplay {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.fairplay::before { content: '✓'; color: var(--green); font-weight: 700; }

/* ── HORIZONTAL BRACKET ──────────────────────────────────────── */
.bracket-container {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  padding: 32px 32px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* One big horizontal flex row: [col] [arrow] [col] [arrow] … */
.bracket-track {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 200px;
  margin: auto;
}

/* Each round column */
.round-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0.35;
  transition: opacity 0.3s;
  flex-shrink: 0;
}
.round-col.active  { opacity: 1; }
.round-col.done    { opacity: 1; }

/* Multiplier badge above the column */
.mult-badge {
  background: var(--card-dark);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  font-family: 'Space Mono', monospace;
  transition: all 0.3s;
  white-space: nowrap;
}
.mult-badge.active {
  border-color: var(--blue);
  color: var(--blue-bright);
  background: rgba(27,110,243,0.12);
}
.mult-badge.passed {
  border-color: var(--green);
  color: var(--green);
  background: var(--win-bg);
}

/* The pair of cards stacked vertically inside a column */
.card-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* VS divider between the two cards */
.vs-divider {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ── GAME CARDS ───────────────────────────────────────────────── */
.game-card {
  width: 80px;
  height: 80px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: all 0.3s;
  flex-shrink: 0;
  user-select: none;
}

.game-card.empty {
  background: var(--card-dark);
  border-style: dashed;
  border-color: var(--border);
}

.game-card.current {
  border-color: var(--blue);
  background: var(--current-bg);
  box-shadow: 0 0 16px rgba(27,110,243,0.4);
}

.game-card.win {
  border-color: var(--win-border);
  background: var(--win-bg);
  box-shadow: 0 0 14px var(--green-glow);
}

.game-card.lose {
  border-color: var(--lose-border);
  background: var(--lose-bg);
  opacity: 0.6;
}

.game-card.tie {
  border-color: #f0c040;
  background: rgba(240,192,64,0.08);
  box-shadow: 0 0 14px rgba(240,192,64,0.3);
}

/* ── HORIZONTAL CONNECTOR ARROW ───────────────────────────────── */
.h-connector {
  display: flex;
  align-items: center;
  width: 48px;
  flex-shrink: 0;
  position: relative;
  margin-top: 28px; /* align with cards, past the badge */
}

.h-connector::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 2px;
  background: var(--border);
  transition: background 0.35s;
}

/* Arrow head */
.h-connector::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-left: 8px solid var(--border);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: border-left-color 0.35s;
}

.h-connector.passed::before { background: var(--green); }
.h-connector.passed::after  { border-left-color: var(--green); }
.h-connector.active::before { background: var(--blue); }
.h-connector.active::after  { border-left-color: var(--blue); }

/* ── CHOICE ROW (bottom) ─────────────────────────────────────── */
.choice-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 16px 24px 20px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.choice-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
}

.choice-btn {
  width: 86px;
  height: 86px;
  background: var(--card);
  border: 2px solid var(--border-light);
  border-radius: 14px;
  font-size: 36px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(27,110,243,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--blue-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(27,110,243,0.3);
}
.choice-btn:hover:not(:disabled)::before { opacity: 1; }
.choice-btn:active:not(:disabled) { transform: translateY(-1px) scale(0.97); }
.choice-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.choice-btn.selected {
  border-color: var(--blue);
  background: var(--current-bg);
  box-shadow: 0 0 20px rgba(27,110,243,0.4);
}

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes cardReveal {
  from { transform: scale(0.5) rotateY(90deg); opacity: 0; }
  to   { transform: scale(1) rotateY(0deg);    opacity: 1; }
}

@keyframes winPulse {
  0%, 100% { box-shadow: 0 0 14px var(--green-glow); }
  50%       { box-shadow: 0 0 28px rgba(0,201,123,0.5), 0 0 40px rgba(0,201,123,0.2); }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.1); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1);   opacity: 1; }
}

.reveal-anim { animation: cardReveal 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.win-anim    { animation: winPulse   1.5s ease infinite; }
.bounce-in   { animation: bounceIn  0.4s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.tie-pop     { animation: tiePop    0.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.card-bounce { animation: cardBounce 0.55s cubic-bezier(0.34,1.56,0.64,1) forwards; }

@keyframes tiePop {
  0%   { transform: scale(0.7) translateY(6px); opacity: 0; }
  60%  { transform: scale(1.06) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes cardBounce {
  0%   { transform: scale(1); }
  20%  { transform: scale(0.88) rotate(-4deg); }
  50%  { transform: scale(1.15) rotate(3deg); }
  75%  { transform: scale(0.96) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.btn-cashout:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.win-anim    { animation: winPulse   1.5s ease infinite; }
.bounce-in   { animation: bounceIn  0.4s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ── GAME OVER OVERLAY ───────────────────────────────────────── */
.gameover-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.gameover-overlay.show { display: flex; }

.gameover-box {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  animation: bounceIn 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.gameover-box.win-box  { border-color: var(--green); }
.gameover-box.lose-box { border-color: #e84040; }

.gameover-icon  { font-size: 64px; margin-bottom: 16px; }
.gameover-title { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.gameover-box.win-box  .gameover-title { color: var(--green); }
.gameover-box.lose-box .gameover-title { color: #e84040; }

.gameover-amount {
  font-size: 40px;
  font-weight: 700;
  color: var(--text-bright);
  font-family: 'Space Mono', monospace;
  margin-bottom: 24px;
}
.gameover-box.win-box .gameover-amount { color: var(--green); }

.gameover-btn {
  width: 100%;
  background: var(--blue);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}
.gameover-btn:hover { background: var(--blue-bright); }

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--card-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── AUTO PANEL ──────────────────────────────────────────────── */
.strategy-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.strategy-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.strategy-btn:hover { border-color: var(--blue); color: var(--text-bright); }
.strategy-btn.active {
  background: rgba(27,110,243,0.15);
  border-color: var(--blue);
  color: var(--blue-bright);
}

.toggle-row {
  margin-bottom: 8px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

.btn-stop {
  width: 100%;
  background: linear-gradient(135deg, #c0392b, #e84040);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(232,64,64,0.25);
}
.btn-stop:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(232,64,64,0.4); }

.auto-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.stat-cell {
  background: var(--card-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  font-family: 'Space Mono', monospace;
}
.stat-val.loss { color: #e84040; }
.stat-val.tie  { color: #f0c040; }

.stat-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Auto net profit color */
.payout-amount.profit { color: var(--green); }
.payout-amount.loss   { color: #e84040; }

/* ── INPUT ERROR STATE ───────────────────────────────────────── */
.input-error {
  font-size: 12px;
  font-weight: 600;
  color: #e84040;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin-bottom 0.2s ease;
  margin-bottom: 0;
}
.input-error.show {
  max-height: 40px;
  opacity: 1;
  margin-bottom: 6px;
}

input.input-invalid {
  border-color: #e84040 !important;
  box-shadow: 0 0 0 2px rgba(232,64,64,0.2);
}

@keyframes inputShake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-7px); }
  30%     { transform: translateX(6px); }
  45%     { transform: translateX(-5px); }
  60%     { transform: translateX(4px); }
  75%     { transform: translateX(-2px); }
  90%     { transform: translateX(2px); }
}
.input-shake {
  animation: inputShake 0.45s cubic-bezier(0.36,0.07,0.19,0.97) forwards;
}

/* ── PAYOUT COUNTER BAR ──────────────────────────────────────── */
.payout-bar {
  display: flex;
  align-items: stretch;
  background: var(--card-dark);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.payout-bar-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 12px 28px;
  flex: 1;
}

.payout-bar-divider {
  width: 1px;
  background: var(--border);
  margin: 10px 0;
}

.payout-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.payout-bar-amount {
  font-family: 'Space Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
  transition: color 0.3s;
}

.payout-bar-amount.active {
  color: var(--green);
  text-shadow: 0 0 20px rgba(0,201,123,0.4);
}

.payout-bar-amount.locked {
  color: var(--blue-bright);
  text-shadow: 0 0 16px rgba(58,139,255,0.35);
}

.payout-bar-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

@keyframes payoutPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.payout-pop {
  animation: payoutPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── MAX BUTTON ──────────────────────────────────────────────── */
.max-btn {
  background: rgba(27,110,243,0.15);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-bright);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.max-btn:hover {
  background: var(--blue);
  color: white;
}

/* ── DEMO LABEL (hide on small screens) ─────────────────────── */
.demo-label {
  font-size: 13px;
  color: var(--text-dim);
}

/* ── MOBILE SIDEBAR TOGGLE ───────────────────────────────────── */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--blue);
  border: none;
  border-radius: 50px;
  padding: 12px 28px;
  font-size: 20px;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(27,110,243,0.5);
  transition: all 0.2s;
}
.mobile-sidebar-toggle:hover { background: var(--blue-bright); }

.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 149;
  backdrop-filter: blur(2px);
}
.mobile-sidebar-backdrop.show { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Header */
  header {
    padding: 0 14px;
    height: 48px;
  }
  .demo-label { display: none; }
  .wallet-btn { display: none; }
  .logo { font-size: 15px; }
  .balance { font-size: 13px; padding: 5px 10px; }

  /* App body: stack vertically, game area takes full screen */
  .app-body {
    flex-direction: column;
    position: relative;
  }

  /* Sidebar becomes a slide-up drawer from the bottom */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border-right: none;
    border-top: 2px solid var(--border-light);
    border-radius: 20px 20px 0 0;
    z-index: 150;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    padding: 20px 16px 32px;
    /* Drag handle */
  }
  .sidebar::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto 16px;
  }
  .sidebar.mobile-open {
    transform: translateY(0);
  }

  /* Show toggle button on mobile */
  .mobile-sidebar-toggle { display: flex; align-items: center; gap: 8px; }
  .mobile-sidebar-toggle::after { content: 'Bet'; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 14px; }

  /* Game area takes full height */
  .game-area {
    flex: 1;
    height: calc(100vh - 48px);
    padding-bottom: 80px; /* room for the toggle button */
  }

  /* Payout bar compact on mobile */
  .payout-bar {
    padding: 0;
  }
  .payout-bar-col {
    padding: 8px 14px;
  }
  .payout-bar-amount {
    font-size: 18px;
  }
  .payout-bar-label {
    font-size: 10px;
  }
  .payout-bar-meta {
    font-size: 11px;
  }

  /* Bracket container — no centering on mobile, scroll naturally */
  .bracket-container {
    padding: 16px 12px;
    justify-content: flex-start;
  }

  /* Cards slightly smaller */
  .game-card {
    width: 64px;
    height: 64px;
    font-size: 26px;
    border-radius: 10px;
  }
  .mult-badge {
    font-size: 11px;
    padding: 3px 10px;
  }
  .h-connector { width: 32px; }

  /* Choice buttons — bigger tap targets */
  .choice-row {
    padding: 12px 16px 16px;
    gap: 10px;
  }
  .choice-btn {
    width: 80px;
    height: 80px;
    font-size: 32px;
    border-radius: 16px;
  }

  /* Game header */
  .game-header {
    padding: 10px 14px;
  }
  .game-title { font-size: 14px; }

  /* Gameover box */
  .gameover-box {
    padding: 28px 20px;
  }
  .gameover-icon  { font-size: 48px; }
  .gameover-title { font-size: 24px; }
  .gameover-amount { font-size: 32px; }
}

@media (max-width: 400px) {
  .choice-btn {
    width: 70px;
    height: 70px;
    font-size: 28px;
  }
  .game-card {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  .h-connector { width: 24px; }
}

/* ── CARD OWNER LABELS ───────────────────────────────────────── */
.card-owner-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 6px;
  text-align: center;
  width: 100%;
}

.you-label {
  color: var(--blue-bright);
  background: rgba(27,110,243,0.15);
  border: 1px solid rgba(27,110,243,0.4);
  box-shadow: 0 0 8px rgba(27,110,243,0.15);
}

.cpu-label {
  color: #e84040;
  background: rgba(232,64,64,0.12);
  border: 1px solid rgba(232,64,64,0.3);
  box-shadow: 0 0 8px rgba(232,64,64,0.1);
}

/* Player just revealed — soft blue glow before result */
.game-card.player-revealed {
  border-color: var(--blue-bright);
  background: rgba(27,110,243,0.12);
  box-shadow: 0 0 18px rgba(27,110,243,0.35);
}

/* CPU card in suspense — dimmed pulsing state */
.game-card.cpu-waiting {
  border-color: var(--border);
  background: var(--card-dark);
  color: var(--text-dim);
  font-size: 22px;
  animation: cpuWait 0.7s ease-in-out infinite alternate;
}

@keyframes cpuWait {
  from { opacity: 0.4; transform: scale(0.96); }
  to   { opacity: 0.85; transform: scale(1.02); }
}

/* ── CHOICE SECTION HEADER ───────────────────────────────────── */
.choice-section {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.choice-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
}

.choice-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px 0;
}

.choice-you-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-bright);
  background: rgba(27,110,243,0.12);
  border: 1px solid rgba(27,110,243,0.3);
  border-radius: 20px;
  padding: 3px 12px;
  letter-spacing: 0.4px;
}

.choice-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

.choice-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 10px 24px 18px;
}
/* Remove old ::before since it's now on .choice-section */
.choice-row::before { display: none; }

/* Choice button label */
.choice-btn {
  flex-direction: column;
  gap: 4px;
}

.choice-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.choice-btn:hover:not(:disabled) .choice-label,
.choice-btn.selected .choice-label {
  color: var(--text-bright);
}

/* ── RESPONSIVE: choice section ─────────────────────────────── */
@media (max-width: 768px) {
  .choice-section-header {
    padding: 6px 14px 0;
  }
  .choice-row {
    padding: 8px 14px 14px;
  }
}

/* ── FLOATING PAYOUT TEXT ────────────────────────────────────── */
.floating-payout {
  position: fixed;
  transform: translateX(-50%);
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 12px rgba(0,201,123,0.7);
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  animation: floatUp 1.4s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes floatUp {
  0%   { opacity: 0;   transform: translateX(-50%) translateY(0px)   scale(0.7); }
  15%  { opacity: 1;   transform: translateX(-50%) translateY(-10px) scale(1.15); }
  60%  { opacity: 1;   transform: translateX(-50%) translateY(-38px) scale(1); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-60px) scale(0.9); }
}

/* ── GAME TOAST NOTIFICATION ─────────────────────────────────── */
.game-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  padding: 12px 24px;
  border-radius: 50px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  animation: toastFade 2.2s cubic-bezier(0.4,0,0.2,1) forwards;
}

.game-toast-win {
  background: rgba(0,201,123,0.15);
  border: 1px solid var(--green);
  color: var(--green);
  box-shadow: 0 4px 24px rgba(0,201,123,0.25);
}

.game-toast-lose {
  background: rgba(232,64,64,0.15);
  border: 1px solid #e84040;
  color: #e84040;
  box-shadow: 0 4px 24px rgba(232,64,64,0.2);
}

@keyframes toastFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0px); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(0px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* bracket-container needs relative positioning for absolute toast */
.bracket-container { position: relative; }

/* ── NO BET FLOAT ────────────────────────────────────────────── */
.no-bet-float {
  position: fixed;
  transform: translateX(-50%);
  background: rgba(240,192,64,0.15);
  border: 1px solid #f0c040;
  color: #f0c040;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  animation: noBetFloat 1.8s cubic-bezier(0.4,0,0.2,1) forwards;
}

@keyframes noBetFloat {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0px)   scale(0.85); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.05); }
  65%  { opacity: 1; transform: translateX(-50%) translateY(-28px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.95); }
}

/* Inactive state — dim but still clickable */
.choice-btn.btn-inactive {
  opacity: 0.3;
  cursor: pointer; /* keep pointer so click fires */
}
.choice-btn.btn-inactive:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-light);
}