/* ==========================================================================
   BENCHCUT DESIGN SYSTEM
   ========================================================================== */

/* Typography & Core variables */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d0c;
  --bg-raised: #111514;
  --ink: #f1f4ec;
  --muted: #9da8a0;
  --dim: #68746d;
  --line: #29332e;
  --line-strong: #405047;
  --accent: #b7ff3c;
  --accent-ink: #0b1009;
  --panel: #121816;
  --panel-strong: #19211d;
  --shadow: none;
  --radius: 6px;
  --radius-sm: 4px;
  --max: 1440px;
  --pad: clamp(14px, 2.4vw, 32px);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-bg: rgba(10, 13, 12, 0.96);
  --danger: #ff786f;
  --ok: #8ee89b;
  --warn: #ffd166;
  --body-bg-gradient: radial-gradient(circle at 72% 2%, rgba(183, 255, 60, 0.05), transparent 400px), linear-gradient(180deg, #0d1210 0%, #0a0d0c 100%);
  --body-pattern-opacity: 0.06;
  --stat-b-color: var(--accent);
  --receipt-bg: #0d1210;
  --tag-bg: #0c110f;
  --tag-border: var(--line-strong);
  --tag-color: var(--muted);
  --tag-hot-bg: rgba(183, 255, 60, 0.08);
  --tag-hot-border: rgba(183, 255, 60, 0.45);
  --tag-hot-color: var(--accent);
  --table-hover: var(--panel-strong);
  --table-head-bg: #19211d;
  --side-note-bg: rgba(183, 255, 60, 0.08);
  --side-note-border: var(--accent);
  --side-note-color: var(--muted);
  --btn-primary-shadow: none;
  --btn-secondary-bg: var(--panel);
  --btn-secondary-border: var(--line-strong);
  --btn-secondary-color: var(--ink);
  --card-glow: 0 0 0 1px var(--line);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eceff1;
  --bg-raised: #ffffff;
  --ink: #263238;
  --muted: #607d8b;
  --dim: #78909c;
  --line: #d7dee2;
  --line-strong: #b0bec5;
  --accent: #1976d2;
  --accent-ink: #ffffff;
  --panel: #ffffff;
  --panel-strong: #f5f7f8;
  --shadow: 0 2px 4px rgba(38, 50, 56, .08), 0 1px 5px rgba(38, 50, 56, .06);
  --radius: 8px;
  --radius-sm: 4px;
  --font-sans: 'Inter', Roboto, "Segoe UI", Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --header-bg: rgba(255, 255, 255, 0.98);
  --danger: #d32f2f;
  --ok: #388e3c;
  --warn: #f57c00;
  --body-bg-gradient: linear-gradient(180deg, #f5f7f8 0%, #eceff1 100%);
  --body-pattern-opacity: 0;
  --stat-b-color: #1976d2;
  --receipt-bg: #ffffff;
  --tag-bg: #e3f2fd;
  --tag-border: #bbdefb;
  --tag-color: #1565c0;
  --tag-hot-bg: #fce4ec;
  --tag-hot-border: #f8bbd0;
  --tag-hot-color: #c2185b;
  --table-hover: #e3f2fd;
  --table-head-bg: #f5f7f8;
  --side-note-bg: #e3f2fd;
  --side-note-border: #1976d2;
  --side-note-color: #455a64;
  --btn-primary-shadow: 0 2px 3px rgba(25, 118, 210, 0.28);
  --btn-secondary-bg: #ffffff;
  --btn-secondary-border: #90a4ae;
  --btn-secondary-color: #1565c0;
  --card-glow: none;
}

/* Base resets & styles */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--body-bg-gradient);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  font-size: 14px;
  letter-spacing: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--body-pattern-opacity);
  background-image:
    linear-gradient(rgba(244, 241, 232, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 241, 232, .08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, black, transparent 55%);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: rgba(215, 255, 95, .35); }

/* Core Layout Elements */
.skip-link {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

.shell {
  width: min(var(--max), calc(100% - (var(--pad) * 2)));
  margin: 0 auto;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.nav {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.brand-mark {
  width: 27px;
  height: 27px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #090a0a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='4' fill='%23090a0a'/%3E%3Cpath d='M12 14h40v8H12zM12 30h30v8H12zM12 46h20v8H12z' fill='%23d7ff5f'/%3E%3C/svg%3E") center / cover no-repeat;
  box-shadow: none;
  flex: 0 0 auto;
}
.navlinks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  background: transparent;
  border: 0;
}
.navlinks a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 3px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .15s ease, color .15s ease;
}
.navlinks a:hover,
.navlinks a.active {
  background: var(--panel-strong);
  color: var(--accent);
}
.navlinks a:active,
.btn:active,
.text-pill:active,
summary:active { transform: translateY(1px) scale(.99); }

.github-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 3px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  background: var(--btn-secondary-bg);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.github-link:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.mobile-nav { display: none; }

/* Main layout containers */
main {
  min-height: 70dvh;
  padding: 24px 0 48px;
}
.loading-screen,
.empty-state,
.error-screen {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: clamp(20px, 4vw, 40px);
  box-shadow: var(--shadow);
}
.loading-bars {
  display: grid;
  gap: 10px;
  max-width: 480px;
}
.loading-bars span {
  display: block;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--panel-strong), var(--line), var(--panel-strong));
  animation: pulse 1.2s ease-in-out infinite;
}
.loading-bars span:nth-child(2) { width: 78%; }
.loading-bars span:nth-child(3) { width: 58%; }
@keyframes pulse { 50% { opacity: .45; } }

/* Typography & Headings */
.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.page-head.full { grid-template-columns: minmax(0, 820px); }
.crumb {
  display: inline-flex;
  width: max-content;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 780px;
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: .98;
  letter-spacing: -.055em;
  text-wrap: balance;
}
h2 {
  font-size: 18px;
  letter-spacing: -.025em;
}
h3 {
  font-size: 13px;
}
p {
  color: var(--muted);
}
.lede {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}
.microcopy {
  max-width: 560px;
  color: var(--dim);
  font-size: 12px;
}
.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }

/* Hero section */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: stretch;
  min-height: 0;
  margin-bottom: 18px;
}
.hero > div:first-child { padding: 18px 0; }
.hero h1 { margin: 0 0 12px; }
.hero-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.btn,
.text-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .02em;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  box-shadow: var(--btn-primary-shadow);
}
.btn.secondary,
.text-pill {
  border: 1px solid var(--btn-secondary-border);
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-color);
}
.btn:hover,
.text-pill:hover {
  text-decoration: none;
  border-color: var(--accent);
}

/* Receipt Card */
.receipt {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--receipt-bg);
  box-shadow: var(--shadow);
  padding: 1px;
  transform: none;
  overflow: hidden;
}
.receipt-inner {
  border: 1px dashed var(--line);
  padding: 15px;
  background: transparent;
}
.receipt-top,
.receipt-line,
.run-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}
.receipt-top {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}
.receipt-score {
  margin: 20px 0 16px;
  font-size: 58px;
  line-height: 1;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
}
.receipt-line,
.run-line {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}
.receipt-line b,
.run-line b {
  color: var(--ink);
}
.receipt-foot {
  margin-top: 12px;
  padding: 8px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Stats Wall */
.stat-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin: 18px 0 24px;
}
.stat {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 25px;
  line-height: .9;
  letter-spacing: -.06em;
  color: var(--stat-b-color);
}
.stat span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Split section */
.split-section {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  margin: 26px 0;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section-title {
  position: sticky;
  top: 76px;
}
.section-title h2,
.wide-callout h2,
.panel h2,
.task-pack h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: .95;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.section-title p,
.wide-callout p,
.panel p,
.task-pack p { color: var(--muted); }
.evidence-list {
  display: grid;
  gap: 0;
}
.evidence-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.evidence-row code {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}
.evidence-row h3 {
  margin: 0 0 4px;
  font-size: 13px;
}
.evidence-row p { max-width: 630px; margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.wide-callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
  margin: 18px 0;
}

/* Toolbar & controls */
.toolbar {
  position: sticky;
  top: 57px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 190px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.control { display: grid; gap: 5px; }
.control span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
input, select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg-raised);
  padding: 0 10px;
  outline: none;
  font-size: 12px;
  transition: border-color 0.15s ease;
}
input:focus, select:focus { border-color: var(--accent); }

/* Builder Layouts */
.builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.builder-grid .control.wide { grid-column: 1 / -1; }
.builder-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}
.command-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.command-builder .panel {
  border: 0;
  background: transparent;
  padding: 8px;
}
.command-preview {
  position: sticky;
  top: 92px;
  padding: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.command-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.copy-status {
  min-height: 22px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Leaderboard Details */
.leader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.podium {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 0;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.podium-main,
.podium-side,
.panel,
details,
.task-pack,
.run-card,
.empty-state,
.error-screen {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.podium-main {
  padding: 18px;
}
.podium-side {
  padding: 18px;
  border-left: 1px solid var(--line);
  display: grid;
  align-content: stretch;
}
.podium-main h2 {
  margin: 12px 0 5px;
  font-size: 21px;
}
.score-figure {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 20px 0 10px;
}
.score-figure b {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 42px;
  line-height: .8;
  letter-spacing: -.08em;
}
.score-figure span { color: var(--muted); }

.rank-tag,
.tag,
.status {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  padding: 4px 8px;
  color: var(--tag-color);
  background: var(--tag-bg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.rank-tag.hot,
.tag.hot {
  border-color: var(--tag-hot-border);
  color: var(--tag-hot-color);
  background: var(--tag-hot-bg);
}

.status.ok { border-color: rgba(142, 232, 155, .42); color: var(--ok); background: rgba(142, 232, 155, .08); }
.status.no, .danger { border-color: rgba(255, 120, 111, .42); color: var(--danger); background: rgba(255, 120, 111, .08); }

/* Run Card */
.run-list { display: grid; gap: 5px; }
.run-card {
  display: grid;
  grid-template-columns: 36px minmax(220px, 1fr) repeat(3, minmax(82px, 110px)) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  transition: border-color .15s ease, background .15s ease;
  box-shadow: var(--shadow);
}
.run-card:hover {
  border-color: var(--accent);
  background: var(--panel-strong);
}
.rank-number {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}
.run-title h2 {
  margin: 0 0 3px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.run-title p {
  margin: 0;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-metrics { display: contents; }
.mini-metric {
  display: grid;
  gap: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  min-height: 40px;
}
.mini-metric b {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
}
.mini-metric span {
  color: var(--dim);
  font-size: 9px;
  text-transform: uppercase;
}
.run-card .hero-actions {
  display: flex;
  margin: 0 !important;
}

/* Metric Row */
.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  min-height: 40px;
}
.metric-row:last-child { border-bottom: 0; }
.metric-row b {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
}
.metric-row span {
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.metric-row small { color: var(--dim); font-size: 10px; }

/* Tasks grid */
.task-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.task-pack {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  box-shadow: var(--shadow);
}
.task-pack:nth-child(1) { grid-column: span 3; background: var(--panel-strong); }
.task-pack:nth-child(2) { grid-column: span 3; }
.task-pack:nth-child(3) { grid-column: span 2; }
.task-pack:nth-child(4) { grid-column: span 2; }
.task-pack:nth-child(5) { grid-column: span 2; }
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Foldable Details element */
details {
  overflow: hidden;
  margin: 7px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--ink);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  margin-left: auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 16px;
}
details[open] summary::after { content: "-"; }
.fold-body {
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 12px;
}
.json-block {
  max-height: 520px;
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  font: 11px/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.raw-data { margin-top: 14px; border-top: 1px solid var(--line); }
.raw-data summary { padding: 10px 0; color: var(--accent); font-size: 11px; }

/* Method layout list */
.method-list {
  counter-reset: item;
  display: grid;
  gap: 10px;
}
.method-item {
  counter-increment: item;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.method-item::before {
  content: counter(item, decimal-leading-zero);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
}
.method-item h2 { margin-bottom: 5px; font-size: 14px; }
.method-item p { margin: 0; color: var(--muted); }

/* Code highlights */
.code-panel {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050606;
  padding: 12px;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  color: #eceff1;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

/* Run Details Layout */
.run-detail {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.sticky-panel { position: sticky; top: 92px; }
.panel { padding: 15px; box-shadow: var(--shadow); }
.task-list { display: grid; gap: 8px; }
.task-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.check-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}
.check-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--muted);
  background: var(--bg);
  font-size: 12px;
}
.back-link { margin-bottom: 14px; }

/* Footer elements */
footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 28px;
  color: var(--dim);
  font-size: 11px;
}
footer .shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
footer nav { display: flex; gap: 16px; color: var(--muted); }

/* Run Detail Wiki Pages */
.wiki-page { max-width: var(--max); }
.wiki-header {
  border-bottom: 1px solid var(--line-strong);
  padding: 8px 0 20px;
  margin-bottom: 20px;
}
.wiki-header h1 {
  max-width: 920px;
  margin: 12px 0 10px;
  font-size: clamp(32px, 5vw, 64px);
  line-height: .98;
  letter-spacing: -.06em;
  overflow-wrap: anywhere;
}
.wiki-lede { color: var(--muted); font-size: 14px; }
.wiki-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.wiki-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(20px, 4vw, 54px); align-items: start; }
.wiki-sidebar { display: grid; gap: 18px; position: sticky; top: 92px; }
.wiki-toc { display: grid; gap: 2px; border-left: 2px solid var(--line-strong); padding: 2px 0 2px 14px; }
.wiki-toc b { margin-bottom: 7px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.wiki-toc a { padding: 4px 0; color: var(--muted); font-size: 12px; }
.wiki-toc a:hover { color: var(--accent); }
.wiki-infobox { border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.wiki-infobox-title { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.wiki-infobox .metric-row { padding: 10px 12px; }
.wiki-infobox .metric-row b { font-size: 16px; }
.wiki-article { min-width: 0; }
.wiki-section { scroll-margin-top: 88px; border-top: 1px solid var(--line-strong); padding: 24px 0 28px; }
.wiki-section:first-child { border-top: 0; padding-top: 0; }
.wiki-section h2 { margin: 0 0 10px; font-size: 21px; line-height: 1; letter-spacing: -.045em; }
.wiki-section p { max-width: 720px; color: var(--muted); }
.wiki-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.wiki-stat-grid div { display: grid; gap: 6px; min-height: 88px; padding: 14px; border-right: 1px solid var(--line); }
.wiki-stat-grid div:last-child { border-right: 0; }
.wiki-stat-grid b { color: var(--accent); font-family: var(--font-mono); font-size: 22px; }
.wiki-stat-grid span { color: var(--dim); font-size: 10px; text-transform: uppercase; }
.wiki-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line); font-size: 13px; }
.wiki-table th, .wiki-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.wiki-table th { width: 32%; color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.wiki-table td { color: var(--ink); overflow-wrap: anywhere; }
.wiki-muted { color: var(--dim) !important; font-size: 12px; }
.wiki-source { border-left: 3px solid var(--accent); padding: 10px 12px; background: var(--side-note-bg); font-size: 12px; overflow-wrap: anywhere; }

/* Dashboard and Data surfaces */
.data-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 10px 0 18px; border-bottom: 1px solid var(--line); }
.data-header h1 { margin: 0; font-size: clamp(24px, 3.4vw, 36px); letter-spacing: -.04em; }
.data-header-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; white-space: nowrap; }
.data-header-meta b { color: var(--ink); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2); }
.dashboard-toolbar { display: flex; align-items: center; gap: 18px; min-height: 48px; margin: 14px 0; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.dashboard-label { flex: 1; color: var(--ink); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.toolbar-status { padding-left: 14px; border-left: 1px solid var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.dashboard-toolbar .text-pill { width: auto; }
.data-grid { display: grid; }
.metrics-grid { grid-template-columns: repeat(6, 1fr); gap: 1px; overflow: hidden; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.dashboard-metric { min-height: 92px; padding: 12px; background: var(--panel); }
.dashboard-metric span, .dashboard-metric small { display: block; color: var(--muted); font-size: 9px; }
.dashboard-metric span { text-transform: uppercase; letter-spacing: .06em; }
.dashboard-metric b { display: block; margin: 8px 0 4px; color: var(--stat-b-color); font-family: var(--font-mono); font-size: 22px; line-height: 1; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.dashboard-main, .dashboard-side { min-width: 0; padding: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.section-bar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-bar .crumb { display: block; margin-bottom: 3px; }
.section-bar h2 { margin: 0; font-size: 15px; }
.section-bar .text-pill { width: auto; min-height: 29px; padding-inline: 8px; font-size: 10px; }
.compact-table { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.compact-table-head, .compact-table-row { display: grid; grid-template-columns: 34px minmax(180px, 1fr) 78px 80px 100px 24px; align-items: center; gap: 10px; padding: 9px 10px; }
.compact-table-head { background: var(--table-head-bg); color: var(--muted); font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; }
.compact-table-row { min-height: 54px; border-top: 1px solid var(--line); color: var(--ink); font-family: var(--font-mono); font-size: 11px; text-decoration: none; }
.compact-table-row:hover { background: var(--table-hover); text-decoration: none; }
.compact-table-row strong { color: var(--stat-b-color); font-size: 13px; }
.table-rank { color: var(--dim); }
.table-model { min-width: 0; display: grid; gap: 3px; }
.table-model b { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.table-model small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.row-arrow { color: var(--accent); font-size: 16px; text-align: right; }
.data-empty { display: grid; gap: 8px; padding: 28px 16px; border: 1px dashed var(--line-strong); background: var(--panel-strong); border-radius: var(--radius-sm); }
.data-empty b { color: var(--ink); }
.data-empty span { color: var(--muted); font-size: 12px; }
.data-empty .text-pill { width: max-content; }
.pack-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.pack-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.pack-row:last-child { border-bottom: 0; }
.pack-row:hover { background: var(--table-hover); text-decoration: none; }
.pack-row span { display: grid; gap: 3px; }
.pack-row b { font-size: 12px; }
.pack-row small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.pack-row strong { color: var(--stat-b-color); font-family: var(--font-mono); font-size: 18px; }
.side-note { display: grid; gap: 4px; margin-top: 14px; padding: 10px; border-left: 3px solid var(--side-note-border); background: var(--side-note-bg); color: var(--side-note-color); font-size: 11px; border-radius: var(--radius-sm); }
.side-note span { color: var(--muted); line-height: 1.4; }
.dashboard-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; color: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.dashboard-foot a { color: var(--accent); }

/* Theme Switcher Button Style */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* Base Responsive Media Queries */
@media (max-width: 900px) {
  .nav { min-height: 62px; }
  .navlinks, .github-link { display: none; }
  .mobile-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px var(--pad) 10px;
    border-top: 1px solid var(--line);
    scrollbar-width: none;
    background: var(--header-bg);
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 13px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .mobile-nav a.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
  main { padding-top: 16px; }
  .hero,
  .page-head,
  .split-section,
  .podium,
  .run-detail { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .receipt { transform: none; }
  .section-title,
  .sticky-panel { position: static; }
  .stat-wall { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--line); }
  .toolbar { grid-template-columns: 1fr; position: static; }
  .command-builder { grid-template-columns: 1fr; }
  .command-preview { position: static; }
  .run-card { grid-template-columns: 36px minmax(0, 1fr); }
  .run-card .mini-metrics { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
  .run-card .hero-actions { grid-column: 1 / -1; }
  .mini-metric { border-top: 1px solid var(--line); border-left: 0; padding: 8px 0 0; }
  .task-grid { grid-template-columns: 1fr; }
  .task-pack:nth-child(n) { grid-column: auto; }
  footer .shell { align-items: flex-start; flex-direction: column; }
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-sidebar { position: static; grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr); align-items: start; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-columns { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { --pad: 16px; }
  h1 { font-size: clamp(30px, 12vw, 42px); }
  .page-head h1 { font-size: clamp(28px, 10vw, 36px); }
  .hero-actions { flex-direction: column; }
  .btn, .text-pill { width: 100%; }
  .stat-wall { grid-template-columns: 1fr; }
  .stat { min-height: 75px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .evidence-row,
  .method-item { grid-template-columns: 1fr; gap: 8px; }
  .mini-metrics { grid-template-columns: 1fr; }
  .builder-grid { grid-template-columns: 1fr; }
  .builder-grid .control.wide { grid-column: auto; }
  .receipt-score { font-size: 48px; }
  .metric-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  summary { align-items: flex-start; min-height: 0; padding: 16px; }
  .fold-body { padding: 0 16px 16px; }
  .wiki-sidebar, .wiki-stat-grid { grid-template-columns: 1fr; }
  .wiki-stat-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .wiki-stat-grid div:last-child { border-bottom: 0; }
  .wiki-table th, .wiki-table td { display: block; width: auto; }
  .wiki-table th { padding-bottom: 4px; border-bottom: 0; }
  .wiki-table td { padding-top: 0; }
  .data-header { display: grid; align-items: start; gap: 12px; }
  .data-header-meta { white-space: normal; }
  .dashboard-toolbar { flex-wrap: wrap; gap: 8px; }
  .dashboard-label { flex-basis: 100%; }
  .toolbar-status { padding-left: 0; border-left: 0; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .compact-table-head, .compact-table-row { grid-template-columns: 24px minmax(0, 1fr) 60px 24px; gap: 7px; }
  .compact-table-head span:nth-child(4), .compact-table-head span:nth-child(5), .compact-table-row > span:nth-child(4), .compact-table-row > span:nth-child(5) { display: none; }
  .dashboard-foot { display: grid; }
}

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