/* HQC-Bend project page */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --surface: #ffffff;
  --ink: #14161b;
  --ink-2: #3b414c;
  --muted: #646b78;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;

  --brand: #c8102e;
  --brand-ink: #a30d25;
  --brand-soft: #fdecef;

  --cpu: #b85a0a;
  --cpu-soft: #fdf0e2;
  --qpu: #0b8577;
  --qpu-soft: #e0f4f1;
  --hyb: #6447c0;
  --hyb-soft: #eee9fb;
  --sim: #2f66b0;
  --sim-soft: #e6eef9;
  --opt: #2e7a32;
  --opt-soft: #e5f3e6;
  --feas: #1d67a8;
  --feas-soft: #e3eef8;

  --code-bg: #12151c;
  --code-bar: #1a1e27;
  --code-ink: #e5e8ee;
  --code-muted: #8a93a5;
  --code-line: #262b36;

  --figure-bg: #ffffff;
  --dot: rgba(20, 22, 27, 0.07);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);

  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --bg-alt: #13161c;
    --surface: #181b22;
    --ink: #e9ebef;
    --ink-2: #c4c9d2;
    --muted: #959cab;
    --line: #272b34;
    --line-strong: #353a45;
    --brand: #f04a62;
    --brand-ink: #ff6b80;
    --brand-soft: #3a1219;
    --cpu: #f0a560;
    --cpu-soft: #33240f;
    --qpu: #45c9b8;
    --qpu-soft: #0f2d29;
    --hyb: #a990f2;
    --hyb-soft: #241c3e;
    --sim: #7eaaec;
    --sim-soft: #172338;
    --opt: #78c27c;
    --opt-soft: #16291a;
    --feas: #72b2ec;
    --feas-soft: #13253a;
    --code-bg: #0a0c10;
    --code-bar: #12151b;
    --code-line: #232833;
    --figure-bg: #f4f5f7;
    --dot: rgba(233, 235, 239, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

:root[data-theme="dark"] {
  --bg: #0e1014;
  --bg-alt: #13161c;
  --surface: #181b22;
  --ink: #e9ebef;
  --ink-2: #c4c9d2;
  --muted: #959cab;
  --line: #272b34;
  --line-strong: #353a45;
  --brand: #f04a62;
  --brand-ink: #ff6b80;
  --brand-soft: #3a1219;
  --cpu: #f0a560;
  --cpu-soft: #33240f;
  --qpu: #45c9b8;
  --qpu-soft: #0f2d29;
  --hyb: #a990f2;
  --hyb-soft: #241c3e;
  --sim: #7eaaec;
  --sim-soft: #172338;
  --opt: #78c27c;
  --opt-soft: #16291a;
  --feas: #72b2ec;
  --feas-soft: #13253a;
  --code-bg: #0a0c10;
  --code-bar: #12151b;
  --code-line: #232833;
  --figure-bg: #f4f5f7;
  --dot: rgba(233, 235, 239, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-ink); }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 750; max-width: 30ch; margin-bottom: 18px; text-wrap: balance; }
h3 { font-size: 18px; font-weight: 650; margin-bottom: 8px; }
p { margin: 0 0 14px; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-alt); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.section--alt code { background: var(--surface); }
pre code, .section--alt pre code { white-space: pre; border: 0; padding: 0; background: none; border-radius: 0; }
pre, code { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
ul, ol { padding-left: 1.2em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
strong { font-weight: 650; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav__inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: inline-flex; flex: none; white-space: nowrap; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand__mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.topnav__links { display: flex; gap: 2px; list-style: none; margin: 0 auto; padding: 0; }
.topnav__links a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.topnav__links a:hover, .topnav__links a.is-active { color: var(--ink); background: var(--bg-alt); }
.topnav__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topnav__links + .topnav__actions { margin-left: 0; }

.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.iconbtn:hover { color: var(--ink); border-color: var(--line-strong); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

.langbtn { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13px var(--font); text-decoration: none; white-space: nowrap; }
.langbtn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- Chinese typography ---------- */
html[lang^="zh"] {
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Zen Hei", system-ui, sans-serif;
}
html[lang^="zh"] h2, html[lang^="zh"] h3, html[lang^="zh"] .hero__sub { letter-spacing: 0; }
html[lang^="zh"] h2 { max-width: 20em; }
html[lang^="zh"] .hero__sub { max-width: 21em; }
html[lang^="zh"] .intro, html[lang^="zh"] .lead { max-width: 40em; }
html[lang^="zh"] .eyebrow, html[lang^="zh"] .kicker { font-family: var(--mono), var(--font); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.2;
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { color: var(--ink); border-color: var(--ink-2); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn--dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn--dark:hover { color: var(--bg); opacity: .9; border-color: var(--ink); }
.btn--small { padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }
.linkbtn { background: none; border: 0; padding: 4px 6px; color: var(--code-muted); font: 500 12px/1 var(--font); cursor: pointer; border-radius: 6px; }
.linkbtn:hover { color: var(--code-ink); background: rgba(255,255,255,.06); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: 72px 0 48px;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  border-bottom: 1px solid var(--line);
}
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 56px; align-items: center; }
.eyebrow { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--brand); letter-spacing: 0.02em; margin-bottom: 14px; }
.hero h1 { font-size: clamp(48px, 8vw, 84px); font-weight: 800; letter-spacing: -0.04em; margin-bottom: 10px; }
.hero__sub { font-size: clamp(19px, 2.2vw, 23px); font-weight: 600; color: var(--ink); line-height: 1.35; max-width: 32ch; margin-bottom: 16px; text-wrap: balance; }
.lead { font-size: 17px; color: var(--ink-2); max-width: 56ch; }
.newpill { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; max-width: 100%; }
.newpill:hover { color: var(--ink); border-color: var(--ink-2); }
.newpill::after { content: "→"; }
.newpill__tag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: #fff; font: 600 11px var(--mono); }
.authors { font-size: 15px; margin: 18px 0 24px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.caption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.hero__code .codecard { box-shadow: var(--shadow); }

.stats { list-style: none; padding: 0; margin: 56px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); }
.stats li { padding: 20px 20px 0 0; display: flex; flex-direction: column; gap: 4px; }
.stats li + li { padding-left: 20px; border-left: 1px solid var(--line); }
.stats__n { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; color: var(--brand); line-height: 1.1; }
.stats__l { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* ---------- sections ---------- */
.section { padding: 88px 0; }
.section--alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--brand); margin-bottom: 10px; letter-spacing: .02em; }
.intro { font-size: 18px; color: var(--ink-2); max-width: 72ch; margin-bottom: 32px; }
.subhead { margin-top: 48px; margin-bottom: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.gap-lg { gap: 40px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.panel--accent { background: var(--brand-soft); border-color: transparent; align-self: start; }
.panel--accent p { color: var(--ink); font-size: 17px; margin: 0; }

/* math */
.math-block { overflow-x: auto; overflow-y: hidden; padding: 6px 0; margin: 4px 0 14px; }
.math-block .katex-display { margin: 0; text-align: left; }
.math-block .katex-display > .katex { text-align: left; }
.math-block--center .katex-display, .math-block--center .katex-display > .katex { text-align: center; }
.math-block--scroll { padding-bottom: 10px; }
.katex { font-size: 1.08em; }
.math-inline-lg { font-size: 18px; overflow-x: auto; }

/* motivation */
.iconlist { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 16px; }
.iconlist li { display: flex; gap: 14px; align-items: flex-start; }
.iconlist__ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.iconlist__ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iconlist strong { display: block; }
.iconlist span { color: var(--ink-2); font-size: 15px; }
.callout { display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--line); }
.callout__n { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; color: var(--brand); line-height: 1; flex: none; }
.callout__l { font-size: 14px; color: var(--ink-2); line-height: 1.5; }

.ladder { list-style: none; padding: 0; margin: 14px 0 16px; display: grid; gap: 6px; }
.ladder li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg-alt); font-size: 15px; }
.ladder li:nth-child(1) { margin-right: 36%; }
.ladder li:nth-child(2) { margin-right: 24%; }
.ladder li:nth-child(3) { margin-right: 12%; }
.ladder__c { font-weight: 700; min-width: 108px; font-size: 14px; }
.ladder li.is-hot { background: var(--brand-soft); }
.ladder li.is-hot .ladder__c { color: var(--brand); }

/* compare table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 14px 18px; border-bottom: 1px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--bg-alt); }
.compare tbody th { font-weight: 600; width: 26%; }
.compare tbody th .chip { margin-right: 6px; }
.compare ul { margin: 0; padding-left: 1.1em; }
.compare li + li { margin-top: 2px; }

.chip { display: inline-block; font: 600 11px/1 var(--mono); letter-spacing: .03em; padding: 5px 8px; border-radius: 999px; vertical-align: 2px; white-space: nowrap; }
.chip--cpu { background: var(--cpu-soft); color: var(--cpu); }
.chip--qpu { background: var(--qpu-soft); color: var(--qpu); }
.chip--hyb { background: var(--hyb-soft); color: var(--hyb); }
.chip--sim { background: var(--sim-soft); color: var(--sim); }

.steps3 { margin-top: 36px; }
.step { position: relative; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.step__n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--qpu-soft); color: var(--qpu); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.step p { color: var(--ink-2); font-size: 15px; margin: 0; }

.split-note { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.split-note__item { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius); border: 1px dashed var(--line-strong); }
.split-note__item p { margin: 0; color: var(--ink-2); font-size: 15px; }
.split-note__item .chip { margin-top: 3px; }

/* figures */
.figure { margin: 0; min-width: 0; }
.figure img { background: var(--figure-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; width: 100%; }
.figure figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.figure--wide { margin-bottom: 32px; }
.figure--wide img { padding: 20px; }

/* stages */
.stages { margin-bottom: 40px; }
.stage { padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.stage__n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--qpu); color: var(--qpu); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.stage p { color: var(--ink-2); font-size: 15px; }
.stage p:last-child { margin-bottom: 0; }

.formulas .panel { padding-bottom: 12px; }

.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 32px; }
.features li { position: relative; padding-left: 30px; color: var(--ink-2); font-size: 15px; }
.features li strong { color: var(--ink); }
.features li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--opt-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%232e7a32' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/20px no-repeat;
}

/* backends */
.backends { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 32px 0 48px; }
.backend { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.backend header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.backend header code { font-size: 12px; }
.backend p { color: var(--ink-2); font-size: 15px; margin: 0; }

.hss { align-items: center; }
.hss__diagram { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.hss__diagram svg { width: 100%; height: auto; display: block; }
.hss__diagram text { font: 600 13px var(--font); text-anchor: middle; }
.svg-node rect { fill: var(--bg-alt); stroke: var(--line-strong); }
.svg-node text { fill: var(--ink); }
.svg-ch rect { fill: var(--cpu-soft); stroke: var(--cpu); }
.svg-ch text { fill: var(--cpu); }
.svg-qm rect { fill: var(--qpu-soft); stroke: var(--qpu); }
.svg-qm text { fill: var(--qpu); }
.svg-out rect { fill: var(--brand); }
.svg-out text { fill: #fff; }
.svg-line path { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.svg-arrowhead { fill: var(--muted); }

/* cuts */
.cutpair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.cutpair__item { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag--opt { background: var(--opt-soft); color: var(--opt); }
.tag--feas { background: var(--feas-soft); color: var(--feas); }

.tabs__list { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs__list button { border: 0; background: none; padding: 9px 14px; border-radius: 9px; font: 600 15px var(--font); color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tabs__list button code { font-size: 12px; background: transparent; border-color: var(--line); }
.tabs__list button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tabs__panel .panel { padding-bottom: 10px; }
.panel-intro { color: var(--ink-2); max-width: 75ch; margin-bottom: 20px; }
.bdd-note { margin-top: 16px; max-width: 80ch; }

.flow { counter-reset: f; list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.flow li { counter-increment: f; position: relative; padding-left: 40px; color: var(--ink-2); }
.flow li::before { content: counter(f); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }

.multicut { margin-top: 64px; align-items: center; }
.multicut p { color: var(--ink-2); }

/* builder */
.builder { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 28px; align-items: start; }
.builder__form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px; margin: 0; background: var(--surface); min-width: 0; }
fieldset[disabled] { opacity: .55; }
legend { font-weight: 650; font-size: 14px; padding: 0 6px; margin-left: -6px; }
.field3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.field2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
label { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); min-width: 0; }
input[type="number"], input[type="text"], select {
  font: 500 14px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 0; border-color: var(--brand); }
input:disabled { opacity: .55; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; }
.switch { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.lambda-info { margin-top: 14px; font-size: 14px; color: var(--ink-2); padding: 12px 14px; border-radius: 10px; background: var(--bg-alt); }
.lambda-info b { color: var(--ink); font-family: var(--mono); font-weight: 600; font-size: 13px; }
.lambda-info .katex { font-size: 1em; }
.builder__note { margin: 0; font-size: 14px; color: var(--ink-2); min-height: 1.6em; }
.builder__note .warn { color: var(--brand); font-weight: 600; }
.builder__out { position: sticky; top: 80px; }
.codecard--json pre { max-height: 560px; }

.details { margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.details summary { cursor: pointer; padding: 16px 20px; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 10px; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.details[open] summary::before { transform: rotate(45deg); }
.details > .tablewrap { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.details > .math-block { padding: 8px 20px 18px; margin: 0; border-top: 1px solid var(--line); }
.kw td:first-child { white-space: nowrap; }
.kw td:last-child { min-width: 150px; }
.kw code { white-space: nowrap; }

/* code cards */
.codecard { position: relative; background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius); border: 1px solid var(--code-line); overflow: hidden; min-width: 0; }
.codecard__bar { display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: var(--code-bar); border-bottom: 1px solid var(--code-line); min-height: 38px; }
.codecard__bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #3a404c; }
.codecard__name { font: 500 12px var(--mono); color: var(--code-muted); margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codecard__bar .codecard__name:first-child { margin-left: 0; }
.codecard__actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.codecard pre { margin: 0; padding: 16px 18px; overflow: auto; font: 400 13.5px/1.65 var(--mono); }
.codecard pre code { color: var(--code-ink); font-size: inherit; }
.codecard .copy { position: absolute; top: 8px; right: 8px; z-index: 1; background: #232834; border: 1px solid #343b49; color: #c9cfda; font: 500 12px var(--font); padding: 5px 10px; border-radius: 7px; cursor: pointer; opacity: .85; }
.codecard .copy:hover { opacity: 1; color: #fff; }
.codecard--log pre { max-height: 360px; color: #c9ced8; }

/* highlight.js tokens (code cards are always dark) */
.hljs-keyword, .hljs-selector-tag, .hljs-meta .hljs-keyword { color: #ff8fa3; }
.hljs-built_in, .hljs-attr, .hljs-type { color: #8cc8ff; }
.hljs-string, .hljs-regexp { color: #a8dba8; }
.hljs-number, .hljs-literal, .hljs-symbol { color: #f9c97c; }
.hljs-comment, .hljs-quote { color: #7b8496; font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #c7aeff; }
.hljs-params { color: var(--code-ink); }
.hljs-meta { color: #7b8496; }
.hljs-variable, .hljs-template-variable { color: #ffb38a; }

/* quick start */
.qs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.qs__step { position: relative; padding-left: 56px; }
.qs__step::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: -36px; width: 2px; background: var(--line); }
.qs__step:last-child::before { display: none; }
.qs__head { display: flex; align-items: center; gap: 14px; margin-left: -56px; margin-bottom: 12px; }
.qs__n { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; }
.qs__head h3 { margin: 0; font-size: 20px; }
.qs__step > p { color: var(--ink-2); max-width: 75ch; }
.qs__step .codecard + p { margin-top: 12px; }
.qs__step .grid-2 { gap: 16px; }
.gpu-note { margin-top: 20px; padding: 18px 20px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--line); }
.gpu-note h4 { font-size: 16px; margin: 0 0 8px; }
.gpu-note > p { color: var(--ink-2); font-size: 15px; }
.gpu-note > p code { white-space: normal; overflow-wrap: anywhere; }
.gpu-note > p:last-child { margin: 12px 0 0; }

.outputs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.outputs div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.outputs code { align-self: flex-start; }
.outputs span { font-size: 14px; color: var(--ink-2); }

/* results */
#results .grid-2 + .grid-2 { margin-top: 40px; }

/* data center */
.dcstats { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.dcstats li { padding: 18px 20px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.dcstats span { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; white-space: nowrap; }
.vars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vars li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-2); font-size: 15px; }
.vars .chip { min-width: 88px; text-align: center; }
.arrowlink { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-right: 18px; text-decoration: none; }
.arrowlink::after { content: "→"; transition: transform .15s; }
.arrowlink:hover::after { transform: translateX(3px); }

/* research */
.papercount { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-wrap: wrap; gap: 10px 36px; }
.papercount li { display: flex; align-items: baseline; gap: 8px; font-size: 15px; color: var(--ink-2); }
.papercount span { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--brand); }
.papers { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.paper { display: flex; flex-direction: column; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.paper__meta { margin-bottom: 12px; }
.paper h3 { font-size: 17px; line-height: 1.35; margin-bottom: 8px; }
.paper h3 a { color: var(--ink); text-decoration: none; }
.paper h3 a:hover { color: var(--brand); text-decoration: underline; }
.paper p { margin: 0; }
.paper__authors { font-size: 14px; color: var(--ink-2); }
.paper__venue { font-size: 14px; color: var(--muted); margin-top: 2px !important; }
.paper__what { font-size: 15px; color: var(--ink-2); margin-top: 12px !important; padding-top: 12px; border-top: 1px solid var(--line); }
.topic { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; }
.topic--energy { background: var(--opt-soft); color: var(--opt); }
.topic--net { background: var(--sim-soft); color: var(--sim); }
.topic--fl { background: var(--hyb-soft); color: var(--hyb); }
.papers__note { margin-top: 20px; }

/* cite */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.contact p { color: var(--ink-2); }

/* footer */
.footer { padding: 32px 0; border-top: 1px solid var(--line); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .topnav__links { display: none; }
}
@media (max-width: 920px) {
  .hero__grid, .builder { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .builder__out { position: static; }
  .grid-3, .backends { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats li:nth-child(3) { padding-left: 0; border-left: 0; }
  .dcstats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .outputs { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .section { padding: 64px 0; }
  .hero { padding: 48px 0 32px; }
  .grid-2, .grid-3, .backends, .split-note, .cutpair, .features, .contact, .papers { grid-template-columns: minmax(0,1fr); }
  .gap-lg { gap: 28px; }
  .field3 { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
  .field2 { grid-template-columns: minmax(0,1fr); }
  .stats { grid-template-columns: 1fr; margin-top: 36px; }
  .stats li, .stats li + li { padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: baseline; gap: 14px; }
  .stats__n { font-size: 26px; min-width: 64px; }
  .dcstats { grid-template-columns: minmax(0,1fr); }
  .ladder li { margin-right: 0 !important; }
  .compare tbody th { width: auto; min-width: 140px; }
  .qs__step { padding-left: 0; }
  .qs__head { margin-left: 0; }
  .qs__step::before { display: none; }
  .multicut { margin-top: 48px; }
  .topnav__actions .btn span { display: none; }
  .intro { font-size: 17px; }
  .figure--wide img { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
