:root {
  --bg: #131010; --surface: #1b1614; --surface-2: #241d1a; --border: #352b26;
  --ink: #f2ece7; --ink-2: #c3b8b0; --muted: #8f8177;
  --red: #f0576f; --red-ink: #f6899a; --red-soft: #3a181f;
  --blue: #6fa8e6; --blue-soft: #16283f;
  --gold: #e0b45c;
  --good: #8fcba3; --bad: #f0576f;
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.55;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: .01em; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }

/* A view is shown by removing `hidden`; a class that sets `display` must not
   quietly win over it. */
[hidden] { display: none !important; }

header.top { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; margin-bottom: 18px; }
header.top h1 { font-size: 30px; text-transform: uppercase; letter-spacing: .04em; }
header.top .brand { color: inherit; text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px; border-radius: 7px; color: var(--muted); text-decoration: none;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: 13px;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--surface-2); }
/* On a phone the links take a row of their own rather than a column. */
@media (max-width: 520px) {
  header.top { margin-bottom: 12px; }
  header.top .nav { order: 3; flex-basis: 100%; }
  header.top .who { margin-left: auto; }
}
.who a { color: var(--ink-2); text-decoration: none; font-size: 13px; }
.who a.signin, a.button, button.button {
  display: inline-block; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--red);
  color: var(--ink); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px;
  background: transparent; cursor: pointer; text-decoration: none;
}
.who a.signin:hover, a.button:hover, button.button:hover { background: var(--red-soft); }
.who a.whoName::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 7px; }
a { color: var(--ink-2); }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.narrow { max-width: 560px; margin: 0 auto; }
.tag { font-family: var(--font-sans); font-size: 10px; letter-spacing: .06em; color: var(--gold); border: 1px solid var(--gold); border-radius: 20px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
.banner {
  margin: 14px 0 22px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--gold);
  color: var(--ink-2);
}
.cols { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 22px; align-items: start; }
.cols.wide { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card + .card { margin-top: 18px; }
.card > h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-2); margin-bottom: 14px; }

label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 5px; }
input[type=text], select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 10px; margin-bottom: 14px;
}
input[type=text]:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.blurb { font-size: 12.5px; color: var(--muted); margin: -8px 0 14px; font-style: italic; }

.budget { display: flex; justify-content: space-between; font-size: 12px; margin: 12px 0 6px; color: var(--ink-2); }
.budget.over { color: var(--bad); font-weight: 600; }
.meter { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--good); transition: width .12s; }
.meter.over i { background: var(--bad); }

button.primary {
  width: 100%; margin-top: 14px; padding: 10px; border: none; border-radius: 8px;
  background: var(--red); color: #1a0d10; font-weight: 700; cursor: pointer;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em;
}
button.primary:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
button.ghost {
  padding: 5px 11px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 12px;
}
button.ghost:hover:not(:disabled) { border-color: var(--red); color: var(--ink); }
button.ghost:disabled { opacity: .4; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 0 8px 8px; }
td { padding: 9px 8px; border-top: 1px solid var(--border); vertical-align: middle; }
td.num { font-family: var(--font-mono); text-align: right; }
.pal { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.fname { font-weight: 600; color: var(--ink); text-decoration: none; }
a.fname:hover { text-decoration: underline; }
.mine { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--good); border: 1px solid var(--good); border-radius: 20px; padding: 0 6px; margin-left: 7px; vertical-align: 1px; }
.ftype { color: var(--muted); font-size: 11.5px; }

.pill { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--ink-2); }
.pill.queued { border-color: var(--gold); color: var(--gold); }
.pill.running { border-color: var(--blue); color: var(--blue); }
.pill.complete { border-color: var(--good); color: var(--good); }
.pill.failed { border-color: var(--bad); color: var(--bad); }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }

.empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 6px; }
.vs .mid { font-family: var(--font-display); color: var(--muted); font-size: 15px; }
.rounds { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.rounds div { padding: 2px 0; }
.err { color: var(--bad); font-size: 12.5px; font-family: var(--font-mono); word-break: break-word; }
.quote { color: var(--ink-2); font-style: italic; font-size: 12.5px; margin-top: 4px; }
.fightrow { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--border); cursor: pointer; }
.fightrow:hover { background: var(--surface-2); }
.fightrow.sel { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--red); }
.fightrow .who { flex: 1; min-width: 0; }
.spinner { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ----------------------------------------------------------------- league -- */

/* The league fills the window (league.js sets --fit): the feed and the rail
   scroll inside it, and the page itself stays put. */
.wrap:has(> main > #view-league:not([hidden])) { max-width: 1480px; padding-bottom: 16px; }
.league {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "watch tabs" "watch rail"; column-gap: 22px;
  height: var(--fit, calc(100svh - 110px));
}
.watch { grid-area: watch; display: flex; gap: 12px; min-height: 0; }
.paneTabs { grid-area: tabs; }
.paneTabs [data-pane=watch] { display: none; }
.rail {
  grid-area: rail; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.rail .card { padding: 14px; }
.league[data-side=ladder] #fightsPane, .league[data-side=fights] #ladderPane { display: none; }
.ladder th { padding: 0 6px 8px; white-space: nowrap; }
.ladder th:first-child { padding-left: 0; }
.ladder td { padding: 8px 6px; }
.ladder td:first-child { padding-left: 0; }
.ladder td:last-child { padding-right: 0; }
.rowErr { margin: 0; padding: 0 2px 10px; }
#bookCard .vs select { margin-bottom: 0; }

/* One fight to a screen: the feed snaps from reel to reel, and never skips one. */
.feed {
  flex: 1; min-width: 0; position: relative; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; overflow-anchor: none; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.reel {
  height: calc(100% - 12px); margin-bottom: 12px; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.feedNav { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.feedNav button { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.feedNav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feedCount { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* The bill: red corner left, blue corner right. */
.bill { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; }
.fighterPlate { min-width: 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--red); }
.fighterPlate.p2 { text-align: right; padding: 2px 12px 2px 0; border-left: 0; border-right: 3px solid var(--blue); }
.fighterPlate .fname {
  display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.2; letter-spacing: .02em;
  text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fighterPlate.p2 .pal { margin: 0 0 0 8px; }
.fighterPlate .quote { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vsMark { font-family: var(--font-display); font-size: 20px; letter-spacing: .08em; color: var(--muted); }

/* The tape takes whatever room the bill and the result leave, at 16:9. */
.screen { flex: 1 1 auto; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; }
.tv {
  position: relative; width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9;
  border-radius: 10px; overflow: hidden; background: #000;
}
.tv video { display: block; width: 100%; height: 100%; }
.progress { position: absolute; inset: 0 0 auto; height: 3px; background: rgb(255 255 255 / .14); pointer-events: none; }
.progress i { display: block; width: 0; height: 100%; background: var(--red); transition: width .25s linear; }
.sound {
  position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px; border: 0; border-radius: 20px; background: rgb(0 0 0 / .7); color: #fff;
  font-size: 12.5px; cursor: pointer;
}
.sound span { display: inline-flex; }
.sound svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.curtain {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 16px; background: rgb(12 9 9 / .84); text-align: center;
}
.verdict .kicker { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.verdict b { display: block; font-family: var(--font-display); font-size: 36px; font-weight: 600; line-height: 1.15; text-transform: uppercase; }
.verdict.p1 b { color: var(--red-ink); }
.verdict.p2 b { color: var(--blue); }
.verdict .score { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.curtainActions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.curtainActions button.primary { width: auto; margin: 0; padding: 9px 18px; }
.curtainActions button.ghost { padding: 8px 14px; }

/* A fight still to come: the two of them squaring up until the tape exists. */
.tv.waiting { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 8% 5%; background: #0d0f14; }
.corner { width: 38%; height: 70%; display: flex; align-items: flex-end; justify-content: center; }
.corner.p2 .strip { transform: scaleX(-1); }
.waitNote {
  position: absolute; top: 18px; left: 0; right: 0; margin: 0; display: flex; align-items: center; justify-content: center;
  gap: 9px; color: var(--ink-2); font-size: 13px;
}

.reelFoot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; font-size: 12.5px; }
.reelFoot .when { margin-left: auto; }
.result { flex: 1; min-width: 0; }
.result summary {
  width: fit-content; cursor: pointer; color: var(--ink-2);
  font-family: var(--font-display); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase;
}
.result .hint { font-family: var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--muted); }
.result[open] .hint { display: none; }
.resultBody { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 24px; }
.resultBody .rounds { margin-top: 6px; }
.upNext { padding: 0; border: 0; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.upNext b { color: var(--ink-2); font-weight: 600; }
.upNext:hover, .upNext:hover b { color: var(--ink); }

@media (max-width: 900px) {
  /* A phone has room for one: the tabs pick the feed, the ladder or the list. */
  .league { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tabs" "watch"; }
  .league[data-phone=side] { grid-template-areas: "tabs" "rail"; }
  .league[data-phone=side] .watch, .league[data-phone=watch] .rail { display: none; }
  .paneTabs [data-pane=watch] { display: block; }
  .feedNav { display: none; }
  .reel { gap: 10px; padding: 12px; }
  .bill { gap: 10px; }
  .fighterPlate .fname { font-size: 17px; }
  .fighterPlate .quote { font-size: 11.5px; }
  .vsMark { font-size: 15px; }
  .verdict b { font-size: 24px; }
  .curtain { gap: 10px; }
  .reelFoot .result { flex-basis: 100%; }
}

/* ---------------------------------------------------------------- builder -- */

.segmented { display: flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button {
  flex: 1; padding: 7px 10px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 12px; font-family: inherit;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.on { background: var(--red); color: #fff; }

.describe { display: flex; gap: 8px; margin-bottom: 8px; }
.describe input[type=text] { flex: 1; margin-bottom: 0; min-width: 0; }
.describe button {
  padding: 8px 12px; border-radius: 7px; border: 1px solid var(--red); background: var(--red);
  color: #1a0d10; font-weight: 700; cursor: pointer; font-size: 12.5px; white-space: nowrap;
}
.describe button:disabled { background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: wait; }

h4.family {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 10px 0 5px;
}
h4.family:first-child { margin-top: 0; }
.strip { image-rendering: pixelated; background-repeat: no-repeat; margin-top: auto; }

/* The builder takes the page: half of it is a picture of the bot, and the
   other half is pictures of what it could be. */
body:has(#view-build:not([hidden])) .wrap { max-width: 1480px; }
.builder { display: grid; grid-template-columns: clamp(300px, 34%, 460px) minmax(0, 1fr); gap: 28px; align-items: start; }

/* The bot stays pinned while the menus beside it scroll, so every change can
   be watched as it lands. */
.side { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 14px; }

/* Pixel art: never let the browser smooth it, and never stretch it — the size
   difference between one body and another is the point of the picture. The
   stage tracks the window's height so the whole column stays on screen. */
.preview {
  position: relative; margin: 0; display: flex; align-items: flex-end; justify-content: center;
  height: clamp(240px, calc(100vh - 470px), 470px); padding: 14px 8px 18px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 100%, #1a2030 0%, #0d0f14 62%);
}
/* A floor to stand on. */
.preview::after {
  content: ''; position: absolute; left: 6%; right: 6%; bottom: 18px; height: 1px;
  background: linear-gradient(to right, transparent, rgba(195, 184, 176, .35), transparent);
}
.preview .strip { position: relative; z-index: 1; }
.plate {
  position: absolute; top: 12px; left: 14px; z-index: 2; display: flex; flex-direction: column; line-height: 1.2;
  pointer-events: none; text-shadow: 0 1px 3px #0d0f14, 0 0 8px #0d0f14;
}
.plateName { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.plateLine { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.stageBar { display: flex; gap: 8px; margin-top: 10px; }
.stageBar .segmented { flex: 1; margin-bottom: 0; }
button.reroll { display: inline-flex; align-items: center; gap: 6px; }
.reroll svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.reroll svg circle { fill: currentColor; stroke: none; }

.sheet { padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.sheet .nameInput { font-family: var(--font-display); font-size: 18px; letter-spacing: .03em; margin-bottom: 12px; }
.sheet .budget { margin-top: 12px; }
.sheet .roomNote { margin-top: 8px; }

/* The stats at a glance: thin bars filled to the value and outlined to this
   body's ceiling, hatched past it. The whole block opens the tuning tab. */
.miniStats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; width: 100%; margin: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; text-align: left;
}
.miniStats:hover { border-color: var(--red-ink); }
.miniStat { display: grid; grid-template-columns: minmax(0, 64px) 1fr 14px; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); }
.miniLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.miniValue { font-family: var(--font-mono); text-align: right; color: var(--ink); }
.miniBar {
  position: relative; height: 6px; border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 4px);
}
.miniBar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.miniBar .room { width: var(--room, 100%); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--muted); }
.miniBar .fill { width: var(--fill, 0%); background: var(--red); transition: width .12s; }

.options { min-width: 0; }
.prompt { margin-bottom: 16px; }
.prompt .blurb { margin: 0; }

.tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs [role=tab] {
  flex: none; padding: 9px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  font-family: var(--font-display); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
}
.tabs [role=tab]:hover { color: var(--ink-2); }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--red); }
.panelNote { font-size: 12.5px; color: var(--muted); margin: -4px 0 14px; }

/* A menu: its name and what is picked, then the options as pictures. */
.picker { margin-bottom: 24px; }
.picker > h3 {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.picker > h3 .current { font-family: var(--font-sans); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.picker > h3 .current:empty { display: none; }
.menuRow { display: flex; flex-wrap: wrap; gap: 0 30px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 88px), 1fr)); gap: 8px; }
.menuRow .tiles { grid-template-columns: repeat(3, var(--tile, 76px)); }
.tiles h4.family { grid-column: 1 / -1; margin: 8px 0 0; }
.tiles h4.family:first-child { margin-top: 0; }

.tile {
  display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 4px 4px 6px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-size: 11.5px; line-height: 1.25; text-align: center; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.tile:hover { border-color: var(--red-ink); color: var(--ink); }
.tile.on { border-color: var(--red); background: var(--red-soft); color: var(--ink); font-weight: 600; }
.tile .thumb {
  position: relative; display: flex; align-items: flex-end; justify-content: center;
  aspect-ratio: var(--ratio, 4 / 3); padding-bottom: 4%; border-radius: 6px; overflow: hidden;
  background: radial-gradient(110% 80% at 50% 100%, #161b27 0%, #0d0f14 70%);
}
.tile .thumb.centre { align-items: center; padding-bottom: 0; }
.tile.on .thumb { box-shadow: inset 0 0 0 1px rgba(240, 87, 111, .45); }
/* Sized as a share of its tile by the script, so it stretches with the page. */
.tile .pic { position: relative; display: block; width: 0; max-width: 100%; line-height: 0; }
.tile .pic img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.tile .pic img.smooth { image-rendering: auto; }
.tile .pic img:not([src]) { visibility: hidden; }
.tile .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .note { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 10px; font-weight: 400; color: var(--gold); }
.tile .note:empty { display: none; }
/* Where the blow lands: the hit box the fight takes off the same frame. */
.tile .hit { position: absolute; border: 1px solid var(--red); border-radius: 2px; background: rgba(240, 87, 111, .22); }
/* New pictures on their way dim the old ones rather than blanking them. */
.picker.loading .pic { opacity: .5; transition: opacity .2s; }
.words .tile { padding: 10px 8px; }
.words .tile .name { font-size: 13px; }

/* The body under the pointer, or the one picked: bodies are compared by hovering. */
.bodyCard {
  min-height: 96px; margin-bottom: 20px; padding: 12px 14px;
  border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: 8px; background: var(--surface);
}
.bodyCardHead { display: flex; align-items: baseline; gap: 10px; }
.bodyCardHead strong { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: .03em; }
.bodyCardHead .jumps { font-size: 11.5px; color: var(--muted); }
.bodyCard p { margin: 3px 0 8px; font-size: 12.5px; color: var(--ink-2); }
.ceilings { display: flex; flex-wrap: wrap; gap: 5px; }
.ceiling { padding: 1px 8px; border: 1px solid var(--border); border-radius: 20px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.ceiling.up { color: var(--good); border-color: rgba(143, 203, 163, .4); }
.ceiling.down { color: var(--bad); border-color: rgba(240, 87, 111, .4); }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 0; cursor: pointer; }
.swatch span { font-size: 10.5px; color: var(--ink-2); }
.swatch input[type=color] {
  width: 58px; height: 40px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: transparent;
}
.swatch input[type=color]:hover { border-color: var(--red-ink); }
.swatch input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.swatch input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.swatch input[type=color]::-moz-color-swatch { border: 0; border-radius: 5px; }

/* One column: the bot stays on screen above the menus, and naming and signing
   come last, after everything they sign for. */
@media (max-width: 900px) {
  .builder { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .side { display: contents; }
  .stage { position: sticky; top: 0; z-index: 3; margin: 0 -20px; padding: 8px 20px 10px; background: var(--bg); }
  .preview { height: 210px; }
  .options { order: 1; }
  .sheet { order: 2; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ tuning -- */

/* The stats sit under the body that bounds them: the header names the body,
   the "why" line says which picks moved which ceiling, and every row shows
   the whole scale so a sponsor can see what this body cannot reach. */
.tuning { max-width: 660px; }
.tuneHead { font-family: var(--font-display); font-size: 14px; letter-spacing: .03em; color: var(--ink); margin: 0 0 4px; }
.why { font-size: 12px; color: var(--ink-2); margin: 0 0 10px; }
.tuneNote {
  font-size: 12px; color: var(--ink-2); margin: 0 0 10px; padding: 6px 10px;
  background: var(--surface-2); border-left: 3px solid var(--gold); border-radius: 4px;
}
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--muted); margin: 0 0 12px; }
.legend i { position: relative; display: inline-block; width: 12px; height: 10px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--border); border-radius: 2px; }
.lg.fill { background: var(--red); border-color: var(--red); }
.lg.room { border-color: var(--muted); }
.lg.cant { background: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 4px); }
.lg.base { border: 0; }
.lg.base::after { content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); border: 4px solid transparent; border-bottom: 5px solid var(--gold); }
.lg.split { background: linear-gradient(to right, transparent 5px, var(--border) 5px 6px, transparent 6px); border-color: var(--muted); }

.statGroup { margin-bottom: 12px; }
.statGroup h4 {
  font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}
.statGroup h4 .price { font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--gold); }

.stat { margin-bottom: 11px; }
.statHead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 8px; margin-bottom: 3px; }
.statName { font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: help; }
.badge { margin-left: 5px; font-family: var(--font-mono); font-size: 10px; font-weight: 400; }
.badge.up { color: var(--good); }
.badge.down { color: var(--bad); }
.readout { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* One cell per value on the stat's own scale, all tracks at the same cell size,
   so an eight-step scale is a shorter track rather than fatter cells. */
.track {
  position: relative; display: grid; grid-template-columns: repeat(var(--cells), 1fr); gap: 2px;
  width: calc(100% * var(--cells) / var(--max-cells, 10)); height: 16px; margin-bottom: 6px;
  cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; border-radius: 3px;
}
.track:focus-within { outline: 2px solid var(--red); outline-offset: 3px; }
/* The keyboard's handle on the track: focusable and announced, never seen. */
.track input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.cell { position: relative; border: 1px solid var(--border); border-radius: 2px; --mid: var(--border); }
/* A step that costs more than a point is drawn in that many parts. */
.track.split .cell {
  background-image: repeating-linear-gradient(to right,
    transparent 0 calc(100% / var(--p) - 1px), var(--mid) calc(100% / var(--p) - 1px) calc(100% / var(--p)));
  /* One pixel wider than the cell, so the line after the last part hides under the border. */
  background-size: calc(100% + 1px) 100%; background-repeat: no-repeat;
}
.cell.fill { background-color: var(--red); border-color: var(--red); --mid: rgba(0, 0, 0, .45); }
.cell.room { border-color: var(--muted); }
.track .cell.cant {
  border-color: var(--border); cursor: not-allowed;
  background-image: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 5px);
  background-size: auto;
}
/* Where this body stops: a bar after the last cell it can reach. */
.cell.ceil::before { content: ''; position: absolute; right: -3px; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--ink-2); }
/* The body's base build: a tick under its cell. */
.cell.base::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 3px solid transparent; border-bottom: 4px solid var(--gold);
}

#resetStats { margin: 2px 0 4px; }
.unfit { color: var(--bad); font-size: 11.5px; margin-top: 2px; }

/* ---------------------------------------------------------------- sign in -- */

.signin h2 { font-size: 20px; color: var(--ink); text-transform: none; letter-spacing: .01em; }
.lede { color: var(--ink-2); font-size: 13.5px; margin: 0 0 16px; }
.signin a.button, .signin button.button { display: block; width: 100%; text-align: center; margin-bottom: 8px; padding: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
input[type=email] {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
  color: inherit; font: inherit;
}
.describe input[type=email] { flex: 1; min-width: 0; }
input[type=email]:focus { outline: 2px solid var(--red); outline-offset: 1px; }

.methods { color: var(--ink-2); font-size: 13px; margin: 0; }
.keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.roomNote { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.roomNote.full { color: var(--bad); }

/* ----------------------------------------------------------------- stable -- */

.stableHead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stableHead h2 { font-size: 22px; text-transform: uppercase; letter-spacing: .06em; }
.stableHead .button { margin-left: auto; }
.nudge { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-left: 3px solid var(--gold); border-radius: 6px; padding: 9px 12px; margin: 0 0 14px; }
.botGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.botCard {
  display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none;
}
.botCard:hover { border-color: var(--red-ink); }
.botCard.retired { opacity: .6; }
.botPic {
  display: flex; align-items: flex-end; justify-content: center; height: 150px; margin-bottom: 8px;
  border-radius: 8px; background: #0d0f14; overflow: hidden;
}
.botName { font-family: var(--font-display); font-size: 17px; letter-spacing: .02em; }
.botLine { font-family: var(--font-mono); font-size: 13px; margin-top: 4px; display: flex; align-items: baseline; }
.botRecord { margin-left: auto; color: var(--ink-2); }
.emptySlot { align-items: center; justify-content: center; min-height: 240px; border-style: dashed; color: var(--muted); text-align: center; }
.emptySlot span { font-size: 34px; line-height: 1; font-family: var(--font-display); }

/* --------------------------------------------------------------- bot page -- */

.botStage {
  display: flex; align-items: flex-end; justify-content: center; min-height: 260px; margin: -4px -4px 14px;
  border-radius: 8px; background: #0d0f14; overflow: hidden;
}
.card > h2.botTitle { font-size: 26px; color: var(--ink); text-transform: none; letter-spacing: .01em; margin-bottom: 2px; }
.bio { color: var(--ink-2); margin: 12px 0 6px; }
.botStats { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.statLine { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 2px 0; }
.standing { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.standing div { display: flex; flex-direction: column; }
.standing b { font-family: var(--font-mono); font-size: 20px; font-weight: 400; color: var(--ink); }
.standing span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 520px) { .standing { grid-template-columns: repeat(2, 1fr); } }
