/* CrashTop — visual system */
:root {
  --bg: #06080c;
  --bg-soft: #0a0e15;
  --card: rgba(255, 255, 255, 0.028);
  --card-solid: #0d1219;
  --line: rgba(126, 126, 126, 0.075);
  --line-soft: rgba(255, 255, 255, 0.045);
  --text: #e9eef7;
  --text-dim: #9aa6ba;
  --text-mute: #6b7688;
  --mint: #12d899;
  --mint-deep: #13b98b;
  --amber: #ffb45c;
  --amber-deep: #ff9a3d;
  --red: #f00f0f;
  --violet: #5a1aa3;
  --orange: #e75d00;
  --blue: #0063f8;
  --green: #00c853;
  --radius: 4px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --ring-width: 1.2;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
::selection { background: rgba(60, 230, 176, 0.25); }

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  pointer-events: none;
  background:
    radial-gradient(48% 60% at 18% 10%, rgba(60, 230, 176, 0.09), transparent 62%),
    radial-gradient(42% 55% at 78% 0%, rgba(139, 123, 255, 0.09), transparent 65%),
    radial-gradient(38% 45% at 55% 80%, rgba(255, 180, 92, 0.05), transparent 70%);
  filter: blur(10px);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px clamp(14px, 2vw, 28px) 26px;
}

/* ---------------- top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 4px 2px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #04120d;
  background: linear-gradient(145deg, #40f0b5, var(--mint) 45%, #6ef3b5);
  box-shadow: 0 8px 26px rgba(60, 230, 176, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.brand-mark svg { width: 26px; height: 26px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-name span { color: var(--mint); }

.badge-version {
  margin-left: 2px;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  border: 1px solid #fd7e0725;
  background: rgba(207, 84, 12, 0.13);
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.navlink {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.18s, background 0.18s;
}

.navlink:hover { color: var(--text); }
.navlink.is-active { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
  transition: 0.18s;
}

.icon-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .ico-off { display: none; }
body:not(.sound-on) .icon-btn .ico-on { display: none; }
body:not(.sound-on) .icon-btn .ico-off { display: block; }

.balance-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(207, 216, 213, 0.11);
  background: linear-gradient(180deg, rgba(21, 180, 130, 0.068), rgba(10, 212, 148, 0.116));
}

.balance-label { color: var(--text-mute); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.balance-pill strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.balance-unit { color: var(--text-mute); font-size: 11px; }

.ghost-btn {
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  transition: 0.18s;
}
.ghost-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.008)),
    var(--card-solid);
  box-shadow: var(--shadow);
}

.stage {
  overflow: hidden;
  min-width: 0;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 6px;
}

.round-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.round-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dot-sep { color: var(--text-mute); }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  box-shadow: 0 0 0 0 rgba(60, 230, 176, 0.4);
  transition: background 0.11s;
}
.live-dot.is-live { background: var(--mint); animation: pulse 1.1s infinite; }
.live-dot.is-bust { background: var(--red); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(60, 230, 176, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(60, 230, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(60, 230, 176, 0); }
}

.stage-stats { display: flex; gap: 22px; }
.mini-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mini-stat span { color: var(--text-mute); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; }
.mini-stat b { font-family: var(--font-display); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------------- chart ---------------- */
.chart-wrap {
  position: relative;
  height: clamp(310px, 40vh, 430px);
  margin: 0 8px;
  overflow: hidden;
  border-radius: 16px;
}

#chart { display: block; width: 100%; height: 100%; }

.chart-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 52% at 62% 44%, rgba(60, 230, 176, 0.07), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s;
}
.chart-wrap.is-live .chart-glow { opacity: 1; }
.chart-wrap.is-bust .chart-glow {
  opacity: 1;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255, 92, 116, 0.12), transparent 70%);
}

.multiplier {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(58px, 8.4vw, 112px);
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #eff1f5;
  text-shadow: 0 3px 26px rgba(0, 0, 0, 0.55), 0 0 44px rgba(60, 230, 176, 0.16);
  pointer-events: none;
  transition: color 0.35s, text-shadow 0.35s, opacity 0.3s;
  white-space: nowrap;
}
.multiplier .mult-x { font-size: 0.46em; margin-left: 0.06em; color: var(--text); font-weight: 600; }
.multiplier.is-hot { color: var(--amber); text-shadow: 0 0 54px rgba(92, 195, 255, 0.28); }
.multiplier.is-hot .mult-x { color: rgb(53, 255, 228); }
.multiplier.is-bust { color: var(--red); text-shadow: 0 0 60px rgba(255, 92, 92, 0.35); }
.multiplier.is-bust .mult-x { color: rgba(255, 92, 92, 0.7); }
.multiplier.is-idle { opacity: 0.5; font-size: clamp(44px, 6vw, 76px); }
.multiplier.is-ghost { opacity: 0; }
.chart-wrap.is-bust .multiplier { opacity: 0; }

.multiplier.pop { animation: pop 0.42s var(--ease); }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(1); }
  35% { transform: translate(-50%, -50%) scale(1.06); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.countdown {
  white-space: nowrap;
  max-width: calc(100% - 28px);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px 12px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.7);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s, transform 0.3s;
}
.countdown.is-hidden { opacity: 0; transform: translate(-50%, -44%) scale(0.96); pointer-events: none; }

.countdown .ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 2.4; }
.ring-fg {
  fill: none;
  stroke: var(--mint);
  stroke-width: var(--ring-width);
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px rgba(60, 230, 176, 0.5));
  transition: stroke 0.3s;
}
.countdown.is-closing .ring-fg { stroke: var(--amber); }

.countdown-text { display: flex; flex-direction: column; line-height: 1.2; }
.countdown-text span { color: var(--text-mute); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.countdown-text b { font-family: var(--font-display); font-size: 17px; font-variant-numeric: tabular-nums; }

.bust-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  pointer-events: none;
}
.bust-overlay.is-visible { opacity: 1; transform: scale(1); }
.bust-word {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.986);
  text-shadow: 0 0 50px rgba(51, 51, 51, 0.4);
}
.bust-overlay strong {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6), 0 0 70px rgba(255, 92, 116, 0.5);
  font-variant-numeric: tabular-nums;
}

.chart-footnote {
  display: none !important;
  position: absolute;
  left: 18px;
  top: 10px;
  color: var(--text-mute);
  font-size: 11px;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.3s;
  opacity: 0.85;
}

.chart-wrap.shake { animation: shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ---------------- history ---------------- */
.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 4px;
}

.history {
  display: flex;
  gap: 6px;
  overflow: hidden;
  flex: 1;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}

.history-pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  animation: slidein 0.35s var(--ease);
}
@keyframes slidein {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
.history-pill.low { color: #ff8fa0; background: rgba(255, 92, 116, 0.09); border-color: rgba(255, 92, 116, 0.18); }
.history-pill.mid { color: #6ff0c8; background: rgba(60, 230, 176, 0.08); border-color: rgba(60, 230, 176, 0.16); }
.history-pill.high { color: var(--amber); background: rgba(255, 180, 92, 0.1); border-color: rgba(255, 180, 92, 0.22); }

.history-more {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-mute);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: 0.18s;
}
.history-more:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }

/* ---------------- panels / tables ---------------- */
.panel-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.panel-tab {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: 0.18s;
}
.panel-tab:hover { color: var(--text-dim); }
.panel-tab.is-active { color: var(--text); border-bottom-color: var(--mint); }
.panel-tab-spacer { flex: 1; }
.panel-note { color: var(--text-mute); font-size: 10.5px; letter-spacing: 0.04em; }

.panel-body { padding: 6px 10px 12px; }

.panel-view { display: none; }
.panel-view.is-active { display: block; animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 0.9fr 0.9fr 0.9fr;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text-mute);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ta-r { text-align: right; }

.rows { max-height: 252px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
.rows::-webkit-scrollbar { width: 6px; }
.rows::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 0.9fr 0.9fr 0.9fr;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s;
}
.row:nth-child(odd) { background: rgba(255, 255, 255, 0.012); }
.row:hover { background: rgba(255, 255, 255, 0.04); }
.row.is-me {
  background: linear-gradient(90deg, rgba(60, 230, 176, 0.11), rgba(60, 230, 176, 0.02));
  box-shadow: inset 2px 0 0 var(--mint);
}
.row.is-cashed .row-x { color: var(--mint); }
.row.is-lost { opacity: 0.55; }
.row.is-lost .row-x { color: var(--red); }
.row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar {
  width: 22px; height: 22px; flex: 0 0 auto;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em;
  color: #06100c;
}
.row-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .tag { font-size: 9px; color: var(--mint); border: 1px solid rgba(60, 230, 176, 0.3); padding: 1px 4px; border-radius: 4px; }
.row-bet { color: var(--text-dim); }
.row-x { color: var(--text-mute); }
.row-pay { text-align: right; color: var(--text); }
.row-pay.win { color: var(--mint); }
.row-pay.loss { color: var(--text-mute); }

.table-more { padding: 8px 10px 2px; color: var(--text-mute); font-size: 11px; }
.empty { padding: 26px 10px; text-align: center; color: var(--text-mute); font-size: 12.5px; }

/* round info */
.round-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
}
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv span { color: var(--text-mute); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.kv b { font-family: var(--font-display); font-size: 14px; font-variant-numeric: tabular-nums; }
.kv.wide { grid-column: 1 / -1; }
.kv code {
  display: block;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  color: var(--text-dim);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.soft-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  transition: 0.18s;
  width: max-content;
}
.soft-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.05); }

#panel-round .soft-btn { margin: 2px 10px 12px; }

/* ---------------- side ---------------- */
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }

.bet-card { padding: 18px; }
.bet-card.card--inline { margin: 10px 10px 4px; }

.bet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.bet-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.auto-pill {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
}
.auto-pill.is-on { color: var(--mint); border-color: rgba(60, 230, 176, 0.3); background: rgba(60, 230, 176, 0.07); }

.field { margin-bottom: 14px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text-dim);
  font-size: 12px;
}
.field-hint { color: var(--text-mute); font-size: 11px; font-variant-numeric: tabular-nums; }

.input-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.input-shell:focus-within { border-color: rgba(60, 230, 176, 0.45); box-shadow: 0 0 0 4px rgba(60, 230, 176, 0.07); }
.input-shell input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.input-shell input::placeholder { color: var(--text-mute); }
.input-unit { color: var(--text-mute); font-size: 12px; }
.input-shell.is-disabled { opacity: 0.42; pointer-events: none; }

.chip-row { display: flex; gap: 6px; margin-top: 8px; }
.chip {
  flex: 1;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: 0.16s;
  padding: 0;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.05); }
.chip.is-active { color: #06120e; background: linear-gradient(180deg, #7bffd6, var(--mint)); border-color: transparent; font-weight: 600; }

.switch { position: relative; display: inline-flex; align-items: center; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  transition: 0.2s;
  display: block;
}
.switch-thumb {
  display: block;
  width: 16px; height: 16px;
  margin: 2px;
  border-radius: 50%;
  background: #8d97a8;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.switch input:checked + .switch-track { background: rgba(60, 230, 176, 0.22); border-color: rgba(60, 230, 176, 0.4); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: var(--mint); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(60, 230, 176, 0.18); }

.auto-bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
}
.auto-bet-row b { display: block; font-size: 12.5px; font-weight: 500; }
.auto-bet-row small { color: var(--text-mute); font-size: 11px; }

.action-btn {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #2ee45b, #36d164 10%, #5ad856);
  color: #04130e;
  box-shadow: 0 12px 34px rgba(60, 230, 176, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: transform 0.14s var(--ease), box-shadow 0.2s, filter 0.2s, background 0.25s, color 0.2s;
}
.action-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 42px rgba(60, 230, 176, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.action-btn:active:not(:disabled) { transform: translateY(0); }
.action-btn:disabled { filter: grayscale(0.4) brightness(0.7); box-shadow: none; }
.action-main { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.action-sub { font-size: 11px; opacity: 0.62; font-weight: 500; }

.action-btn.is-cashout {
  background: linear-gradient(180deg, #ffd693, var(--amber) 45%, #ff9a3d);
  color: #1b0f02;
  box-shadow: 0 12px 34px rgba(255, 180, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: cashPulse 1.8s infinite;
}
@keyframes cashPulse {
  0%, 100% { box-shadow: 0 12px 34px rgba(255, 180, 92, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
  50% { box-shadow: 0 14px 44px rgba(255, 180, 92, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
}

.action-btn.is-cashed {
  background: rgba(60, 230, 176, 0.1);
  color: var(--mint);
  border: 1px solid rgba(60, 230, 176, 0.32);
  box-shadow: none;
  filter: none;
}

.action-btn.is-queued {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--line);
  box-shadow: none;
  filter: none;
}

.bet-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 12px 2px 2px;
  font-size: 11.5px;
  color: var(--text-mute);
}
.bet-summary div { display: flex; flex-direction: column; gap: 2px; }
.bet-summary div:last-child { text-align: right; }
.bet-summary b { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.session-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.session-strip div { display: flex; flex-direction: column; gap: 2px; }
.session-strip span { color: var(--text-mute); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; }
.session-strip b { font-family: var(--font-display); font-size: 13px; font-variant-numeric: tabular-nums; }
.session-strip b.pos { color: var(--mint); }
.session-strip b.neg { color: var(--red); }

.fair-teaser { padding: 16px 18px; }
.fair-teaser-head { display: flex; gap: 12px; margin-bottom: 12px; }
.shield {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--mint);
  background: rgba(60, 230, 176, 0.08);
  border: 1px solid rgba(60, 230, 176, 0.18);
}
.shield svg { width: 19px; height: 19px; }
.fair-teaser b { font-size: 13px; display: block; margin-bottom: 3px; }
.fair-teaser p { margin: 0; color: var(--text-mute); font-size: 11.5px; line-height: 1.5; }

/* ---------------- footer ---------------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px 0;
  color: var(--text-mute);
  font-size: 11.5px;
}
.footer-links { display: flex; gap: 14px; }
.footer-links button {
  background: none; border: 0; padding: 0;
  color: var(--text-mute); font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.15);
}
.footer-links button:hover { color: var(--text-dim); }

/* ---------------- modals ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-scrim {
  position: absolute; inset: 0;
  background: rgba(3, 5, 8, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #10151d, #0a0e14);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
  animation: modalin 0.28s var(--ease);
  scrollbar-width: thin;
}
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 19px; letter-spacing: -0.02em; }
.modal-head p { margin: 0; color: var(--text-mute); font-size: 12px; }
.modal-head code, .fair-note code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
}

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

.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.verify-field { display: flex; flex-direction: column; gap: 5px; }
.verify-field.wide { grid-column: 1 / -1; }
.verify-field span { color: var(--text-mute); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; }
.verify-field input {
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  outline: none;
}
.verify-field input:focus { border-color: rgba(60, 230, 176, 0.4); }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; }
.copy-btn {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-mute);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.copy-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }

.verify-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.action-btn.compact { width: auto; min-height: 44px; padding: 0 20px; font-size: 13px; flex-direction: row; }
.action-btn.compact .action-main { font-size: 13px; }
.verify-result { font-size: 12px; color: var(--text-mute); }
.verify-result.ok { color: var(--mint); }
.verify-result.bad { color: var(--red); }

.formula { margin-top: 16px; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.formula summary {
  padding: 11px 14px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
}
.formula pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  color: #b6c4d8;
}

.fair-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid rgba(60, 230, 176, 0.14);
  background: rgba(60, 230, 176, 0.045);
  color: var(--text-mute);
  font-size: 11.5px;
  line-height: 1.55;
}

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
.stat span { color: var(--text-mute); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; display: block; margin-bottom: 5px; }
.stat b { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; }

.dist-title { margin: 20px 0 10px; font-size: 12px; font-weight: 500; color: var(--text-dim); }
.dist { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: grid; grid-template-columns: 74px 1fr 44px; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-mute); }
.dist-bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.dist-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), #7bffd6); transition: width 0.4s var(--ease); }
.dist-row:nth-child(1) .dist-fill { background: linear-gradient(90deg, #ff5c74, #ff8fa0); }
.dist-row:nth-child(5) .dist-fill { background: linear-gradient(90deg, var(--amber-deep), #ffd693); }
.dist-row b { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------------- toasts ---------------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  min-width: 210px;
  max-width: 320px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  font-size: 12.5px;
  color: var(--text-dim);
  animation: toastin 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 9px;
}
.toast.leaving { animation: toastout 0.25s ease forwards; }
.toast b { color: var(--text); font-variant-numeric: tabular-nums; }
.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); flex: 0 0 auto; }
.toast.win .t-dot { background: var(--mint); box-shadow: 0 0 12px rgba(60, 230, 176, 0.6); }
.toast.loss .t-dot { background: var(--red); box-shadow: 0 0 12px rgba(255, 92, 116, 0.6); }
.toast.info .t-dot { background: var(--amber); }
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(6px); } }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .side { position: static; }
  .stage-stats { gap: 14px; }
}

@media (max-width: 900px) {
  .topnav { display: none; }
  .layout { grid-template-columns: 1fr; }
  .side { order: 2; }
  .stage { order: 1; }
  .chart-wrap { height: clamp(280px, 44vh, 380px); }
  .multiplier { font-size: clamp(46px, 12vw, 84px); }
  .stage-stats { display: none; }
  .footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 620px) {
  .app { padding: 12px 10px 20px; }
  .topbar { gap: 10px; flex-wrap: wrap; padding-bottom: 12px; }
  .brand-name { font-size: 19px; }
  .badge-version { display: none; }
  .balance-pill { padding: 7px 10px; }
  .balance-label { display: none; }
  .ghost-btn { padding: 8px 10px; font-size: 12px; }
  .stage-head { padding: 13px 14px 4px; }
  .stage-stats { display: none; }
  .history-row { padding: 8px 12px 2px; }
  .panel-note { display: none; }
  .history { overflow-x: auto; mask-image: none; scrollbar-width: none; }
  .history::-webkit-scrollbar { display: none; }
  .modal { padding: 10px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .verify-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.history-empty { color: var(--text-mute); font-size: 11.5px; padding: 5px 2px; }
