:root {
  --bg: #0c0e13; --panel: #141822; --panel-2: #1b2130; --line: #252c3b;
  --text: #e7ecf5; --muted: #8a93a8; --accent: #4ade80; --accent-2: #38bdf8;
  --loss: #f87171; --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--loss); min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; letter-spacing: .14em; display: flex; align-items: center; gap: 10px; }
.brand em { font-style: normal; font-weight: 400; letter-spacing: .04em; color: var(--muted); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.account { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; }

main { padding: 20px; max-width: 1180px; margin: 0 auto; }
/* The game, then its history. Balances live in the top bar. */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.wide { grid-column: 1 / -1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

button {
  font: inherit; border-radius: 8px; border: 1px solid transparent; cursor: pointer; padding: 9px 14px;
}
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: #06210f; font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.big { width: 100%; padding: 13px; font-size: 16px; margin-top: 4px; }
.ghost { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.ghost:hover:not(:disabled) { border-color: var(--muted); }
.small-btn { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

input, select {
  font: inherit; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label input, label select { margin-top: 6px; }


.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { background: none; color: var(--muted); border: 1px solid var(--line); }
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--accent); }

.result {
  height: 108px; display: grid; place-items: center; border-radius: var(--radius);
  background: var(--panel-2); margin-bottom: 16px; text-align: center;
}
.result .big-num { font-size: 38px; font-weight: 700; font-family: ui-monospace, monospace; }
.result .win { color: var(--accent); }
.result .lose { color: var(--loss); }
.result .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* An instant game: its controls on the left, the outcome large on the right. */
.instant { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 20px; }
.instant .result { height: auto; min-height: 250px; margin-bottom: 0; }
.instant .result .big-num { font-size: 56px; }
@media (max-width: 760px) {
  .instant { grid-template-columns: 1fr; }
  .instant .result { order: -1; min-height: 120px; }
  .instant .result .big-num { font-size: 40px; }
}

.amount { display: flex; gap: 8px; }
/* The bet's currency is the one chosen in the wallet, shown beside the amount rather than picked here. */
.amount-asset {
  display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 6px; padding: 0 12px; min-width: 64px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.payout-preview {
  display: flex; justify-content: space-between; font-size: 13px; color: var(--muted);
  padding: 10px 0; border-top: 1px solid var(--line); margin-bottom: 6px;
}
.payout-preview b { color: var(--text); font-family: ui-monospace, monospace; }

.kv { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 0 0 14px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0 0 10px; }
.seed-edit { display: flex; gap: 6px; align-items: center; }
.seed-edit input { flex: 1; min-width: 0; }
.trunc { overflow-wrap: anywhere; color: var(--accent-2); }
.revealed {
  background: var(--panel-2); border-radius: 8px; padding: 10px; margin-top: 12px;
  font-size: 12px; overflow-wrap: anywhere;
}

.scroll { max-height: 320px; overflow-y: auto; }
.history { width: 100%; border-collapse: collapse; font-size: 13px; }
.history th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  padding: 6px 8px; position: sticky; top: 0; background: var(--panel);
}
.history td { padding: 7px 8px; border-top: 1px solid var(--line); font-family: ui-monospace, monospace; }
.history .w { color: var(--accent); }
.history .l { color: var(--loss); }

/* ------------------------------------------------------- explainer page -- */
.link { color: var(--accent-2); text-decoration: none; }
.link:hover { text-decoration: underline; }
.seed-link { float: right; font-size: 12px; text-transform: none; letter-spacing: 0; }

.prose { max-width: 760px; }
.prose h1 { font-size: 30px; margin: 8px 0 4px; letter-spacing: -0.01em; }
.prose h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  margin: 38px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.prose p { margin: 0 0 14px; }
.prose .lead { font-size: 17px; line-height: 1.6; color: var(--text); margin-bottom: 4px; }
.prose code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.note { color: var(--muted); border-left: 2px solid var(--line); padding-left: 14px; }

.defs { margin: 0; }
.defs dt { font-weight: 600; margin-top: 14px; }
.defs dt:first-child { margin-top: 0; }
.defs dd { margin: 4px 0 0; color: var(--muted); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: s; position: relative; padding: 0 0 18px 40px;
  border-left: 1px solid var(--line); margin-left: 13px;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: -13px; top: -2px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--accent);
}

.code {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; overflow-x: auto; font-family: ui-monospace, monospace; font-size: 13px;
  line-height: 1.6; margin: 0 0 14px;
}

.verifier { margin-bottom: 10px; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fields2 label:first-child, .fields2 label:nth-child(2) { grid-column: 1 / -1; }
@media (max-width: 620px) { .fields2 { grid-template-columns: 1fr; } }

.v-out { margin-top: 14px; font-size: 13px; }
.v-out:empty { display: none; }
.v-out.good { border-left: 2px solid var(--accent); padding-left: 12px; }
.v-out.bad { border-left: 2px solid var(--loss); padding-left: 12px; color: var(--loss); }
.v-row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.v-row span { color: var(--muted); }
.v-row b { overflow-wrap: anywhere; text-align: right; font-weight: 500; }

.proves { width: 100%; border-collapse: collapse; font-size: 14px; }
.proves td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.proves td:first-child { white-space: nowrap; font-weight: 600; width: 1%; }
.proves .yes { color: var(--accent); }
.proves .no { color: var(--muted); }

/* --------------------------------------------------------- deposit popup -- */
.deposit-grid { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.qr {
  width: 168px; height: 168px; padding: 12px; background: #fff; border-radius: var(--radius);
  flex-shrink: 0;
}
.qr svg { width: 100%; height: 100%; display: block; }
.addr-block { flex: 1; min-width: 260px; }
.addr {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; margin-bottom: 10px;
}
.warn {
  margin: 18px 0 0; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5;
  background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .35);
}
.warn strong { color: var(--loss); }
.networks { margin-top: 20px; display: grid; }
.network { border-top: 1px solid var(--line); padding: 14px 0 12px; }
.network-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tokens { width: 100%; border-collapse: collapse; margin: 8px 0 6px; }
.tokens td { padding: 4px 10px 4px 0; vertical-align: middle; }
.tokens .tok { width: 1%; white-space: nowrap; color: var(--muted); font-size: 13px; }
.contract { font-size: 12.5px; overflow-wrap: anywhere; }
.tokens .nowrap { white-space: nowrap; width: 1%; }
@media (max-width: 560px) {
  .tokens, .tokens tbody, .tokens tr, .tokens td { display: block; width: auto; }
  .tokens tr { padding: 6px 0; border-bottom: 1px solid var(--line); }
  .tokens .tok { color: var(--text); font-weight: 600; }
}
.history .p { color: var(--accent-2); }

/* Two ways in: a segmented switch, not two buttons of equal weight to hunt between. */
.dep-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.dep-tab { padding: 8px 10px; border-radius: 7px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.dep-tab:hover { color: var(--text); }
.dep-tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

.dep-status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2);
  font-size: 14px; line-height: 1.45;
}
.dep-label {
  display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 8px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.link-btn {
  padding: 0; background: none; border: 0; color: var(--accent-2);
  font-size: 12px; letter-spacing: 0; text-transform: none;
}
.link-btn:hover { text-decoration: underline; }

.dep-holdings { display: grid; gap: 6px; max-height: 250px; margin-bottom: 18px; overflow-y: auto; }
.holding {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
}
.holding:hover:not(:disabled) { border-color: var(--muted); }
.holding[aria-checked="true"] { border-color: var(--accent); background: rgba(74, 222, 128, .07); }
.holding:disabled { opacity: .45; cursor: default; }
.holding .coin { width: 28px; height: 28px; flex-basis: 28px; font-size: 14px; }
.holding-name { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.holding-name b { font-size: 14px; }
.holding-name small { font-size: 12px; color: var(--muted); }
.holding-bal { font-size: 14px; font-variant-numeric: tabular-nums; }

.dep-amount {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.dep-amount:focus-within { border-color: var(--accent-2); }
.dep-amount input {
  flex: 1; min-width: 0; padding: 8px 0; border: 0; background: none;
  font: 600 18px ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
}
.dep-amount input:focus { outline: none; }
.dep-amount-asset { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dep-hint { min-height: 1.3em; margin: 8px 2px 14px; line-height: 1.45; }
.dep-hint.bad { color: var(--loss); }
#dep-send { margin-top: 0; }

.dep-contracts { margin-top: 16px; }
.dep-contracts summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.dep-contracts summary:hover { color: var(--text); }
.dep-contracts .networks { margin-top: 8px; }
@media (max-width: 560px) { .qr { margin: 0 auto; } }

/* ------------------------------------------------------------ admin page -- */
.admin-page { max-width: 1180px; }
.admin-page .tabs { margin-bottom: 0; border-bottom: 1px solid var(--line); gap: 0; }
.admin-page .tab {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 16px;
  background: none; color: var(--muted); display: inline-block; text-decoration: none;
}
.admin-page .tab:hover { color: var(--text); }
.admin-page .tab.active { background: none; color: var(--text); border-bottom-color: var(--accent); }
.panel { padding-top: 18px; }

.status { font-size: 12px; }
.status.ok { color: var(--accent); }
.status.bad { color: var(--loss); }
.msg { font-size: 13px; margin: 8px 0 0; min-height: 1.2em; }
.msg.ok { color: var(--accent); }
.msg.bad { color: var(--loss); }

/* Dense data table: the admin console is for scanning many rows, not reading prose.
   Named `data`, not `grid`: `.grid` is the player page's three-column layout, and a table that
   inherited `display: grid` from it put its thead and tbody in different columns. */
.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.data th {
  text-align: left; font-weight: 500; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: rgba(255, 255, 255, .02); }
.data .num { text-align: right; }
.data .mid { text-align: center; }
.data .mid input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }

/* Inputs sit inside cells without looking like a form. */
.cell {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 8px; width: 100%; font-size: 13px;
}
.cell:hover { border-color: var(--line); }
.cell:focus { background: var(--panel-2); border-color: var(--accent-2); outline: none; }
.cell.num { text-align: right; }
.data td:has(> .cell) { padding: 4px 6px; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(74, 222, 128, .12); color: var(--accent); border: 1px solid rgba(74, 222, 128, .3);
}

.addbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px;
  padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.addbar input, .addbar select { width: auto; }
.addbar .grow { flex: 1; min-width: 220px; }
.addbar .narrow { width: 110px; }
.inline { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; white-space: nowrap; }
.inline input { width: auto; margin: 0; }

@media (max-width: 900px) {
  .admin-page { overflow-x: auto; }
  .data { min-width: 760px; }
}

/* ---------------------------------------------------------------- crash -- */

/* Recent crash points. The strip is the first thing a crash player looks at. */
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 12px; }
.pop {
  font-family: ui-monospace, monospace; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  white-space: nowrap; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
}
.pop.ok { color: var(--text); }
.pop.hot { color: var(--accent); border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .1); }
.pop.cold { color: var(--loss); }

.stage {
  position: relative; height: 300px; margin-bottom: 16px; overflow: hidden;
  border-radius: var(--radius); background: var(--panel-2);
}
.stage canvas { width: 100%; height: 100%; display: block; }
.stage-overlay {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; pointer-events: none;
}
.crash-mult {
  font-family: ui-monospace, monospace; font-size: 52px; font-weight: 700;
  letter-spacing: -0.02em; text-shadow: 0 2px 24px rgba(0, 0, 0, .65);
}
.crash-mult.busted { color: var(--loss); }
.crash-phase { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stage-round {
  position: absolute; top: 10px; right: 12px;
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted);
}
@media (max-width: 560px) {
  .stage { height: 220px; }
  .crash-mult { font-size: 38px; }
}

.crash-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .crash-form { grid-template-columns: 1fr; } }
/* Cashing out is a different act from betting, so it is a different colour. */
button.cash { background: var(--accent-2); color: #06212b; }

/* The game on the left, the round's players on the right. The players column is exactly as tall as the game and
   its list scrolls inside it, so a round filling up never pushes the curve or the bet button around. */
.crash-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 20px; align-items: stretch;
}
.crash-main { min-width: 0; }
.crash-commit-line { margin-bottom: 0; }
.crash-side {
  display: flex; flex-direction: column; min-width: 0;
  padding-left: 20px; border-left: 1px solid var(--line);
}
.crash-side h3 {
  margin: 0 0 8px; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
/* Absolutely placed, the list adds nothing to the column's height: the game decides it. */
.crash-players-box { position: relative; flex: 1; min-height: 240px; }
.crash-players-box > .scroll { position: absolute; inset: 0; max-height: none; }
.crash-side .history { font-size: 12px; }
.crash-side .history td { padding: 6px 4px; }
@media (max-width: 760px) {
  .crash-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .crash-side { padding: 12px 0 0; margin-top: 16px; border-left: 0; border-top: 1px solid var(--line); }
  .crash-players-box { min-height: 0; }
  .crash-players-box > .scroll { position: static; max-height: 320px; }
}
.history .right { text-align: right; }
#crash-players td { border-top: 0; border-bottom: 1px solid var(--line); }
#crash-commit {
  display: inline-block; max-width: 240px; vertical-align: bottom;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------------------------------------------------------- sound -- */
/* Mute beside the avatar; volume in the account menu. */
.sound-btn {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 10px;
}
.sound-btn:hover { color: var(--text); border-color: var(--muted); }
.sound-btn svg { width: 19px; height: 19px; }
.sound-btn .sound-off, .sound-btn.muted .sound-on { display: none; }
.sound-btn.muted .sound-off { display: block; }
.menu-volume { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; font-size: 13px; color: var(--muted); }
.menu-volume svg { width: 18px; height: 18px; flex-shrink: 0; }
.menu-volume input[type="range"] {
  flex: 1; min-width: 0; width: auto; padding: 0; border: 0; background: none; accent-color: var(--accent);
}
.menu-volume span { min-width: 3.6em; text-align: right; }

/* ---------------------------------------------------------------- mines -- */

/* The controls on the left and the board large on the right: the shape of an instant game. */
.mines { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.mines-board {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
  width: 100%; max-width: 460px; margin: 0 auto; padding: 12px;
  border-radius: var(--radius); background: var(--panel-2);
}
@media (max-width: 760px) {
  .mines { grid-template-columns: 1fr; }
  .mines-board { order: -1; }
}
.tile {
  aspect-ratio: 1; padding: 0; display: grid; place-items: center; opacity: 1; cursor: default;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}
.tile svg { width: 56%; height: 56%; }
/* Only a tile that can be turned looks like it can be. */
.tile.live { cursor: pointer; background: var(--panel); }
.tile.live:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.tile.working { background: var(--panel); border-color: var(--accent-2); animation: tile-pulse .7s ease-in-out infinite alternate; }
.tile.gem { color: var(--accent); background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .4); }
.tile.mine { color: var(--loss); }
.tile.hit { background: rgba(248, 113, 113, .18); border-color: var(--loss); }
/* After the game: what was never turned, shown faintly so what was turned stands out. */
.tile.dim { opacity: .4; background: var(--bg); border-color: var(--line); }
@keyframes tile-pulse { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile.working { animation: none; }
}
.mines-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
#mines-commit {
  display: inline-block; max-width: 240px; vertical-align: bottom;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ------------------------------------------------------- admin: users tab -- */
.audit-head {
  margin: 26px 0 10px; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
/* Rows are the way a player is picked, so they have to look pickable. */
.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.avatar.avatar-xs { width: 22px; height: 22px; }
.avatar.avatar-sm { width: 28px; height: 28px; }
#rows-users tr { cursor: pointer; }
#rows-users tr.picked { background: rgba(56, 189, 248, .1); }
#rows-users tr.picked td:first-child { box-shadow: inset 2px 0 0 var(--accent-2); }
.tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(56, 189, 248, .12); color: var(--accent-2); border: 1px solid rgba(56, 189, 248, .3);
}
/* A self-adjustment is the shape abuse takes; it should catch the eye in the log. */
.data tr.self td { background: rgba(248, 113, 113, .06); }
.data .warnmark { color: var(--loss); }
/* A hidden game should read as switched off at a glance. */
.data tr.off td { opacity: .55; }
.data tr.off td:first-child b { text-decoration: line-through; }

/* ------------------------------------------------------------ game menu -- */
/* A column of its own down the left of the player page. Below 900px it folds into a scrolling row
   under the header, so a phone keeps the whole width for the game. */
.shell { display: flex; align-items: flex-start; }
.shell > main { flex: 1; min-width: 0; }

.sidebar {
  position: sticky; top: 0; flex: 0 0 264px; height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px;
}
.nav-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 0 10px; margin: 4px 0 10px;
}
.nav-head:not(:first-child) { margin-top: 28px; }
.nav-games { display: grid; gap: 6px; }
.nav-empty { padding: 0 10px; }

.nav-game {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px; text-align: left; background: none; color: var(--text); text-decoration: none;
  border: 1px solid transparent; border-radius: 10px;
  transition: background-color .12s, border-color .12s;
}
.nav-game:hover { background: var(--panel-2); }
.nav-game:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.nav-game.active { background: var(--panel-2); border-color: var(--line); }
.nav-game.active::before {
  content: ''; position: absolute; left: -14px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}

.nav-icon {
  flex: 0 0 46px; height: 46px; display: grid; place-items: center; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  font-size: 18px; font-weight: 700; transition: color .12s, border-color .12s, background-color .12s;
}
.nav-icon svg { width: 24px; height: 24px; }
.nav-game:hover .nav-icon { color: var(--text); }
.nav-game.active .nav-icon {
  color: var(--accent); border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .1);
}

.nav-text { display: grid; min-width: 0; line-height: 1.25; }
.nav-text b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-text small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
/* A round game is running whether or not you are watching; the dot says so. */
.nav-text .live i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--loss);
  box-shadow: 0 0 8px var(--loss); animation: nav-pulse 1.6s ease-in-out infinite;
}
@keyframes nav-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .nav-text .live i { animation: none; } }

.nav-links { display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 14px;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 900px) {
  .shell { flex-direction: column; align-items: stretch; }
  .sidebar {
    position: static; flex: none; height: auto; padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .nav-head { display: none; }
  .nav-games { display: flex; gap: 8px; overflow-x: auto; }
  .nav-game { flex: 0 0 auto; width: auto; gap: 10px; padding: 7px 14px 7px 7px; border-color: var(--line); }
  .nav-game.active { border-color: var(--accent); }
  .nav-game.active::before { display: none; }
  .nav-icon { flex-basis: 36px; height: 36px; border-radius: 9px; }
  .nav-text small { display: none; }
  .nav-links { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
  .nav-link { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
}

/* --------------------------------------------------------------- top bar -- */
/* Brand on the left; on the right, the wallet and then the account — money beside the player it belongs to. */
header.topbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px;
  position: sticky; top: 0; z-index: 20; padding-block: 10px;
}
.topbar .account { grid-column: 3; justify-self: end; }

.wallet { position: relative; grid-column: 2; justify-self: end; }
/* One slim pill: the balance being played, and the way to top it up — nothing else, no spare room. */
.wallet-box {
  display: flex; align-items: center; height: 40px; padding: 3px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.wallet-btn {
  display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 8px 0 5px;
  background: none; color: var(--text); border-radius: 7px;
}
.wallet-btn:hover, .wallet-btn[aria-expanded="true"] { background: var(--panel-2); }
.wallet-coin { display: grid; }
/* Amount and symbol share one baseline: they are different fonts and sizes, so centring each box on its
   own leaves the symbol floating above or below the digits. */
.wallet-amount { display: inline-flex; align-items: baseline; gap: 4px; line-height: 1; }
/* Tabular digits, so a balance ticking up and down does not make the pill twitch sideways. */
.wallet-balance { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; transition: color .5s; }
.wallet-balance.up { color: var(--accent); transition: none; }
.wallet-balance.down { color: var(--loss); transition: none; }
.wallet-sym { font-size: 11px; font-weight: 600; color: var(--muted); }
.chev { width: 13px; height: 13px; color: var(--muted); transition: transform .15s; }
.wallet-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.wallet-deposit {
  display: inline-flex; align-items: center; gap: 5px; height: 100%; padding: 0 12px;
  border-radius: 7px; font-size: 13px; font-weight: 600;
}
.wallet-deposit svg { width: 14px; height: 14px; flex-shrink: 0; }

/* A coin: its official logo, or — for an asset we ship no logo for — a neutral disc with a letter.
   Logos are not cropped: not every official mark is a circle (Tether's is not). */
.coin {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; line-height: 1;
}
.coin img { display: block; width: 100%; height: 100%; object-fit: contain; }
.coin-letter { border-radius: 50%; background: #4b5569; color: #fff; }

/* A logo inline with text — in tables and labels. Sized to the text it sits beside. */
.coin-img { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; object-fit: contain; }
.coin-img.coin-letter { display: inline-grid; place-items: center; font-size: 9px; font-weight: 700; line-height: 1; }
/* In a label that already spaces its children, the logo needs no margin of its own. */
.amount-asset .coin-img, .dep-amount-asset .coin-img { margin-right: 0; }

/* Aligned to the pill's right edge: it sits near the edge of the screen, and must not run off it. */
.wallet-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 260px; max-height: 60vh; overflow-y: auto; padding: 5px; display: grid; gap: 1px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.wallet-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; text-align: left;
  background: none; color: var(--text); border-radius: 7px;
}
/* In the list there is room for the coin to be read at a glance. */
.wallet-item .coin { width: 26px; height: 26px; flex-basis: 26px; font-size: 14px; }
.wallet-item:hover { background: var(--panel-2); }
.wallet-item.active { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.wallet-item .name { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.wallet-item .name b { font-size: 13px; }
.wallet-item .name small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-item .amt { font-size: 13px; }
.wallet-item .amt.zero { color: var(--muted); }

@media (max-width: 640px) {
  header.topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; }
  .topbar .brand em, .wallet-sym, .deposit-label { display: none; }
  .account-menu { width: min(300px, calc(100vw - 24px)); }
  .wallet-deposit { padding: 0 9px; }
  .wallet-menu { width: min(260px, calc(100vw - 24px)); }
}

/* ----------------------------------------------------------------- popup -- */
.modal {
  padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.modal::backdrop { background: rgba(4, 6, 10, .72); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
body:has(.modal[open]) { overflow: hidden; }

/* Everything inside one wrapper, so a click that lands on the dialog itself is a click on the backdrop. */
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; color: var(--muted); font-size: 24px; line-height: 1; padding: 4px 10px; }
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-sub {
  margin: 26px 0 8px; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}

/* ------------------------------------------------------------------ home -- */
a.brand { color: inherit; text-decoration: none; }

.home { display: grid; gap: 28px; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center;
  padding: 36px; border-radius: 18px; border: 1px solid var(--line); overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(74, 222, 128, .14), transparent 55%),
    linear-gradient(135deg, #151b27, #10141d);
}
.hero-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .3);
}
.hero h1 { margin: 14px 0 12px; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -0.02em; }
.hero-lead { margin: 0 0 22px; max-width: 46ch; color: var(--muted); font-size: 16px; line-height: 1.6; }
.hero-cta { gap: 12px; }
.big-cta { padding: 12px 22px; font-size: 16px; border-radius: 10px; }
.hero-art { height: 220px; }
.hero-art svg { display: block; width: 100%; height: 100%; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-art { height: 120px; order: -1; }
}

.home-head {
  margin: 0 0 -14px; font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.game-card {
  display: grid; gap: 14px; padding: 20px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .15s, border-color .15s, background-color .15s;
}
.game-card:hover { transform: translateY(-2px); border-color: rgba(74, 222, 128, .45); background: var(--panel-2); }
.game-card:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.game-card-icon {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px;
  background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .3); color: var(--accent);
  font-size: 22px; font-weight: 700;
}
.game-card-icon svg { width: 30px; height: 30px; }
.game-card-name { display: grid; gap: 2px; }
.game-card-name b { font-size: 18px; }
.game-card-name small { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.game-card-name .live i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--loss);
  box-shadow: 0 0 8px var(--loss); animation: nav-pulse 1.6s ease-in-out infinite;
}
.game-card-go { font-size: 14px; font-weight: 600; color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .game-card { transition: none; }
  .game-card:hover { transform: none; }
  .game-card-name .live i { animation: none; }
}

/* ----------------------------------------------------------------- slots -- */
/* Third-party games: a row on the homepage, the lobby, and one game framed. */
.slot-page { display: grid; gap: 16px; align-content: start; }
.slots-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.slot-card {
  position: relative; display: grid; gap: 8px; overflow: hidden; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); transition: transform .15s, border-color .15s;
}
.slot-card:hover { transform: translateY(-2px); border-color: rgba(74, 222, 128, .45); }
.slot-card:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.slot-card img, .slot-card .slot-card-blank {
  width: 100%; height: auto; aspect-ratio: 288 / 210; object-fit: cover; display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted); font-size: 28px; font-weight: 700;
}
.slot-card-name { display: grid; gap: 2px; padding: 0 12px 12px; min-width: 0; }
.slot-card-name b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-card-name small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A card's shape, shimmering, while the catalog loads. */
.slot-skeleton { pointer-events: none; }
.slot-skeleton .slot-card-blank, .slot-skeleton b, .slot-skeleton small {
  background: linear-gradient(90deg, var(--panel-2) 25%, #232a3a 50%, var(--panel-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 6px;
}
.slot-skeleton .slot-card-blank { border-radius: 0; }
.slot-skeleton b { height: 14px; width: 70%; }
.slot-skeleton small { height: 12px; width: 45%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty and error states, in place of the grid. */
.slot-status { display: grid; gap: 10px; padding: 22px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.slot-status p { margin: 0; }
.slot-status p:empty { display: none; }
.slot-status .row { justify-content: center; }

/* The homepage rows: strips that scroll by touch, by their buttons, or by the arrow keys. */
/* A scroll strip inside grid and flex boxes: every ancestor down to it must be allowed to shrink (min-width: 0), or the
   row's min-content width — the sum of its cards — becomes the page's width. */
.home > * { min-width: 0; }
.home-rows { display: grid; gap: 24px; min-width: 0; }
.home-row { display: grid; gap: 14px; min-width: 0; }
.home-row-head { display: flex; align-items: baseline; gap: 10px; }
.home-row-head .home-head { margin: 0; }
.home-slots { display: grid; gap: 18px; min-width: 0; }
.home-slots-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.home-slots-head .home-head { margin: 0 0 4px; }
.home-slots-head p { margin: 0; }
.home-slots-head input { min-width: 240px; }
.carousel { position: relative; min-width: 0; max-width: 100%; }
.carousel-track {
  display: flex; gap: 12px; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-padding: 0 4px;
  padding: 4px; margin: -4px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 14px; }
.carousel-track > .slot-card { flex: 0 0 160px; width: 160px; scroll-snap-align: start; }
.carousel-track > .game-card { flex: 0 0 220px; width: 220px; scroll-snap-align: start; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--text);
  border-color: var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.carousel-btn svg { width: 18px; height: 18px; }
.carousel-btn.prev { left: -14px; }
.carousel-btn.next { right: -14px; }
.carousel-btn:hover:not(:disabled) { border-color: var(--muted); }
.carousel-btn:disabled { opacity: .25; }
.carousel.fits .carousel-btn { display: none; }                   /* everything is in view: nothing to scroll to */
@media (max-width: 760px) { .carousel-btn { display: none; } }    /* a thumb does the scrolling */

/* One game framed: where it came from, what mode it is in, and which balance it plays. */
.slot-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; color: var(--muted); text-decoration: none; }
.slot-back:hover { color: var(--text); }
.slot-back svg { width: 16px; height: 16px; }
.slot-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.mode-badge.free { color: var(--accent); background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .4); }
.mode-badge.real { color: #fbbf24; background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .45); }
.slot-currency { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.slot-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.slot-actions .ghost { display: inline-flex; align-items: center; gap: 6px; }
.slot-actions .ghost svg { width: 16px; height: 16px; }
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.mode-btn { padding: 8px 14px; border-radius: 7px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
#slot-real.active { color: #fbbf24; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .45); }
.slot-frame { width: 100%; aspect-ratio: 16 / 9; min-height: 420px; border: 1px solid var(--line); border-radius: 14px; background: #000; }
.slot-frame:fullscreen { border: 0; border-radius: 0; }
@media (prefers-reduced-motion: reduce) {
  .slot-card { transition: none; }
  .slot-card:hover { transform: none; }
  .slot-skeleton .slot-card-blank, .slot-skeleton b, .slot-skeleton small { animation: none; }
  .carousel-track { scroll-behavior: auto; }
}

.home-points { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.point { display: grid; gap: 6px; padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.point b { font-size: 15px; }
.point span { font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------------------------------------------------------- account menu -- */
.topbar .account { position: relative; }
/* The avatar sits in a ring that fills as the player moves through their level, in their level's colour. */
.avatar-btn {
  position: relative; padding: 3px; line-height: 0; border: 0; border-radius: 50%;
  background: conic-gradient(var(--lvl, var(--accent)) calc(var(--progress, 0) * 1turn), var(--line) 0);
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { filter: brightness(1.15); }
.avatar-btn .avatar { box-shadow: 0 0 0 2px var(--panel); }
.avatar-level {
  position: absolute; right: -5px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 999px; line-height: 1;
  background: var(--lvl, var(--accent)); color: #0c0e13; font-size: 10px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--panel);
}
.avatar { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--bg); }
.avatar-lg { width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; }

.account-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30;
  width: 300px; max-height: calc(100vh - 90px); overflow-y: auto; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45); color: var(--text); font-size: 14px;
}
/* Focusable only so a click on its plain rows keeps focus inside it, rather than closing it. */
.account-menu:focus { outline: none; }
.menu-profile { display: flex; align-items: center; gap: 12px; padding: 6px 6px 12px; }
.menu-who { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.menu-who b { font-size: 14px; }
.menu-group { padding: 6px 0; border-top: 1px solid var(--line); }
.menu-label {
  padding: 6px 10px 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px;
  background: none; border: 0; border-radius: 8px; color: var(--text);
  font-size: 14px; text-align: left; text-decoration: none;
}
.menu-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-item:hover:not(:disabled) svg, .menu-item:focus-visible svg { color: var(--text); }
.menu-item:disabled { opacity: .55; cursor: not-allowed; }
.menu-soon {
  margin-left: auto; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.menu-foot { padding-bottom: 0; }
.menu-signout, .menu-signout svg { color: var(--loss); }
.menu-item.menu-signout:hover:not(:disabled) svg, .menu-item.menu-signout:focus-visible svg { color: var(--loss); }

/* ------------------------------------------------------------ bet history -- */
.bets-page { display: grid; gap: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.page-head p { margin: 0; max-width: 62ch; }
/* A page of its own, so the table takes the height it needs; narrow screens scroll it sideways. */
.scroll.tall { max-height: none; overflow-x: auto; }

/* ---------------------------------------------------------------- levels -- */
.level-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.xp-bar { display: block; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.xp-bar i {
  display: block; height: 100%; width: calc(var(--progress, 0) * 100%); border-radius: inherit;
  background: var(--lvl, var(--accent)); transition: width .4s ease;
}
.xp-bar-lg { height: 10px; }
@media (prefers-reduced-motion: reduce) { .xp-bar i { transition: none; } }

/* The level card at the top of the account menu. */
.menu-level {
  display: grid; gap: 6px; margin: 0 2px 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); color: var(--text); text-decoration: none;
}
.menu-level:hover, .menu-level:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--lvl, var(--line)); }

/* A level badge beside a name, e.g. in the Crash players table. */
.lvl {
  display: inline-grid; place-items: center; min-width: 20px; height: 16px; margin-right: 6px; padding: 0 4px;
  border-radius: 999px; vertical-align: 1px; font: 700 10px/1 ui-sans-serif, system-ui, sans-serif;
  color: var(--lvl); background: color-mix(in srgb, var(--lvl) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--lvl) 45%, transparent);
}

/* A large ring: the rewards page, and the level-up moment. */
.level-ring {
  flex-shrink: 0; width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%;
  background: conic-gradient(var(--lvl, var(--accent)) calc(var(--progress, 0) * 1turn), var(--line) 0);
}
.level-ring-num {
  width: 80px; height: 80px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel); color: var(--lvl, var(--accent)); font: 800 30px/1 ui-sans-serif, system-ui, sans-serif;
}

.rewards-page { display: grid; gap: 16px; }
.level-card { display: flex; align-items: center; gap: 22px; }
.level-card-body { display: grid; gap: 10px; flex: 1; min-width: 0; }
.level-title { font-size: 22px; }
.rewards-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.rewards-grid p { margin: 0 0 10px; line-height: 1.55; }
@media (max-width: 560px) { .level-card { flex-direction: column; align-items: stretch; text-align: center; } .level-card .level-ring { margin: 0 auto; } }

.levelup { position: fixed; top: 76px; left: 50%; z-index: 40; transform: translateX(-50%); }
.levelup-card {
  display: grid; justify-items: center; gap: 6px; padding: 18px 28px 16px; cursor: pointer;
  border-radius: 16px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--lvl, var(--accent)) 55%, var(--line));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 44px color-mix(in srgb, var(--lvl, var(--accent)) 25%, transparent);
  animation: levelup-in .45s cubic-bezier(.2, 1.4, .4, 1);
}
.levelup-ring { width: 72px; height: 72px; }
.levelup-ring .level-ring-num { width: 60px; height: 60px; font-size: 24px; }
.levelup-title { font-size: 18px; }
@keyframes levelup-in { from { opacity: 0; transform: translateY(-12px) scale(.85); } }
@media (prefers-reduced-motion: reduce) { .levelup-card { animation: none; } }

/* ---------------------------------------------------------------- chests -- */
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head h2 { margin-bottom: 12px; }
.menu-count {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; text-align: center;
  background: var(--accent); color: #06210f; font-size: 11px; font-weight: 800;
}

.chests { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.chest-card {
  display: grid; justify-items: center; gap: 8px; padding: 16px 14px; text-align: center; border-radius: 14px;
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--lvl, var(--accent)) 40%, var(--line));
}
.chest-card button { width: 100%; }
.chest-icon { display: grid; place-items: center; color: var(--lvl, var(--accent)); }
.chest-icon svg { width: 44px; height: 44px; }

/* The tier colours: the rarer, the warmer. */
.tier { font-weight: 700; }
.tier-common { --tier: #8a93a8; } .tier-uncommon { --tier: #4ade80; } .tier-rare { --tier: #38bdf8; }
.tier-epic { --tier: #a78bfa; } .tier-legendary { --tier: #e7b847; } .tier-mythic { --tier: #f472b6; }
.tier { color: var(--tier); }

.chest-reveal {
  display: grid; justify-items: center; gap: 4px; margin-bottom: 14px; padding: 20px; border-radius: 14px; text-align: center;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--tier) 22%, transparent), transparent 70%), var(--bg);
  border: 1px solid color-mix(in srgb, var(--tier) 55%, var(--line));
  animation: reveal-in .5s cubic-bezier(.2, 1.4, .4, 1);
}
.chest-reveal .chest-icon { color: var(--tier); }
.reveal-tier { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--tier); }
.reveal-amount { font-size: 28px; font-family: ui-monospace, monospace; color: var(--accent); }
@keyframes reveal-in { from { opacity: 0; transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { .chest-reveal { animation: none; } }

/* ---------------------------------------------------------------- weekly -- */
.weekly-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.weekly-card, .jackpot-card { display: grid; gap: 10px; align-content: start; }
.weekly-card p, .jackpot-card p { margin: 0; line-height: 1.5; }
.weekly-big { font: 800 26px/1.15 ui-monospace, monospace; overflow-wrap: anywhere; }
.weekly-big .coin-img, .home-jackpot-pot .coin-img { width: 22px; height: 22px; margin-right: 8px; vertical-align: -3px; }
.weekly-claim {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}
.weekly-claim div { display: grid; gap: 2px; min-width: 0; }
.jackpot-card { background: radial-gradient(circle at 100% 0%, rgba(231, 184, 71, .14), transparent 60%), var(--panel); }
.jackpot-pot { color: #e7b847; }
.jackpot-last {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
}
.jackpot-last img { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.jackpot-last div { display: grid; gap: 2px; min-width: 0; }
.seed-hash { font: 11px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; color: var(--muted); }

.home-jackpot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 20px; border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  background: radial-gradient(circle at 0% 50%, rgba(231, 184, 71, .18), transparent 55%), var(--panel);
  border: 1px solid color-mix(in srgb, #e7b847 40%, var(--line));
}
.home-jackpot:hover { border-color: #e7b847; }
.home-jackpot-label { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #e7b847; }
.home-jackpot-pot { font: 800 24px/1 ui-monospace, monospace; }
.home-jackpot .muted { margin-left: auto; }

/* --------------------------------------------------------------- avatars -- */
.avatar.avatar-xl { width: 96px; height: 96px; border-radius: 22px; }
.avatar-now { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.avatar-now-body { display: grid; gap: 8px; justify-items: start; }
.avatar-style-name { font-size: 18px; }
.token-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.token-chip { padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.token-chip b { color: var(--text); }

.profile-name { display: grid; gap: 8px; margin-bottom: 16px; }
.profile-name p { margin: 0; }
.name-row { display: flex; gap: 8px; flex-wrap: wrap; }
.name-row input { flex: 1 1 180px; min-width: 0; }
.profile-name #username-clear { justify-self: start; }

.style-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.style-tile {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px;
  border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--text);
}
.style-tile:not(:disabled):hover { border-color: var(--accent); }
.style-tile:disabled { cursor: default; opacity: 1; }
.style-tile.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.style-img { width: 64px; height: 64px; border-radius: 14px; background: var(--panel-2); }
.style-tile.locked .style-img { filter: grayscale(1) brightness(.55); }
.style-tile.locked .style-name { color: var(--muted); }
.style-name { font-size: 12px; line-height: 1.2; text-align: center; }
.style-lock { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); color: #fff; }
.style-lock svg { width: 20px; height: 20px; }
.style-current {
  position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: #06210f; font-size: 10px; font-weight: 800;
}
.reveal-style { margin: 6px 0 2px; }
.reveal-prize { font-size: 18px; }
.home-foot { margin: 0; text-align: center; }

.credits { display: grid; gap: 14px; margin: 0 0 18px; padding: 0; list-style: none; }
.credit { display: flex; align-items: flex-start; gap: 12px; }
.credit img { flex-shrink: 0; border-radius: 10px; background: var(--panel-2); }
.credit div { display: grid; gap: 2px; min-width: 0; }
.credit pre { white-space: pre-wrap; font-size: 12px; }

/* ----------------------------------------------------------------- 404 -- */
.not-found { max-width: 520px; margin: 48px auto; }
.not-found-lead { font-size: 20px; margin: 0 0 6px; }
.button-link { display: inline-block; padding: 9px 14px; border-radius: 8px; text-decoration: none; }

/* The header dot goes grey while the socket is reconnecting, so a stale page never looks live. */
.dot.offline { background: var(--muted); box-shadow: none; }
