/* Avogadro Arena: dark "scoreboard / terminal" theme. Mobile-first; no external fonts or images. */

:root {
  color-scheme: dark;

  --bg: #0b0d10;
  --surface: #11151a;
  --surface-2: #171c22;
  --sunken: #080a0c;
  --line: #262e37;
  --line-strong: #3b4552;
  /* Borders that identify a control (selects, buttons, toggles): at least 3:1 against
     --bg, --surface and --surface-2 (WCAG 1.4.11). */
  --control-line: #5f6b78;

  --text: #ece8e1;
  --muted: #a8b1bb;
  --dim: #8d97a3;
  --link: #8fd8ff;
  --on-accent: #0b0d10;

  /* Attacker (Jordan) warm amber; defender (Alex) cool cyan; green held/detected. */
  --atk: #ffa94d;
  --atk-tint: rgba(255, 169, 77, 0.12);
  --atk-line: rgba(255, 169, 77, 0.45);
  --def: #4fd3e6;
  --def-tint: rgba(79, 211, 230, 0.1);
  --def-line: rgba(79, 211, 230, 0.4);
  --good: #6fdc8c;
  --good-tint: rgba(111, 220, 140, 0.1);
  --good-line: rgba(111, 220, 140, 0.45);
  --bad: #ff7b72;
  --bad-tint: rgba(255, 123, 114, 0.1);
  --warn: #e8c35a;
  --warn-tint: rgba(232, 195, 90, 0.1);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 16px;
  --radius: 6px;
  --max: 1100px;
}

/* ---------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--font-ui);
  overflow-wrap: break-word;
}

main {
  flex: 1;
  width: 100%;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.1rem);
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1rem;
}

h4 {
  font-size: 0.95rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Links that stand on their own line ("Open the replay →", "Back to the leaderboard", a
   prompt version under its label, the footer link): inline padding gives a 40 px tap area
   without moving any text. */
.state p > a,
.outcome-card p > a,
.live-match p > a,
.facts dd > a,
.not-found li > a,
.site-footer a {
  position: relative; /* above the next line's box, so all of the padding is tappable */
  padding-block: 0.8rem;
}

code,
pre,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

code {
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

table {
  font-variant-numeric: tabular-nums;
}

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

::selection {
  background: rgba(79, 211, 230, 0.35);
}

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

.muted {
  color: var(--muted);
}

.atk {
  color: var(--atk);
}

.def {
  color: var(--def);
}

.bad {
  color: var(--bad);
}

.warn {
  color: var(--warn);
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
}

/* ---------------------------------------------------------------- header, nav, footer */

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--on-accent);
  border-radius: var(--radius);
}

.skip:focus {
  top: 0.5rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.5rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

/* A periodic-table tile: Av, atomic number 23 (as in 6.022e23). */
.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--atk);
  border-radius: 4px;
  color: var(--atk);
  font: 700 0.9rem/1 var(--font-mono);
}

.brand-mark::before {
  content: "23";
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.45rem;
  color: var(--muted);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 -2px 0 var(--def);
}

.nav-live-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--bad);
}

.site-footer {
  margin-top: 3rem;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

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

.page {
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page-head .lede,
.lede {
  color: var(--muted);
  max-width: 46rem;
  font-size: 1.02rem;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font: 500 0.75rem/1.4 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow .mono {
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel > h2 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.panel--atk {
  border-top: 2px solid var(--atk);
}

.panel--def {
  border-top: 2px solid var(--def);
}

section > h2 {
  margin-top: 0;
}

.subhead {
  margin: 1rem 0 0.5rem;
  color: var(--muted);
  font: 500 0.8rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------- controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 0.75rem 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
}

.field-label,
.seg-ctl legend {
  color: var(--muted);
  font: 500 0.72rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select,
.btn {
  min-height: 2.5rem;
  max-width: 100%;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

select {
  padding-right: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

select:disabled {
  color: var(--dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}

.btn--primary {
  border-color: var(--def);
  background: var(--def);
  color: var(--on-accent);
  font-weight: 600;
}

.btn--primary:hover {
  background: #7fe0ee;
  border-color: #7fe0ee;
}

.btn--icon {
  width: 2.5rem;
  padding: 0;
}

/* Radio groups styled as segmented buttons (native keyboard behaviour kept). */
.seg-ctl {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.seg-ctl legend {
  padding: 0;
  margin-bottom: 0.3rem;
}

.seg-options {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.seg-options label {
  position: relative;
  cursor: pointer;
}

.seg-options input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.seg-options span {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
  border-right: 1px solid var(--line);
}

.seg-options label:last-child span {
  border-right: 0;
}

.seg-options label:hover span {
  color: var(--text);
  background: var(--surface-2);
}

.seg-options input:checked + span {
  background: var(--text);
  color: var(--on-accent);
  font-weight: 600;
}

.seg-options input[value="attacker"]:checked + span {
  background: var(--atk);
}

.seg-options input[value="defender"]:checked + span {
  background: var(--def);
}

.seg-options input:focus-visible + span {
  outline: 2px solid var(--def);
  outline-offset: -4px;
}

/* A checked option is filled with a light colour (cyan for "Defender"), so a cyan ring
   inside it would be invisible: use a dark one there. */
.seg-options input:checked:focus-visible + span {
  outline-color: var(--on-accent);
}

/* ---------------------------------------------------------------- states */

.state {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.state p:last-child {
  margin-bottom: 0;
}

.state-title {
  color: var(--text);
  font-weight: 600;
}

.state--loading {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-style: dashed;
}

.state--loading .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.3em;
  vertical-align: -0.15em;
  background: var(--muted);
  animation: blink 1s steps(1) infinite;
}

.state--empty {
  border-style: dashed;
}

.state--error {
  border-color: var(--bad);
  background: var(--bad-tint);
}

.state--error .state-title {
  color: var(--bad);
}

.state .btn {
  margin-top: 0.25rem;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- banners */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.banner--live {
  border-color: var(--bad);
  background: var(--bad-tint);
}

a.banner--live:hover {
  background: rgba(255, 123, 114, 0.16);
}

.banner--error {
  border-color: var(--bad);
}

.banner-kicker {
  color: var(--muted);
  font: 600 0.75rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.banner--live .banner-kicker {
  color: var(--bad);
}

.banner-main {
  flex: 1 1 14rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.banner-cta {
  color: var(--link);
  font-weight: 600;
  white-space: nowrap;
}

/* The idle banner's "Live page →" is a link of its own: 40+ px to tap. */
a.banner-cta {
  position: relative;
  display: inline-block;
  padding-block: 0.6rem;
  margin-block: -0.6rem;
}

.live-dot {
  flex: none;
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 0 rgba(255, 123, 114, 0.6);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 123, 114, 0.55);
  }
  70% {
    box-shadow: 0 0 0 0.5rem rgba(255, 123, 114, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 123, 114, 0);
  }
}

/* ---------------------------------------------------------------- chips, tags */

.chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  color: var(--muted);
  font: 500 0.75rem/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}

.tag {
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip--atk {
  color: var(--atk);
  border-color: var(--atk-line);
  background: var(--atk-tint);
}

.chip--def {
  color: var(--def);
  border-color: var(--def-line);
  background: var(--def-tint);
}

.chip--good {
  color: var(--good);
  border-color: var(--good-line);
  background: var(--good-tint);
}

.chip--bad {
  color: var(--bad);
  border-color: var(--bad);
  background: var(--bad-tint);
}

.chip--warn {
  color: var(--warn);
  border-color: rgba(232, 195, 90, 0.45);
  background: var(--warn-tint);
}

.chip--dim {
  color: var(--dim);
  border-style: dashed;
}

.chip--tactic {
  color: var(--atk);
  border-style: dashed;
  border-color: var(--atk-line);
}

/* ---------------------------------------------------------------- tables */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.data th,
.data td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.data tbody tr:last-child > * {
  border-bottom: 0;
}

.data thead th {
  white-space: normal;
  vertical-align: bottom;
  background: var(--surface-2);
  color: var(--muted);
  font: 500 0.72rem/1.3 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data tbody tr:hover > * {
  background: var(--surface-2);
}

.data .num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.data thead .num {
  text-align: right;
}

.data thead .num button.sort {
  justify-content: flex-end;
  text-align: right;
}

.data tbody th {
  font-weight: 500;
}

/* The model column stays put while the numbers scroll. */
.data .col-model {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 8rem;
  max-width: 11rem;
  white-space: normal;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.data thead .col-model {
  background: var(--surface-2);
  z-index: 2;
}

/* At least 40 x 40 px to tap; the negative margin eats the cell padding so the header
   row doesn't grow. */
button.sort {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  margin: -0.55rem -0.4rem;
  padding: 0.25rem 0.4rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

button.sort:hover {
  color: var(--text);
}

.sort-arrow::after {
  content: "↕";
  opacity: 0.45;
}

th[aria-sort="ascending"] .sort-arrow::after {
  content: "▲";
  opacity: 1;
}

th[aria-sort="descending"] .sort-arrow::after {
  content: "▼";
  opacity: 1;
}

th.sorted {
  color: var(--text);
}

.model-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.model-cell a {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Links in table cells fill the row's height (>= 40 px) without changing the layout;
   position keeps the overhang (over a model's maker line) tappable. */
.data td a,
.data th a {
  position: relative;
  display: inline-block;
  padding-block: 0.55rem;
  margin-block: -0.55rem;
}

.model-cell a:hover {
  color: var(--link);
}

.maker {
  color: var(--muted);
  font: 0.72rem var(--font-mono);
}

.rank {
  display: inline-block;
  min-width: 1.8rem;
  text-align: center;
  color: var(--muted);
}

.rank--1,
.rank--2,
.rank--3 {
  border-radius: 3px;
  color: var(--on-accent);
  font-weight: 700;
}

.rank--1 {
  background: var(--warn);
}

.rank--2 {
  background: #c9d1d9;
}

.rank--3 {
  background: #d9a46c;
}

.stagecell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.meter {
  display: inline-block;
  width: 3rem;
  height: 0.35rem;
  border-radius: 2px;
  background: linear-gradient(to right, var(--atk) calc(var(--v, 0) * 100%), var(--line) 0);
}

.meter--def {
  background: linear-gradient(to right, var(--def) calc(var(--v, 0) * 100%), var(--line) 0);
}

.lb-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.stagebar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  max-width: 34rem;
}

.seg {
  display: grid;
  place-items: center;
  min-height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--dim);
  font: 600 0.8rem var(--font-mono);
}

.seg--proven {
  border-color: var(--atk);
  background: var(--atk);
  color: var(--on-accent);
}

.seg--verbal {
  border: 1px dashed var(--atk);
  background: repeating-linear-gradient(135deg, rgba(255, 169, 77, 0.38) 0 3px, transparent 3px 7px);
  color: var(--text);
}

.stagebar--compact {
  gap: 2px;
  max-width: none;
}

.stagebar--compact .seg {
  min-height: 0.5rem;
  border-radius: 1px;
}

.seg--flash {
  animation: stage-flash 1.4s ease-out;
}

@keyframes stage-flash {
  0% {
    transform: scale(1.12);
    box-shadow: 0 0 0 0 rgba(255, 169, 77, 0.9);
  }
  100% {
    transform: none;
    box-shadow: 0 0 0 0.75rem rgba(255, 169, 77, 0);
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch.seg {
  display: inline-block;
  width: 1.1rem;
  min-height: 0;
  height: 0.8rem;
}

.stage-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stage-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
}

.stage-list-meta {
  color: var(--muted);
  font: 0.8rem var(--font-mono);
}

/* "show" links next to stages and the detection report: 40 px tall to tap. */
.stage-list-meta a,
.outcome-detail a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding-inline: 0.25rem;
  margin-block: -0.75rem;
}

.stage-evidence {
  flex-basis: 100%;
  padding-left: 0.6rem;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font: 0.78rem var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background: var(--atk);
  color: var(--on-accent);
  font: 700 0.74rem/1.4 var(--font-mono);
}

.stage-badge-note {
  font-weight: 500;
}

.stage-badge-note::before {
  content: "· ";
}

/* ---------------------------------------------------------------- match cards */

.mcards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mcard {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.mcard:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.mcard--live {
  border-color: var(--bad);
}

.mcard-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.mcard-top time {
  margin-left: auto;
}

.mcard-vs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.45rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mcard-vs .vs,
.vs-title .vs {
  color: var(--dim);
  font: 500 0.8em var(--font-mono);
}

.mcard-foot {
  color: var(--muted);
  font: 0.75rem var(--font-mono);
}

.outcome {
  font: 600 0.72rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.outcome--atk {
  color: var(--atk);
}

.outcome--def {
  color: var(--good);
}

.outcome--draw {
  color: var(--muted);
}

.outcome--void {
  color: var(--dim);
}

.outcome--live {
  color: var(--bad);
}

.more {
  margin-top: 0.75rem;
}

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

.vs-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  margin: 0 0 0.4rem;
  overflow-wrap: anywhere;
}

.vs-title a {
  position: relative;
  padding-block: 0.45em; /* taller tap area; inline padding doesn't move the text */
  text-decoration: none;
}

.vs-title a:hover {
  text-decoration: underline;
}

.vs-title a.atk,
.vs-title .atk {
  color: var(--atk);
}

.vs-title a.def,
.vs-title .def {
  color: var(--def);
}

h2.vs-title {
  font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem);
}

.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  font-size: 0.85rem;
}

.roles {
  column-gap: 1rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
}

.facts > div {
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  font: 500 0.7rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.facts dd {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.outcome-card {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
}

.outcome-card p {
  margin: 0 0 0.35rem;
}

.outcome-card p:last-child {
  margin-bottom: 0;
}

.outcome-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.outcome-card.outcome--atk {
  border-color: var(--atk-line);
  border-left-color: var(--atk);
  background: var(--atk-tint);
}

.outcome-card.outcome--atk .outcome-title {
  color: var(--atk);
}

.outcome-card.outcome--def {
  border-color: var(--good-line);
  border-left-color: var(--good);
  background: var(--good-tint);
}

.outcome-card.outcome--def .outcome-title {
  color: var(--good);
}

.outcome-card.outcome--live {
  border-left-color: var(--bad);
}

.outcome-card.outcome--void {
  border-style: dashed;
}

.outcome-detail q {
  font-style: italic;
}

.outcome-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.model-head h1 {
  overflow-wrap: anywhere;
}

.model-sub {
  color: var(--muted);
}

.model-id {
  color: var(--text);
}

/* ---------------------------------------------------------------- transcript */

.transcript {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.transcript-empty {
  color: var(--muted);
  font-style: italic;
}

.turn-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.8rem 0 0.1rem;
  color: var(--dim);
  font: 600 0.72rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.turn-sep::before,
.turn-sep::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: min(92%, 46rem);
  min-width: 0;
}

.msg--atk {
  align-self: flex-start;
}

.msg--def {
  align-self: flex-end;
}

.bubble {
  min-width: 0;
  padding: 0.6rem 0.8rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.msg--atk .bubble {
  border-left: 3px solid var(--atk);
  border-top-left-radius: 2px;
}

.msg--def .bubble {
  border-right: 3px solid var(--def);
  border-top-right-radius: 2px;
}

.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}

.who {
  font-weight: 700;
  font-size: 0.9rem;
}

.msg--atk .who {
  color: var(--atk);
}

.msg--def .who {
  color: var(--def);
}

.msg-role,
.msg-round {
  color: var(--dim);
  font: 0.7rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.msg-links {
  display: inline-flex;
  gap: 0.15rem;
  margin-left: auto;
  margin-right: -0.5rem;
  font: 0.72rem var(--font-mono);
}

/* 40 x 40 px tap targets; the negative margin keeps the header line compact, and
   position keeps the overhang above the message text for tapping. */
.msg-links a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  margin-block: -0.5rem;
  border-radius: 4px;
  color: var(--muted);
}

.msg-links a:hover {
  color: var(--link);
}

.msg-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-empty {
  margin: 0;
  color: var(--dim);
  font-style: italic;
}

.msg-foot {
  margin-top: 0.4rem;
  color: var(--dim);
  font: 0.7rem var(--font-mono);
  overflow-wrap: anywhere;
}

.reasoning {
  margin-top: 0.5rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.35rem;
  font-size: 0.88rem;
}

.reasoning summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Disclosure toggles are at least 40 px tall to tap. */
.reasoning summary,
.judge-raw summary,
.params summary,
details.stats > summary {
  min-height: 2.5rem;
  padding-block: 0.5rem;
  line-height: 1.5rem;
}

.reasoning .msg-text {
  margin-top: 0.4rem;
  color: var(--muted);
}

.msg.leak .bubble,
.tool.leak {
  border-color: var(--atk);
  box-shadow: 0 0 0 1px var(--atk-line);
}

.leak-banner {
  margin: 0.15rem 0 0.45rem;
}

mark.canary {
  padding: 0 0.15em;
  border-radius: 2px;
  background: var(--atk);
  color: var(--on-accent);
}

/* A message opened by link: on load (.targeted) and after an in-page jump (:target). */
.targeted .bubble,
.tool.targeted,
.note.targeted,
.msg:target .bubble,
.tool:target,
.note:target {
  outline: 2px solid var(--def);
  outline-offset: 3px;
}

.msg,
.tool,
.note {
  scroll-margin-block: 5rem;
}

/* Tool call blocks under Alex's bubble. */
.tools {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tool {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--def-line);
  border-radius: var(--radius);
  background: var(--sunken);
  font: 0.8rem/1.5 var(--font-mono);
}

.tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line);
  color: var(--def);
}

.tool-name {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

.tool-args {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 0.2rem 0.8rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
}

.tool-args dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tool-args dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool-args-raw,
.tool-noargs {
  margin: 0;
  padding: 0.5rem 0.65rem;
}

.tool-noargs {
  color: var(--dim);
}

.tool-result {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.65rem 0.55rem;
  border-top: 1px dashed var(--line);
  color: var(--muted);
}

.tool-result-label {
  color: var(--dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool-result-label::before {
  content: "→ ";
}

.tool-result--pending,
.tool-result--missing {
  color: var(--dim);
  font-style: italic;
}

.tool--stage {
  border-color: var(--atk);
  border-left-color: var(--atk);
  background: linear-gradient(var(--atk-tint), var(--atk-tint)), var(--sunken);
}

.tool--stage .tool-head {
  color: var(--atk);
  border-bottom-color: var(--atk-line);
}

.tool--detect {
  border-color: var(--good-line);
  border-left-color: var(--good);
  background: linear-gradient(var(--good-tint), var(--good-tint)), var(--sunken);
}

.tool--detect .tool-head {
  color: var(--good);
}

.tool-detect-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Controller notes: private annotations on Jordan's side. */
.note {
  align-self: flex-start;
  max-width: min(88%, 40rem);
  padding: 0.45rem 0.7rem;
  border: 1px dashed var(--atk-line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
  color: var(--atk);
  font: 600 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Judge chips under Alex's last bubble of a turn. */
.judge {
  align-self: flex-end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
  max-width: min(92%, 46rem);
}

.judge-label {
  color: var(--dim);
  font: 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.judge-raw {
  flex-basis: 100%;
  font-size: 0.75rem;
  text-align: right;
}

.judge-raw summary {
  cursor: pointer;
  color: var(--dim);
  font-family: var(--font-mono);
}

.judge-raw pre {
  margin-top: 0.35rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  color: var(--muted);
  text-align: left;
  max-height: 22rem;
  overflow: auto;
}

/* "Jordan is typing…" */
.thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}

.thinking--atk {
  align-self: flex-start;
  border-color: var(--atk-line);
}

.thinking--def {
  align-self: flex-end;
  border-color: var(--def-line);
}

.dots {
  display: inline-flex;
  gap: 0.2rem;
}

.dots i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: currentColor;
  animation: dot 1.2s ease-in-out infinite;
}

.thinking--atk .dots {
  color: var(--atk);
}

.thinking--def .dots {
  color: var(--def);
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ---------------------------------------------------------------- live page */

.conn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--muted);
  font: 0.8rem var(--font-mono);
}

.conn-dot {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--dim);
}

.conn-dot--on {
  background: var(--good);
}

.conn-dot--off {
  background: var(--warn);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.9rem 1.25rem;
}

.status-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  min-width: 0;
}

.status-label {
  flex-basis: 100%;
  color: var(--muted);
  font: 500 0.7rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.status-detail {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.phase {
  font: 700 0.85rem var(--font-mono);
}

.phase::before {
  content: "● ";
}

.phase--running {
  color: var(--good);
}

.phase--waiting,
.phase--idle {
  color: var(--def);
}

.phase--paused,
.phase--quota_exhausted {
  color: var(--warn);
}

.phase--error {
  color: var(--bad);
}

.quota {
  position: relative;
  flex: 1 1 6rem;
  height: 0.55rem;
  min-width: 5rem;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.quota-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--def);
}

.quota--high .quota-fill {
  background: var(--warn);
}

.upnext {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.upnext li {
  padding-block: 0.2rem;
  overflow-wrap: anywhere;
}

/* Inline padding enlarges the tap area (to about 40 px) without moving the text. */
.upnext a {
  position: relative;
  padding-block: 0.7rem;
}

.upnext .tag {
  margin-left: 0.5rem;
}

.upnext a.atk {
  color: var(--atk);
}

.upnext a.def {
  color: var(--def);
}

.live-match {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.jump {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 5;
  transform: translateX(-50%);
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--def);
  border-radius: 999px;
  background: var(--bg);
  color: var(--def);
  font: 600 0.85rem var(--font-ui);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.jump[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- about page */

.prose {
  max-width: 46rem;
}

.prose p,
.prose li {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.about-table td,
.about-table th {
  white-space: normal;
  min-width: 8rem;
}

.about-table td:first-child,
.about-table th:first-child {
  min-width: 0;
}

.stage-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--atk);
  font-weight: 600;
}

.stage-name.detect {
  color: var(--good);
}

.prompt {
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prompt > summary {
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.prompt[open] > summary {
  border-bottom: 1px solid var(--line);
}

.prompt-body {
  padding: 0.75rem 0.85rem;
}

.prompt-body h3 {
  font-size: 0.95rem;
}

.prompt-body h3:not(:first-child) {
  margin-top: 1rem;
}

.prompt-text {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.55;
  max-height: 34rem;
  overflow: auto;
}

.prompt-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.tool-list p {
  margin: 0.2rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.params summary {
  cursor: pointer;
  color: var(--muted);
  font: 0.78rem var(--font-mono);
}

.params .prompt-text {
  margin-top: 0.4rem;
}

.question {
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.question:first-child {
  border-top: 0;
  padding-top: 0;
}

.question-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.question-text {
  color: var(--text);
  font-size: 0.9rem;
}

.criteria {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.criteria dt {
  margin-top: 0.3rem;
}

.criteria dd {
  margin: 0.1rem 0 0 1rem;
}

/* ---------------------------------------------------------------- 404 */

.not-found {
  padding: 3rem 0 1rem;
}

.not-found .code {
  margin: 0 0 0.5rem;
  color: var(--atk);
  font: 700 clamp(3rem, 2rem + 6vw, 5.5rem)/1 var(--font-mono);
  letter-spacing: -0.04em;
}

.not-found ul {
  padding-left: 1.2rem;
}

/* Room for the links' enlarged tap areas between items. */
.not-found li + li {
  margin-top: 0.6rem;
}

/* ---------------------------------------------------------------- wider screens */

@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .mcards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    padding: 1.25rem;
  }

  .msg,
  .judge {
    max-width: min(82%, 46rem);
  }
}

@media (min-width: 960px) {
  .data .col-model {
    min-width: 12rem;
    max-width: 18rem;
  }

  .mcards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 420px) {
  .tool-args {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-args dd {
    margin-bottom: 0.3rem;
  }

  .seg-options span {
    padding: 0.35rem 0.6rem;
  }

  .site-nav a {
    padding: 0.35rem 0.55rem;
  }
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .seg--flash {
    outline: 2px solid var(--atk);
    outline-offset: 2px;
  }

  .dots i {
    opacity: 0.8;
  }
}

/* About-page tables become labelled cards on phones. */
@media (max-width: 639px) {
  .about-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .about-table,
  .about-table tbody {
    display: block;
  }

  .about-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.5rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--line);
  }

  .about-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data.about-table th,
  .data.about-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    text-align: left;
    background: none;
  }

  .data.about-table td {
    flex-basis: 100%;
  }

  .data.about-table td.num {
    flex-basis: auto;
    color: var(--muted);
  }

  .about-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-top: 0.4rem;
    color: var(--muted);
    font: 500 0.68rem var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.07em;
  }
}
