:root {
  --bg: #0e0e1a;
  --panel: #1b1b2b;
  --panel-2: #23233a;
  --line: #2e2e44;
  --accent: #e59407;
  --accent-2: #ffd900;
  --green: #28a745;
  --green-2: #1e7e34;
  --red: #e8453c;
  --text: #e9e9f1;
  --muted: #9a9ab0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 940px;
  margin: 0 auto;
  padding: 12px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 22px; }
.brand-icon { color: var(--red); transform: rotate(-20deg); display: inline-block; }
.brand-name { color: var(--accent-2); letter-spacing: 1px; }
.balance-box { display: flex; flex-direction: column; align-items: flex-end; }
.balance-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.balance-value { font-size: 20px; font-weight: 700; color: var(--accent-2); }
.balance-value small { font-size: 12px; color: var(--muted); }

/* ---------- history strip ---------- */
.history {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 4px;
  scrollbar-width: thin;
}
.history::-webkit-scrollbar { height: 6px; }
.history::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.history .chip {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ---------- game canvas ---------- */
.game-area {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 30% 60%, #2a1342 0%, #11041f 60%, #0a0212 100%);
}
#game { display: block; width: 100%; height: auto; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0,0,0,0.6);
}
.multiplier {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 1px;
  transition: color .15s ease;
}
.multiplier.crashed { color: var(--red); }
.status {
  margin-top: 6px;
  font-size: 16px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.status.crashed { color: var(--red); font-weight: 700; }

/* ---------- bet panels ---------- */
.bet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.bet-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.panel-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  flex: 1;
  padding: 6px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.tab.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

.stake-row { display: flex; align-items: center; gap: 8px; }
.stepper {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}
.stepper:hover { background: #2f2f48; }
.stake-input, .auto-target {
  background: #11111c;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  padding: 8px;
}
.stake-input { flex: 1; width: 100%; }

.quick-row { display: flex; gap: 6px; margin-top: 8px; }
.quick {
  flex: 1;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.quick:hover { color: var(--text); background: #2f2f48; }

.auto-cashout {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 2px;
  font-size: 13px;
  color: var(--muted);
}
.auto-target { width: 78px; font-size: 14px; padding: 5px; }

.action-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  transition: transform .05s ease, filter .15s ease;
}
.action-btn:active { transform: scale(0.98); }
.action-btn.idle    { background: linear-gradient(180deg, #2fb84d, var(--green-2)); }   /* place a bet */
.action-btn.queued  { background: linear-gradient(180deg, #d39e00, #a07800); }            /* waiting for round */
.action-btn.cashout { background: linear-gradient(180deg, #ffb43a, var(--accent)); color:#1a1a1a; } /* cash out live */
.action-btn:disabled { filter: grayscale(.5) brightness(.7); cursor: not-allowed; }

/* ---------- footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.sound-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 10px;
}

@media (max-width: 620px) {
  .bet-grid { grid-template-columns: 1fr; }
  .multiplier { font-size: 48px; }
}
