@font-face {
  font-family: "EB Garamond";
  src: url("fonts/EBGaramond-wght.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #f6f2ea;
  --card: #fffdf8;
  --ink: #1b1a17;
  --muted: #6b655c;
  --faint: #a39b8e;
  --line: #e2dacb;
  --miss: #e04e39;
  --extra: #3f6fc9;
  --accent: #1b1a17;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: #efe9dd; }
.top .wrap { padding-top: 28px; padding-bottom: 0; }
.brand { margin: 0 0 6px; font-weight: 600; font-size: 13px; letter-spacing: .02em; color: var(--muted); }
h1 { font: 500 52px/1.05 var(--serif); margin: 0 0 12px; letter-spacing: -.01em; }
h1 span { color: var(--muted); font-style: italic; font-weight: 400; }
.lede { max-width: 820px; margin: 0 0 12px; font-size: 16.5px; color: #34312b; }
.links { margin: 0 0 18px; display: flex; gap: 18px; flex-wrap: wrap; }
.links a { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--faint); }
.links a:hover { border-color: var(--ink); }
.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none; padding: 9px 14px 10px; border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; font-size: 14px;
}
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .45); }

/* Sections */
section { padding: 36px 0 12px; }
section + section { border-top: 1px solid var(--line); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h2 { font: 500 32px/1.1 var(--serif); margin: 0; }
.note { color: var(--muted); max-width: 900px; margin: 10px 0 18px; font-size: 14px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; }
.sw.ink { background: var(--ink); }
.sw.miss { background: var(--miss); }
.sw.extra { background: var(--extra); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; flex: none; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); }
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font: 600 13px var(--sans);
  color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.table-wrap { overflow-x: auto; overflow-y: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 10px; text-align: left; white-space: nowrap; }
th { font: 600 12px var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr + tr td { border-top: 1px solid #efe8db; }

/* Leaderboard */
.board td.model { font-weight: 600; }
.board .score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; }
.board .ci { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.board td.barcell { width: 30%; min-width: 220px; padding-top: 6px; padding-bottom: 6px; }
.board td.detail { white-space: normal; font-size: 13px; }
.bar { position: relative; height: 26px; }
.bar .ref { position: absolute; top: -8px; bottom: -8px; border-left: 1.5px dashed var(--faint); }
.bar .ci-line { position: absolute; top: 12px; height: 2px; background: currentColor; opacity: .45; }
.bar .fill { position: absolute; left: 0; top: 7px; height: 12px; border-radius: 3px; opacity: .9; }
.bar .tip { position: absolute; top: 4px; width: 3px; height: 18px; border-radius: 2px; background: currentColor; }
.board tr.refrow td { color: var(--muted); font-style: italic; }
.board .eff { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.board .eff b { color: var(--ink); font-weight: 700; }
.axis { position: relative; height: 14px; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis span { position: absolute; top: 0; transform: translateX(-50%); }

/* Grid of final shadows */
.grid th { text-align: center; }
.grid th.plate, .grid td.plate { text-align: left; }
.grid td { padding: 6px 4px; vertical-align: top; text-align: center; }
.grid td.plate { padding-left: 14px; min-width: 130px; white-space: normal; vertical-align: middle; }
.grid th { white-space: normal; font-size: 11px; line-height: 1.3; }
.grid td.plate b { display: block; font-size: 14px; }
.grid td.plate span { color: var(--muted); font-size: 12px; }
.grid .tile { display: block; width: 112px; margin: 0 auto; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f7f3ea; }
.grid .tile img { display: block; width: 112px; height: 84px; }
.grid button.tile { padding: 0; cursor: pointer; font: inherit; }
.grid button.tile:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.grid .sc { display: block; font: 600 12.5px var(--sans); font-variant-numeric: tabular-nums; margin-top: 3px; }
.grid .sc.best { color: #0b0a09; background: #f2d98d; border-radius: 4px; padding: 0 4px; display: inline-block; }
.grid th .dot { margin-right: 4px; }

/* Episode viewer */
.pickers { display: flex; gap: 10px; flex-wrap: wrap; }
.pickers label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
select {
  font: 500 14px var(--sans); padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
}
.ep-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; align-items: stretch; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; }
.chip small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.chip b { font-size: 17px; font-variant-numeric: tabular-nums; }
.chip.big b { font-size: 22px; }
.chip.tiles { display: flex; gap: 8px; padding: 6px; }
.chip.tiles figure { margin: 0; text-align: center; }
.chip.tiles img { width: 96px; height: 72px; display: block; border-radius: 5px; border: 1px solid var(--line); }
.chip.tiles figcaption { font-size: 11px; color: var(--muted); }

.ep-main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.viewer { margin: 0; }
.viewer .frame { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.viewer img { width: 100%; height: 100%; object-fit: contain; display: block; }
.viewer figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; min-height: 20px; }
.side { display: flex; flex-direction: column; gap: 12px; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 4px; }
.chart svg { display: block; width: 100%; height: auto; cursor: pointer; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--muted); padding: 2px 4px 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.controls { display: flex; gap: 6px; align-items: center; }
.controls button {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font: 600 13px var(--sans); color: var(--ink); min-width: 38px;
}
.controls button:hover { border-color: var(--ink); }
.controls input[type="range"] { flex: 1; accent-color: var(--ink); }
.call, .plan { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.plan { max-height: 260px; overflow: auto; }
.call .k, .plan .k { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.call .t { font: 600 15px var(--mono); }
.call .args { font: 13px/1.45 var(--mono); color: #3d3a34; word-break: break-word; margin-top: 4px; }
.call .res { margin-top: 6px; }
.ok { color: #2f7a3e; font-weight: 600; }
.no { color: var(--miss); font-weight: 600; }
.up { color: #2f7a3e; }
.down { color: var(--miss); }
.plan p { margin: 4px 0 0; }
.plan .subj { font-weight: 600; }

details.calls { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
details.calls summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.calls-wrap { max-height: 420px; overflow: auto; border-top: 1px solid var(--line); }
#ep-calls td { font-size: 13px; padding: 6px 12px; }
#ep-calls td.args { font-family: var(--mono); font-size: 12px; white-space: normal; color: #3d3a34; min-width: 240px; }
#ep-calls tr { cursor: pointer; }
#ep-calls tr:hover td { background: #f7f2e7; }
#ep-calls tr.cur td { background: #f2e6c8; }
#ep-calls th { position: sticky; top: 0; background: var(--card); }
.closing { margin: 18px 0 8px; }
.closing blockquote {
  margin: 6px 0 0; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--ink);
  border-radius: 8px; white-space: pre-wrap; font-size: 14px; color: #34312b; max-height: 320px; overflow: auto;
}
.closing .k { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

footer { color: var(--muted); font-size: 12.5px; padding: 28px 24px 40px; border-top: 1px solid var(--line); margin-top: 28px; }

@media (max-width: 900px) {
  h1 { font-size: 40px; }
  .ep-main { grid-template-columns: 1fr; }
  .board td.barcell { min-width: 200px; }
}
