/* Doomscroll UI. Dials: variance 8, motion 6, density 4. One accent (desaturated emerald) on zinc. */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --z-50: #fafafa;
  --z-100: #f4f4f5;
  --z-150: #ececee;
  --z-200: #e4e4e7;
  --z-300: #d4d4d8;
  --z-400: #a1a1aa;
  --z-500: #71717a;
  --z-600: #52525b;
  --z-700: #3f3f46;
  --z-800: #27272a;
  --z-900: #18181b;
  --z-950: #0c0c0e;

  --bg: #f5f5f6;
  --surface: #ffffff;
  --ink: var(--z-950);
  --ink-2: var(--z-700);
  --ink-3: #6b6b74;
  --line: rgba(24, 24, 27, 0.08);
  --line-strong: rgba(24, 24, 27, 0.14);

  --accent: hsl(158 52% 32%);
  --accent-ink: hsl(158 58% 22%);
  --accent-soft: hsl(158 38% 94%);
  --accent-line: hsl(158 34% 80%);

  --on-accent: #ffffff;

  --shadow-diffuse: 0 24px 48px -24px rgba(24, 24, 27, 0.12), 0 2px 6px -2px rgba(24, 24, 27, 0.04);
  --shadow-lift: 0 30px 60px -28px rgba(24, 24, 27, 0.18), 0 2px 8px -2px rgba(24, 24, 27, 0.05);
  --shadow-sheet: rgba(24, 24, 27, 0.35);
  --inner-edge: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --topbar-bg: rgba(245, 245, 246, 0.78);
  --topbar-edge: rgba(255, 255, 255, 0.6);
  --tint: rgba(24, 24, 27, 0.04);
  --tint-code: rgba(24, 24, 27, 0.05);
  --surface-soft: rgba(255, 255, 255, 0.72);
  --row-hover: rgba(255, 255, 255, 0.62);
  --stripe: rgba(24, 24, 27, 0.025);
  --shimmer: rgba(255, 255, 255, 0.75);
  --strike: rgba(113, 113, 122, 0.35);
  --scrim: rgba(12, 12, 14, 0.28);
  --grain: 0.035;
  color-scheme: light;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 0.45s var(--ease);

  --r-xl: 2rem;
  --r-lg: 1.5rem;
  --r-md: 1rem;
  --r-sm: 0.625rem;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Dark: same zinc family with the scale flipped so z-100 stays "quiet fill" and z-700 stays
   "strong mark" in both themes. Emerald is lifted in lightness, not saturation. */
:root[data-theme="dark"] {
  --z-50: #0e0e11;
  --z-100: #1c1c21;
  --z-150: #232329;
  --z-200: #2c2c33;
  --z-300: #4a4a53;
  --z-400: #82828c;
  --z-500: #9d9da6;
  --z-600: #b3b3bb;
  --z-700: #c6c6cd;
  --z-800: #dcdce0;
  --z-900: #ebebee;
  --z-950: #f5f5f6;

  --bg: #101013;
  --surface: #17171b;
  --ink-3: var(--z-500);
  --line: rgba(244, 244, 245, 0.08);
  --line-strong: rgba(244, 244, 245, 0.14);

  --accent: hsl(158 40% 52%);
  --accent-ink: hsl(158 44% 72%);
  --accent-soft: hsl(158 32% 13%);
  --accent-line: hsl(158 28% 30%);
  --on-accent: #0c1411;

  --shadow-diffuse: 0 24px 48px -24px rgba(4, 4, 6, 0.6), 0 2px 6px -2px rgba(4, 4, 6, 0.35);
  --shadow-lift: 0 30px 60px -28px rgba(4, 4, 6, 0.75), 0 2px 8px -2px rgba(4, 4, 6, 0.4);
  --shadow-sheet: rgba(4, 4, 6, 0.8);
  --inner-edge: inset 0 1px 0 rgba(255, 255, 255, 0.045);

  --topbar-bg: rgba(16, 16, 19, 0.78);
  --topbar-edge: rgba(255, 255, 255, 0.03);
  --tint: rgba(244, 244, 245, 0.05);
  --tint-code: rgba(244, 244, 245, 0.07);
  --surface-soft: rgba(28, 28, 33, 0.6);
  --row-hover: rgba(244, 244, 245, 0.035);
  --stripe: rgba(244, 244, 245, 0.03);
  --shimmer: rgba(255, 255, 255, 0.06);
  --strike: rgba(157, 157, 166, 0.4);
  --scrim: rgba(4, 4, 6, 0.6);
  --grain: 0.05;
  color-scheme: dark;
}

/* Cross-fade only while the user switches, so first paint and hover transitions stay untouched. */
:root.theme-anim,
:root.theme-anim *,
:root.theme-anim *::before,
:root.theme-anim *::after {
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease), fill 0.35s var(--ease) !important;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* Grain on a fixed, non-interactive layer only. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.ico { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.125em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */

.shell { max-width: 1400px; margin: 0 auto; padding: 0 2rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -1px 0 var(--topbar-edge);
}
.topbar .shell {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 2rem;
  height: 60px;
}
.wordmark {
  display: flex; align-items: baseline; gap: 0.6rem;
  text-decoration: none; font-weight: 620; letter-spacing: -0.02em; font-size: 1.02rem;
}
.wordmark .tick {
  width: 9px; height: 9px; border-radius: 2px; background: var(--ink);
  transform: translateY(-1px) rotate(45deg);
}
.wordmark small { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); font-weight: 450; letter-spacing: 0; }

.nav { display: flex; gap: 0.25rem; }
.nav a {
  text-decoration: none; color: var(--ink-3); font-size: 0.86rem; font-weight: 500;
  padding: 0.4rem 0.75rem; border-radius: 999px; transition: color var(--t), background var(--t);
}
.nav a:hover { color: var(--ink); background: var(--tint); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.76rem; color: var(--ink-2);
  padding: 0.38rem 0.8rem 0.38rem 0.65rem;
  border-radius: 999px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--inner-edge);
  white-space: nowrap;
}
.status-pill .sep { width: 1px; height: 12px; background: var(--line-strong); }
.status-pill .mono { color: var(--ink-3); }

.theme-switch {
  --thumb: 2;
  position: relative; display: grid; grid-template-columns: repeat(3, 30px); gap: 2px; padding: 3px;
  border-radius: 999px; background: var(--z-100); box-shadow: inset 0 0 0 1px var(--line), var(--inner-edge);
}
.theme-switch button {
  position: relative; z-index: 1; height: 26px; border: 0; border-radius: 999px; background: none;
  display: grid; place-items: center; color: var(--ink-3); font-size: 0.95rem;
  transition: color var(--t), transform 0.3s var(--ease);
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button:active { transform: scale(0.92); }
.theme-switch button[aria-checked="true"] { color: var(--ink); }
.theme-thumb {
  position: absolute; top: 3px; left: 3px; width: 30px; height: 26px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px -2px rgba(12, 12, 14, 0.25), var(--inner-edge);
  transform: translate3d(calc(var(--thumb) * 32px), 0, 0);
  transition: transform 0.5s cubic-bezier(0.34, 1.4, 0.5, 1);
}
:root.theme-anim .theme-thumb { transition: transform 0.5s cubic-bezier(0.34, 1.4, 0.5, 1), background-color 0.35s var(--ease) !important; }
:root[data-theme="dark"] .theme-thumb { background: var(--z-200); }
:root[data-theme="dark"] .seg span.on { background: var(--z-200); }

.breath {
  position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--z-400); flex: none;
}
.breath::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: currentColor; opacity: 0; color: var(--z-400);
  animation: breathe 2.8s var(--ease) infinite;
}
.breath.ok { background: var(--accent); }
.breath.ok::after { color: var(--accent); }
.breath.bad { background: var(--z-700); }
@keyframes breathe {
  0% { transform: scale(0.6); opacity: 0.35; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 4rem;
  padding: 4.5rem 0 2.5rem;
  align-items: start;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 1.4rem;
}
.eyebrow .rule { width: 28px; height: 1px; background: var(--line-strong); }
.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 4.1vw, 3.7rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 600;
  max-width: 13ch;
}
.hero h1 span { color: var(--ink-3); font-weight: 500; }
.lede {
  margin: 1.6rem 0 0; max-width: 52ch; color: var(--ink-3); font-size: 1.02rem; line-height: 1.65;
}
.lede strong { color: var(--ink-2); font-weight: 560; }

.lane-key {
  display: grid; grid-template-columns: repeat(3, max-content); gap: 0.5rem 1.5rem;
  margin: 2.2rem 0 0; padding: 0; list-style: none; font-size: 0.82rem; color: var(--ink-3);
}
.lane-key li { display: flex; align-items: center; gap: 0.5rem; }
.lane-key b { color: var(--ink); font-weight: 560; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.read { background: var(--accent); }
.swatch.skim { background: var(--z-700); }
.swatch.pass { background: var(--z-300); }

/* run panel */
.panel {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-diffuse);
  padding: 2rem;
}
.hero .panel { margin-top: 2.75rem; }

.field { display: grid; gap: 0.5rem; }
.field label { font-size: 0.8rem; font-weight: 560; color: var(--ink-2); }
.field .help { font-size: 0.78rem; color: var(--ink-3); margin: 0; }
.field .err { font-size: 0.78rem; color: var(--z-900); margin: 0; display: flex; gap: 0.4rem; align-items: center; }
.field .err[hidden] { display: none; }
.field .err .ico { color: var(--z-900); }

.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.input {
  width: 100%; height: 48px; padding: 0 1rem 0 2.6rem;
  border-radius: 14px; border: 0; background: var(--z-100);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--t), background var(--t);
  font-size: 0.95rem;
}
.input::placeholder { color: var(--z-400); }
.input:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent-line), 0 0 0 4px var(--accent-soft); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--z-700); background: var(--surface); }
.input-wrap { position: relative; }
.input-wrap .ico { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: var(--z-400); font-size: 1.05rem; pointer-events: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 48px; padding: 0 1.35rem; border: 0; border-radius: 14px;
  font-weight: 560; font-size: 0.92rem; letter-spacing: -0.01em;
  transition: transform 0.5s var(--ease), background var(--t), box-shadow var(--t), opacity var(--t);
  transform: translate3d(var(--mx, 0), var(--my, 0), 0);
}
.btn:active { transform: translate3d(var(--mx, 0), calc(var(--my, 0px) + 1px), 0) scale(0.98); }
.btn-primary { background: var(--ink); color: var(--z-50); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 20px -12px var(--shadow-sheet); }
.btn-primary:hover { background: var(--z-800); }
.btn-primary[disabled] { opacity: 0.55; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); height: 40px; padding: 0 1rem; border-radius: 12px; font-size: 0.85rem; }
.btn-ghost:hover { box-shadow: 0 0 0 1px var(--z-400); }
.btn-text { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 0.82rem; font-weight: 520; display: inline-flex; gap: 0.35rem; align-items: center; }
.btn-text:hover { color: var(--ink); }

.chips-head { display: flex; justify-content: space-between; align-items: baseline; margin: 1.75rem 0 0.7rem; }
.chips-head span { font-size: 0.8rem; font-weight: 560; color: var(--ink-2); }
.chips-head small { font-size: 0.74rem; color: var(--ink-3); }
.chips {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 0.45rem;
  overflow-x: auto; padding: 2px 2px 0.6rem; margin: 0 -2px;
  scrollbar-width: thin; scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  height: 32px; padding: 0 0.8rem; border-radius: 999px; border: 0;
  background: var(--z-100); color: var(--ink-2); font-size: 0.8rem; font-weight: 500;
  transition: background var(--t), color var(--t), box-shadow var(--t), transform 0.3s var(--ease);
  scroll-snap-align: start;
}
.chip:hover { background: var(--z-150); color: var(--ink); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--z-50); }
.chip.demo { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.chip.demo[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* ---------- receipt ---------- */

.receipt {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) repeat(4, minmax(0, 0.8fr)) repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  margin-top: 1rem;
}
.receipt > div { padding: 1.1rem 1.1rem 1.2rem; border-left: 1px solid var(--line); min-width: 0; }
.receipt > div:first-child { border-left: 0; padding-left: 0; }
.receipt .k { display: block; font-size: 0.7rem; color: var(--ink-3); font-family: var(--mono); letter-spacing: 0.03em; text-transform: uppercase; }
.receipt .v { display: block; margin-top: 0.35rem; font-family: var(--mono); font-size: 1.28rem; letter-spacing: -0.02em; font-feature-settings: "tnum"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt .v.sm { font-size: 0.84rem; margin-top: 0.55rem; white-space: normal; line-height: 1.35; }
.receipt .run-title { font-family: var(--sans); font-size: 1rem; font-weight: 560; letter-spacing: -0.01em; }
.receipt .v.read { color: var(--accent); }

.dist { display: flex; height: 4px; border-radius: 99px; overflow: hidden; background: var(--z-150); margin-top: 0.7rem; }
.dist i { display: block; height: 100%; transform-origin: left; transition: flex-grow 0.9s var(--ease); flex-grow: 0; flex-basis: 0; }
.dist .r { background: var(--accent); }
.dist .s { background: var(--z-700); }
.dist .p { background: var(--z-300); }

/* notices */
.notices { display: grid; gap: 0.5rem; margin-top: 1rem; }
.notice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: start;
  padding: 0.85rem 1rem; border-radius: var(--r-md); font-size: 0.84rem; color: var(--ink-2);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.notice .ico { margin-top: 0.18rem; color: var(--ink-3); }
.notice b { color: var(--ink); font-weight: 560; }
.notice.warn { background: var(--z-100); box-shadow: 0 0 0 1px var(--line-strong); }
.notice.warn .ico { color: var(--ink); }
.notice code { font-family: var(--mono); font-size: 0.78rem; background: var(--tint-code); padding: 0.05rem 0.35rem; border-radius: 5px; }

/* ---------- feed ---------- */

.feed {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) 368px;
  grid-template-areas: "read side insp";
  gap: 2.5rem;
  padding: 2.75rem 0 5rem;
  align-items: start;
}
.col-read { grid-area: read; }
.col-side { grid-area: side; display: grid; gap: 2.75rem; }
.col-insp { grid-area: insp; }

.lane-h {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 0.7rem;
  margin: 0 0 1.1rem;
}
.lane-h h2 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 0.55rem; }
.lane-h p { margin: 0; font-size: 0.8rem; color: var(--ink-3); }
.lane-h .count { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3); }

.stack { display: grid; gap: 1rem; }

/* post */
.post {
  position: relative; display: grid; gap: 0.9rem;
  padding: 1.5rem 1.6rem 1.35rem; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-diffuse);
  cursor: pointer; text-align: left;
  transition: box-shadow var(--t), transform 0.6s var(--ease);
}
.post:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-lift); }
.post:active { transform: translateY(-1px) scale(0.995); }
.post[aria-current="true"] { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-lift); }

.post-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  font-size: 0.74rem; font-weight: 620; letter-spacing: 0.02em; color: var(--ink-2);
  background: linear-gradient(145deg, var(--z-100), var(--z-200));
  box-shadow: inset 0 0 0 1px var(--line), var(--inner-edge);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who { min-width: 0; line-height: 1.25; }
.who b { display: block; font-size: 0.88rem; font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 0.78rem; color: var(--ink-3); }
.conf { text-align: right; line-height: 1.1; }
.conf b { font-family: var(--mono); font-size: 1rem; font-weight: 520; letter-spacing: -0.02em; }
.conf span { display: block; font-size: 0.66rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }

.post-text { margin: 0; font-size: 0.97rem; line-height: 1.62; color: var(--z-800); white-space: pre-line; overflow-wrap: anywhere; }

.metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1.1rem; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); }
.metrics span { display: inline-flex; align-items: center; gap: 0.35rem; }
.metrics .ico { font-size: 0.95rem; color: var(--z-400); }

.heat { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--sans); font-size: 0.74rem; font-weight: 540; padding: 0.15rem 0.55rem 0.15rem 0.45rem; border-radius: 999px; background: var(--z-100); color: var(--ink-2); }
.heat .ico { font-size: 0.85rem; color: currentColor !important; }
.heat.hot { background: var(--accent-soft); color: var(--accent-ink); }
.heat.hot .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }

.post-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-3); }
.post-foot .why { display: inline-flex; align-items: center; gap: 0.4rem; }
.open-x { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 540; color: var(--ink); text-decoration: none; }
.open-x:hover { color: var(--accent); }

.tag-top {
  position: absolute; top: -10px; left: 1.4rem;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.22rem 0.55rem; border-radius: 6px; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 14px -8px var(--accent);
}

/* skim */
.post.skim { padding: 1.15rem 1.25rem 1.05rem; gap: 0.7rem; background: var(--surface-soft); box-shadow: 0 0 0 1px var(--line); border-radius: 1.15rem; }
.post.skim:hover { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-diffuse); }
.post.skim .post-text { font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post.skim .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 0.64rem; }
.post.skim .who b { font-size: 0.82rem; }
.post.skim .conf b { font-size: 0.86rem; }
.post.skim .metrics { font-size: 0.74rem; gap: 0.3rem 0.85rem; }

/* pass */
.pass-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pass-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; align-items: baseline;
  padding: 0.8rem 0.25rem; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background var(--t), padding var(--t);
}
.pass-row:hover { background: var(--row-hover); }
.pass-row[aria-current="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.pass-row .h { font-size: 0.8rem; font-weight: 560; color: var(--ink-2); }
.pass-row .t { grid-column: 1 / -1; font-size: 0.8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: line-through; text-decoration-color: var(--strike); }
.pass-row .r { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); white-space: nowrap; }
.more { margin-top: 0.8rem; }

/* empty states */
.empty {
  border-radius: var(--r-xl); padding: 2.75rem 2.5rem;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-diffuse);
  display: grid; gap: 1rem; justify-items: start;
}
.empty h3 { margin: 0; font-size: 1.4rem; letter-spacing: -0.03em; font-weight: 600; max-width: 22ch; line-height: 1.15; }
.empty p { margin: 0; color: var(--ink-3); max-width: 52ch; }
.empty .row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }
.ghost-lines { display: grid; gap: 0.6rem; width: 100%; margin-top: 1rem; }
.ghost-lines i { display: block; height: 9px; border-radius: 99px; background: var(--z-100); }
.ghost-lines i:nth-child(1) { width: 78%; }
.ghost-lines i:nth-child(2) { width: 92%; }
.ghost-lines i:nth-child(3) { width: 54%; }

.placeholder {
  border-radius: 1.15rem; padding: 1.25rem; font-size: 0.82rem; color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  background-image: repeating-linear-gradient(135deg, transparent 0 9px, var(--stripe) 9px 10px);
}

/* skeletons */
.sk {
  position: relative; overflow: hidden; background: var(--z-150); border-radius: 8px;
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--shimmer) 50%, transparent 80%);
  transform: translateX(-100%); animation: shimmer 1.5s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-card { padding: 1.5rem 1.6rem; border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 0 0 1px var(--line); display: grid; gap: 0.8rem; }
.sk-card.skim { border-radius: 1.15rem; padding: 1.15rem 1.25rem; background: var(--surface-soft); }
.sk-head { display: grid; grid-template-columns: 36px 1fr 44px; gap: 0.75rem; align-items: center; }
.sk-av { width: 36px; height: 36px; border-radius: 11px; }
.sk-line { height: 10px; }
.sk-row { height: 44px; border-radius: 0; background: transparent; border-bottom: 1px solid var(--line); display: grid; align-content: center; gap: 6px; }

/* inspector */
.insp {
  position: sticky; top: 84px;
  border-radius: var(--r-xl); background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-diffuse);
  padding: 1.6rem 1.5rem 1.4rem;
  max-height: calc(100dvh - 104px); overflow-y: auto; scrollbar-width: thin;
}
.insp-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.icon-btn.insp-close { display: none; }
.verdict { margin: 1.1rem 0 0; display: grid; gap: 0.35rem; }
.verdict .lane-word { font-size: 1.9rem; font-weight: 620; letter-spacing: -0.045em; line-height: 1; }
.verdict .lane-word.read { color: var(--accent); }
.verdict .lane-word.pass { color: var(--z-400); }
.verdict p { margin: 0; font-size: 0.84rem; color: var(--ink-3); line-height: 1.5; }
.verdict .by { font-size: 0.8rem; color: var(--ink-2); font-weight: 540; }

.state {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.2rem 0 0.2rem;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.state div { padding: 0.65rem 0 0.7rem; border-left: 1px solid var(--line); padding-left: 0.7rem; }
.state div:first-child { border-left: 0; padding-left: 0; }
.state span { display: block; font-size: 0.64rem; font-family: var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.state b { font-family: var(--mono); font-weight: 500; font-size: 0.92rem; }

.qgroup { margin-top: 1.35rem; }
.qgroup-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.55rem; }
.qgroup-h h3 { margin: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: -0.005em; }
.qgroup-h span { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); }
.qgroup-h span.ok { color: var(--accent); }

.q {
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto 1rem; gap: 0.3rem 0.55rem; align-items: center;
  padding: 0.55rem 0; border-top: 1px solid var(--line);
}
.q .n { font-family: var(--mono); font-size: 0.68rem; color: var(--z-400); }
.q .l { font-size: 0.8rem; color: var(--ink-2); line-height: 1.3; }
.q .val { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-2); text-align: right; }
.q .mark { font-size: 0.9rem; color: var(--z-300); display: grid; place-items: center; }
.q.ok .mark { color: var(--accent); }
.q.no .mark { color: var(--z-700); }
.q .viz { grid-column: 2 / 4; }

.bar { position: relative; height: 5px; border-radius: 99px; background: var(--z-150); }
.bar i { position: absolute; inset: 0; border-radius: inherit; background: var(--z-700); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform 0.8s var(--ease); }
.q.ok .bar i { background: var(--accent); }
.bar .th { position: absolute; top: -3px; bottom: -3px; width: 1.5px; background: var(--ink); left: calc(var(--th) * 100%); border-radius: 1px; opacity: 0.55; }

.pips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pips i { height: 5px; border-radius: 99px; background: var(--z-150); transition: background var(--t); }
.pips i.on { background: var(--z-700); }
.q.ok .pips i.on { background: var(--accent); }
.pips i.min { box-shadow: 0 0 0 1px var(--z-400); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 9px; background: var(--z-100); }
.seg span { font-size: 0.68rem; text-align: center; padding: 0.18rem 0; border-radius: 6px; color: var(--ink-3); transition: background var(--t), color var(--t); }
.seg span.on { background: var(--surface); color: var(--ink); font-weight: 560; box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08); }
.q.ok .seg span.on { color: var(--accent-ink); }

.insp-note { margin: 1.2rem 0 0; font-size: 0.74rem; color: var(--ink-3); line-height: 1.5; }
.insp-empty { padding: 1.4rem 0 0.4rem; display: grid; gap: 0.6rem; }
.insp-empty p { margin: 0; font-size: 0.85rem; color: var(--ink-3); }
.insp-empty .ghost-q { display: grid; gap: 0.55rem; margin-top: 0.6rem; }
.insp-empty .ghost-q i { display: grid; grid-template-columns: 1.6rem 1fr 3rem; gap: 0.55rem; align-items: center; }
.insp-empty .ghost-q i::before { content: ""; height: 7px; border-radius: 99px; background: var(--z-150); grid-column: 2; }
.insp-empty .ghost-q i::after { content: ""; height: 5px; border-radius: 99px; background: var(--z-100); }

/* ---------- how ---------- */

.how {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 4rem;
  padding: 4.5rem 0; border-top: 1px solid var(--line-strong);
}
.how-intro { position: sticky; top: 100px; align-self: start; }
.how-intro h2 { margin: 0; font-size: clamp(1.6rem, 2.4vw, 2.2rem); line-height: 1.05; letter-spacing: -0.04em; font-weight: 600; max-width: 15ch; }
.how-intro p { color: var(--ink-3); max-width: 44ch; margin: 1.2rem 0 0; }
.how-body { display: grid; gap: 3rem; }
.qlist { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 2.5rem; }
.qlist h3 { margin: 0 0 0.6rem; font-size: 0.82rem; font-weight: 600; grid-column: span 1; }
.qlist ol { margin: 0; padding: 0; list-style: none; counter-reset: q var(--start, 0); }
.qlist li { counter-increment: q; display: grid; grid-template-columns: 2rem 1fr; padding: 0.7rem 0; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-2); }
.qlist li::before { content: counter(q, decimal-leading-zero); font-family: var(--mono); font-size: 0.72rem; color: var(--z-400); padding-top: 0.12rem; }
.qlist li b { font-weight: 580; color: var(--ink); }
.rules { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.25rem; }
.rule-card { border-radius: var(--r-lg); padding: 1.5rem; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.rule-card.tall { grid-row: span 2; }
.rule-card h4 { margin: 0 0 0.5rem; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; letter-spacing: -0.01em; }
.rule-card p { margin: 0; font-size: 0.86rem; color: var(--ink-3); }
.rule-card p + p { margin-top: 0.7rem; }
.not-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.not-list li { padding: 0.8rem 0; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-3); }
.not-list li b { color: var(--ink-2); font-weight: 560; }

.foot {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--ink-3);
}
.foot .mono { font-size: 0.72rem; }

/* ---------- motion ---------- */

.reveal { animation: rise 0.75s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }
.fade { animation: fadein 0.5s var(--ease) both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- history page ---------- */

.page-head {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 3rem; align-items: end;
  padding: 4rem 0 2.25rem;
}
.page-head h1 { margin: 0; font-size: clamp(2rem, 3.4vw, 3rem); letter-spacing: -0.045em; line-height: 1; font-weight: 600; }
.page-head h1 span { color: var(--ink-3); font-weight: 500; }
.page-head .lede { margin-top: 1.1rem; }
.filter-form { display: grid; gap: 0.5rem; }
.filter-form .input-row .btn { height: 48px; }

.kpis {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
}
.kpis > div { padding: 1.4rem 1.25rem 1.5rem; border-left: 1px solid var(--line); }
.kpis > div:first-child { border-left: 0; padding-left: 0; }
.kpis .k { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.kpis .v { display: block; margin-top: 0.4rem; font-family: var(--mono); font-size: 2rem; letter-spacing: -0.04em; font-weight: 450; }
.kpis .v.read { color: var(--accent); }
.kpis .dist { height: 6px; margin-top: 1rem; max-width: 420px; }

.runs { margin: 2.5rem 0 5rem; }
.runs-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.runs-table th { text-align: left; font-family: var(--mono); font-weight: 450; font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); padding: 0 1rem 0.75rem 0; border-bottom: 1px solid var(--line-strong); }
.runs-table td { padding: 1rem 1rem 1rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.runs-table tbody tr { cursor: pointer; transition: background var(--t); }
.runs-table tbody tr:hover { background: var(--row-hover); }
.runs-table .when { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); white-space: nowrap; }
.runs-table .niche { font-weight: 560; }
.runs-table .mode { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-3); }
.runs-table .lanes { display: grid; grid-template-columns: 140px auto; gap: 0.9rem; align-items: center; }
.runs-table .lanes .dist { margin: 0; height: 5px; }
.runs-table .lanes .mono { font-size: 0.76rem; color: var(--ink-3); white-space: nowrap; }
.runs-table .lanes .mono b { color: var(--accent); font-weight: 500; }
.runs-table .ms { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); text-align: right; }
.runs-table th.ms { text-align: right; }
.runs-table .go { width: 1.5rem; color: var(--z-400); }

.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); padding: 0; border: 0;
  background: var(--bg); box-shadow: -30px 0 60px -30px var(--shadow-sheet);
}
.drawer::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.drawer[open] { animation: slidein 0.55s var(--ease) both; }
@keyframes slidein { from { transform: translate3d(40px, 0, 0); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-in { padding: 1.75rem 1.75rem 3rem; }
.drawer-top { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.drawer h2 { margin: 0.35rem 0 0; font-size: 1.6rem; letter-spacing: -0.04em; line-height: 1.05; font-weight: 600; }
.drawer .meta { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-3); margin: 0.6rem 0 0; }
.drawer section { margin-top: 2rem; }
.drawer .stack { gap: 0.75rem; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; display: grid; place-items: center; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong); color: var(--ink-2); flex: none; transition: transform 0.3s var(--ease); }
.icon-btn:active { transform: scale(0.96); }

/* ---------- responsive ---------- */

@media (max-width: 1279px) {
  .feed { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); grid-template-areas: "read insp" "read side"; }
  .receipt { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 0.75fr)) repeat(3, minmax(0, 1fr)); }
  .receipt > div { padding-left: 0.8rem; padding-right: 0.8rem; }
  .insp { position: relative; top: 0; max-height: none; }
}

@media (max-width: 1023px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 3rem; }
  .hero .panel { margin-top: 0; }
  .feed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "read" "side"; gap: 2.5rem; }
  .receipt { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 1rem; }
  .receipt > div { border-left: 0; padding-left: 0; padding-right: 0; border-bottom: 1px solid var(--line); }
  .receipt > div:first-child { grid-column: 1 / -1; }
  .insp {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    max-height: 78dvh; overflow-y: auto; border-radius: 1.75rem 1.75rem 0 0;
    box-shadow: 0 -30px 60px -30px var(--shadow-sheet), 0 0 0 1px var(--line);
    transform: translate3d(0, 105%, 0); transition: transform 0.55s var(--ease);
    padding-bottom: calc(1.4rem + env(safe-area-inset-bottom));
  }
  .insp.is-open { transform: none; }
  .icon-btn.insp-close { display: grid; }
  .how { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .how-intro { position: static; }
  .page-head { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .kpis > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 767px) {
  .shell { padding: 0 1rem; }
  .topbar .shell { grid-template-columns: auto 1fr auto; gap: 0.75rem; }
  .topbar .status-pill { display: none; }
  .wordmark small { display: none; }
  .nav a { padding: 0.4rem 0.6rem; }
  .theme-switch { grid-template-columns: repeat(3, 28px); }
  .theme-thumb { width: 28px; transform: translate3d(calc(var(--thumb) * 30px), 0, 0); }
  .nav { justify-content: end; }
  .hero { padding: 2.25rem 0 1.5rem; }
  .panel { padding: 1.35rem; border-radius: 1.5rem; }
  .lane-key { grid-template-columns: minmax(0, 1fr); }
  .input-row { grid-template-columns: minmax(0, 1fr); }
  .receipt { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post { padding: 1.2rem 1.15rem 1.1rem; }
  .empty { padding: 1.75rem 1.4rem; }
  .qlist, .rules { grid-template-columns: minmax(0, 1fr); }
  .rule-card.tall { grid-row: auto; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpis > div { border-left: 0 !important; padding-left: 0 !important; border-bottom: 1px solid var(--line); }
  .runs-table thead { display: none; }
  .runs-table, .runs-table tbody, .runs-table tr, .runs-table td { display: block; width: 100%; }
  .runs-table tr { padding: 0.9rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 1rem; }
  .runs-table td { border: 0; padding: 0; }
  .runs-table td.lanes-td { grid-column: 1 / -1; }
  .runs-table td.go, .runs-table td.mode-td { display: none; }
}

@media (hover: none) {
  .post:hover { transform: none; }
}

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