@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #53575E;
  --surface: #5F636A;
  --surface-alt: #595D64;
  --deep: #43474E;
  --track: #686C73;
  --line: #868A91;
  --line-dim: #6F737A;
  --accent: #FFB000;
  --accent-text: #FFE08A;
  --accent-ink: #1A1B1E;
  --ink: #FFFFFF;
  --ink-2: #F2F4F7;
  --muted: #E3E6EB;
  --faint: #DFE3E8;
  --pass: #4CE0B3;
  --fail: #FFB3AE;
  --font-title: 'Geist Mono', ui-monospace, monospace;
  --font-body: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img, video, svg { max-width: 100%; }

.shell { max-width: 1240px; margin: 0 auto; padding: 20px 20px 44px; }

/* Top navigation bar */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px; padding: 12px 16px; margin-bottom: 24px;
  background: var(--surface); border: 1px solid var(--accent);
}
.brand-link {
  display: inline-flex; align-items: center; gap: 10px; min-height: 36px;
  color: var(--ink); font-family: var(--font-title); font-weight: 800; font-size: 16px;
  letter-spacing: -0.01em; text-decoration: none;
}
.brand-link:hover { color: var(--accent-text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; display: block; image-rendering: pixelated; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px;
  color: var(--ink-2); font-size: 13px; border: 1px solid transparent;
}
.nav a:hover { border-color: var(--line); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* TUI framed panels (sharp 0px corners) */
.tui-panel {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  padding: 24px 20px 20px; margin-bottom: 24px;
}
.tui-panel.accent { border-color: var(--accent); }
.tui-tab {
  position: absolute; top: -12px; left: 14px; padding: 1px 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700;
  letter-spacing: 0.01em;
}
.tui-panel:not(.accent) .tui-tab {
  background: var(--deep); color: var(--ink); border: 1px solid var(--line);
}

/* Hero & typography */
h1, h2, h3 { font-family: var(--font-title); margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.prompt-h1 { font-size: clamp(22px, 3.2vw, 34px); line-height: 1.18; color: var(--ink); }
.prompt-h1 .gt, .prompt-h2 .gt { color: var(--accent-text); margin-right: 8px; }
.prompt-h2 { font-size: 20px; line-height: 1.25; color: var(--ink); margin-bottom: 4px; }
.sub-comment { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.sub-comment::before { content: '# '; color: var(--faint); }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.crumb a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; min-width: 36px; padding: 0 6px; }
.crumb a:hover { color: var(--accent-text); }

/* Stats strip */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px;
}
.stat-box { background: var(--deep); border: 1px solid var(--line-dim); padding: 12px 14px; }
.stat-val { font-family: var(--font-title); font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.15; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Segmented phosphor bars */
.segbar { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; }
.segbar i { display: block; width: 7px; height: 11px; background: var(--track); }
.segbar.wide i { width: 9px; height: 12px; }
.brand-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex-shrink: 0; }
.model-tag { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink); }
a.model-tag { min-height: 36px; min-width: 36px; }

/* Model leaderboard cards */
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.model-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--deep); border: 1px solid var(--line-dim); padding: 16px;
  color: var(--ink); text-decoration: none;
}
.model-card:hover { border-color: var(--accent); text-decoration: none; }
.model-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-name { font-family: var(--font-title); font-size: 16px; font-weight: 800; }
.model-meta { font-size: 12px; color: var(--muted); }
.model-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line-dim); }
.mm-val { font-weight: 700; font-size: 14px; color: var(--ink); }
.mm-lbl { font-size: 12px; color: var(--faint); }
.hold-note { font-size: 12px; color: var(--accent-text); border-left: 2px solid var(--accent); padding-left: 8px; }

/* Filter toolbar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 16px; }
.filter-btn {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  min-height: 36px; padding: 6px 12px; cursor: pointer;
  background: var(--deep); color: var(--ink-2); border: 1px solid var(--line-dim);
}
.filter-btn:hover { border-color: var(--accent); color: var(--ink); }
.filter-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Matrix table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-dim); background: var(--deep); }
table.matrix { width: 100%; border-collapse: collapse; min-width: 680px; }
table.matrix th, table.matrix td {
  text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-dim); vertical-align: middle;
}
table.matrix thead th { background: var(--surface-alt); font-size: 12px; color: var(--ink-2); font-weight: 700; white-space: nowrap; }
table.matrix tbody tr:hover { background: rgba(255, 176, 0, 0.06); }
.test-title-link { color: var(--ink); font-weight: 700; display: inline-flex; align-items: center; min-height: 36px; padding: 4px 0; }
.test-title-link:hover { color: var(--accent-text); }
.test-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.cell-link { display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); text-decoration: none; min-height: 38px; min-width: 44px; justify-content: center; }
.cell-link:hover { color: var(--accent-text); text-decoration: none; }
.cell-score { font-weight: 700; font-size: 13px; color: var(--ink); }
.cell-muted { font-size: 12px; color: var(--faint); }
.status-pass { color: var(--pass); }
.status-warn { color: var(--accent-text); }
.status-fail { color: var(--fail); }

/* Visual highlight gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.shot-card { background: var(--deep); border: 1px solid var(--line-dim); display: flex; flex-direction: column; }
.shot-card:hover { border-color: var(--accent); }
.shot-thumb { display: block; aspect-ratio: 16 / 10; background: #2D3036; overflow: hidden; border-bottom: 1px solid var(--line-dim); }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.shot-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.shot-title { font-weight: 700; color: var(--ink); font-size: 13px; }
.shot-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Test comparison page */
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 14px; }
.run-card { background: var(--deep); border: 1px solid var(--line-dim); display: flex; flex-direction: column; }
.run-card-head {
  padding: 12px 14px; background: var(--surface-alt); border-bottom: 1px solid var(--line-dim);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.run-media { position: relative; background: #2A2D33; border-bottom: 1px solid var(--line-dim); }
.run-media img.shot-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; display: block; }
.run-media img.shot-img.mobile-shot { max-width: 240px; aspect-ratio: auto; margin: 12px auto; border: 1px solid var(--line-dim); }
.run-media.svg-stage { padding: 18px; display: grid; place-items: center; min-height: 240px; background: #2A2D33; }
.run-media.svg-stage.light { background: #ECEEF1; }
.run-media.svg-stage img { max-height: 280px; width: auto; object-fit: contain; }
.run-media video { width: 100%; display: block; background: #1A1B1E; max-height: 360px; }
.media-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line-dim); font-size: 12px;
}
.btn-group { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.btn-sm {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  min-height: 36px; min-width: 36px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center;
  background: var(--deep); color: var(--ink-2); border: 1px solid var(--line); text-decoration: none;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.btn-sm.active, .btn-sm.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-sm.primary:hover { color: var(--accent-ink); opacity: 0.92; }

.run-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.run-empty { padding: 36px 16px; text-align: center; color: var(--faint); font-size: 13px; background: #3B3F46; border-bottom: 1px solid var(--line-dim); }
.run-notes { font-size: 12px; color: var(--muted); margin: 0; }
.run-links { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 10px; border-top: 1px dashed var(--line-dim); font-size: 12px; margin-top: auto; }
.run-links a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: underline; text-underline-offset: 3px; }
table.matrix td > a { display: inline-flex; align-items: center; min-height: 36px; }

/* SlopScore & automated checks */
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: grid; grid-template-columns: 104px 1fr 48px; align-items: center; gap: 8px; font-size: 12px; }
.cat-name { color: var(--muted); }
.cat-val { text-align: right; color: var(--ink); font-weight: 700; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.check-list li { display: flex; gap: 8px; align-items: baseline; }
.check-ok { color: var(--pass); font-weight: 700; }
.check-bad { color: var(--fail); font-weight: 700; }
.check-got { color: var(--faint); }

/* Text & prompt blocks */
details.tui-details { border: 1px solid var(--line-dim); background: var(--deep); }
details.tui-details summary {
  cursor: pointer; min-height: 40px; padding: 10px 14px; font-weight: 700; font-size: 13px; color: var(--ink);
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
details.tui-details summary::-webkit-details-marker { display: none; }
details.tui-details summary::before { content: '+ '; color: var(--accent-text); margin-right: 6px; }
details.tui-details[open] summary::before { content: '- '; }
details.tui-details[open] summary { border-bottom: 1px solid var(--line-dim); }
pre.code-pane {
  margin: 0; padding: 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-body); font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
  background: #3B3F46; max-height: 460px; overflow-y: auto;
}
.text-output {
  margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-body); font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
  background: #3B3F46; border-bottom: 1px solid var(--line-dim); max-height: 380px; overflow-y: auto;
}

/* Modal preview for interactive HTML deliverables */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(24, 26, 30, 0.84);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  width: min(1200px, 100%); height: min(88vh, 880px); background: var(--surface);
  border: 1px solid var(--accent); display: flex; flex-direction: column;
}
.modal-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-dim); background: var(--deep);
}
.modal-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.modal-stage { flex: 1; background: #2A2D33; display: flex; justify-content: center; overflow: auto; }
.modal-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-stage.phone iframe { width: 390px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

/* Methodology prose */
.prose p { margin: 0 0 12px; color: var(--ink-2); max-width: 72ch; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); max-width: 72ch; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--ink); }

/* Dashed footer matching Editorial chartkit */
.site-footer {
  margin-top: 32px; padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  font-size: 12px; color: var(--muted);
}
.footer-handle { color: var(--ink); font-weight: 700; }

@media (max-width: 760px) {
  .shell { padding: 14px 12px 32px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tui-panel { padding: 20px 14px 14px; }
  .compare-grid { grid-template-columns: 1fr; }
}
