/* ---------- fonts (bundled, so the game looks right with no internet) ---------- */

@font-face {
  font-family: 'Unbounded';
  src: url('/fonts/unbounded-latin.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+00D7;
}
@font-face {
  font-family: 'Unbounded';
  src: url('/fonts/unbounded-cyrillic.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-cyrillic.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ---------- tokens ---------- */

:root {
  --ink: #0F1B36;
  --ink-deep: #0A1430;
  --ink-2: #15244A;
  --ink-3: #1D3061;
  --ink-4: #253A73;
  --line: #2A3D70;
  --line-soft: rgba(42, 61, 112, .55);
  --paper: #E9EDF6;
  --muted: #94A2C6;
  --amber: #FFB547;
  --amber-hi: #FFC870;
  --amber-deep: #F08A24;
  --red: #FF6159;
  --sky: #7FD8F0;
  --sky-hi: #A6E6F7;

  --display: 'Unbounded', system-ui, sans-serif;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --press: 0 8px 18px -10px rgba(3, 8, 24, .95), 0 2px 4px -1px rgba(3, 8, 24, .5);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  color-scheme: dark;
}

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font: 500 15px/1.45 var(--ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--amber);
}

::selection { background: var(--amber); color: var(--ink); }

* { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
input::placeholder { color: #7684AA; opacity: 1; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

svg { width: 18px; height: 18px; flex: none; }
.coin { color: var(--amber); }

/* ---------- avatars ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--av, var(--amber));
  color: var(--ink);
  font: 700 12px/1 var(--display);
  text-transform: uppercase;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 21px/1 var(--display);
  letter-spacing: -0.02em;
}
.brand-mark { width: 26px; height: 26px; color: var(--amber); }

.top-tools { display: flex; align-items: center; gap: 10px; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-weight: 650;
  transition: background .2s, border-color .2s;
}
.chip-btn:hover { background: var(--ink-2); border-color: var(--ink-4); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--paper);
  transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--ink-2); border-color: var(--ink-4); }

/* One pill: avatar, name and balance. It opens the account menu. */
.wallet {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  max-width: 230px;
  margin-left: 4px;
  padding: 0 16px 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink-2);
  color: var(--paper);
  text-align: left;
  transition: background .2s, border-color .2s;
}
.wallet:hover { background: var(--ink-3); border-color: var(--ink-4); }
.wallet[hidden] { display: none; }
.avatar.md { width: 36px; height: 36px; font-size: 14px; }
.wallet-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.me-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--muted);
}
.balance-line { display: flex; align-items: center; gap: 6px; }
.balance-line .coin { width: 16px; height: 16px; }
.wallet-balance {
  font: 700 17px/1.1 var(--display);
  letter-spacing: -0.01em;
  color: var(--paper);
  transition: color .4s;
}
.wallet-balance.up { color: var(--sky); }
.delta {
  position: absolute;
  right: 10px;
  top: 100%;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
  font: 800 11.5px/1.3 var(--ui);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}
.login-btn {
  height: 40px;
  margin-left: 4px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  font: 700 14px/1 var(--display);
  transition: background .15s;
}
.login-btn:hover { background: var(--amber-hi); }
.login-btn[hidden] { display: none; }
.delta.show { animation: delta-in 1.8s var(--ease-out) forwards; }
@keyframes delta-in {
  0% { opacity: 0; transform: translateY(-6px); }
  12% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(4px); }
}

/* ---------- history strip ---------- */

.history {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 14px;
}
.history ol {
  display: flex;
  gap: 6px;
  min-height: 30px; /* reserved so the first crash doesn't push the page down */
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.history ol::-webkit-scrollbar { display: none; }
.history button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ink-2);
  font: 700 12.5px/30px var(--ui);
  white-space: nowrap;
  color: var(--muted);
  transition: background .2s;
}
.history button:hover { background: var(--ink-3); }
.history .mid button { color: var(--amber); }
.history .high button { color: var(--ink); background: var(--sky); }
.history .high button:hover { background: var(--sky-hi); }
.history li.fresh { animation: chip-in .5s var(--ease-out); }
@keyframes chip-in { from { opacity: 0; transform: translateX(-14px) scale(.9); } }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "stage bet"
    "players social";
  gap: 18px 18px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 32px;
}

/* ---------- stage ---------- */

.stage {
  grid-area: stage;
  position: relative;
  height: clamp(340px, 58vh, 560px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(41, 64, 128, .45), transparent 60%),
    var(--ink-deep);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size; /* the readout sizes itself to the flight screen */
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255, 97, 89, .35), rgba(255, 97, 89, 0) 70%);
  opacity: 0;
  pointer-events: none;
}
.stage.just-crashed .flash { animation: flash .7s ease-out; }
.stage.just-crashed { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes shake {
  15% { transform: translate(-5px, 2px); }
  30% { transform: translate(5px, -3px); }
  45% { transform: translate(-4px, 1px); }
  60% { transform: translate(3px, -1px); }
  80% { transform: translate(-1px, 1px); }
}

/* The readout sits in the upper-left of the plot: the curve bends below the line from
   launch to rocket and the y-axis keeps headroom above the rocket, so it never gets there. */
.readout {
  position: absolute;
  left: 72px;
  top: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}
.mult {
  font: 800 clamp(40px, 13cqw, 118px)/1 var(--display);
  letter-spacing: -0.035em;
  color: var(--paper);
  text-shadow: 0 6px 30px rgba(6, 12, 32, .85);
  transform-origin: left center;
}
.mult.long { font-size: clamp(34px, 10cqw, 92px); }
.mult.xlong { font-size: clamp(30px, 8cqw, 76px); }
.mult.bump { animation: bump .45s var(--ease-out); }
@keyframes bump { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
.status {
  margin-top: 12px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(10, 20, 48, .55);
  font-weight: 650;
  font-size: 14.5px;
  color: var(--muted);
}
.stage.is-betting .mult { color: rgba(233, 237, 246, .92); }
.stage.is-flying .mult { color: var(--amber); }
.stage.is-crashed .mult { color: var(--red); }
.stage.is-crashed .status { color: var(--paper); background: rgba(255, 97, 89, .16); }
.stage.is-betting .status { color: var(--paper); }

.win-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
  font: 700 16px/1.2 var(--display);
  white-space: nowrap;
  box-shadow: var(--press);
  opacity: 0;
  pointer-events: none;
}
.win-pop.show { animation: pop 1.9s var(--ease-out) forwards; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(-8px) scale(.92); }
  14% { opacity: 1; transform: none; }
  75% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(6px); }
}

.countdown {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(42, 61, 112, .5);
  opacity: 0;
  transition: opacity .25s;
}
.stage.is-betting .countdown { opacity: 1; }
#countdownBar { height: 100%; width: 100%; background: var(--amber); transform-origin: left; }

/* ---------- bet box ---------- */

.betbox {
  grid-area: bet;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--ink-2);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.amount-row { display: flex; gap: 6px; }
.amount-field { position: relative; flex: 1; min-width: 0; display: flex; }
.amount-field .coin { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; pointer-events: none; }
.amount-field input { padding-left: 42px; width: 100%; }

.amount-row input,
.auto-input input,
.chat-form input,
.join input {
  min-width: 0;
  height: 48px;
  padding-right: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink);
  font-weight: 700;
  font-size: 17px;
  transition: border-color .2s, box-shadow .2s;
}
.auto-input input, .chat-form input, .join input { padding-left: 14px; }
.amount-row input:hover, .auto-input input:hover, .chat-form input:hover, .join input:hover { border-color: var(--ink-4); }
.amount-row input:focus, .auto-input input:focus, .chat-form input:focus, .join input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 181, 71, .16);
}
.quick {
  width: 50px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  font-weight: 750;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.quick:hover { background: var(--ink-3); border-color: var(--ink-4); }
.quick:active { background: var(--ink-4); }

.auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 42px;
  height: 25px;
  border-radius: 999px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 1px 3px rgba(3, 8, 24, .5);
  transition: transform .25s var(--ease-out), background .2s;
}
.switch input:checked + .switch-track { background: var(--amber); border-color: var(--amber); }
.switch input:checked + .switch-track::after { transform: translateX(17px); background: var(--ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--amber); outline-offset: 2px; }

.auto-input { position: relative; width: 108px; }
.auto-input input { width: 100%; padding-right: 30px; }
.auto-input span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
}
.auto-row.off .auto-input { opacity: .45; }

.payout-hint {
  min-height: 20px;
  margin: 8px 0 14px;
  font-size: 13.5px;
  color: var(--muted);
}
.payout-hint b { color: var(--paper); font-weight: 750; }

.main-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 66px;
  border: 0;
  border-radius: var(--r-md);
  font: 700 18px/1.15 var(--display);
  letter-spacing: -0.01em;
  transition: background .15s, box-shadow .2s, transform .1s var(--ease-out);
}
.main-btn:active:not(:disabled) { transform: scale(.98); }
.main-sub { font: 750 14px/1.2 var(--ui); opacity: .8; letter-spacing: 0; }
.main-sub:empty { display: none; }
.main-btn.is-bet { background: var(--amber); color: var(--ink); box-shadow: var(--press); }
.main-btn.is-bet:hover { background: var(--amber-hi); }
.main-btn.is-cashout { background: var(--sky); color: var(--ink); box-shadow: var(--press); }
.main-btn.is-cashout:hover { background: var(--sky-hi); }
.main-btn.is-cashout .main-sub { font: 700 18px/1.2 var(--display); opacity: 1; }
.main-btn.is-queue { background: transparent; color: var(--amber); box-shadow: inset 0 0 0 2px var(--amber); }
.main-btn.is-queue:hover { background: rgba(255, 181, 71, .1); }
.main-btn.is-cancel { background: var(--ink-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.main-btn.is-cancel:hover { background: var(--ink-4); }
.main-btn.is-done { background: rgba(127, 216, 240, .12); color: var(--sky); box-shadow: inset 0 0 0 1px rgba(127, 216, 240, .35); }
.main-btn.is-done:hover { background: rgba(127, 216, 240, .18); }
.main-btn.is-done .main-sub { color: var(--paper); opacity: .7; }

.bet-note {
  min-height: 21px;
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}
.bet-note.win { color: var(--sky); }
.bet-note.loss { color: var(--red); }

.refill {
  margin-top: 10px;
  height: 42px;
  border: 1px dashed var(--amber);
  border-radius: 12px;
  background: transparent;
  color: var(--amber);
  font-weight: 750;
}
.refill:hover { background: rgba(255, 181, 71, .08); }

.mystats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.mystats div { margin: 0; }
.mystats dt { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.mystats dd { margin: 3px 0 0; font: 600 15.5px/1.2 var(--display); }

.hint { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  box-shadow: inset 0 -1px 0 var(--line);
  border-radius: 5px;
  font: 700 11.5px/1.4 var(--ui);
  color: var(--paper);
}

/* ---------- lower sections ---------- */

.players { grid-area: players; min-width: 0; padding-top: 4px; }
.social { grid-area: social; min-width: 0; display: flex; flex-direction: column; padding-top: 4px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 11px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; font: 600 16px/1.2 var(--display); letter-spacing: -0.01em; }
.section-meta { font-size: 13.5px; color: var(--muted); }

.bets { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.bets th {
  padding: 11px 6px 7px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
}
.bets td { padding: 8px 6px; border-top: 1px solid var(--line-soft); transition: background .6s; }
.bets th:nth-child(n+2), .bets td:nth-child(n+2) { text-align: right; }
.bets .who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bets .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bets tr.me .who span:last-child { color: var(--amber); font-weight: 750; }
.bets tr.flash td { background: rgba(127, 216, 240, .12); transition: none; }
.bets .won { color: var(--sky); font-weight: 750; }
.bets .lost { color: var(--red); }
.bets .wait { color: var(--muted); }
.bets td:first-child { max-width: 0; width: 38%; }

.empty { margin: 16px 4px; color: var(--muted); font-size: 14px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs button {
  margin-bottom: -1px;
  padding: 0 4px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 16px/1.2 var(--display);
  letter-spacing: -0.01em;
  transition: color .2s, border-color .2s;
}
.tabs button + button { margin-left: 14px; }
.tabs button:hover { color: var(--paper); }
.tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--amber); }

.chat { display: flex; flex-direction: column; }
.chat-log {
  height: 236px;
  margin: 0;
  padding: 10px 2px 6px;
  list-style: none;
  overflow-y: auto;
  font-size: 14px;
}
.chat-log:empty { display: none; }
.chat-log li { display: flex; gap: 9px; padding: 5px 2px; overflow-wrap: anywhere; }
.chat-log .avatar { margin-top: 1px; }
.chat-log b { display: block; font-weight: 750; font-size: 13px; color: var(--av, var(--amber)); }
.chat-log p { margin: 0; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { flex: 1; height: 44px; font-size: 14.5px; font-weight: 550; }
.chat-form button {
  height: 44px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  background: var(--ink-3);
  font-weight: 750;
  transition: background .15s;
}
.chat-form button:hover { background: var(--ink-4); }

.board ol { margin: 0; padding: 4px 0 0; list-style: none; counter-reset: rank; }
.board li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line-soft);
  counter-increment: rank;
  font-size: 14.5px;
}
.board .rank { color: var(--muted); font-weight: 750; text-align: center; }
.board .rank svg { width: 17px; height: 17px; color: var(--amber); vertical-align: -3px; }
.board .who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.board .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.board .dot.on { background: var(--sky); }
.board .money { font-weight: 750; text-align: right; }
.board .best { display: block; font-size: 12px; font-weight: 650; color: var(--muted); }
.board li.me .who .nm { color: var(--amber); font-weight: 750; }

/* ---------- dialogs ---------- */

.dlg {
  width: min(460px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--ink-2);
  color: var(--paper);
  box-shadow: 0 30px 80px -30px rgba(3, 8, 24, .95);
}
.dlg[open] { animation: dlg-in .35s var(--ease-out); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.dlg::backdrop { background: rgba(6, 12, 30, .72); backdrop-filter: blur(4px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dlg h2 { margin: 0; font: 700 20px/1.2 var(--display); letter-spacing: -0.01em; }
.dlg h3 { margin: 22px 0 10px; font: 600 15px/1.2 var(--display); }
.dlg-text { margin: 8px 0; color: var(--muted); font-size: 14.5px; }
.dlg-text.small { font-size: 13px; }

.join h1 { margin: 10px 0 8px; font: 800 36px/1 var(--display); letter-spacing: -0.03em; }
.join p { margin: 0 0 22px; color: var(--muted); }
.join-mark { width: 42px; height: 42px; color: var(--amber); }
.join input { width: 100%; }
.join .main-btn { margin-top: 6px; }
.form-error { min-height: 20px; margin: 8px 0 8px !important; color: var(--red) !important; font-size: 14px; }

.round-crash { margin: 4px 0 12px; font: 800 44px/1 var(--display); letter-spacing: -0.03em; }
.round-crash.low { color: var(--muted); }
.round-crash.mid { color: var(--amber); }
.round-crash.high { color: var(--sky); }
.kv { margin: 14px 0 0; }
.kv dt { font-size: 12.5px; font-weight: 650; color: var(--muted); margin-top: 10px; }
.kv dd { margin: 3px 0 0; font: 500 12.5px/1.45 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; color: var(--paper); }
.verify { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; font-weight: 700; }
.verify svg { margin-top: 2px; }
.verify.ok { color: var(--sky); }
.verify.bad { color: var(--red); }
.verify.na { color: var(--muted); font-weight: 500; font-size: 14px; }

.invite-urls, .online-list { margin: 0; padding: 0; list-style: none; }
.invite-urls li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink);
  font: 700 16px/1.2 var(--ui);
}
.invite-urls code { font: inherit; overflow-wrap: anywhere; }
.invite-urls button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: var(--ink-3);
  font-weight: 750;
  font-size: 13.5px;
  white-space: nowrap;
}
.invite-urls button:hover { background: var(--ink-4); }
.online-list { display: flex; flex-wrap: wrap; gap: 6px; }
.online-list li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--ink-3); font-weight: 650; font-size: 14px; }

/* ---------- toasts & connection ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px 11px 14px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: 14.5px;
  box-shadow: 0 14px 34px -12px rgba(3, 8, 24, .7);
  animation: toast-in .3s var(--ease-out);
}
.toast.win { background: var(--sky); }
.toast.error { background: var(--red); color: #fff; }
.toast.out { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.conn {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 8px 16px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "bet" "players" "social";
    gap: 16px;
    padding: 0 16px 24px;
  }
  .top { padding: 12px 16px 10px; }
  .history { padding: 0 16px 12px; }
  .stage { height: clamp(300px, 50vh, 440px); }
  .readout { left: 62px; top: 18px; }
  .players, .social { padding-top: 10px; }
}

@media (max-width: 520px) {
  .brand span { display: none; }
  #onlineCount { display: none; }
  .chip-btn { width: 40px; padding: 0; justify-content: center; }
  .wallet { height: 42px; gap: 8px; padding: 0 14px 0 4px; max-width: 200px; }
  .avatar.md { width: 32px; height: 32px; font-size: 13px; }
  .wallet-balance { font-size: 15px; }
  .betbox { padding: 18px 16px 16px; }
  .bets th:nth-child(3), .bets td:nth-child(3) { display: none; }
  .bets td:first-child { width: 46%; }
  .win-pop { font-size: 14px; }
  .status { font-size: 13px; padding: 4px 11px; margin-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- accounts & admin ---------- */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--ink);
  border: 1px solid var(--line);
}
.seg button {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--paper); }
.seg button[aria-selected="true"] { background: var(--ink-3); color: var(--paper); }

.join .field-label { margin-top: 12px; }
.join .field-label:first-of-type { margin-top: 0; }
.field-hint { margin: 8px 0 0 !important; font-size: 13px; color: var(--muted) !important; }

.dlg input:not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink);
  font-weight: 650;
  font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.dlg input:not([type="checkbox"]):hover { border-color: var(--ink-4); }
.dlg input:not([type="checkbox"]):focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 181, 71, .16); }

.dlg.wide { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }

.stack { display: flex; flex-direction: column; }
.stack .field-label { margin-top: 12px; }
.stack h3 { margin-bottom: 4px; }

.row-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 10px 0 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 181, 71, .45);
  border-radius: 12px;
  background: rgba(255, 181, 71, .08);
  color: var(--amber);
  font-weight: 750;
  text-align: left;
}
.row-btn:hover { background: rgba(255, 181, 71, .14); }

.sec-btn {
  height: 46px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink-3);
  font-weight: 750;
  transition: background .15s;
}
.sec-btn:hover { background: var(--ink-4); }
.sec-btn.danger { width: 100%; color: var(--red); background: transparent; border-color: rgba(255, 97, 89, .45); }
.sec-btn.danger:hover { background: rgba(255, 97, 89, .1); }
.form-error.ok { color: var(--sky) !important; }

.grant-form { display: flex; flex-direction: column; margin-top: 8px; }
.grant-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.grant-form .main-btn { min-height: 54px; font-size: 16px; }

.admin-users, .admin-grants { margin: 0; padding: 0; list-style: none; }
.admin-users { max-height: 220px; overflow-y: auto; }
.admin-users li, .admin-grants li { border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.admin-grants li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 2px; }
.admin-users .pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.admin-users .pick:hover { background: rgba(37, 58, 115, .45); }
.admin-users .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.admin-users .tag { margin-left: 6px; font-size: 12px; color: var(--amber); font-weight: 700; }
.admin-users .money, .admin-grants .money { font-weight: 750; }
.admin-grants .what { overflow-wrap: anywhere; color: var(--muted); }
.admin-grants .what b { color: var(--paper); font-weight: 700; }
.admin-grants .plus { color: var(--sky); }
.admin-grants .minus { color: var(--red); }

.refill-wait {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  text-wrap: balance;
}
.refill-wait b { color: var(--paper); }

@media (max-width: 520px) {
  .grant-row { grid-template-columns: 1fr; }
}
