@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ground: #f5f6f8;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #566170;
  --line: #d9dee6;
  --court: #2b5aa6;
  --court-deep: #1d4a92;
  --court-pale: #a9c0e6;
  --clay: #b9481a;
  --ok: #1f7a4d;
  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --wrap: 1120px;
  --gap: clamp(1rem, 2.4vw, 1.75rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  font-feature-settings: "ss01" 0;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--court-pale); color: var(--ink); }
:focus-visible { outline: 2px solid var(--court); outline-offset: 3px; border-radius: 3px; }
a { color: var(--court-deep); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
html { scrollbar-color: #b8c1cd transparent; }

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

/* masthead */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; gap: 1rem; }
.brand { white-space: nowrap; display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }
.nav { display: flex; gap: .25rem; }
.nav a { white-space: nowrap; color: var(--muted); text-decoration: none; padding: .4rem .7rem; border-radius: 6px; font-size: .95rem; }
.nav a:hover { color: var(--ink); background: var(--ground); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
.lead { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--muted); max-width: 60ch; }
.num { font-variant-numeric: lining-nums; }
code, pre, kbd { font-family: var(--mono); font-size: .86em; }

/* ---------- explorer page ---------- */
.intro { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2rem); display: grid; gap: 1rem; }

.matches { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.match {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; text-align: left; padding: .65rem .9rem; border-radius: 10px; cursor: pointer;
  display: grid; gap: .1rem; min-width: 12rem; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.match:hover { border-color: #b7c2d1; }
.match[aria-pressed="true"] { border-color: var(--court); box-shadow: inset 0 0 0 1px var(--court); }
.match b { font-weight: 650; }
.match span { color: var(--muted); font-size: .88rem; }

.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.video-wrap { position: relative; background: #0d1117; aspect-ratio: 960 / 464; }
.video-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; }
.state {
  position: absolute; left: 1rem; top: 1rem; display: flex; align-items: center; gap: .5rem;
  background: rgba(13, 17, 23, .72); color: #fff; padding: .35rem .7rem .35rem .55rem; border-radius: 999px;
  font-size: .88rem; font-weight: 550; pointer-events: none; transition: background .25s var(--ease);
}
.state i { width: .6rem; height: .6rem; border-radius: 50%; background: #8a94a3; transition: background .25s var(--ease), box-shadow .25s var(--ease); }
.state.live i { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.22); }
.state.live { background: rgba(29, 74, 146, .86); }

.controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.btn {
  appearance: none; display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: 500 .93rem/1 var(--sans); padding: .55rem .8rem; border-radius: 8px; cursor: pointer;
}
.btn:hover { border-color: #b7c2d1; background: #fafbfc; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 1rem; height: 1rem; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .95rem; margin-left: auto; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 2.4rem; height: 1.4rem; border-radius: 999px; background: #c9d1dc; position: relative; transition: background .25s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(20,24,31,.25); transition: transform .3s var(--ease); }
.switch input:checked + .track { background: var(--court); }
.switch input:checked + .track::after { transform: translateX(1rem); }
.switch input:focus-visible + .track { outline: 2px solid var(--court); outline-offset: 3px; }
.pos { color: var(--muted); font-size: .9rem; }

/* generated vs real score, over the video */
.board { position: absolute; right: 1rem; top: 1rem; background: rgba(13, 17, 23, .78); color: #fff; border-radius: 10px; padding: .45rem .6rem .5rem; font-size: .82rem; pointer-events: none; }
.board table { border-collapse: collapse; font-variant-numeric: lining-nums; }
.board th, .board td { padding: .12rem .45rem; text-align: right; white-space: nowrap; }
.board thead th { font-weight: 500; color: rgba(255,255,255,.65); font-size: .74rem; }
.board tbody th { text-align: left; font-weight: 500; color: rgba(255,255,255,.8); }
.board td.gen { font-weight: 700; }
.board td span { display: inline-block; min-width: 1.1em; text-align: right; }
.board td .set { opacity: .6; font-weight: 500; }
.board td .p { min-width: 1.7em; margin-left: .45em; padding-left: .45em; border-left: 1px solid rgba(255,255,255,.25); }
.board td.real { color: rgba(255,255,255,.75); }
.board .verdict { margin: .25rem .45rem 0; font-size: .74rem; color: rgba(255,255,255,.7); display: flex; align-items: center; gap: .35rem; }
.board .verdict::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: #9aa3ae; }
.board .verdict.ok::before { background: #5fd39a; }
.board .verdict.bad::before { background: #ff9b73; }

/* view mode: full match vs only points */
.mode { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 1rem; background: #e6eaf0; border-radius: 12px; }
.mode button {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer;
  padding: .6rem 1.1rem; border-radius: 9px; display: grid; gap: .05rem; text-align: left; min-width: 11rem;
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.mode button b { font-weight: 650; }
.mode button span { font-size: .86rem; font-variant-numeric: lining-nums; }
.mode button:hover { color: var(--ink); }
.mode button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20,24,31,.12), 0 2px 8px rgba(20,24,31,.06); }
.mode button[data-mode="points"][aria-checked="true"] { background: var(--court); color: #fff; }
.mode button[data-mode="points"][aria-checked="true"] span { color: rgba(255,255,255,.85); }

/* the court band: timelines drawn like court lines */
.band { background: var(--court); color: #fff; padding: .9rem 1rem 1rem; }
.band + .band { border-top: 1px solid rgba(255,255,255,.18); }
.band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .85rem; color: rgba(255,255,255,.82); margin-bottom: .5rem; }
.band-head b { color: #fff; font-weight: 600; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { display: inline-block; width: 1.1rem; height: .35rem; background: #fff; border-radius: 1px; }
.legend i.gt { height: 2px; background: rgba(255,255,255,.75); }
.legend i.sb { width: 2px; height: .8rem; background: #ffb38f; }
.legend i.pr { height: .7rem; background: rgba(255,255,255,.28); }
.timeline { display: block; width: 100%; height: 64px; cursor: pointer; touch-action: none; }
.timeline.zoom { height: 96px; }

.below { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); padding: clamp(1.5rem, 3vw, 2.25rem) 0; align-items: start; }
.panel h2 { margin-bottom: .35rem; }
.panel > p { color: var(--muted); margin-bottom: 1rem; max-width: 52ch; }

.list { max-height: 26rem; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.list table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.list th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.list td { padding: .5rem .8rem; border-bottom: 1px solid #edf0f4; font-variant-numeric: lining-nums; }
.list tr[data-s] { cursor: pointer; }
.list tr[data-s]:hover td { background: #f3f6fb; }
.list tr.now td { background: #e9f0fb; }
.tag { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; }
.tag::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); }
.tag.fp::before { background: var(--clay); }
.tag.fn::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.tag.fn { color: var(--muted); }

.scores { border-collapse: collapse; width: 100%; font-variant-numeric: lining-nums; font-size: .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.scores th, .scores td { padding: .6rem .8rem; text-align: right; border-bottom: 1px solid #edf0f4; }
.scores th:first-child, .scores td:first-child { text-align: left; }
.scores thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.scores tbody tr:last-child td { border-bottom: 0; }
.scores .big { font-weight: 700; }
.note { color: var(--muted); font-size: .9rem; margin-top: .8rem; max-width: 60ch; }

.next { border-top: 1px solid var(--line); padding: clamp(2rem, 5vw, 3.5rem) 0; display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; }
.next p { color: var(--muted); max-width: 52ch; margin-top: .5rem; }
.cta { display: inline-flex; align-items: center; gap: .6rem; background: var(--ink); color: #fff; text-decoration: none; padding: .85rem 1.15rem; border-radius: 10px; font-weight: 600; }
.cta:hover { background: #262c36; }
.cta svg { transition: transform .3s var(--ease); }
.cta:hover svg { transform: translateX(3px); }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 1.5rem 0 2.5rem; }

/* ---------- explainer (read) ---------- */
.doc { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); padding: clamp(2.5rem, 6vw, 4rem) 0 4rem; }
.toc { position: sticky; top: 1.5rem; align-self: start; font-size: .9rem; }
.toc b { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; border-left: 1px solid var(--line); }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: .3rem 0 .3rem .9rem; margin-left: -1px; border-left: 1px solid transparent; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--court-deep); border-left-color: var(--court); font-weight: 600; }
.prose { max-width: 70ch; }
.prose > header { margin-bottom: 2.5rem; display: grid; gap: 1rem; }
.prose section { padding-top: 1rem; margin-bottom: 2.75rem; scroll-margin-top: 1rem; }
.prose h2 { margin-bottom: 1rem; }
.prose h3 { margin: 1.75rem 0 .5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin-bottom: .35rem; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose pre { background: #eef1f5; border: 1px solid #e1e6ed; border-radius: 10px; padding: 1rem 1.1rem; overflow: auto; line-height: 1.55; margin: 0 0 1.25rem; font-size: .84rem; tab-size: 4; }
.prose :not(pre) > code { background: #e9edf3; padding: .1em .35em; border-radius: 4px; }
.prose pre .c { color: #6b7684; }
.prose pre .k { color: var(--court-deep); }
.prose figure { margin: 1.5rem 0 2rem; }
.prose figure.wide { margin-right: min(0px, calc((70ch - 100%) )); }
.prose figure img, .prose figure svg { width: 100%; height: auto; display: block; }
.prose figure img { border-radius: 10px; }
.prose figcaption { color: var(--muted); font-size: .9rem; margin-top: .6rem; max-width: 64ch; }
.fig-pair { display: grid; grid-template-columns: minmax(0, 1fr) 9rem; gap: 1rem; align-items: center; }
.callout { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.15rem; margin: 0 0 1.25rem; }
.callout p:last-child { margin-bottom: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: .93rem; font-variant-numeric: lining-nums; margin: 0 0 1.25rem; }
.prose th, .prose td { text-align: right; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.prose th:first-child, .prose td:first-child { text-align: left; }
.prose thead th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.refs { padding-left: 1.4rem !important; }
.refs li { margin-bottom: .7rem; }
.refs .why { display: block; color: var(--muted); font-size: .92rem; }

@media (max-width: 900px) {
  .below { grid-template-columns: 1fr; }
  .doc { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { grid-template-columns: 1fr 1fr; border-left: 0; gap: 0 1rem; }
  .toc a { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .nav a { padding: .4rem .45rem; font-size: .9rem; }
  .brand { font-size: .95rem; }
  .scores th, .scores td { padding: .55rem .5rem; }
  .match { min-width: 0; flex: 1 1 100%; }
  .mode { display: grid; width: 100%; }
  .mode button { min-width: 0; padding: .55rem .8rem; }
  .state { left: .6rem; top: .6rem; font-size: .8rem; }
  .video-wrap { aspect-ratio: auto; }
  .video-wrap video { aspect-ratio: 960 / 464; height: auto; }
  .board { position: static; border-radius: 0; background: #0d1117; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .75rem .5rem; font-size: .78rem; }
  .board .verdict { margin: 0; }
  .fig-pair { grid-template-columns: 1fr; }
  .fig-pair svg { max-width: 9rem; margin: 0 auto; }
  .legend { gap: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
