:root {
  --bg: #12141c;
  --panel: #1c2030;
  --line: #2c3248;
  --text: #e8eaf2;
  --dim: #9aa1b5;
  --accent: #4f8cff;
  --win: #38c172;
  --lose: #e3554f;
}
* { box-sizing: border-box; }
/* The hidden attribute must win even over display rules like .cashout's. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
}
header a { color: var(--dim); text-decoration: none; }
#balance {
  font-variant-numeric: tabular-nums;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
}
main { max-width: 560px; margin: 0 auto; padding: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 6px; }
.card p { margin: 0 0 12px; color: var(--dim); }
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: wait; }
label { display: block; margin: 10px 0 4px; color: var(--dim); font-size: 0.9rem; }
input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.result {
  text-align: center;
  padding: 18px 0 6px;
  min-height: 90px;
}
.result .big { font-size: 2.6rem; font-weight: 700; }
.win { color: var(--win); }
.lose { color: var(--lose); }
.grid { border-collapse: separate; border-spacing: 6px; margin: 0 auto; }
.grid td {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.muted { color: var(--dim); font-size: 0.85rem; }
.mono { font-family: ui-monospace, monospace; font-size: 0.75rem; word-break: break-all; }
ul.history { list-style: none; padding: 0; margin: 0; }
ul.history li {
  display: flex;
  justify-content: space-between;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
details { margin-top: 12px; color: var(--dim); }
details summary { cursor: pointer; }
.error { color: var(--lose); min-height: 1.2em; margin-top: 8px; }

/* Live crash stage */
.stage {
  position: relative;
  text-align: center;
  padding: 26px 0 14px;
  min-height: 150px;
  overflow: hidden;
}
.rocket {
  font-size: 2rem;
  transition: transform 0.1s linear;
  display: inline-block;
}
.stage .mult { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stage.flying .mult { color: var(--accent); }
.stage.cashed .mult { color: var(--win); }
.stage.crashed .mult { color: var(--lose); }
.stage.crashed { animation: shake 0.35s; }
.stage.crashed .rocket { visibility: hidden; }
.subline { color: var(--dim); margin-top: 6px; min-height: 1.4em; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
button.cashout {
  display: block;
  width: 100%;
  padding: 18px;
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--win);
  border-radius: 12px;
}
/* Shared rounds + accounts */
.who { display: flex; align-items: center; gap: 10px; }
.banner {
  text-align: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.row { display: flex; gap: 10px; margin-top: 12px; }
.row button { flex: 1; }
button.alt { background: var(--panel); border: 1px solid var(--accent); color: var(--accent); }
button.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 6px 10px;
  font-size: 0.85rem;
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lose);
  vertical-align: middle;
  margin-left: 6px;
}
.dot.on { background: var(--win); }

/* Dice, cashier and admin */
.testnet {
  border: 1px solid #8a6d1f;
  background: #2a2310;
  color: #f0c04a;
  border-radius: 8px;
  padding: 9px 12px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}
.walletpick, #dirRow { display: flex; gap: 10px; }
.walletpick { margin-bottom: 10px; }
button.pick {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
button.pick.on { border-color: var(--accent); color: var(--text); }
button.pick:disabled { opacity: 0.35; cursor: not-allowed; }
button.pick .mono { font-size: 0.9rem; }
.stats {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.stats > div {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.stats span { display: block; font-size: 0.75rem; }
.stats strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
.mono.addr {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
}
.card.intro h2 { font-size: 1.1rem; }
.card.game h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
}
.pendingRow {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  gap: 6px;
}
ul.history li span:last-child { text-align: right; }

/* Top up + withdraw */
.row a { flex: 1; text-decoration: none; }
.row a button { width: 100%; }
.qrbox {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
/* White plate behind the code: scanners need the light quiet zone, and a QR
   drawn dark-on-dark simply will not read. */
.qr {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  line-height: 0;
}
.qr svg { width: 208px; height: 208px; display: block; }
.presets { display: flex; gap: 8px; }
.presets .pick { flex-direction: row; font-variant-numeric: tabular-nums; }
.warn {
  border: 1px solid #8a3a2f;
  background: #2a1512;
  color: #f0a99e;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-top: 14px;
}
.deposit {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  margin-bottom: 10px;
}
.deposit-top { display: flex; justify-content: space-between; align-items: baseline; }
.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.bar span { display: block; height: 100%; background: var(--accent); transition: width 0.4s; }
.deposit.ok .bar span { background: var(--win); }
.deposit.bad .bar span { background: var(--lose); }
ul.steps { margin: 0; padding-left: 18px; color: var(--dim); }
ul.steps li { margin-bottom: 5px; }
