/* =========================================================
   Rocket Queen – static demo
   ========================================================= */

@font-face {
  font-family: "RQ";
  src: url("../static/d40d0ea520f507eb.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #120a26;
  --bg-2: #1b1038;
  --panel: #231545;
  --panel-2: #2c1b56;
  --line: rgba(148, 78, 245, 0.18);
  --text: #f4efff;
  --muted: #948ac5;
  --purple: #944ef5;
  --pink: #e04ef5;
  --orange: #ffb025;
  --orange-2: #fb550e;
  --green: #2bd47d;
  --red: #ff453a;
  --blue: #3fa9f5;

  --radius: 14px;
  --topbar-h: 56px;
  --font: "RQ", "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

input { font: inherit; color: inherit; }

/* ---------------- top bar ---------------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.topbar__logo { height: 34px; }
.topbar__spacer { flex: 1; }

.balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--panel);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.balance img { width: 20px; }
.balance__cur { color: var(--muted); }

.topbar__icons { display: flex; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  transition: background .2s;
}
.icon-btn:hover { background: var(--panel); }
.icon-btn img { width: 22px; }

/* ---------------- layout ---------------- */
.layout {
  height: calc(100% - var(--topbar-h));
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

/* ---------------- live bets sidebar ---------------- */
.bets-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  background: var(--bg);
  border-radius: 10px;
}
.tabs__item {
  padding: 7px 0;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.tabs__item.is-active { background: var(--panel-2); color: var(--text); }

.bets-panel__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px 8px;
  font-size: 13px;
  color: var(--muted);
}
.bets-panel__players { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; }
.bets-panel__players img { width: 20px; }
.bets-panel__total b { color: var(--text); }

.bets-panel__head,
.player {
  display: grid;
  grid-template-columns: 1.4fr 1fr .8fr 1fr;
  align-items: center;
  gap: 4px;
}
.bets-panel__head {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bets-panel__head span:not(:first-child) { text-align: right; }

.bets-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-2) transparent;
}
.player {
  padding: 7px 8px;
  margin-bottom: 3px;
  border-radius: 8px;
  background: var(--panel);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  transition: background .3s, border-color .3s, opacity .3s;
}
.player > span:not(:first-child) { text-align: right; }
.player__name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.player__name em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player__ava {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800;
  color: #fff;
}
.player__coef, .player__win { color: var(--muted); }
.player.is-won { background: rgba(43, 212, 125, .12); border-color: rgba(43, 212, 125, .4); }
.player.is-won .player__coef { color: var(--blue); font-weight: 700; }
.player.is-won .player__win { color: var(--green); font-weight: 700; }
.player.is-lost { opacity: .45; }
.player.is-me { border-color: var(--orange); }

/* ---------------- game column ---------------- */
.game-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

/* history strip */
/* recent results bar – desktop: plain strip above the stage */
.results-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.results-bar .history { flex: 1; min-width: 0; }
.results-bar__bets, .results-bar__clock { display: none; }
.only-mobile { display: none; }

.history {
  display: flex;
  gap: 6px;
  overflow: hidden;
  padding: 2px 0;
  mask-image: linear-gradient(90deg, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.history__item {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-2);
  font-variant-numeric: tabular-nums;
  animation: pop-in .35s ease-out;
}
.history__item.lvl-1 { color: var(--blue); }
.history__item.lvl-2 { color: var(--purple); }
.history__item.lvl-3 { color: var(--pink); }

@keyframes pop-in {
  from { transform: translateX(-20px) scale(.8); opacity: 0; }
}

/* ---------------- stage ---------------- */
.stage {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  /* sunset sky: purple → magenta → orange */
  background: linear-gradient(180deg, #6a1cb4 0%, #8e2aab 24%, #c2468c 50%, #ea763f 76%, #f7a531 100%);
  isolation: isolate;
}

/* sky layers */
.sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.sky__glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 45% at 75% 100%, rgba(255, 214, 110, .35), transparent 70%),
    radial-gradient(55% 40% at 15% 0%, rgba(70, 12, 140, .35), transparent 70%);
}

.sky__stars {
  position: absolute; inset: -50%;
  background-repeat: repeat;
}
.sky__stars--far {
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff8, transparent),
    radial-gradient(1px 1px at 120px 80px, #fff6, transparent),
    radial-gradient(1px 1px at 200px 160px, #fff7, transparent),
    radial-gradient(1px 1px at 60px 190px, #fff5, transparent),
    radial-gradient(1px 1px at 170px 20px, #fff6, transparent);
  background-size: 240px 220px;
}
.sky__stars--near {
  background-image:
    radial-gradient(1.5px 1.5px at 40px 60px, #fff6c8, transparent),
    radial-gradient(2.5px 2.5px at 260px 120px, #ffd45a, transparent),
    radial-gradient(1.5px 1.5px at 150px 300px, #ffe9a8, transparent),
    radial-gradient(2px 2px at 330px 240px, #ffd45a, transparent);
  background-size: 380px 360px;
  opacity: .8;
}

/* parallax clouds flying past (drawn by js/sky.js) */
.sky__clouds { position: absolute; inset: 0; width: 100%; height: 100%; }

/* flying: everything drifts down/left to sell the climb */
.stage[data-phase="flying"] .sky__stars--far  { animation: drift 40s linear infinite; }
.stage[data-phase="flying"] .sky__stars--near { animation: drift 14s linear infinite; }

@keyframes drift {
  to { transform: translate(-25%, 25%); }
}

/* graph canvas */
.stage__graph {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

/* multiplier */
.stage__center {
  position: absolute;
  left: 36%; top: 30%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  pointer-events: none;
}
.multiplier {
  font-size: clamp(48px, 9vw, 110px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  /* golden gradient odds (top → bottom), in flight and on the final result */
  color: transparent;
  background: linear-gradient(180deg, #ffd593 0%, #ffc367 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 4px 22px rgba(255, 195, 103, .45));
}
.crash-label {
  font-size: clamp(16px, 2.2vw, 24px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .25);
  margin-top: 6px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s .15s, transform .3s .15s;
}
.stage[data-phase="waiting"] .stage__center { opacity: 0; }
/* final result: the odds flicker a few times fast, then hold */
.stage[data-phase="crashed"] .multiplier {
  animation: odd-flicker .14s ease-in-out 3;
}
@keyframes odd-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .12; }
}
.stage[data-phase="crashed"] .crash-label { opacity: 1; transform: none; }
/* after a crash the final multiplier glides to the centre of the stage */
.stage[data-phase="crashed"] .stage__center {
  left: 50%; top: 50%;
  transition: left .45s cubic-bezier(.2,.8,.2,1), top .45s cubic-bezier(.2,.8,.2,1);
}

/* waiting overlay */
.waiting {
  position: absolute;
  left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.stage[data-phase="waiting"] .waiting { opacity: 1; }
.waiting__spinner { width: 64px; }
.waiting__title {
  white-space: nowrap;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.waiting__bar {
  width: min(260px, 60vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  overflow: hidden;
}
.waiting__fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-2), var(--orange));
  transform-origin: left;
}
.waiting__time { color: rgba(255,255,255,.85); font-weight: 700; font-variant-numeric: tabular-nums; }

/* toasts */
.toasts {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #128a52, #1fb36b);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  font-weight: 700;
  white-space: nowrap;
  animation: toast 3s ease forwards;
}
.toast small { display: block; font-size: 11px; opacity: .8; font-weight: 600; }
.toast b { font-size: 18px; }
@keyframes toast {
  0%   { opacity: 0; transform: translateY(-12px); }
  10%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-12px); }
}

/* ---------------- bet controls ---------------- */
.bet-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bet-card {
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  border: 1px solid transparent;
  transition: border-color .3s;
}
.bet-card[data-state="placed"],
.bet-card[data-state="queued"] { border-color: rgba(255, 69, 58, .5); }
.bet-card[data-state="active"]  { border-color: rgba(255, 176, 37, .6); }

.bet-card__tabs {
  display: flex;
  justify-content: center;
  margin: 0 auto 10px;
  width: 160px;
  padding: 3px;
  background: var(--bg);
  border-radius: 999px;
}
.bet-card__tab {
  flex: 1;
  padding: 4px 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.bet-card__tab.is-active { background: var(--panel-2); color: var(--text); }

.bet-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 10px;
}
.bet-card__left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.stepper {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 999px;
  padding: 3px;
}
.stepper__btn {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--panel-2);
  font-size: 18px;
  line-height: 1;
}
.stepper__input {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: none;
  border: 0;
  outline: 0;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.chip {
  padding: 4px 0;
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.chip:hover { background: var(--panel-2); color: var(--text); }

.bet-card[data-state]:not([data-state="idle"]) .stepper,
.bet-card[data-state]:not([data-state="idle"]) .chips { opacity: .5; pointer-events: none; }

/* main bet button */
.bet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  background: linear-gradient(180deg, #34e08a, #18a85f);
  box-shadow: 0 4px 0 #0f7a44, inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .1s, filter .2s;
  min-height: 72px;
}
.bet-btn:hover { filter: brightness(1.08); }
.bet-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0f7a44; }
.bet-btn__title { font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.bet-btn__sub { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bet-card[data-state="placed"] .bet-btn,
.bet-card[data-state="queued"] .bet-btn {
  background: linear-gradient(180deg, #ff6a5f, #d8342b);
  box-shadow: 0 4px 0 #9b1f18, inset 0 1px 0 rgba(255,255,255,.3);
}
.bet-card[data-state="active"] .bet-btn {
  background: linear-gradient(180deg, var(--orange), var(--orange-2));
  box-shadow: 0 4px 0 #a63506, inset 0 1px 0 rgba(255,255,255,.35);
}
.bet-card[data-state="active"] .bet-btn__sub { font-size: 18px; }

/* auto cash out row */
.bet-card__auto {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.bet-card.is-auto .bet-card__auto { display: flex; }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.switch input { display: none; }
.switch__track {
  position: relative;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--panel-2);
  transition: background .2s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }

.auto-input {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg);
  font-weight: 800;
}
.auto-input input {
  width: 52px;
  background: none;
  border: 0;
  outline: 0;
  text-align: right;
  font-weight: 800;
}
.auto-input input:disabled { opacity: .5; }

/* ---------------- responsive ---------------- */
/* ---------------- sidebar tabs: All / My / Top ---------------- */
.tabs__item { transition: background .2s, color .2s; }
.tabs__item.is-active { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }
.tab-pane { display: none; flex-direction: column; min-height: 0; flex: 1; }
.tab-pane.is-active { display: flex; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty-note { color: var(--muted); font-size: 13px; padding: 16px 8px; text-align: center; }

/* my bets */
.bets-panel__head--my { margin-top: 10px; }
.my-bet__time { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.fair-btn { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--muted); background: var(--panel-2); }
.fair-btn:hover { color: var(--text); }

/* top filters */
.top-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 10px; }
.select select {
  width: 100%; appearance: none; -webkit-appearance: none;
  padding: 9px 30px 9px 12px; border: 0; border-radius: 9px;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23f4efff%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M6 9l6 6 6-6%22/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.select select:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }

/* top cards */
.top-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--panel-2) transparent; }
.top-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 148px 22px; gap: 6px; align-items: center;
  padding: 8px; margin-bottom: 8px; border-radius: 12px; background: var(--panel);
}
.top-card.is-me { box-shadow: inset 0 0 0 1.5px var(--orange); }
.top-card__who { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-left: 4px; }
.top-card__who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-card__ava {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-size: 11px; font-weight: 800; color: #fff;
}
.top-card__rows { display: grid; gap: 5px; }
.kv {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5px 8px; border-radius: 7px; background: var(--bg-2); font-size: 12.5px;
}
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.mult-chip { padding: 2px 8px; border-radius: 6px; color: #fff; font-size: 12px; }
.mult-chip.lvl-1 { background: #3d55c4; }
.mult-chip.lvl-2 { background: #7b3fe4; }
.mult-chip.lvl-3 { background: #e88a0c; }
.top-card__actions { display: grid; gap: 5px; }
.top-card__actions button {
  height: 26px; border-radius: 6px; display: grid; place-items: center;
  color: var(--muted); background: var(--panel-2); transition: color .2s, background .2s;
}
.top-card__actions button:hover { color: var(--text); background: var(--line); }

/* ---------------- dialogs: fairness check, rules, limits ---------------- */
dialog.fair {
  width: min(780px, calc(100vw - 16px)); max-height: calc(100vh - 32px);
  padding: 16px; border: 0; border-radius: 16px;
  background: #2a2147; color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
dialog.fair::backdrop { background: rgba(8, 4, 20, .6); }
dialog.fair[open] { animation: dlg-in .25s cubic-bezier(.2, .9, .25, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.fair__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fair__head h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.fair__shield { color: var(--purple); }
.fair__box { padding: 14px; margin-bottom: 14px; border-radius: 12px; background: #352b58; }
.fair__box h4 { margin: 0 0 12px; font-size: 13px; }
.fair__pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fair__pill { padding: 7px 12px; border-radius: 8px; background: #4a3f70; font-size: 12.5px; color: #d8d0f5; }
.fair__pill b { color: #fff; }
.fair__field {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 8px; border-radius: 8px; background: #241c3d;
}
.fair__field > span { font-size: 14px; }
.fair__field code { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fair__field button { color: #cfc7ee; display: grid; place-items: center; transition: color .2s, transform .2s; }
.fair__field button:hover { color: #fff; }
.fair__field button[hidden] { display: none; }
.fair__field button.is-copied { color: var(--green); transform: scale(1.15); }
.fair__note { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: #e2dcf7; }
.fair__verify { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 40%); gap: 10px; }
.fair__verify input {
  min-width: 0; padding: 12px 14px; border: 0; border-radius: 9px; outline: 0;
  background: #241c3d; color: var(--text); font: inherit; font-size: 14px;
}
.fair__verify input:focus-visible { box-shadow: 0 0 0 2px var(--purple); }
.fair__verify button {
  border-radius: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: linear-gradient(180deg, #8b5cff, #6c3df0); color: #fff;
}
.fair__verify button:disabled { opacity: .45; cursor: not-allowed; }
.fair__result { margin-top: 10px; font-size: 13px; }
.fair__result:empty { display: none; }
.fair__result code { display: block; margin-top: 4px; color: var(--muted); word-break: break-all; }
.fair__result small { display: block; margin-top: 4px; }
.fair__result.is-ok b { color: var(--green); }
.fair__result.is-bad b { color: var(--red); }
.fair__more summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 2px; cursor: pointer; list-style: none; color: #e2dcf7;
}
.fair__more summary::-webkit-details-marker { display: none; }
.fair__more summary::after { content: "\2303"; transform: rotate(180deg); transition: transform .2s; }
.fair__more[open] summary::after { transform: none; }
.fair__more h4 { margin: 10px 0 8px; font-size: 17px; }
.fair__more ul, .fair__info ol { margin: 0; padding-left: 18px; color: #d8d0f5; font-size: 13px; line-height: 1.8; }
.fair__info { margin: 0; }
.limits { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; font-size: 14px; }
.limits dt { color: var(--muted); }
.limits dd { margin: 0; font-weight: 800; text-align: right; }
dialog.fair--info { width: min(480px, calc(100vw - 16px)); }

/* ---------------- top-bar menu ---------------- */
.menu { position: relative; }
.menu__btn { background: var(--panel); }
.menu__btn[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
  width: 270px; padding: 12px 0 8px; border-radius: 14px;
  background: #1f1640; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: dlg-in .18s ease-out;
}
.menu__panel[hidden] { display: none; }
.menu__user { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 14px; border-bottom: 1px solid var(--line); }
.menu__user b { font-size: 16px; }
.menu__ava {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-weight: 800; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, #8b5cff, #5a2bd4);
}
.menu__row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; text-align: left; color: var(--text);
  transition: background .15s;
}
.menu__row svg { color: #a69bd6; flex: none; }
button.menu__row:hover { background: rgba(255, 255, 255, .05); }
.menu__row--toggle { cursor: pointer; }
.menu__row--toggle span { flex: 1; }
.menu__panel hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.toggle {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 36px; height: 20px; border-radius: 6px; position: relative; cursor: pointer;
  background: var(--panel-2); transition: background .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 4px;
  background: #6b5ea8; transition: transform .2s, background .2s;
}
.toggle:checked { background: #2c1b56; }
.toggle:checked::after { transform: translateX(16px); background: var(--purple); }
.toggle:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ---------------- history of rounds (bottom sheet) ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 4, 20, .55);
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  max-width: 560px; margin: 0 auto;
  max-height: 70vh; overflow-y: auto;
  padding: 16px 12px calc(18px + env(safe-area-inset-bottom));
  background: #2a2147;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .45);
  transform: translateY(105%);
  transition: transform .38s cubic-bezier(.2, .9, .25, 1);
  visibility: hidden;
}
.sheet.is-open { transform: none; visibility: visible; }
.sheet:not(.is-open) { transition: transform .3s ease-in, visibility 0s .3s; }
.sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet__icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--purple);
}
.sheet__icon img { width: 18px; filter: brightness(0) invert(1); }
.sheet__title {
  flex: 1; margin: 0;
  font-size: 17px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.sheet__close {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  color: #f5a524;
  background: #3a2c3a;
  border: 2px solid #f5a524;
}
.sheet__close:hover { background: #4a3540; }
.sheet__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.round {
  display: grid; place-items: center;
  height: 32px; border-radius: 7px;
  font-size: 13px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.round.is-long { font-size: 10px; }
.round.lvl-1 { background: #3d55c4; }
.round.lvl-2 { background: #7b3fe4; }
.round.lvl-3 { background: #e88a0c; }

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    padding: 8px 16px 16px;
  }
  .game-col { order: -1; }
  .stage { min-height: 0; aspect-ratio: 16 / 11; flex: none; }
  .bets-panel { max-height: 420px; }
}

@media (max-width: 640px) {
  :root { --resbar-h: 64px; }   /* fixed results bar at the bottom (38px button + padding + border) */
  .only-mobile { display: inline; }
  .only-desktop { display: none; }

  /* top bar: balance · logo · icons */
  .topbar { display: grid; grid-template-columns: 1fr auto 1fr; padding: 0 12px; gap: 8px; }
  .topbar__spacer { display: none; }
  .balance { order: -1; justify-self: start; background: none; padding: 0; gap: 6px; font-size: 15px; }
  .balance img { width: 22px; }
  .topbar__logo { justify-self: center; height: 30px; }
  .topbar__icons { justify-self: end; gap: 0; }
  .topbar__icons .icon-btn { width: 34px; height: 34px; }
  .topbar__icons .icon-btn--history { display: none; }
  .menu__panel { width: min(270px, calc(100vw - 24px)); }
  .fair__verify { grid-template-columns: minmax(0, 1fr); }
  .fair__verify button { padding: 12px; }

  /* The screen above the fixed results bar is shared: both bet slips keep their natural height and
     the game canvas takes the rest, so the slips are never pushed under the bar. The bar's space is
     reserved here, on the layout (body has height:100%, so padding on body would not extend the
     scroll area). On very short screens the canvas stops at its min-height and the page scrolls. */
  .layout {
    display: flex; flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
    padding: 8px 8px calc(12px + var(--resbar-h) + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .game-col { flex: 1 0 auto; }
  .bets-panel { display: none; }

  /* game canvas fills what the bet slips leave */
  .stage { aspect-ratio: auto; max-height: none; flex: 1 1 auto; min-height: 240px; }
  /* in flight the odds sit top-centre, clear of the (larger) rocket */
  .stage__center { left: 50%; top: 10.5%; }
  .multiplier { font-size: 46px; }
  .waiting__title { font-size: 14px; white-space: nowrap; }
  .waiting__spinner { width: 48px; }

  /* recent results: fixed bottom bar */
  .results-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--bg-2);
    border-top: 1px solid var(--line);
  }
  .results-bar__bets {
    display: flex; flex-direction: column; align-items: center;
    padding-right: 12px; margin-right: 2px;
    border-right: 1px solid var(--line);
    line-height: 1.1;
  }
  .results-bar__bets small { color: var(--muted); font-size: 12px; font-weight: 600; }
  .results-bar__bets b { font-size: 18px; }
  .results-bar__clock { display: grid; flex: none; }
  .results-bar .history { overflow-x: auto; scrollbar-width: none; }
  .results-bar .history::-webkit-scrollbar { display: none; }
  .history__item { padding: 7px 14px; border-radius: 8px; font-size: 13px; color: #fff; }
  .history__item.lvl-1 { background: #36408f; color: #c9d1ff; }
  .history__item.lvl-2 { background: #6f3fd8; color: #fff; }
  .history__item.lvl-3 { background: #e88a0c; color: #fff; }

  /* bet panels */
  .bet-controls { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .bet-card { padding: 10px; }
  .bet-card__tabs { display: none; }
  .bet-card { display: flex; flex-direction: column; }
  .bet-card__auto {
    display: flex; order: -1;
    margin: 0 0 10px; padding: 0; border: 0;
    gap: 10px; justify-content: flex-start;
  }
  .bet-card__auto .switch { color: var(--text); font-size: 13px; }
  .bet-card__auto .auto-input { margin-left: auto; padding: 6px 12px; border-radius: 8px; }
  .bet-card__auto .auto-input span { color: var(--muted); }
  .bet-card__auto .auto-input input { width: 44px; text-align: left; }
  /* square checkboxes */
  .switch__track { width: 24px; height: 24px; border-radius: 7px; background: var(--panel-2); }
  .switch__track::after {
    top: 6px; left: 8px; width: 6px; height: 10px; border-radius: 1px;
    background: none; border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0); transform-origin: center;
  }
  .switch input:checked + .switch__track { background: var(--purple); }
  .switch input:checked + .switch__track::after { transform: rotate(45deg) scale(1); }

  .stepper { border-radius: 10px; }
  .stepper__btn { border-radius: 8px; }
  .chip { border-radius: 8px; padding: 6px 0; }

  /* purple BET button with an underline accent */
  .bet-btn {
    position: relative;
    border-radius: 12px;
    background: linear-gradient(180deg, #8b5cff, #6c3df0);
    box-shadow: 0 4px 0 #4b25b8, inset 0 1px 0 rgba(255,255,255,.3);
  }
  .bet-btn:active { box-shadow: 0 2px 0 #4b25b8; }
  .bet-btn::after {
    content: ""; position: absolute; left: 18%; right: 18%; bottom: -12px;
    height: 3px; border-radius: 3px; background: #7b4dff;
  }
  .bet-card[data-state="idle"] .bet-btn__sub { display: none; }
  .bet-card[data-state="idle"] .bet-btn__title { font-size: 18px; }
}

/* ---------------- free bets banner ---------------- */
.free-bets-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: min(540px, calc(100% - 24px));
  cursor: pointer;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .25));
}
.free-bets-banner[hidden] { display: none; }
.free-bets-banner__main {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(18, 10, 38, .78);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
}
.free-bets-banner__bets {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0524e, #cf2f38);
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
}
.free-bets-banner__label { opacity: .9; }
.free-bets-banner__bets b { font-size: 18px; }
.free-bets-banner__bets span:last-child { color: rgba(255, 255, 255, .8); font-weight: 600; white-space: nowrap; }
.free-bets-banner__win {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 100px;
  padding: 6px 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3f7dff, #2b55d6);
  text-align: right;
}
.free-bets-banner__win span { font-size: 11px; opacity: .8; font-weight: 600; }
.free-bets-banner__win b { font-size: 16px; font-variant-numeric: tabular-nums; }
.free-bets-banner__manage {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 3px 8px 0;
  color: #d2d2d2;
  font-size: 11px;
  font-weight: 600;
}

/* ---------------- free bets dialog ---------------- */
dialog.fair--freebets { width: min(540px, calc(100vw - 16px)); }
.fb { display: flex; flex-direction: column; gap: 10px; }
.fb-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  background: #241c3d;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background .18s, border-color .18s;
}
.fb-option:hover { background: #2d234a; }
.fb-option.active { border-color: var(--orange); background: rgba(255, 176, 37, .12); }
.fb-radio {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #6f6592;
  position: relative;
}
.fb-option.active .fb-radio { border-color: var(--orange); }
.fb-option.active .fb-radio::after {
  content: "";
  position: absolute; inset: 3px;
  border-radius: 50%;
  background: var(--orange);
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
}
.fb-archive { color: #cfc7ee; font-size: 12px; font-weight: 700; }
.fb-archive:hover { color: #fff; }
.fb-table { display: flex; flex-direction: column; gap: 4px; }
.fb-tr {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #241c3d;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.fb-tr.fb-th {
  background: none;
  padding: 2px 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fb-tr.fb-th span:not(:first-child),
.fb-tr.fb-option span:nth-child(n+2) { text-align: right; }
.fb-tr.fb-th span:first-child { text-align: left; }
.fb-tr.fb-option { padding: 10px; background: #241c3d; border-radius: 8px; border: 1px solid transparent; }
.fb-tr.fb-option.active { background: rgba(255, 176, 37, .12); border-color: var(--orange); }
.fb-tr.archived { opacity: .75; }
.fb-status { font-size: 11px; font-weight: 700; color: var(--muted); }
.fb-qty { font-weight: 800; text-align: left !important; }
.fb-won { color: var(--green); font-weight: 700; }
.fb-note { margin: 6px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.fb-empty { padding: 22px 10px; text-align: center; color: var(--muted); }
.free-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--orange);
  color: #1f1640;
  font-size: 9px;
  font-weight: 800;
  vertical-align: 1px;
}
.bet-card.is-free-bet { border-color: rgba(255, 176, 37, .65); }
.bet-card.is-free-bet .bet-btn { background: linear-gradient(180deg, #ffc85a, #f09a18); box-shadow: 0 4px 0 #a56306, inset 0 1px 0 rgba(255,255,255,.4); }
.toast--error { background: linear-gradient(90deg, #b3262d, #d83b41); }

@media (max-width: 640px) {
  .free-bets-banner { top: 8px; width: calc(100% - 16px); }
  .free-bets-banner__bets { padding: 7px 9px; font-size: 12px; }
  .free-bets-banner__win { min-width: 82px; padding: 5px 10px; }
  .free-bets-banner__win b { font-size: 14px; }
  .fb-tr { grid-template-columns: 28px 1fr 1fr 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .sky__stars { animation: none !important; }
}

/* ---- server mode: platform fairness form (server seed + client seeds) */
.fair__verify--platform { grid-template-columns: minmax(0, 1fr); }
.fair__verify--platform button { padding: 12px 14px; }

/* ---- server mode: session ended / expired / wrong game (never falls back to the demo) */
.session-ended {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px;
  background: rgba(18, 10, 38, .94);
}
.session-ended__box {
  max-width: 420px; padding: 28px 24px; border-radius: 16px; text-align: center;
  background: var(--bg-2); box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.session-ended__box img { width: 180px; max-width: 70%; margin-bottom: 16px; }
.session-ended__box p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text); }
