:root {
  --bg: #E9E6DD; --surface: #FBF8F1; --ink: #232323; --soft: #55524B; --muted: #8C8C8C; --line: #D8D3C8;
  --paper: #FFF1C6; --yellow: #FFD21E; --orange: #FF9D00; --blue: #3B7CF6; --red: #D9453D; --green: #3E8E5E;
  --pass: #3E8E5E; --fail: #D9453D; --infra: #B9B3A6; --none: transparent;
  --edge: #232323; --shadow: #232323; --hover: #F5F0E3; --best: #FCE9A9; --topbar: rgba(233, 230, 221, .92);
  --display: 'Chewy', 'Source Sans 3', cursive; --body: 'Source Sans 3', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1D1C19; --surface: #272622; --ink: #DCD7CB; --soft: #ADA79A; --muted: #948F84; --line: #3E3C37;
    --paper: #3D3624; --yellow: #EDC536; --blue: #5B93F8; --red: #E8655E; --green: #5BAF7D; --pass: #5BAF7D;
    --fail: #E8655E; --infra: #5E5A52; --edge: #55524B; --shadow: #000; --hover: #2F2E29; --best: #3D3624;
    --topbar: rgba(29, 28, 25, .92);
  }
}
:root[data-theme="dark"] {
  --bg: #1D1C19; --surface: #272622; --ink: #DCD7CB; --soft: #ADA79A; --muted: #948F84; --line: #3E3C37;
  --paper: #3D3624; --yellow: #EDC536; --blue: #5B93F8; --red: #E8655E; --green: #5BAF7D; --pass: #5BAF7D;
  --fail: #E8655E; --infra: #5E5A52; --edge: #55524B; --shadow: #000; --hover: #2F2E29; --best: #3D3624;
  --topbar: rgba(29, 28, 25, .92);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.soft { color: var(--soft); }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--topbar); backdrop-filter: blur(8px); }
.top .wrap { display: flex; align-items: center; justify-content: center; gap: 16px; height: 60px; position: relative; }
.switch { display: flex; gap: 2px; padding: 4px; border: 2px solid var(--edge); border-radius: 999px; background: var(--surface);
  overflow-x: auto; max-width: calc(100vw - 32px); scrollbar-width: none; }
.switch a { font: 600 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: var(--soft); padding: 8px 12px; border-radius: 999px; white-space: nowrap; transition: background .2s, color .2s; }
.switch a:hover { color: var(--ink); }
.switch a.on { background: var(--yellow); color: #232323; }
.top .meta { position: absolute; right: 20px; display: flex; align-items: center; gap: 12px; font: 12px var(--mono); color: var(--muted); }
.theme { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--edge); background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 14px; display: grid; place-items: center; }
@media (max-width: 1500px) { .top .meta .upd { display: none; } }
@media (max-width: 760px) { .top .meta { display: none; } }

/* hero */
.hero { text-align: center; padding: 36px 0 18px; }
.hero h1 { font: 400 52px/1.1 var(--display); margin: 0; display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero h1 .box { background: var(--yellow); color: #232323; border: 2px solid var(--edge); border-radius: 10px; padding: 0 12px 4px;
  box-shadow: 3px 3px 0 var(--shadow); }
.hero h1 .chip { font: 600 13px var(--mono); border: 2px solid var(--edge); border-radius: 999px; padding: 3px 10px; background: var(--surface); }
.hero .lede { font-weight: 700; margin: 14px 0 4px; }
.hero .sub { color: var(--soft); max-width: 720px; margin: 0 auto; }
.status { margin: 18px auto 0; max-width: 820px; border: 2px dashed var(--edge); border-radius: 12px; padding: 10px 16px;
  background: var(--paper); font-size: 14px; }
.status.done { border-style: solid; background: var(--surface); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 26px 0 8px; }
.card { background: var(--surface); border: 2px solid var(--edge); border-radius: 12px; padding: 12px 14px; }
.card.hot { background: var(--yellow); color: #232323; box-shadow: 3px 3px 0 var(--shadow); }
.card .big { font: 700 22px/1.2 var(--body); display: flex; align-items: center; gap: 8px; }
.card .lab { font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; opacity: .75; margin-top: 2px; }
.card .det { font: 12px var(--mono); opacity: .8; margin-top: 6px; }
.card img { width: 22px; height: 22px; border-radius: 5px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }

/* sections */
section { padding: 34px 0 6px; }
h2 { font: 400 34px/1.15 var(--display); margin: 0 0 4px; }
h3 { font: 700 18px var(--body); margin: 0 0 8px; }
.intro { color: var(--soft); margin: 0 0 16px; max-width: 900px; }
.panel { background: var(--surface); border: 2px solid var(--edge); border-radius: 14px; padding: 16px 18px; box-shadow: 3px 3px 0 var(--shadow); }
.panel + .panel { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.foot { text-align: center; font: 12px var(--mono); color: var(--muted); margin-top: 10px; }

/* tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font: 600 11px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--soft); text-align: right;
  padding: 8px 10px; border-bottom: 2px solid var(--edge); vertical-align: bottom; white-space: nowrap; }
th.l, td.l { text-align: left; }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--ink); }
td { padding: 10px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--hover); }
td.best { background: var(--best); font-weight: 700; }
td .s { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.rank { font: 400 24px var(--display); text-align: left; width: 34px; }
.who { display: flex; align-items: center; gap: 10px; text-align: left; font-family: var(--body); }
.who img { width: 24px; height: 24px; border-radius: 6px; background: #fff; padding: 2px; }
.who b { font-size: 15px; }
.who .v { display: block; font: 11px var(--mono); color: var(--muted); }
.tag { font: 700 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; border-radius: 999px; padding: 2px 7px;
  border: 1.5px solid var(--edge); background: var(--yellow); color: #232323; margin-left: 6px; vertical-align: 2px; }
.tag.ghost { background: transparent; color: var(--soft); border-color: var(--line); }
.tag.us { background: var(--blue); color: #fff; border-color: var(--blue); }
.boardcell { font-style: italic; color: var(--soft); }
.bar { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.bar .track { position: relative; flex: 1; height: 12px; border: 1.5px solid var(--edge); border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar .ci { position: absolute; top: 4px; height: 2px; background: var(--ink); opacity: .55; }
.bar .num { font-weight: 700; width: 52px; text-align: right; }
.bar.pending .fill { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px) !important; }

/* head to head */
.h2h { display: grid; gap: 14px; }
.h2h .row { display: grid; grid-template-columns: 220px 1fr 220px; align-items: center; gap: 14px; }
.h2h .axis { position: relative; height: 34px; }
.h2h .zero { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--edge); }
.h2h .rng { position: absolute; top: 14px; height: 6px; border-radius: 3px; }
.h2h .pt { position: absolute; top: 9px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--edge); transform: translateX(-50%); }
.h2h .ticks { position: relative; height: 16px; font: 11px var(--mono); color: var(--muted); }
.h2h .ticks span { position: absolute; transform: translateX(-50%); }
.verdict { font: 600 13px var(--mono); }
.verdict.tied { color: var(--soft); } .verdict.ahead { color: var(--green); } .verdict.behind { color: var(--red); }
@media (max-width: 760px) { .h2h .row { grid-template-columns: 1fr; } }

/* charts */
svg text { font-family: var(--mono); fill: var(--soft); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font: 12px var(--mono); color: var(--soft); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* tasks */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pill { font: 600 12px var(--mono); border: 2px solid var(--edge); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; }
.pill.on { background: var(--yellow); color: #232323; }
.pill .n { opacity: .6; margin-left: 4px; }
.search { font: 13px var(--mono); border: 2px solid var(--edge); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; min-width: 200px; }
.tasks td { padding: 7px 10px; }
.tasks td.name { text-align: left; font-family: var(--mono); font-size: 13px; }
.tasks td.name small { display: block; color: var(--muted); font-size: 11px; }
.tasks tr.t { cursor: pointer; }
.sq { display: inline-flex; gap: 3px; }
.sq i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1.5px solid var(--edge); }
.sq i.pass { background: var(--pass); } .sq i.fail { background: var(--fail); } .sq i.infra { background: var(--infra); }
.sq i.run { background: transparent; border-style: dashed; }
.sq i.cheat { background: repeating-linear-gradient(135deg, var(--fail) 0 3px, var(--surface) 3px 5px); border-color: var(--fail); }
td .s.raw { color: var(--soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--soft) 50%, transparent); }
.sq i.board { background: transparent; border-color: var(--line); }
.det td { background: var(--bg) !important; text-align: left; font-size: 12px; }
.det table td, .det table th { padding: 4px 8px; font-size: 12px; }
.det table th { border-bottom-width: 1px; }

/* method */
.flaws { counter-reset: f; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.flaws li { counter-increment: f; position: relative; padding-left: 42px; }
.flaws li::before { content: counter(f); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--edge); background: var(--paper); font: 700 13px/24px var(--mono); text-align: center; }
.flaws b { display: block; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { font: 600 12px var(--mono); color: var(--soft); text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.kv dd { margin: 0; }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } }
footer { padding: 40px 0 60px; text-align: center; font: 12px var(--mono); color: var(--muted); }
.rise { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } .bar .fill { transition: none; } html { scroll-behavior: auto; } }
tr.prev td { opacity: .78; }
