/* "Street Fighter II (Large) (Colour)" by Patrick H. Lauke, CC BY 3.0. A pixel-grid COLR
   font: use sizes that are multiples of 16px so every brick stays a whole pixel. */
@font-face {
  font-family: 'SF2 Colour';
  src: url('/fonts/sf2/street-fighter-ii-large-colour.colr.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #0a0908;
  --bg-2: #121110;
  --panel: #161412;
  --panel-2: #1e1b18;
  --line: #3a2424;
  --line-2: #5c2a2a;
  --text: #f4ebd8;
  --muted: #c8bda8;
  --dim: #8a8070;
  --red: #e31c23;
  --red-deep: #9a1218;
  --blue: #3d8bff;
  --blue-deep: #1c4fae;
  --salt: #ffd166;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --radius: 10px;
  --pixel: 'Silkscreen', ui-monospace, 'Cascadia Mono', monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { height: 100%; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(227, 28, 35, 0.22), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: #fff6e4; text-decoration: none; }
a:hover { color: var(--red); text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--pixel); font-weight: 700; letter-spacing: 0.02em; line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
.pixel { font-family: var(--pixel); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.salt { color: var(--salt); font-weight: 600; }
.red-text { color: var(--red); }
.blue-text { color: var(--blue); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 0;
  padding: 0;
  background: rgba(10, 9, 8, 0.94);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.topbar-main {
  display: flex; align-items: center; gap: 14px;
  padding: 5px 16px 4px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 41px; height: 44px; object-fit: contain; display: block; }
.brand-wordmark { height: 44px; width: auto; display: block; }
.topbar-chrome {
  display: flex; align-items: center; gap: 10px;
  min-height: 28px;
  padding: 4px 16px;
  background:
    linear-gradient(180deg, #2c1010 0%, #120808 100%);
  border-top: 1px solid #5c2a2a;
  border-bottom: 2px solid var(--red);
  box-shadow: inset 0 1px 0 rgba(244, 235, 216, 0.08);
}
.free-tag {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border: 1px solid #ffd166;
  background: linear-gradient(180deg, #ff3a40, var(--red-deep));
  color: #fff6e4;
  font-family: var(--pixel);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255, 246, 228, 0.28);
}
.free-line {
  flex-shrink: 0;
  color: #fff6e4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chrome-sep {
  flex-shrink: 0;
  width: 1px; height: 12px;
  background: #7a3a3a;
}
.coin-line {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-credit {
  position: fixed; right: 10px; bottom: 6px; z-index: 15;
  margin: 0;
  max-width: min(340px, calc(100vw - 24px));
  text-align: right;
  font-size: 10px;
  line-height: 1.35;
  color: var(--dim);
  pointer-events: none;
}
.page-credit a { pointer-events: auto; color: var(--muted); }
.arcade { font-family: 'SF2 Colour', var(--pixel); font-weight: 400; letter-spacing: 0; }
h1.arcade { font-size: 32px; line-height: 1.1; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted);
  font-family: var(--pixel); font-size: 13px;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--red); }
.account { display: flex; align-items: center; gap: 10px; }
.balance-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 209, 102, 0.1); border: 1px solid rgba(255, 209, 102, 0.35);
  color: var(--salt); font-family: var(--pixel); font-size: 14px;
}
.balance-chip .shaker { width: 12px; height: 14px; image-rendering: pixelated; }
.user-name { color: var(--muted); font-size: 14px; }
.mode-banner {
  padding: 6px 20px; font-size: 13px; text-align: center;
  background: rgba(227, 28, 35, 0.14); border-bottom: 1px solid rgba(227, 28, 35, 0.35); color: #f4ebd8;
}
.mode-banner a { color: var(--salt); }

/* ---------- layout ---------- */
.app { max-width: 1320px; margin: 0 auto; padding: 20px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.flow > * + * { margin-top: 16px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font-family: var(--pixel); font-size: 13px; letter-spacing: 0.02em;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }
.btn-salt { background: var(--salt); border-color: #ffe29a; color: #2a1d00; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(255, 107, 107, 0.5); color: var(--bad); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-red { background: linear-gradient(180deg, #ff1a1a, var(--red-deep)); border-color: #ff4d52; color: #fff6e4; }
.btn-blue { background: linear-gradient(180deg, var(--blue), var(--blue-deep)); border-color: #7fb2ff; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; }
input[type='text'], input[type='password'], input[type='number'], input[type='search'], textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line-2); background: #0c0b0a; color: var(--text);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(227, 28, 35, 0.18); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 9px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: #1a1612; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--salt); }

/* ---------- tier & tags ---------- */
.tier {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 5px; font-family: var(--pixel); font-weight: 700; font-size: 13px; color: #0a0908;
}
.tier-X { background: linear-gradient(90deg, #ff6ad5, #c774e8, #8795e8, #94d0ff); }
.tier-S { background: #ffd166; }
.tier-A { background: #ff8a5b; }
.tier-B { background: #7fb2ff; }
.tier-P { background: #b99a7a; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #1a1612; border: 1px solid var(--line-2); color: var(--muted);
}
.tag-house { color: #fff6e4; }
.tag-live { color: var(--good); border-color: rgba(61, 220, 151, 0.4); }

/* ---------- stat bars ---------- */
.stats { display: grid; gap: 5px; }
.stat { display: grid; grid-template-columns: 74px 1fr 26px; align-items: center; gap: 8px; font-size: 12px; }
.stat-name { color: var(--muted); }
.stat-val { text-align: right; font-family: var(--pixel); font-size: 12px; }
.stat-bar { height: 8px; border-radius: 2px; background: #0c0b0a; overflow: hidden; border: 1px solid #3a2424; }
.stat-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #9a1218, #e31c23); }
.stat-bar > i.hi { background: linear-gradient(90deg, #ffb347, #ffd166); }
.stat-bar > i.lo { background: linear-gradient(90deg, #4a4036, #8a8070); }
.stat.prodigy .stat-name { color: var(--salt); }
.progress { height: 10px; border-radius: 3px; background: #0c0b0a; border: 1px solid var(--line-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, #ffd166 0 8px, #ffbf3f 8px 16px); transition: width 0.4s ease; }

/* ---------- arena ---------- */
/* The stage is a 9:16 phone-shaped window: exactly what gets streamed or exported to
   TikTok, YouTube Shorts and Instagram Reels. */
.arena-layout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
.stage-col { display: flex; flex-direction: column; gap: 10px; align-items: center; position: sticky; top: 160px; }
.stage {
  position: relative; border-radius: 14px; overflow: hidden;
  width: min(432px, calc((100vh - 150px) * 9 / 16)); min-width: 216px; aspect-ratio: 9 / 16;
  border: 3px solid #3a2424; background: #070605;
  box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(227, 28, 35, 0.16);
}
.stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.stage-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.info-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.side-grid .stack-col { display: flex; flex-direction: column; gap: 14px; }
body.stream-mode .topbar, body.stream-mode .mode-banner, body.stream-mode .page-credit, body.stream-mode .toasts { display: none; }
body.stream-mode { background: #000; }
body.stream-mode .app { max-width: none; padding: 0; }

/* Arena home: lock the document. Header + stage + bet bar + panels fit 100dvh.
   Only chat logs and odds lists scroll. Class is on <html> so overflow cannot leak. */
html.route-arena,
html.route-arena body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
html.route-arena body {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
html.route-arena .app {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  width: 100%;
  padding: 8px 16px 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html.route-arena .arena-layout {
  flex: 1 1 0;
  min-height: 0;
  align-items: stretch;
  gap: 12px;
  grid-template-rows: minmax(0, 1fr);
}
html.route-arena .stage-col {
  position: static;
  align-self: stretch;
  justify-content: center;
  gap: 6px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  container-type: size;
}
html.route-arena .stage {
  width: min(340px, calc((100dvh - 110px) * 9 / 16));
  max-height: calc(100% - 32px);
  min-width: 0;
}
@supports (height: 1cqh) {
  html.route-arena .stage {
    width: min(340px, calc((100cqh - 32px) * 9 / 16));
    height: min(604px, calc(100cqh - 32px));
    max-height: calc(100cqh - 32px);
  }
}
html.route-arena .info-col {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
html.route-arena .betbar { flex: 0 0 auto; }
html.route-arena .bet-side { min-height: 64px; padding: 6px 8px; }
html.route-arena .bet-center { padding: 6px 10px; gap: 6px; }
html.route-arena .corner-cards { flex: 0 1 auto; min-height: 0; overflow: hidden; }
html.route-arena .corner-head .portrait { width: 48px; height: 48px; }
html.route-arena .side-grid {
  flex: 1 1 0;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
}
html.route-arena .chat {
  height: auto;
  min-height: 0;
  max-height: none;
}
html.route-arena .stack-col {
  min-height: 0;
  overflow: hidden;
}
html.route-arena .stack-col .panel {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html.route-arena .stack-col .list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}
html.route-arena .toasts { bottom: 34px; }
.stream-wrap { height: 100vh; display: grid; place-items: center; background: #000; position: relative; }
.stream-wrap canvas { height: 100vh; width: auto; max-width: 100vw; aspect-ratio: 9 / 16; image-rendering: pixelated; display: block; }
.stream-unmute { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); }
.clip-status { font-size: 13px; color: var(--muted); min-height: 18px; text-align: center; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.clip-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; font-size: 13px; }
.clip-thumb { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); background: #070605; }
.clip-pending { display: grid; place-items: center; color: var(--muted); font-family: var(--pixel); font-size: 12px; }
.clip-title { font-family: var(--pixel); font-size: 13px; }
.target-form { display: grid; grid-template-columns: 140px 1fr 1fr auto; gap: 8px; margin-top: 10px; }
@media (max-width: 760px) { .target-form { grid-template-columns: 1fr; } }
.stage-live {
  position: absolute; top: 10px; right: 12px; display: flex; align-items: center; gap: 6px;
  font-family: var(--pixel); font-size: 11px; color: #ffd0d6;
  background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 6px;
}
.stage-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
.stage-live.offline i { background: var(--dim); box-shadow: none; }
.betbar {
  display: grid; grid-template-columns: 1fr minmax(220px, auto) 1fr; gap: 12px; align-items: stretch;
}
.bet-side {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 84px; padding: 10px; border-radius: var(--radius); cursor: pointer; text-align: center;
  font-family: var(--pixel); color: #fff; border: 2px solid transparent;
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.bet-side:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.bet-side:disabled { cursor: default; filter: saturate(0.55) brightness(0.8); }
.bet-side.red { background: linear-gradient(180deg, #ff1a1a, #9a1218); border-color: #ff4d52; }
.bet-side.blue { background: linear-gradient(180deg, #4f97ff, #1c4fae); border-color: #86b8ff; }
.bet-side.picked { box-shadow: 0 0 0 3px var(--salt), 0 0 22px rgba(255, 209, 102, 0.55); filter: none; }
.bet-side .bs-label { font-size: 12px; opacity: 0.9; }
.bet-side .bs-name { font-size: 17px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-side .bs-meta { font-family: var(--sans); font-size: 12px; opacity: 0.9; }
.bet-center {
  display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 260px;
  padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
}
.bet-amount { display: flex; gap: 6px; }
.bet-amount input { text-align: center; font-family: var(--pixel); font-size: 16px; }
.bet-quick { display: flex; gap: 5px; }
.bet-quick .btn { flex: 1; padding: 5px 0; font-size: 11px; }
.bet-status { font-size: 13px; text-align: center; color: var(--muted); min-height: 20px; }
.bet-status strong { color: var(--text); }
.corner-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.corner { border-top: 3px solid; }
.corner.red { border-top-color: var(--red); }
.corner.blue { border-top-color: var(--blue); }
.corner-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.corner-head .portrait { width: 64px; height: 64px; flex: none; }
.corner-name { font-family: var(--pixel); font-size: 16px; font-weight: 700; line-height: 1.2; }
.corner-sub { font-size: 12px; color: var(--muted); }
.trait-line { font-size: 12px; margin-top: 8px; color: var(--muted); }
.trait-line b { color: var(--text); }
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.chat { display: flex; flex-direction: column; height: 420px; padding: 0; overflow: hidden; }
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--pixel); font-size: 13px; display: flex; justify-content: space-between; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.chat-msg { word-wrap: break-word; }
.chat-msg b { color: var(--salt); font-weight: 600; margin-right: 4px; }
.chat-msg.system { color: var(--dim); font-style: italic; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { padding: 7px 10px; }
.list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; background: #1a1612; }
.list-item .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-red { color: var(--red); font-weight: 600; }
.w-blue { color: var(--blue); font-weight: 600; }

/* ---------- fighter cards ---------- */
.fighter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.fighter-card { display: flex; flex-direction: column; gap: 10px; }
.fighter-card .preview-wrap { background: radial-gradient(circle at 50% 80%, #3a2424, #0c0b0a 70%); border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }
.preview { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.portrait { image-rendering: pixelated; object-fit: contain; background: #0c0b0a; border-radius: 8px; border: 1px solid var(--line); }
.fc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fc-name { font-family: var(--pixel); font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.fc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.fc-status { font-size: 13px; color: var(--muted); }
.fc-error { font-size: 13px; color: var(--bad); }
.create-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr); gap: 20px; align-items: start; }
.create-form h3 { margin-top: 8px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 10px 0 4px; }
.sheet-slot { padding: 12px; margin: 0; }
.sheet-slot h3 { margin-bottom: 6px; }
.slot-file { font-size: 12px; margin: 8px 0 0; word-break: break-word; }
.slot-file.bad, .slot-status.bad { color: var(--bad); }
.slot-file.good { color: var(--good); }
.prompt-builder { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.prompt-out { min-height: 72px; font-size: 12px; line-height: 1.4; background: #0c0b0a; }
.cost-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 10px 12px; border-radius: 8px; background: #1a1612; border: 1px solid var(--line); margin: 12px 0; }

/* ---------- detail ---------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.match-layout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .match-layout { grid-template-columns: 1fr; } }
.clip-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.clip-tabs .btn.on { background: var(--salt); color: #2a1d00; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.prompt-quote { font-size: 14px; color: var(--muted); border-left: 3px solid var(--line-2); padding: 4px 10px; margin: 10px 0; font-style: italic; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid rgba(58, 36, 36, 0.6); vertical-align: middle; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.rank { font-family: var(--pixel); color: var(--dim); width: 36px; }
.mini-portrait { width: 32px; height: 32px; vertical-align: middle; margin-right: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 12px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-family: var(--pixel); font-size: 20px; margin-top: 4px; }

/* ---------- auth ---------- */
.auth-wrap { max-width: 420px; margin: 40px auto; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.auth-tabs a { text-align: center; padding: 8px; border-radius: 8px; font-family: var(--pixel); font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); }
.auth-tabs a.on { color: #2a1d00; background: var(--salt); border-color: var(--salt); }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.form-ok { color: var(--good); font-size: 13px; min-height: 0; margin-bottom: 8px; }
button.linkish {
  background: none; border: 0; padding: 0; color: var(--salt); cursor: pointer;
  font: inherit; text-decoration: underline;
}
.auth-check h1 { margin-top: 0; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 3, 0.78); display: grid; place-items: center; padding: 16px; }
.modal { width: min(640px, 100%); max-height: 86vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: #1a1612; cursor: pointer; text-align: left; width: 100%; }
.pick:hover { border-color: var(--salt); }
.pick .portrait { width: 40px; height: 40px; }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  max-width: 360px; padding: 10px 14px; border-radius: 8px; font-size: 14px;
  background: #1e1b18; border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.18s ease-out;
}
.toast.good { border-color: rgba(61, 220, 151, 0.6); }
.toast.bad { border-color: rgba(255, 107, 107, 0.6); }
.toast.salt { border-color: rgba(255, 209, 102, 0.7); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.roll-in { animation: roll-in 0.5s ease-out; }
@keyframes roll-in { 0% { opacity: 0; transform: scale(0.9); } 60% { transform: scale(1.03); } 100% { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .side-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .arena-layout { grid-template-columns: 1fr; }
  .stage-col { position: static; }
  .stage { width: min(100%, 480px); }
  .chat { height: 320px; }
  .create-layout, .detail-layout { grid-template-columns: 1fr; }
  html.route-arena .arena-layout { grid-template-columns: auto minmax(0, 1fr); }
  html.route-arena .stage { width: min(200px, calc((100dvh - 96px) * 9 / 16)); }
}
@media (max-height: 800px) {
  html.route-arena .trait-line { display: none; }
  html.route-arena .bet-side { min-height: 56px; }
  html.route-arena .panel { padding: 10px 12px; }
}
@media (max-width: 760px) {
  .app { padding: 14px 16px; }
  .topbar-main { flex-wrap: wrap; gap: 6px 12px; padding: 6px 12px; }
  .brand-mark { width: 34px; height: 36px; }
  .brand-wordmark { height: 36px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav a { font-size: 12px; padding: 6px 9px; white-space: nowrap; }
  .topbar-chrome { flex-wrap: wrap; gap: 4px 8px; padding: 4px 12px; min-height: 0; }
  .free-line, .coin-line { white-space: normal; }
  .chrome-sep { display: none; }
  .betbar { grid-template-columns: 1fr 1fr; }
  .bet-center { grid-column: 1 / -1; order: -1; min-width: 0; }
  .corner-cards, .two-col { grid-template-columns: 1fr; }
  .fighter-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }
  html.route-arena .app { padding: 6px 10px; }
  html.route-arena .stage { width: min(150px, calc((100dvh - 140px) * 9 / 16)); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
