/* BitRex Colosseum — the whole UI, no framework.
   Display type is a 7 KB Anton subset (A–Z, 0–9) for FIGHT / K.O. only.
   Everything else stays on system fonts so the 2 MB budget stays on the rex. */

:root {
  --bg: #120e0a;
  --panel: rgba(24, 19, 14, 0.86);
  --panel-line: rgba(226, 186, 120, 0.16);
  --ink: #f2e8d8;
  --muted: #a4947c;
  --gold: #e8b45c;
  --orange: #f7931a;        /* bitcoin */
  --red: #d8452f;
  --green: #6fbf5e;
  --blue: #6aa9d8;
  --stam: #e0c05a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "Colosseum", Impact, Haettenschweiler, "Arial Black", "Franklin Gothic Medium", sans-serif;
}

@font-face {
  font-family: "Colosseum";
  src: url("/client/fonts/colosseum.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020, U+002D, U+002E, U+0030-0039, U+0041-005A;
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
@supports (height: 100dvh) {
  html, body { height: 100dvh; max-height: 100dvh; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#stage {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  display: block;
}

/* A vignette costs one element and replaces a post-processing pass. */
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0,0,0,0.38) 100%);
}

.screen {
  position: fixed; inset: 0; z-index: 5;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  max-height: 100%;
  max-height: 100dvh;
  overflow: auto;
}
.screen.on { display: flex; }
.screen.hud { pointer-events: none; padding: 0; overflow: hidden; z-index: 12; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

/* ── buttons ─────────────────────────────────────────────────────────── */
button, select, input {
  font-family: inherit; font-size: 14px; color: inherit;
}
button {
  cursor: pointer; border-radius: 2px; border: 1px solid var(--panel-line);
  background: rgba(255,255,255,0.04); padding: 10px 16px;
  transition: background .14s, border-color .14s, color .14s, transform .06s;
}
button:hover { background: rgba(255,255,255,0.09); border-color: rgba(232,180,92,0.45); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(180deg, var(--orange), #c9720d);
  border-color: #ffb44d; color: #1a1206; font-weight: 700;
}
button.primary:hover { filter: brightness(1.08); }
button.secondary { background: rgba(232,180,92,0.10); border-color: rgba(232,180,92,0.3); }
button.text-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
button.text-btn:hover {
  background: transparent;
  border: none;
  color: var(--ink);
}
button.text-btn:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}
button.wide { width: 100%; }
button.big { width: 100%; padding: 18px; display: grid; gap: 4px; text-align: left; }
button.big b { font-size: 20px; letter-spacing: .04em; }
button b { display: block; }
button small { display: block; font-weight: 400; opacity: .72; font-size: 11.5px; }

input[type="text"], input:not([type]) {
  background: rgba(0,0,0,0.35); border: 1px solid var(--panel-line);
  border-radius: 8px; padding: 10px 12px; width: 100%; outline: none;
}
input[type="range"] { accent-color: var(--orange); width: 100%; }

/* ── mark ────────────────────────────────────────────────────────────── */
.mark {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.32em;
  color: rgba(242, 232, 216, 0.78);
  line-height: 1;
}
.logo { display: grid; gap: 2px; letter-spacing: .18em; }
.logo .bit { font-size: 40px; font-weight: 800; color: var(--orange); line-height: 1; }
.logo .col { font-size: 18px; color: var(--gold); letter-spacing: .42em; }
.logo.small .bit { font-size: 22px; }
.logo.small .col { font-size: 10px; letter-spacing: .34em; }

/* ── loading ─────────────────────────────────────────────────────────── */
#screen-loading { flex-direction: column; gap: 18px; background: var(--bg); }
.loadbar { width: min(360px, 70vw); height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }

/* ── menu ──────────────────────────────────────────────────────────────
   The pit is the page. A bottom scrim holds PLAY; a thin top strip holds
   identity. No left-rail, no stacked wordmark, no four equal pills. */
#screen-menu {
  align-items: stretch;
  justify-content: space-between;
  overflow: hidden;
  pointer-events: none;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background:
    linear-gradient(to bottom, rgba(8, 6, 4, 0.5) 0%, transparent 16%),
    linear-gradient(to top, rgba(8, 6, 4, 0.82) 0%, rgba(8, 6, 4, 0.28) 18%, transparent 42%);
}
#screen-menu .menu-head,
#screen-menu .menu-dock {
  pointer-events: auto;
}
.menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%;
  padding: 18px 22px 0;
  flex: 0 0 auto;
}
.head-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-wrap {
  margin: 0;
  width: min(480px, 100%);
  max-height: calc(100dvh - 88px);
  display: grid;
  gap: 12px;
  overflow: auto;
  flex: 0 1 auto;
}
.menu-body { display: grid; gap: 14px; align-items: start; }

.menu-dock {
  width: min(560px, calc(100% - 28px));
  margin: 0 14px 18px;
  display: grid;
  gap: 12px;
  align-content: end;
  flex: 0 0 auto;
}
.dock-fight {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
}
.dock-nav {
  display: grid;
  gap: 4px;
  justify-items: start;
}
.dock-links,
.bot-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 16px;
}
.bot-label { font-size: 13px; color: var(--muted); }

.pit-plaque {
  pointer-events: none;
  position: absolute;
  right: 24px;
  bottom: 22px;
  text-align: right;
  text-shadow: 0 2px 18px rgba(0,0,0,0.85), 0 0 24px rgba(0,0,0,0.55);
  display: grid;
  gap: 2px;
  justify-items: end;
}
.pit-plaque[hidden] { display: none; }
.pit-kicker {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.pit-plaque b {
  font-family: var(--display);
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0.08em;
  line-height: 1;
}
.pit-plaque .dim { color: var(--muted); font-size: 11px; }
.pit-rank {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.pit-rank svg { display: block; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.65)); }

.look-load {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: 180px;
}
.look-load[hidden] { display: none !important; }
#look-load-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.look-load-bar {
  display: block;
  width: 180px;
  height: 3px;
  background: rgba(226, 186, 120, 0.18);
  overflow: hidden;
}
.look-load-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transform-origin: left center;
}
.look-load-bar.pulse i {
  width: 38%;
  animation: look-pulse 1.1s ease-in-out infinite;
}
@keyframes look-pulse {
  0%, 100% { transform: translateX(-10%); opacity: 0.55; }
  50% { transform: translateX(160%); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .look-load-bar.pulse i { animation: none; width: 38%; }
}

/* ── the ladder ──────────────────────────────────────────────────────────
   Six rungs, always visible. A player should never have to click to find out
   what the next thing is, or why something is not available yet. */
.ladder {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.rung {
  flex: 1 1 auto; min-width: 72px;
  padding: 8px 10px 7px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--panel-line); background: rgba(255,255,255,.03);
  border-top: 2px solid rgba(255,255,255,.12);
  transition: background .14s, border-color .14s, color .14s;
}
.rung b { display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rung:hover { background: rgba(255,255,255,.07); }
.rung.done { border-top-color: var(--green); }
.rung.done b { color: var(--ink); }
.rung.done::after { content: "✓"; float: right; font-size: 10px; color: var(--green); margin-top: -14px; }
.rung.on { background: rgba(247,147,26,.14); border-color: rgba(247,147,26,.5); border-top-color: var(--orange); }
.rung.on b { color: var(--orange); }
.rung.locked { cursor: not-allowed; opacity: .42; }
.rung.locked::after { content: "🔒"; float: right; font-size: 9px; margin-top: -14px; }

.tag-free {
  display: inline-block; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; vertical-align: middle; margin-left: 6px;
  color: var(--green); border: 1px solid rgba(111,191,94,.45); background: rgba(111,191,94,.12);
}
.menu-foot { max-width: 480px; line-height: 1.5; }

.panel {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 2px;
  padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.panel h2 {
  margin: 0 0 14px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
}
.panel.play { display: grid; gap: 10px; align-content: start; }

.menu-gate { display: grid; gap: 10px; align-content: start; }
.menu-gate[hidden] { display: none !important; }
.rex-gate {
  background: rgba(12, 9, 6, 0.82);
  border: 1px solid var(--panel-line);
  padding: 14px 16px 16px;
  max-height: min(58vh, 480px);
  overflow: auto;
}
.menu-gate h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.08em;
  line-height: 1.1;
}
.gate-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.gate-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 36ch;
}
.wallet-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.connect-cta {
  background: transparent;
  border: 1px solid rgba(232, 180, 92, 0.55);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
}
button.connect-cta:hover {
  background: rgba(232, 180, 92, 0.12);
  border-color: var(--gold);
  color: var(--ink);
}
button.connect-cta:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}
button.connect-cta:disabled {
  opacity: 0.55;
}
.rex-pick { display: grid; gap: 8px; max-height: min(38vh, 380px); overflow: auto; }
.rex-pick-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 12px;
  row-gap: 2px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 2px;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  align-items: center;
}
.rex-pick-card .rex-thumb {
  grid-row: 1 / span 3;
  width: 44px; height: 44px;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(247,147,26,.35), rgba(18,14,10,.4)),
    #3a2e22;
  box-shadow: inset 0 0 0 1px rgba(232,180,92,.2);
}
.rex-pick-card b { font-size: 16px; letter-spacing: 0.04em; grid-column: 2; }
.rex-pick-card .dim { color: var(--muted); font-size: 11px; grid-column: 2; }
.rex-pick-card > *:not(.rex-thumb) { grid-column: 2; }
.rex-pick-card.sel { border-color: var(--gold); background: rgba(232, 180, 92, 0.14); }
.rex-pick-card.sel .rex-thumb { box-shadow: inset 0 0 0 2px var(--gold); }
.rex-pick-card.wild {
  border-style: dashed;
  background: rgba(247, 147, 26, 0.06);
}
.rex-pick-card.wild .rex-thumb {
  background: repeating-linear-gradient(-45deg, rgba(247,147,26,.15) 0 6px, transparent 6px 12px), #2a2218;
}
.rex-pick-tag {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
}
.play-as {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gold);
}
.play-solo {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  background: var(--panel);
}
.play-solo h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: none;
}
.play-solo p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.cosmetic {
  font-style: normal; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--green); border: 1px solid rgba(111,191,94,0.35); border-radius: 999px; padding: 1px 7px;
}
.note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 0; border-left: 2px solid var(--panel-line); padding-left: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--panel-line); background: rgba(255,255,255,0.03); cursor: pointer;
}
.chip:hover { border-color: rgba(232,180,92,0.5); }
.chip.sel { border-color: var(--gold); background: rgba(232,180,92,0.16); color: #fff; }
.chip.locked { opacity: .42; cursor: not-allowed; }
.chip i.swatch { width: 12px; height: 12px; border-radius: 3px; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.chip .price { color: var(--gold); font-family: var(--mono); font-size: 11px; }

.rexes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.rex-card { width: 92px; border: 1px solid var(--panel-line); border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.3); }
.rex-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #1c1712; }
.rex-card span { display: block; font-family: var(--mono); font-size: 10px; padding: 5px; color: var(--muted); }

/* ── queue ───────────────────────────────────────────────────────────── */
#screen-queue { background: rgba(10, 8, 6, 0.42); }
.queue-box { text-align: center; display: grid; gap: 14px; justify-items: center; max-width: 28rem; }
.queue-box h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(28px, 4.6vw, 42px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff6e4;
  text-shadow: 3px 4px 0 #140800;
}
.queue-box .muted { line-height: 1.5; max-width: 22rem; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(232,180,92,0.18); border-top-color: var(--orange);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── HUD ─────────────────────────────────────────────────────────────── */
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 22px;
  padding: 16px 22px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), transparent);
  transition: padding-top 0.22s ease;
}
body:has(.letterbox.top.on) .hud-top { padding-top: calc(4.6vh + 8px); }
.fighter { display: grid; gap: 5px; min-width: 0; }
.fighter .row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.fighter.opp .row { justify-content: flex-end; }
#you-name, #opp-name {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fighter .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.bar { position: relative; height: 13px; border-radius: 3px; background: rgba(0,0,0,0.55); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07); }
.bar.stam { height: 5px; margin-top: 1px; }
.bar i { position: absolute; inset: 0 auto 0 0; display: block; width: 100%; }
.bar.hp i { background: linear-gradient(180deg, #e0563c, #a82d1c); }
.bar.hp .ghostbar { background: rgba(255,255,255,0.3); }
.bar.stam i { background: var(--stam); }
.bar.stam i.low { background: var(--red); }
.bar.stam .ghostbar { background: rgba(94, 196, 168, 0.28); }
.bar.stam i.delay { filter: saturate(0.4); opacity: 0.7; }
.fighter.opp .bar i { left: auto; right: 0; }

/* Head-height identity. Same look, two wallets — this is how you find yourself. */
.nametag {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -118%);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  padding: 4px 8px 5px;
  color: #efe6d4;
  background: rgba(10, 7, 5, 0.78);
  box-shadow: inset 0 0 0 1px rgba(226, 186, 120, 0.18);
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}
.nametag.on { opacity: 1; visibility: visible; }
.nametag.me {
  color: var(--orange);
  box-shadow:
    inset 0 0 0 1px rgba(247, 147, 26, 0.45),
    0 0 14px rgba(247, 147, 26, 0.18);
}

.pips { display: inline-flex; gap: 4px; }
.pips i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255,255,255,0.16); display: block; }
.pips i.won { background: var(--gold); box-shadow: 0 0 8px rgba(232,180,92,.6); }

.centre { text-align: center; }
#timer { font-family: var(--mono); font-size: 34px; font-weight: 700; line-height: 1; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
#timer.urgent { color: var(--red); animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.banner {
  position: absolute; top: 16%; left: 50%;
  font-family: var(--display);
  font-size: clamp(72px, 16vw, 168px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.04em;
  line-height: 0.82;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  color: #fff6e4;
  -webkit-text-stroke: 0.035em #140800;
  paint-order: stroke fill;
  text-shadow:
    5px 7px 0 #140800,
    0 22px 50px rgba(0,0,0,.8),
    0 0 42px rgba(247,147,26,.45);
  transform: translate(-50%, -50%) scale(2.4) skewX(-12deg);
}
.banner.on { animation: banner-slam 1.55s cubic-bezier(.13, 1.45, .32, 1) both; }
.banner.go {
  color: #ffb124;
  font-size: clamp(40px, 8vw, 84px);
  top: 14%;
}
.banner.ko {
  color: #ff2d22;
  font-size: clamp(96px, 22vw, 220px);
  letter-spacing: 0.08em;
  text-shadow:
    6px 8px 0 #140800,
    0 28px 60px rgba(0,0,0,.85),
    0 0 64px rgba(255,45,34,.55);
}
.banner.ko.on { animation: banner-ko 1.85s cubic-bezier(.1, 1.3, .28, 1) both; }
.banner.count {
  color: #f2e8d8;
  font-size: clamp(88px, 18vw, 200px);
  letter-spacing: 0.02em;
}
.banner.count.on { animation: banner-count 0.82s cubic-bezier(.15, 1.7, .4, 1) both; }
.banner.good { color: var(--gold); }
.banner.bad { color: var(--red); font-size: clamp(48px, 9vw, 96px); }

.vs-splash {
  position: absolute; top: 100px; left: 50%;
  transform: translateX(-50%);
  display: none;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: baseline;
  min-width: min(72vw, 640px);
  pointer-events: none;
  z-index: 4;
}
.vs-splash.on { display: grid; animation: vs-in 0.55s cubic-bezier(.13, 1.4, .32, 1) both; }
.vs-splash span {
  font-family: var(--mono);
  font-size: clamp(13px, 2vw, 18px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #fff6e4;
  text-shadow: 0 2px 12px rgba(0,0,0,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vs-splash span:last-child { text-align: right; }
.vs-splash b {
  font-family: var(--display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 400;
  font-style: italic;
  color: var(--orange);
  letter-spacing: 0.08em;
  text-shadow: 3px 4px 0 #140800, 0 0 24px rgba(247,147,26,.45);
}
@keyframes vs-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(1.06); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes banner-slam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.7) skewX(-14deg); filter: blur(8px); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(0.86) skewX(-8deg); filter: blur(0); }
  22%  { transform: translate(-50%, -50%) scale(1.1) skewX(-8deg); }
  82%  { opacity: 1; transform: translate(-50%, -50%) scale(1) skewX(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.06) skewX(-8deg) translateY(-12px); }
}
@keyframes banner-ko {
  0%   { opacity: 0; transform: translate(-50%, -46%) scale(3.1) skewX(-16deg); filter: blur(10px); }
  10%  { opacity: 1; transform: translate(-50%, -50%) scale(0.82) skewX(-8deg); filter: blur(0); }
  20%  { transform: translate(-50%, -50%) scale(1.12) skewX(-8deg); }
  78%  { opacity: 1; transform: translate(-50%, -50%) scale(1) skewX(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.08) skewX(-8deg); }
}
@keyframes banner-count {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.3) skewX(-12deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(0.9) skewX(-8deg); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1) skewX(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.15) skewX(-8deg); }
}

.toasts { position: absolute; top: 42%; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.toast, .dmg { font-weight: 800; letter-spacing: .08em; animation: rise 1s ease-out forwards; text-shadow: 0 3px 14px rgba(0,0,0,.9); }
.toast { font-size: 26px; }
.toast.parry { color: var(--gold); }
.toast.break { color: var(--orange); }
.toast.block { color: var(--blue); font-size: 20px; }
.toast.pierce { color: #e8895a; font-size: 22px; }
.toast.deflect { color: #7ad0ff; }
.toast.feint { color: #e8b45c; font-size: 20px; }

/* Incoming swing callout — the read the whole directional game is built on. */
.read {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 2px;
  opacity: 0; pointer-events: none; transition: opacity .08s;
  text-shadow: 0 3px 14px rgba(0,0,0,.9);
}
.read.on { opacity: 1; }
.read b {
  font-family: var(--display); font-style: italic; font-size: clamp(28px, 4.4vw, 44px);
  letter-spacing: .08em; color: #ffb124; line-height: 1;
  -webkit-text-stroke: 0.03em #140800; paint-order: stroke fill;
}
.read span {
  font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: #fff6e4;
  font-weight: 800;
}
.read.break b { color: #ff4a2a; animation: threat-pulse .22s ease-in-out infinite alternate; }
.read.thrust b { color: #7ad0ff; }
.read.light b { color: #f0d090; font-size: clamp(22px, 3.4vw, 34px); }
.dmg { font-size: 22px; font-family: var(--mono); }
.dmg.me { color: var(--red); }
.dmg.them { color: #ffd98a; }
@keyframes rise { from { transform: translateY(10px) scale(.9); opacity: 0; } 22% { transform: translateY(0) scale(1.06); opacity: 1; } to { transform: translateY(-34px); opacity: 0; } }

.stam-warning {
  position: absolute; top: 58%; left: 50%; transform: translateX(-50%);
  color: var(--red); font-weight: 800; letter-spacing: .14em; font-size: 17px;
  opacity: 0; transition: opacity .2s;
}
.stam-warning.on { opacity: 1; animation: pulse .5s infinite; }

/* ── guard direction ──────────────────────────────────────────────────────
   Three arcs around the crosshair. The lit one is where your guard (or your swing)
   is pointing — the information the directional read depends on. */
.guard {
  position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%);
  width: 132px; height: 34px; opacity: 0; transition: opacity .1s;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; align-items: end;
}
.guard.on { opacity: 1; }
.guard-arc {
  height: 7px; border-radius: 4px; background: rgba(255,255,255,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); transition: background .07s, box-shadow .07s;
}
.guard-arc.high { height: 11px; }
.guard-arc.lit { background: var(--gold); box-shadow: 0 0 10px rgba(232,180,92,.75); }
/* Swinging, not guarding: the same arcs in the attack colour, so the two never read alike. */
.guard.attacking .guard-arc.lit { background: var(--orange); box-shadow: 0 0 10px var(--orange); }
.guard-arc.threat { background: #ff4a2a; box-shadow: 0 0 12px rgba(255,74,42,.85); animation: threat-pulse .28s ease-in-out infinite alternate; }
@keyframes threat-pulse { to { filter: brightness(1.35); } }
.guard-label {
  grid-column: 1 / -1; text-align: center; font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--dim, rgba(255,255,255,.55)); margin-top: 3px;
}

/* ── chain depth ───────────────────────────────────────────────────────── */
.chain-pips {
  position: absolute; left: 50%; bottom: 140px; transform: translateX(-50%);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); opacity: 0; transition: opacity .08s; white-space: nowrap;
  text-shadow: 0 0 12px rgba(232, 180, 92, .45);
}
.chain-pips.on { opacity: 1; }

/* ── ring edge ─────────────────────────────────────────────────────────── */
.brink {
  position: absolute; left: 50%; top: 84px; transform: translateX(-50%);
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--red); opacity: 0; transition: opacity .12s;
  text-shadow: 0 0 14px rgba(216,69,47,.8);
}
.brink.on { opacity: 1; animation: brinkpulse .9s ease-in-out infinite; }
@keyframes brinkpulse { 50% { opacity: .45; } }

.charge {
  position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%);
  width: 230px; display: grid; gap: 4px; justify-items: center; opacity: 0; transition: opacity .12s;
}
.charge.on { opacity: 1; }
.charge-track { position: relative; width: 100%; height: 9px; border-radius: 5px; background: rgba(0,0,0,.6); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.charge-track i { position: absolute; inset: 0 auto 0 0; background: var(--gold); width: 0; }
.charge-track i.breaking { background: var(--orange); box-shadow: 0 0 12px var(--orange); }
.charge-track b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: .85; }
.charge span { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

.hit-flash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 38%, rgba(200,40,20,0.62) 100%); opacity: 0; }
.hit-flash.on { animation: flash .38s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.netstats {
  position: absolute; left: 14px; bottom: 14px; display: none;
  font-family: var(--mono); font-size: 11px; line-height: 1.6;
  background: rgba(0,0,0,.55); border: 1px solid var(--panel-line); border-radius: 8px; padding: 8px 11px;
}
.netstats.on { display: block; }
.netstats table { border-collapse: collapse; margin-top: 4px; }
.netstats td { padding: 0 8px 0 0; }
.netstats .r-read { color: var(--red); }
.netstats .r-simple { color: var(--stam); }
.netstats .r-choice { color: var(--green); }
.hud-hint { position: absolute; right: 14px; bottom: 14px; }

.letterbox {
  position: fixed; left: 0; right: 0; height: 0; background: #050302;
  z-index: 6; pointer-events: none; transition: height 0.22s ease;
}
.letterbox.on { height: 4.6vh; }
.letterbox.top { top: 0; }
.letterbox.bot { bottom: 0; }

.input-display {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: none; gap: 5px; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
}
.input-display.on { display: flex; }
.input-display i {
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.18); border-radius: 4px; color: var(--muted);
}
.input-display i.on { color: #140800; background: var(--gold); border-color: var(--gold); }
.input-display .axes { color: var(--muted); min-width: 36px; text-align: center; }

.train-overlay {
  position: absolute; left: 14px; top: 92px; display: none;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  background: rgba(0,0,0,.5); border: 1px solid var(--panel-line); border-radius: 8px; padding: 8px 10px;
}
.train-overlay.on { display: grid; gap: 2px; }

/* ── result ──────────────────────────────────────────────────────────── */
#screen-result { background: rgba(10,8,6,0.72); backdrop-filter: blur(3px); }
.result-box { text-align: center; display: grid; gap: 16px; justify-items: center; }
.result-box h1 { margin: 0; font-family: var(--display); font-size: 84px; letter-spacing: .08em; font-style: italic; -webkit-text-stroke: 0.03em #140800; paint-order: stroke fill; }
.result-box h1.win { color: var(--gold); }
.result-box h1.lose { color: var(--red); }
.result-box h1.draw { color: var(--muted); }
.score { font-family: var(--mono); font-size: 26px; letter-spacing: .2em; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ── replay ──────────────────────────────────────────────────────────── */
#screen-replay { align-items: flex-end; pointer-events: none; padding: 0; }
.replay-bar {
  pointer-events: auto; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: linear-gradient(0deg, rgba(0,0,0,.82), transparent);
}
.replay-meta { display: grid; gap: 2px; min-width: 180px; }
.replay-rounds { display: flex; gap: 5px; }
.replay-rounds button { padding: 5px 10px; font-size: 12px; }
.replay-rounds button.sel { border-color: var(--gold); background: rgba(232,180,92,.16); }
#rp-scrub { flex: 1; accent-color: var(--orange); }
.badge { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid; width: fit-content; }
.badge.ok { color: var(--green); border-color: rgba(111,191,94,.45); background: rgba(111,191,94,.1); }
.badge.bad { color: var(--red); border-color: rgba(216,69,47,.5); background: rgba(216,69,47,.12); }
/* Played under earlier combat rules — no verdict available, which is not a failure. */
.badge.warn { color: var(--gold); border-color: rgba(232,180,92,.45); background: rgba(232,180,92,.1); }

/* ── modal ───────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(6,4,3,.7); backdrop-filter: blur(4px); padding: 20px; }
.modal.on { display: flex; }
.modal-box {
  position: relative;
  background:
    linear-gradient(180deg, rgba(42, 32, 22, 0.96), rgba(18, 14, 10, 0.97));
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  padding: 22px 26px 18px;
  width: min(760px, 100%);
  max-height: 86vh;
  overflow: auto;
  box-shadow:
    inset 0 0 0 1px rgba(232, 180, 92, 0.08),
    var(--shadow);
}
.modal-box .close { position: absolute; top: 8px; right: 8px; }
.modal-box h2 { margin-top: 0; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.modal-box h3 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 22px 0 8px; }
.modal-box table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modal-box td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.06); }
.modal-box td:last-child { text-align: right; }
kbd {
  font-family: var(--mono); font-size: 11.5px; background: rgba(0,0,0,.5);
  border: 1px solid var(--panel-line); border-bottom-width: 2px; border-radius: 2px; padding: 1px 6px;
}
.bind-btn { font-family: var(--mono); font-size: 11.5px; padding: 4px 9px; }
.bind-btn.listening { border-color: var(--orange); color: var(--orange); }
button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
button.ghost:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.06);
  border-color: transparent;
}
button.icon { padding: 6px 10px; line-height: 1; }

.cmd-sheet h2 {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.14em;
  color: var(--ink);
  line-height: 1;
  margin: 0 0 8px;
}
.cmd-sheet h3 {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--ink);
  margin: 0 0 6px;
}
.cmd-sheet .cmd-body + h3 { margin-top: 18px; }
.cmd-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
}
.cmd-body {
  display: grid;
  grid-template-columns: minmax(13.5em, 0.36fr) 1fr;
  gap: 8px 36px;
  align-items: start;
}
.cmd-keys {
  display: grid;
  grid-template-columns: 1fr;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cmd-keys li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(226, 186, 120, 0.12);
}
.cmd-keys b { font-weight: 600; }
.cmd-keys i {
  font-style: normal;
  color: var(--muted);
  font-size: 11.5px;
  margin-right: auto;
}
.cmd-keys .keys { margin-left: auto; white-space: nowrap; }
.combos, .beats {
  list-style: none;
  margin: 0;
  padding: 0;
}
.combos li {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(226, 186, 120, 0.1);
}
.combos .seq {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  white-space: nowrap;
}
.combo-copy {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.combos b {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  font-weight: 400;
  flex: 0 0 auto;
}
.combos i {
  font-style: normal;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}
.beats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
}
.beats li {
  padding: 5px 0;
  border-bottom: 1px solid rgba(226, 186, 120, 0.08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.beats b { color: var(--ink); font-weight: 600; }
table.stance {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 13px;
}
table.stance th, table.stance td {
  text-align: left;
  padding: 7px 8px 7px 0;
  border-bottom: 1px solid rgba(226, 186, 120, 0.12);
  vertical-align: top;
  line-height: 1.3;
}
table.stance thead th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
table.stance tbody th { color: var(--ink); font-weight: 600; white-space: nowrap; width: 7.5em; }
table.stance td i { font-style: normal; color: var(--muted); display: block; font-size: 11.5px; }
table.stance kbd { font-size: 10.5px; }
.cmd-sheet .note { margin: 14px 0 0; }
.cmd-sheet a.ext {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-underline-offset: 3px;
}

.toast-error {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 40;
  background: rgba(216,69,47,.94); color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
}
.toast-error.on { opacity: 1; transform: translate(-50%, 0); }

/* ── narrow screens ──────────────────────────────────────────────────── */
@media (max-width: 820px) {
  #screen-menu {
    justify-content: space-between;
    background: linear-gradient(to top,
      rgba(8,6,4,0.92) 0%, rgba(8,6,4,0.55) 26%, rgba(8,6,4,0.12) 48%, transparent 68%);
  }
  .menu-head { width: 100%; padding: 14px 16px 0; }
  .menu-dock { width: calc(100% - 24px); margin: 0 12px 14px; }
  .play-big { width: 100%; min-width: 0; }
  .rank-card { width: 100%; min-width: 0; }
  .pit-plaque {
    top: 70px; right: 16px; bottom: auto;
  }
  .pit-plaque b { font-size: 22px; }
  .play-big { padding: 14px 18px 12px; }
  .play-big b { font-size: 30px; }
  .banner { font-size: 64px; }
  .banner.ko { font-size: 84px; }
  .result-box h1 { font-size: 52px; }
  .hud-top { gap: 10px; padding: 10px 12px; }
  #timer { font-size: 26px; }
  .hud-hint { display: none; }
  .ladder-sheet { width: 100%; }
  .cmd-keys { grid-template-columns: 1fr; }
  .cmd-body { grid-template-columns: 1fr; }
  .combos .seq { white-space: normal; }
  .combo-copy { flex-wrap: wrap; gap: 4px 10px; }
  .beats { grid-template-columns: 1fr; }
  .cmd-sheet h2 { font-size: 24px; }
  button.connect-cta { padding: 7px 10px; font-size: 11px; }
}

/* Short windows: shrink the menu so it stays inside the viewport. */
@media (max-height: 760px) {
  .screen { padding: 12px 16px; }
  #screen-menu { padding: 0; }
  .menu-wrap { gap: 8px; }
  .menu-gate { gap: 8px; }
  .menu-gate h1 { font-size: clamp(24px, 5.2vh, 34px); }
  button.big { padding: 12px 14px; }
  button.big b { font-size: 17px; }
}


/* ── the lessons ─────────────────────────────────────────────────────────
   An overlay, not a screen: the arena stays visible behind it because the whole
   point is that you are learning inside the game. */
#screen-tutorial { pointer-events: none; align-items: flex-start; justify-content: flex-start; padding: 0; z-index: 14; }
#screen-tutorial.on { display: block; }
.lesson-card {
  pointer-events: auto;
  position: absolute; left: 20px; top: 20px; width: min(380px, calc(100vw - 40px));
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow); backdrop-filter: blur(6px);
  display: grid; gap: 10px;
}
.lesson-head { display: flex; align-items: center; gap: 10px; }
.lesson-count { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.lesson-dots { display: flex; gap: 3px; flex: 1; }
.lesson-dots i { width: 100%; height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); }
.lesson-dots i.done { background: var(--green); }
.lesson-dots i.on { background: var(--orange); }
.lesson-card h2 { margin: 0; font-size: 19px; letter-spacing: .01em; }
.lesson-teach { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.lesson-teach kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.45); border: 1px solid var(--panel-line); color: var(--ink);
}
.lesson-teach b { color: var(--gold); }
.lesson-teach em { color: var(--ink); font-style: normal; text-decoration: underline; text-decoration-color: rgba(232,180,92,.5); }
.lesson-goal {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border-radius: 9px; background: rgba(247,147,26,.09);
  border: 1px solid rgba(247,147,26,.28); font-size: 12.5px;
}
.lesson-pips { display: flex; gap: 4px; flex: 0 0 auto; }
.lesson-pips i {
  width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.lesson-pips i.lit { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.lesson-actions { display: flex; justify-content: flex-end; }
.lesson-done {
  position: absolute; left: 50%; top: 34%; transform: translateX(-50%) scale(.9);
  font-family: var(--display); font-size: 62px; letter-spacing: .06em; color: var(--green);
  opacity: 0; transition: opacity .16s, transform .16s; text-shadow: 0 0 30px rgba(111,191,94,.6);
}
.lesson-done.on { opacity: 1; transform: translateX(-50%) scale(1); }

/* ── the circuit ─────────────────────────────────────────────────────── */
#screen-circuit {
  align-items: stretch; justify-content: flex-start; overflow: auto;
  background: linear-gradient(100deg, rgba(10,8,6,.96) 0%, rgba(10,8,6,.92) 46%, rgba(10,8,6,.6) 100%);
}
#screen-circuit .menu-head,
#screen-ladder .menu-head {
  padding: 0;
  width: 100%;
}
.circuit-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .circuit-grid { grid-template-columns: 1fr 1.15fr; } }
.circ-stat { display: flex; align-items: baseline; gap: 9px; margin-bottom: 8px; }
.circ-stat b { font-family: var(--mono); font-size: 26px; color: var(--gold); line-height: 1; }
.circ-stat span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
.standings th {
  text-align: left; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; padding: 0 8px 7px 0; border-bottom: 1px solid var(--panel-line);
}
.standings td { padding: 7px 8px 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.standings tr.mine td { color: var(--gold); }
.standings tr.unqualified td { opacity: .5; }


/* ── the one button ──────────────────────────────────────────────────────
   The menu is a single screen now. PLAY is the only thing that should read as
   an action; everything else is deliberately quiet. */
.play-big {
  width: auto; min-width: 220px; padding: 16px 26px 14px; display: grid; gap: 4px; text-align: left;
  border-radius: 2px;
  background: linear-gradient(180deg, #f0a43a 0%, #d47a14 52%, #a85c0c 100%);
  border: 1px solid #ffd089;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.45),
    inset 0 -3px 0 rgba(80, 36, 0, 0.4),
    0 12px 28px rgba(0, 0, 0, 0.42);
}
.play-big:hover { filter: brightness(1.05); }
.play-big b { font-family: var(--display); font-size: 36px; letter-spacing: .14em; line-height: 0.92; }
.play-big small { font-size: 13px; opacity: .88; font-weight: 500; color: #2a1606; }

.rank-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  min-width: 220px;
  padding: 8px 12px 8px 8px;
  background:
    linear-gradient(180deg, rgba(58, 40, 22, 0.94) 0%, rgba(18, 13, 8, 0.94) 100%);
  border: 1px solid rgba(226, 186, 120, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.22),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 10px 24px rgba(0, 0, 0, 0.32);
  border-radius: 3px;
}
.rank-card[hidden] { display: none !important; }
.rank-badge { display: block; line-height: 0; }
.rank-badge svg { display: block; }
.rank-meta { display: grid; gap: 2px; min-width: 0; }
.rank-kicker {
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
}
.rank-meta b {
  font-family: var(--display); font-size: 22px; letter-spacing: .08em; line-height: 1;
}
.rank-lp { font-size: 12px; color: var(--muted); }
.rank-bar {
  display: block; height: 3px; margin-top: 6px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(226, 186, 120, 0.18);
  overflow: hidden;
}
.rank-bar i { display: block; height: 100%; width: 0; background: var(--gold); }
.rank-open { padding: 8px 10px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.result-rank {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px;
  background: linear-gradient(180deg, rgba(58, 40, 22, 0.9), rgba(18, 13, 8, 0.9));
  border: 1px solid rgba(226, 186, 120, 0.38);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.18);
}
.result-rank[hidden] { display: none !important; }
.result-rank-meta { display: grid; gap: 2px; text-align: left; }
.result-rank-meta b { font-family: var(--display); font-size: 26px; letter-spacing: .08em; line-height: 1; }
.result-rank-meta span { font-size: 13px; color: var(--gold); }
.result-rank-meta span.down { color: var(--red); }
.result-rank-meta span.same { color: var(--muted); }

#screen-ladder {
  align-items: stretch;
  justify-content: flex-start;
  overflow: auto;
  padding: 18px 22px 24px;
  background: linear-gradient(90deg, rgba(10,8,6,.94) 0%, rgba(10,8,6,.78) 48%, rgba(10,8,6,.22) 100%);
}
.ladder-sheet {
  width: min(620px, 100%);
  display: grid;
  gap: 18px;
  align-content: start;
}
.ladder-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.ladder-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ladder-title b {
  font-family: var(--display);
  font-size: 34px;
  letter-spacing: 0.1em;
  line-height: 1;
}
.ladder-title span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.rank-rail {
  list-style: none;
  margin: 0;
  padding: 6px 0 10px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.rank-rail .leg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  z-index: 1;
}
.rank-rail .leg::after {
  content: "";
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 1px;
  background: rgba(226, 186, 120, 0.28);
  z-index: -1;
}
.rank-rail .leg:last-child::after { display: none; }
.rank-rail .leg span {
  font-size: 8.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-rail .leg.on span { color: var(--gold); }
.rank-rail .leg svg { display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45)); }
.rank-rail .leg.on svg { transform: scale(1.18); }
.rank-rail .leg.on::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -4px;
  height: 2px;
  background: var(--gold);
}

.ladder-board {
  display: grid;
  gap: 10px;
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(226, 186, 120, 0.28);
  padding-bottom: 8px;
}
.board-head b {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.1em;
}
.board-head span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.board-row {
  display: grid;
  grid-template-columns: 2.2em 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(226, 186, 120, 0.1);
}
.board-row .place {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.board-row .badge { display: flex; justify-content: center; line-height: 0; }
.board-row .badge svg { display: block; }
.board-row .who { display: grid; gap: 1px; min-width: 0; }
.board-row .who b {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-row .who i { font-style: normal; font-size: 11px; color: var(--muted); }
.board-row .lp { font-family: var(--mono); font-size: 12px; color: var(--gold); }
.board-row.mine .who b,
.board-row.mine .place { color: var(--gold); }
.board-row.ghost { opacity: 0.38; }
.board-row.ghost .badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px dashed rgba(226, 186, 120, 0.4);
}
.board-ghost { display: grid; }
.board-ghost[hidden] { display: none !important; }
.board-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 36ch;
}
.board-empty[hidden] { display: none !important; }
.ladder-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  max-width: 42ch;
}
.standings .rank-cell { display: flex; align-items: center; gap: 10px; }
.standings .rank-cell svg { flex: 0 0 auto; }
.standings td.num { text-align: right; font-family: var(--mono); color: var(--muted); }
.standings tr.mine td { color: var(--gold); }

.quick-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quick-row button { padding: 8px 12px; font-size: 12.5px; min-height: 36px; }
.quick-row button.tiny { padding: 8px 12px; font-size: 12px; color: var(--ink); min-width: 64px; }
.quick-row button.tiny:hover { border-color: var(--gold); }
.quick-sep { flex: 1 1 auto; }
.quick-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.control-hint { margin: 0; letter-spacing: 0.02em; }

.circuit-enter { width: auto; text-align: left; padding: 12px 14px; border-radius: 2px; }
.circuit-enter b { display: block; font-size: 15px; }
.circuit-enter small { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
