:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --surface: #ffffff;
  --ink: #3a2f2c;
  --muted: #7a6e68;
  --faint: #a39891;
  --line: rgba(58, 47, 44, 0.14);
  --accent: #7a3b45;
  --accent-soft: rgba(122, 59, 69, 0.11);
  --orange: #c9844a;
  --green: #54785d;
  --green-soft: rgba(84, 120, 93, 0.1);
  --red: #a94f46;
  --red-soft: rgba(169, 79, 70, 0.09);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 400;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code { font-family: "IBM Plex Mono", monospace; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 100; transform: translateY(-200%); padding: .7rem 1rem; color: white; background: var(--accent); }
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 64px; padding: 12px max(24px, calc((100% - 1160px) / 2));
  border-bottom: 1px solid var(--line); background: rgba(247, 245, 241, .92); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 500 12px/1 "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.brand-mark { width: 10px; height: 10px; border: 1.5px solid var(--accent); border-radius: 2px; background: var(--orange); }
nav { display: flex; align-items: center; gap: 20px; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--ink); }
.play-link { padding: 9px 13px; color: white; border-radius: 4px; background: var(--accent); }
.play-link:hover { color: white; background: #65313a; }

main, footer { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 92px 0 64px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker, .pane-kicker { margin: 0; color: var(--accent); font: 500 10px/1.4 "IBM Plex Mono", monospace; letter-spacing: .17em; text-transform: uppercase; }
h1 { max-width: 850px; margin: 14px 0 0; font-size: clamp(2.7rem, 6.5vw, 5.4rem); line-height: .98; letter-spacing: -.045em; font-weight: 300; }
.dek { max-width: 780px; margin: 28px 0 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.25rem); line-height: 1.6; }
.hero-rule { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto; align-items: center; gap: 12px; margin-top: 48px; color: var(--faint); font: 400 10px/1 "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.hero-rule i { height: 1px; background: var(--line); }

.section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 56px 1fr; gap: 18px; align-items: start; margin-bottom: 34px; }
.number { color: var(--faint); font: 400 12px/1.4 "IBM Plex Mono", monospace; }
h2 { max-width: 760px; margin: 6px 0 0; font-size: clamp(1.75rem, 3.4vw, 2.8rem); line-height: 1.08; letter-spacing: -.025em; font-weight: 400; }
h3 { margin: 7px 0 0; font-size: 1.05rem; line-height: 1.35; font-weight: 500; }

.forward-grid { display: grid; grid-template-columns: minmax(0, .85fr) 36px minmax(0, 1.28fr) 36px minmax(0, .7fr); align-items: stretch; }
.forward-grid article, .credit-grid article, .optimizer-grid article { min-width: 0; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.flow-arrow { display: grid; place-items: center; color: var(--accent); font: 400 22px/1 "IBM Plex Mono", monospace; }
.observation-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 20px; }
.observation-list span { position: relative; padding-left: 14px; color: var(--muted); font-size: 14px; }
.observation-list span::before { content: ""; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hidden-list { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
.hidden-list strong { color: var(--ink); }
.weights { margin-top: 20px; border-top: 1px solid var(--line); }
.weight-row { display: grid; grid-template-columns: 74px 1fr 48px; gap: 12px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 13px; }
.weight-row b { color: var(--muted); font-weight: 400; text-align: right; }
.base-weight, .lora-weight { height: 12px; border-radius: 99px; }
.base-weight { background: #ddd6ce; }
.lora-weight { width: 35%; background: var(--accent); }
.equation { margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.equation code { color: var(--ink); }
.projection-note { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.json-output { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 30px 0 20px; }
.json-output code { padding: 8px 7px; border-radius: 4px; background: #eee9e2; }
.json-output .decision { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.action-settings { color: var(--muted); font: 400 11px/1.7 "IBM Plex Mono", monospace; text-align: center; }

.shared-conditions { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.shared-conditions strong { color: var(--ink); }
.shared-conditions em { margin-left: auto; color: var(--faint); font-style: normal; }
.members { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.member { display: grid; gap: 6px; padding: 15px 8px; text-align: center; border-top: 3px solid var(--line); background: rgba(255,255,255,.68); }
.member span { color: var(--faint); font: 400 10px/1.3 "IBM Plex Mono", monospace; text-transform: uppercase; }
.member code { font-size: 13px; }
.member strong { font-size: 13px; font-weight: 400; }
.member b { font-size: 14px; font-weight: 500; }
.member.positive { border-color: var(--green); background: var(--green-soft); }
.member.positive b { color: var(--green); }
.member.negative { border-color: var(--red); background: var(--red-soft); }
.member.negative b { color: var(--red); }
.member.selected { outline: 1px solid var(--green); outline-offset: 3px; }
.artifact-note { margin: 15px 0 0; color: var(--muted); font-size: 13px; }

.credit-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) 36px minmax(0, .75fr); align-items: stretch; }
.timeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 24px; }
.timeline div { text-align: center; }
.timeline span { display: block; color: var(--faint); font: 400 10px/1 "IBM Plex Mono", monospace; }
.timeline b { display: block; margin-top: 7px; padding: 13px 4px; color: var(--red); border-bottom: 2px solid var(--red); background: var(--red-soft); font-weight: 500; }
.timeline-footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.timeline-footer strong { color: var(--ink); }
.advantage-calc > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.advantage-calc > div:first-of-type { margin-top: 12px; }
.advantage-calc > div span { color: var(--muted); }
.advantage-calc > div strong { font-weight: 500; }
.advantage-calc .answer, .advantage-calc .answer span { color: var(--green); }
.advantage-calc p:last-child { margin: 14px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; }

.optimizer-grid { display: grid; grid-template-columns: minmax(0, .84fr) 36px minmax(0, 1.16fr); align-items: stretch; }
.tokens { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 20px; }
.tokens div { display: grid; gap: 8px; padding: 10px 4px; text-align: center; background: #eee9e2; }
.tokens span, .tokens strong { color: var(--faint); font: 400 10px/1 "IBM Plex Mono", monospace; }
.tokens .active { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.tokens .active strong { color: var(--accent); font-weight: 500; }
.ratio { display: flex; align-items: center; gap: 10px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.ratio span { flex: 1; padding: 10px; text-align: center; background: #f0ebe5; }
.ratio i { color: var(--faint); font-style: normal; }
.modules { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.modules code { padding: 7px 9px; color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.freeze-note { margin: 20px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.freeze-note b { color: var(--ink); font-weight: 500; }
.repeat-line { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.repeat-line strong { color: var(--accent); }

.comparison-grid { display: grid; grid-template-columns: .7fr .7fr 1.25fr; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.comparison-grid article { min-width: 0; padding: 26px; }
.comparison-grid article + article { border-left: 1px solid var(--line); }
dl { margin: 20px 0 0; }
dl div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; font-family: "IBM Plex Mono", monospace; }
.scoreboard h3 { margin-bottom: 16px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; margin-top: 9px; }
.score-row span { color: var(--muted); font-size: 13px; }
.score-row b { font: 500 12px/1 "IBM Plex Mono", monospace; }
.score-row i { grid-column: 1 / -1; display: block; height: 6px; border-radius: 99px; background: #e5dfd7; overflow: hidden; }
.score-row i::after { content: ""; display: block; width: var(--score); height: 100%; border-radius: inherit; background: var(--faint); }
.score-base { --score: 6.73%; }
.score-constant { --score: 19.82%; }
.score-trained { --score: 20.64%; }
.score-adaptive { --score: 73.9%; }
.score-perfect { --score: 100%; }
.score-row.trained span, .score-row.trained b { color: var(--accent); }
.score-row.trained i::after { background: var(--accent); }

.run-strip { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 34px 0; border-bottom: 1px solid var(--line); }
.run-strip div { text-align: center; }
.run-strip span { display: block; font: 400 28px/1 "IBM Plex Mono", monospace; }
.run-strip small { display: block; margin-top: 6px; color: var(--faint); font: 400 9px/1.2 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.run-strip > b { color: var(--faint); font-weight: 400; }
.run-strip p { margin: 0 0 0 18px; padding-left: 22px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }

footer { display: flex; justify-content: space-between; gap: 30px; padding: 36px 0 64px; color: var(--muted); font-size: 13px; }
footer p { max-width: 620px; margin: 0; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 850px) {
  .forward-grid, .credit-grid, .optimizer-grid { grid-template-columns: 1fr; gap: 12px; }
  .flow-arrow { min-height: 24px; transform: rotate(90deg); }
  .members { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .comparison-grid { grid-template-columns: 1fr; }
  .comparison-grid article + article { border-left: 0; border-top: 1px solid var(--line); }
  .shared-conditions em { width: 100%; margin-left: 0; }
}

@media (max-width: 600px) {
  .site-header { align-items: flex-start; padding: 16px 20px; }
  nav { justify-content: flex-end; flex-wrap: wrap; gap: 9px 14px; }
  nav a { font-size: 12px; }
  .play-link { padding: 6px 9px; }
  main, footer { width: min(100% - 32px, 1160px); }
  .hero { padding: 68px 0 44px; }
  .hero-rule { grid-template-columns: 1fr; gap: 8px; }
  .hero-rule i { display: none; }
  .section { padding: 52px 0; }
  .section-heading { grid-template-columns: 38px 1fr; gap: 10px; margin-bottom: 26px; }
  .forward-grid article, .credit-grid article, .optimizer-grid article { padding: 20px; }
  .observation-list { grid-template-columns: 1fr; }
  .members { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline { grid-template-columns: repeat(3, 1fr); }
  .timeline-footer, .repeat-line { flex-direction: column; }
  .run-strip { flex-wrap: wrap; gap: 14px; }
  .run-strip p { width: 100%; margin: 8px 0 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); text-align: center; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
