/* ==========================================================================
   MillieniumBench Design System
   Editorial mathematical gravitas + crisp AI benchmark clarity
   ========================================================================== */

:root {
  --bg: #faf9f6;
  --bg-alt: #f3f1eb;
  --surface: #ffffff;
  --surface-subtle: #f7f5f0;
  --surface-hover: #f2efe7;
  --border: #e4e0d5;
  --border-strong: #cfc9ba;

  --ink: #141413;
  --ink-secondary: #525049;
  --ink-muted: #7b776d;

  --gold: #a97822;
  --gold-bright: #c69234;
  --gold-soft: #faf2e1;
  --gold-border: #e7d1a4;

  --teal: #147467;
  --teal-soft: #e6f5f2;
  --teal-border: #b3dfd7;

  --indigo: #2c4b9e;
  --indigo-soft: #eaeffd;

  --crimson: #b34233;
  --crimson-soft: #fcece9;
  --crimson-border: #f0c2ba;

  --code-bg: #16181d;
  --code-border: #282c36;
  --code-ink: #e9ecf2;

  --shadow-sm: 0 1px 2px rgba(20, 20, 19, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 20, 19, 0.06);
  --shadow-lg: 0 24px 60px rgba(20, 20, 19, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --header-h: 66px;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-alt: #13161c;
  --surface: #171b23;
  --surface-subtle: #1d222c;
  --surface-hover: #222835;
  --border: #272d3b;
  --border-strong: #394256;

  --ink: #f3f0e8;
  --ink-secondary: #aeb4c2;
  --ink-muted: #7c8496;

  --gold: #dfb059;
  --gold-bright: #ebc274;
  --gold-soft: rgba(223, 176, 89, 0.12);
  --gold-border: rgba(223, 176, 89, 0.3);

  --teal: #3ec2ae;
  --teal-soft: rgba(62, 194, 174, 0.12);
  --teal-border: rgba(62, 194, 174, 0.3);

  --indigo: #7aa2ff;
  --indigo-soft: rgba(122, 162, 255, 0.13);

  --crimson: #ef7464;
  --crimson-soft: rgba(239, 116, 100, 0.12);
  --crimson-border: rgba(239, 116, 100, 0.3);

  --code-bg: #0b0d11;
  --code-border: #232834;
  --code-ink: #e8ecf5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.38em;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 999;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
}

.brand-mark .mark-bg {
  fill: var(--ink);
}
.brand-mark .mark-stroke-gold {
  stroke: var(--gold-bright);
}
.brand-mark .mark-stroke-ink {
  stroke: var(--bg);
}

.brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-secondary);
}

.site-nav a {
  white-space: nowrap;
  transition: color 0.15s ease;
}
.site-nav a:hover {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
  background: var(--surface-hover);
}

[data-theme="light"] .icon-sun {
  display: none;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

.mobile-menu-btn {
  display: none;
}

.mobile-drawer {
  display: flex;
  flex-direction: column;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  gap: 12px;
}
.mobile-drawer[hidden] {
  display: none;
}
.mobile-drawer a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-secondary);
  padding: 4px 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  font-size: 0.84rem;
  padding: 7px 13px;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 64px;
  border-bottom: 1px solid var(--border);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.hero-title {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: clamp(2.45rem, 5.2vw, 4.1rem);
  font-weight: 500;
  line-height: 1.09;
  letter-spacing: -0.025em;
  max-width: 860px;
}

.serif-italic {
  font-style: italic;
}

.gold-text {
  color: var(--gold);
}

.hero-subtitle {
  margin: 0 0 30px;
  max-width: 680px;
  font-size: 1.07rem;
  color: var(--ink-secondary);
  line-height: 1.68;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 48px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.stat-value.accent-crimson {
  color: var(--crimson);
}

.stat-value.accent-teal {
  color: var(--teal);
}

.stat-meta {
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: 76px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.section-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 6px;
}

.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.2vw, 2.45rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-lead {
  margin: 0 0 28px;
  max-width: 780px;
  font-size: 0.99rem;
  color: var(--ink-secondary);
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   Leaderboard Controls & Table
   ========================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.track-tabs,
.view-switch {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}

.tab-btn,
.switch-btn {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn:hover,
.switch-btn:hover {
  color: var(--ink);
}

.tab-btn.active,
.switch-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.87rem;
}

.search-wrap input:focus {
  outline: 2px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-color: var(--gold);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.pill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  cursor: pointer;
  margin-left: auto;
  user-select: none;
}
.toggle-check input {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.matrix-table th:nth-child(n + 3),
.matrix-table td:nth-child(n + 3) {
  text-align: center !important;
  min-width: 118px;
  white-space: nowrap;
}

.matrix-table td:nth-child(2) {
  min-width: 210px;
}

.leaderboard-table th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.leaderboard-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.leaderboard-table th.sortable:hover {
  color: var(--ink);
}
.leaderboard-table th.sort-active {
  color: var(--gold);
}

.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leaderboard-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.leaderboard-table tbody tr:hover {
  background: var(--surface-hover);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

.col-rank {
  width: 48px;
  text-align: center !important;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-muted);
}

.col-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
}
.rank-1 {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}
.rank-2 {
  background: var(--surface-subtle);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.rank-3 {
  background: var(--crimson-soft);
  color: var(--crimson);
  border: 1px solid var(--crimson-border);
}

.model-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.model-name {
  font-weight: 600;
  color: var(--ink);
}

.model-org {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-open {
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
}

.badge-arch {
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-weight: 500;
}

.badge-unsolved {
  color: var(--crimson);
  background: var(--crimson-soft);
  border: 1px solid var(--crimson-border);
}

.badge-solved {
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
}

.badge-ai-verified {
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
}

.badge-claimed {
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
}

.open-solved-pill.has-solve {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: var(--teal-border);
}

.breakthrough-callout {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.55;
}

.breakthrough-callout.verified {
  background: var(--teal-soft);
  border-color: var(--teal-border);
}

.matrix-empty {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-size: 0.84rem;
}

.proof-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.proof-links-compact {
  margin-top: 6px;
  gap: 5px;
}

.proof-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--indigo);
  background: var(--indigo-soft);
  border: 1px solid color-mix(in srgb, var(--indigo) 26%, transparent);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.proof-link:hover {
  border-color: var(--indigo);
  background: color-mix(in srgb, var(--indigo) 18%, transparent);
  transform: translateY(-1px);
}

.score-bar-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 82px;
}

.score-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
}

.score-num.highlight-track {
  color: var(--gold);
}

.mini-bar {
  width: 78px;
  height: 5px;
  border-radius: 99px;
  background: var(--surface-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}

.mini-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.open-solved-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--crimson);
  background: var(--crimson-soft);
  border: 1px solid var(--crimson-border);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.heat-cell {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 5px 8px;
  display: inline-block;
  min-width: 54px;
  text-align: center;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  font-size: 0.79rem;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Seven Millennium Problems Grid
   ========================================================================== */

.problems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-rows: 1fr;
  gap: 20px;
}

.problem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.problem-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-border);
  box-shadow: var(--shadow-md);
}

.problem-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.problem-card-top .badge {
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
  text-align: left;
}

.problem-num-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.problem-num {
  color: var(--gold);
  font-weight: 600;
}

.problem-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.2;
}

.problem-formula {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-serif);
  font-size: 0.94rem;
  color: var(--ink);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  flex-shrink: 0;
}

.problem-formula > .katex {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.96em;
}

.problem-formula .katex-display {
  margin: 0.15em 0;
  width: max-content;
  min-width: 100%;
  text-align: center;
}

.problem-summary {
  margin: 0;
  font-size: 0.89rem;
  color: var(--ink-secondary);
  flex: 1;
}

.problem-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.problem-sota {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

.problem-inspect {
  color: var(--gold);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   Methodology & Formula Banner
   ========================================================================== */

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.step-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.pipeline-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 500;
}

.pipeline-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

.formula-banner {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.formula-banner-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 10px;
}

.formula-banner-math {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  padding: 12px 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.verification-rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 16px;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Submit / Code Panel
   ========================================================================== */

.submit-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 32px;
  align-items: start;
}

.submit-info p {
  margin: 0 0 18px;
  color: var(--ink-secondary);
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist li {
  position: relative;
  padding-left: 24px;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--teal);
  font-weight: 700;
}

.submit-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.code-panel {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  box-shadow: var(--shadow-md);
}

.code-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--code-border);
  background: rgba(255, 255, 255, 0.03);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #9ba5b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.code-tab {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #9ba5b8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.code-tab.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.copy-btn {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #d6dce8;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.code-block {
  margin: 0;
  padding: 18px 20px;
  color: var(--code-ink);
  overflow-x: auto;
  line-height: 1.6;
}

/* ==========================================================================
   Citation & Footer
   ========================================================================== */

.cite-container {
  max-width: 900px;
}

.disclaimer-box {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.86rem;
  color: var(--ink-secondary);
}
.footer-links a:hover {
  color: var(--ink);
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 16, 0.62);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.2;
}

.modal-body {
  padding: 22px 26px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-body > * {
  flex-shrink: 0;
}

.modal-section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.tier-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tier-item {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}

.tier-item strong {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 4px;
  color: var(--ink);
}

.tier-item p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.model-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.breakdown-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.breakdown-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.breakdown-card-top strong {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .site-nav {
    gap: 16px;
  }
  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pipeline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .submit-layout {
    grid-template-columns: 1fr;
  }
  .verification-rules {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 861px) {
  .mobile-drawer {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .site-nav,
  .github-pill {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 52px 0 46px;
  }
  .section {
    padding: 54px 0;
  }
  .hero-stats,
  .pipeline-grid,
  .tier-list {
    grid-template-columns: 1fr;
  }
  .toggle-check {
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }
  .problems-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .problem-card {
    padding: 18px 18px;
  }
  .problem-formula {
    font-size: 0.82rem;
    padding: 10px 10px;
  }
  .modal-body .problem-formula {
    font-size: 0.78rem;
    padding: 10px 10px;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .modal-header {
    padding: 16px 18px 14px;
  }
  .modal-body {
    padding: 16px 18px 20px;
  }
  .code-block {
    padding: 14px 16px;
  }
  pre code {
    font-size: 0.78rem;
  }
}
