/* SustainaPrint project page. Tokens first; light and dark are both selected values. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7f5;
  --bg-sunk: #eef0ec;
  --surface: #ffffff;
  --line: #e2e4df;
  --line-strong: #c9ccc5;
  --text: #16181a;
  --text-2: #4a4f54;
  --text-3: #63696f;
  --accent: #2f6f4f;
  --accent-ink: #ffffff;
  --accent-soft: #e5f0ea;
  --dark-btn: #1f2328;
  --dark-btn-ink: #ffffff;
  --strong: #d9534f;
  --weak: #90a4ae;
  --fixed: #f5f5f5;
  --load: #d32f2f;
  --view-bg: #f3f4f1;
  --code-bg: #f7f7f4;
  --code-ink: #1d2126;
  --tok-kw: #a1386b;
  --tok-str: #2d7a3a;
  --tok-num: #a35a00;
  --tok-com: #7c8288;
  --tok-fn: #2758a8;
  --pos: #2d7a3a;
  --neg: #b3261e;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #e7e8e4;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 6px 24px rgba(16, 24, 32, .06);
  --radius: 12px;
  --maxw: 760px;
  --widew: 1180px;
  --sans: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121413; --bg-soft: #181b19; --bg-sunk: #1d211e; --surface: #1a1d1b;
    --line: #2b302d; --line-strong: #3a403c;
    --text: #eceeea; --text-2: #c2c7c1; --text-3: #9aa19a;
    --accent: #6cc196; --accent-ink: #0d1a13; --accent-soft: #1f3329;
    --dark-btn: #e9ebe7; --dark-btn-ink: #15171a;
    --view-bg: #1b1e1c; --code-bg: #171a18; --code-ink: #e3e6e1;
    --tok-kw: #ef8fbd; --tok-str: #8fd19b; --tok-num: #f2b46b; --tok-com: #8a918b; --tok-fn: #8fb7f5;
    --pos: #8fd19b; --neg: #f28b82;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --grid: #2a2f2c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121413; --bg-soft: #181b19; --bg-sunk: #1d211e; --surface: #1a1d1b;
  --line: #2b302d; --line-strong: #3a403c;
  --text: #eceeea; --text-2: #c2c7c1; --text-3: #9aa19a;
  --accent: #6cc196; --accent-ink: #0d1a13; --accent-soft: #1f3329;
  --dark-btn: #e9ebe7; --dark-btn-ink: #15171a;
  --view-bg: #1b1e1c; --code-bg: #171a18; --code-ink: #e3e6e1;
  --tok-kw: #ef8fbd; --tok-str: #8fd19b; --tok-num: #f2b46b; --tok-com: #8a918b; --tok-fn: #8fb7f5;
  --pos: #8fd19b; --neg: #f28b82;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  --grid: #2a2f2c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--sans); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
code, kbd, pre, textarea { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
code, kbd { font-family: var(--mono); font-size: .86em; }
code { background: var(--bg-sunk); padding: .1em .35em; border-radius: 5px; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; background: var(--surface); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--surface); padding: 6px 10px; border-radius: 8px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: .88rem; color: var(--text-2); }

/* nav */
.topnav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font: 700 1.05rem var(--display); color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.navlinks { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { color: var(--text-2); text-decoration: none; font-size: .9rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.navlinks a:hover, .navlinks a.active { color: var(--text); background: var(--bg-sunk); }
.navcta { background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; font-size: .88rem; padding: 7px 14px; border-radius: 999px; white-space: nowrap; }

/* hero */
.hero { max-width: var(--widew); margin: 0 auto; padding: 56px 24px 8px; text-align: center; }
.venue { font: 500 .85rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.hero h1 { font: 700 clamp(2rem, 4.6vw, 3.25rem)/1.12 var(--display); letter-spacing: -.02em; margin: 0 auto 18px; max-width: 900px; text-wrap: balance; }
.authors { font: 400 1.08rem/1.7 var(--display); margin: 0 auto 4px; max-width: 880px; }
.authors a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.authors a:hover { color: var(--accent); border-color: var(--accent); }
.affil { color: var(--text-2); margin: 0 0 22px; font-family: var(--display); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 34px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 18px; font: 600 .95rem var(--sans);
  text-decoration: none; cursor: pointer; line-height: 1; transition: transform .12s ease, opacity .12s; }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn.dark { background: var(--dark-btn); color: var(--dark-btn-ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.small { padding: 7px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.teaser { margin: 0 auto; max-width: 1100px; }
.teaser img { border-radius: var(--radius); background: #fff; }
figcaption { font-size: .9rem; color: var(--text-2); margin-top: 10px; text-align: left; line-height: 1.55; }
.teaser figcaption { max-width: 900px; margin: 12px auto 0; }

/* at a glance */
.glance { max-width: var(--widew); margin: 40px auto 8px; padding: 0 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; }
.stat .num { display: block; font: 700 2rem/1.1 var(--display); letter-spacing: -.02em; color: var(--text); margin-bottom: 6px; }
.stat .lbl { font-size: .88rem; color: var(--text-2); line-height: 1.45; display: block; }

/* sections */
section { padding: 0 24px; }
.prose { max-width: var(--maxw); margin: 0 auto; }
.wide { max-width: var(--widew); margin: 0 auto; }
section[id] > h2, .prose > h2 { font: 700 clamp(1.6rem, 3vw, 2.05rem)/1.2 var(--display); letter-spacing: -.015em; margin: 72px 0 14px; }
.prose h3 { font: 700 1.25rem/1.3 var(--display); margin: 40px 0 8px; }
.prose h4, .prose .twocol h3 { font: 700 1.02rem var(--display); margin: 0 0 4px; }
.kicker { font: 600 .8rem var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 72px 0 -6px; }
.kicker + h2 { margin-top: 10px !important; }
.lede { font-size: 1.15rem; color: var(--text); }
.aside-note { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; font-size: .95rem; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0; }
.twocol.align-center { align-items: center; }
.twocol > div > p { margin: 0; color: var(--text-2); }
.contrib { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.contrib > div { display: flex; gap: 12px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.contrib span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 .9rem var(--display); }
.contrib p { margin: 0; font-size: .95rem; line-height: 1.5; }
.workflow { padding-left: 1.3em; }
.workflow li { margin: 6px 0; }
.workflow.compact li { margin: 3px 0; }
.findings { padding-left: 1.1em; }
.findings li { margin: 8px 0; }
.checks { list-style: none; padding: 0; }
.checks li { position: relative; padding-left: 30px; margin: 12px 0; }
.checks li::before { content: ""; position: absolute; left: 0; top: .35em; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%232f6f4f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.paperfig { margin: 26px 0; }
.paperfig img { border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.paperfig.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 8px 0; }
table.data caption { text-align: left; font-weight: 600; font-size: .9rem; color: var(--text-2); padding-bottom: 6px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data thead th { font-weight: 600; color: var(--text-2); border-bottom-color: var(--line-strong); font-size: .85rem; }
table.data td:not(:first-child) { font-variant-numeric: tabular-nums; }
table.data.compact th, table.data.compact td { padding: 6px 8px; }
td.pos { color: var(--pos); font-weight: 600; }
td.neg { color: var(--neg); font-weight: 600; }
details.params, details.api { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 16px 0; background: var(--bg-soft); }
details summary { cursor: pointer; font-weight: 600; }
details.api table th { white-space: nowrap; font-weight: 500; }
details.api table th code { background: none; padding: 0; }

/* viewer */
.view { position: relative; width: 100%; height: var(--h, 380px); background: var(--view-bg); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.view canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.view canvas:active { cursor: grabbing; }
.view .view-msg { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); width: max-content;
  background: var(--surface); color: var(--text-2); box-shadow: 0 1px 4px rgba(0,0,0,.12); border-radius: 999px; padding: 5px 12px;
  font-size: .84rem; pointer-events: none; text-align: center; font-variant-numeric: tabular-nums; }
.view .view-msg.hidden, .view .view-msg:empty { display: none; }
.view .view-hint { position: absolute; right: 10px; bottom: 8px; font-size: .72rem; color: var(--text-3); pointer-events: none; }
.view .view-reset { position: absolute; right: 8px; top: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 8px; font-size: .75rem; padding: 4px 8px; cursor: pointer; opacity: .85; }
.colorbar { position: absolute; left: 14px; top: 14px; bottom: 14px; width: 54px; display: flex; flex-direction: column; pointer-events: none; }
.cb-grad { position: absolute; left: 0; top: 18px; bottom: 0; width: 12px; border-radius: 6px;
  background: linear-gradient(to top, #00007f, #0000ff, #00ffff, #7fff7f, #ffff00, #ff0000, #7f0000); }
.cb-ticks { position: absolute; left: 16px; top: 18px; bottom: 0; }
.cb-ticks span { position: absolute; transform: translateY(-50%); font-size: .7rem; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-title { font-size: .7rem; color: var(--text-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); }
.legend.inline { justify-content: center; margin-top: 10px; }
.ex-view .legend { position: absolute; left: 12px; bottom: 10px; background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 4px 10px; border-radius: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw.strong { background: var(--strong); }
.sw.weak { background: var(--weak); }
.sw.fixed { background: var(--fixed); box-shadow: inset 0 0 0 1px var(--line-strong); }
.sw.load { background: var(--load); }

/* explorer */
.explorer, .compare, .heur, .chart-card, .ui-embed { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.explorer { padding: 14px; margin-top: 18px; }
.ex-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.steps { display: flex; gap: 4px; list-style: none; padding: 4px; margin: 0; background: var(--bg-sunk); border-radius: 12px; flex: 1 1 100%; order: 3; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ex-head .field { flex-direction: row; align-items: center; gap: 8px; }
#ex-play { margin-left: auto; }
.steps::-webkit-scrollbar { display: none; }
.steps li { flex: 1; }
.steps button { width: 100%; border: 0; background: transparent; color: var(--text-2); font: 500 .86rem var(--sans); padding: 8px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.steps button b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; font-size: .72rem; margin-right: 4px; }
.steps button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.steps button.done b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ex-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.ex-view { position: relative; }
.ex-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ex-text h3 { font: 700 1.05rem var(--display); margin: 2px 0 6px; }
.ex-text p { margin: 0 0 8px; font-size: .93rem; color: var(--text-2); line-height: 1.55; }
.ex-controls { display: flex; flex-direction: column; gap: 10px; }
.ex-stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .85rem; padding: 10px 12px; background: var(--bg-soft); border-radius: 10px; }
.ex-stats:empty { display: none; }
.ex-stats dt { color: var(--text-3); }
.ex-stats dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.dirpad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.dirpad button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 0; font: 500 .82rem var(--mono); cursor: pointer; }
.dirpad button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg-sunk); padding: 4px; border-radius: 10px; }
.seg-toggle button { border: 0; background: transparent; padding: 7px; border-radius: 7px; cursor: pointer; color: var(--text-2); font: 500 .85rem var(--sans); }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* form bits */
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--text-2); }
.field.grow { flex: 1; min-width: 200px; }
.field b { color: var(--text); font-variant-numeric: tabular-nums; }
select, input[type="number"] { font: inherit; font-size: .9rem; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; min-height: 34px; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0; }
.check { display: block; padding-left: 24px; text-indent: -24px; font-size: .88rem; color: var(--text-2); cursor: pointer; }
.check input { margin: 0 8px 0 0; vertical-align: -2px; }
.check input { accent-color: var(--accent); }

/* compare */
.compare { padding: 16px; margin-top: 10px; }
.cmp-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 14px; }
.cmp-views { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-views figure { margin: 0; }
.cmp-views figcaption { text-align: center; }
.cmp-stat { color: var(--text-3); font-variant-numeric: tabular-nums; }
.hist-wrap { margin-top: 16px; }
.hist-title { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.hist-title .muted { font-weight: 400; }
.hist { height: 120px; position: relative; }
.hist svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* heuristics */
.heur { padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; margin-top: 10px; }
.heur-side { display: flex; flex-direction: column; gap: 10px; }
.stat-line { font-size: .85rem; color: var(--text-2); margin: 4px 0 0; padding: 10px 12px; background: var(--bg-soft); border-radius: 10px; }

/* code */
.code { margin: 16px 0 22px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.code-tabs { display: flex; align-items: center; gap: 2px; background: var(--bg-sunk); border-bottom: 1px solid var(--line); padding: 4px 6px 0; overflow-x: auto; scrollbar-width: none; }
.code-tabs button { border: 0; background: transparent; color: var(--text-3); font: 500 .78rem var(--mono); padding: 7px 10px 8px; border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap; }
.code-tabs button[aria-selected="true"] { background: var(--code-bg); color: var(--text); }
.code-tabs .spacer { flex: 1; }
.code-tabs .code-act { font: 500 .75rem var(--sans); color: var(--text-3); background: none; border: 0; cursor: pointer; padding: 6px 8px; }
.code-file { font: .74rem var(--mono); color: var(--text-3); padding: 8px 14px 0; }
.code pre { margin: 0; padding: 8px 0 12px; overflow-x: auto; font: .8rem/1.6 var(--mono); color: var(--code-ink); max-height: 340px; }
.code.expanded pre { max-height: none; }
.code pre .ln { display: inline-block; width: 3.4em; padding-right: 1em; text-align: right; color: var(--tok-com); opacity: .6; user-select: none; }
.code .more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--bg-sunk); color: var(--text-2); font: 500 .8rem var(--sans); padding: 6px; cursor: pointer; }
.tok-kw { color: var(--tok-kw); } .tok-str { color: var(--tok-str); } .tok-num { color: var(--tok-num); } .tok-com { color: var(--tok-com); font-style: italic; } .tok-fn { color: var(--tok-fn); }

/* notebook cells */
.cell { margin: 18px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.cell-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.cell-title { font: 600 .9rem var(--display); flex: 1; }
.cell-state { font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cell-state.ok { color: var(--pos); }
.cell-state.err { color: var(--neg); }
.cell-run { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 6px 12px; font: 600 .82rem var(--sans); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.cell-reset { background: none; border: 0; color: var(--text-3); font-size: .78rem; cursor: pointer; }
.cell-editor { position: relative; font: .78rem/1.6 var(--mono); }
.cell-editor pre, .cell-editor textarea { margin: 0; padding: 12px 14px; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; tab-size: 2; letter-spacing: normal; border: 0; }
.cell-editor pre { pointer-events: none; color: var(--code-ink); background: var(--code-bg); overflow: hidden; min-height: 100%; }
.cell-editor textarea { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: none; background: transparent;
  color: transparent; caret-color: var(--text); overflow: hidden; }
.cell-editor textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.cell-out { border-top: 1px solid var(--line); }
.cell-out:empty { display: none; }
.cell-log { margin: 0; padding: 10px 14px; font: .8rem/1.55 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.cell-log .err { color: var(--neg); }
.cell-out .view { border-radius: 0; }

/* charts */
.chart-card { padding: 18px 18px 14px; margin: 18px 0; }
.chart-card.slim { padding: 12px; box-shadow: none; margin: 0; }
.chart-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; }
.chart-title { font: 700 1rem var(--display); }
.chart-sub { font-size: .82rem; color: var(--text-3); }
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-2); margin: 6px 0 2px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-2); font: 11px var(--sans); }
.chart .axis-label { fill: var(--text-3); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { transition: opacity .12s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .dim .bar { opacity: .35; }
.chart .na { fill: var(--text-3); font-size: 10px; }
.chart-table { margin-top: 10px; }
.pill { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 11px; font: 500 .8rem var(--sans); cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--dark-btn); color: var(--dark-btn-ink); border-color: var(--dark-btn); }
.tooltip { position: fixed; z-index: 80; pointer-events: none; background: var(--dark-btn); color: var(--dark-btn-ink); font-size: .8rem; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s; max-width: 260px; }
.tooltip.show { opacity: 1; transform: none; }
.tooltip b { font-weight: 600; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.card { text-align: left; border: 1px solid var(--line); background: var(--bg-soft); border-radius: 12px; padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { font: 700 1rem var(--display); margin: 0 0 4px; }
.card p { margin: 0; font-size: .9rem; color: var(--text-2); line-height: 1.5; }
.card.static { cursor: default; }
.card.static:hover { border-color: var(--line); transform: none; }
.card.static::after { content: none; }
.card::after { content: "Simulate this \2192"; display: block; margin-top: 8px; color: var(--accent); font-size: .82rem; font-weight: 600; }

/* ui embed */
.ui-embed { margin-top: 10px; overflow: hidden; }
.ui-embed iframe { width: 100%; height: 820px; border: 0; display: block; background: #fff; }
.ui-placeholder { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 24px; padding: 20px; }
.ui-placeholder img { border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.ui-placeholder p { margin: 0 0 14px; }
.ui-placeholder .btn { margin: 0 6px 8px 0; }


/* bibtex */
.bib { position: relative; }
.bib pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; overflow-x: auto; font: .8rem/1.55 var(--mono); }
.bib .copy { position: absolute; right: 10px; top: 10px; background: var(--surface); }

.footer { max-width: var(--maxw); margin: 80px auto 0; padding: 28px 24px 48px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--text-3); }
.footer a { color: var(--text-2); }

/* responsive */
@media (max-width: 980px) {
  .ex-body, .heur { grid-template-columns: 1fr; }
  .glance { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .topnav { padding: 8px 16px; gap: 10px; }
  .navcta { display: none; }
  section, .hero, .glance { padding-left: 16px; padding-right: 16px; }
  .hero { padding-top: 32px; }
  .twocol, .contrib, .cards, .cmp-views, .ui-placeholder { grid-template-columns: 1fr; }
  .explorer, .compare, .heur { padding: 10px; border-radius: 14px; }
  .steps button { font-size: .8rem; padding: 7px 8px; }
  .view { --h: 340px !important; }
  #ex-view { --h: 360px !important; }
  .ui-embed iframe { height: 760px; }
  .view .view-hint { display: none; }
  .glance { gap: 10px; }
  .stat .num { font-size: 1.6rem; }
  .cmpbar { grid-template-columns: 70px 1fr 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* live code boxes (editor | output) */
.howto { background: var(--accent-soft); border-radius: 12px; padding: 14px 18px; margin: 18px 0; }
.howto p { margin: 0 0 8px; font-size: .95rem; }
.howto p:last-child { margin: 0; }
.box { margin: 14px 0 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.box-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 6px 8px 6px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.box-title { flex: 1; min-width: 0; font: 500 .8rem var(--sans); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-title code { font: .78rem var(--mono); color: var(--text); }
@media (max-width: 600px) { .box-title { flex-basis: 100%; } }  /* the file name on its own row above the buttons */
.box-state { font-size: .75rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.box-state.ok { color: var(--pos); } .box-state.err { color: var(--neg); }
.box-act { background: none; border: 0; color: var(--text-3); font: 500 .78rem var(--sans); cursor: pointer; padding: 6px; }
.box-act[aria-pressed="true"] { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.box-run { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 7px 14px; font: 600 .84rem var(--sans); cursor: pointer; white-space: nowrap; }
.box-run:disabled { opacity: .6; cursor: progress; }
.box-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.box-code { min-width: 0; background: var(--code-bg); border-right: 1px solid var(--line); max-height: 560px; overflow: auto; }
.box-code .code-file { padding-top: 10px; }
.box-code .code-file.release { margin-top: 4px; border-top: 1px dashed var(--line); }
.box-out { min-width: 0; display: flex; flex-direction: column; }
.box-out .view { border-radius: 0; flex: none; }
.box-out .cell-log { flex: 1; border-top: 1px solid var(--line); min-height: 2.5em; }
.box-out .cell-log:empty::before { content: "Press Run to execute this step."; color: var(--text-3); }
.ui-bar { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; font-size: .85rem; color: var(--text-2); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
@media (max-width: 860px) {
  .box-body { grid-template-columns: 1fr; }
  .box-code { border-right: 0; border-bottom: 1px solid var(--line); max-height: 420px; }
}

/* the font shorthand resets ligatures, so switch them off after it */
.cell-editor, .cell-editor pre, .cell-editor textarea, .code pre, .bib pre, .cell-log {
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}

/* mesh source bar (live fTetWild or the release's cached mesh) */
.meshbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); font-size: .86rem; color: var(--text-2); }
.meshbar .mb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.meshbar[data-state="busy"] .mb-dot { animation: mb-pulse 1s ease-in-out infinite; }
.meshbar[data-state="cached"] .mb-dot { background: var(--text-3); }
.meshbar[data-state="error"] .mb-dot { background: #c62828; }
.meshbar .mb-text { flex: 1 1 240px; min-width: 0; font-variant-numeric: tabular-nums; }
/* the text changes every second while meshing: keep its height fixed so the page below does not move */
.meshbar { min-height: 46px; }
.heur-side .meshbar .mb-text { min-height: 2.9em; }
.meshbar .mb-btns { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; flex: none; }
.meshbar .mb-btns button { font: inherit; font-size: .82rem; padding: 4px 11px; border: 0; background: var(--surface); color: var(--text-2); cursor: pointer; }
.meshbar .mb-btns button + button { border-left: 1px solid var(--line-strong); }
.meshbar .mb-btns button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.meshbar .mb-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#ex-mesh { margin: 0 0 10px; }
.heur-side .meshbar { margin: 0; }
@keyframes mb-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .meshbar[data-state="busy"] .mb-dot { animation: none; } }
.cell-log .box-status { color: var(--text-3); font-style: italic; }

/* reserve room for text that appears after a run, so the page below does not jump (Safari has no scroll anchoring) */
.box-out .cell-log { min-height: 4.6em; }
.heur-side .stat-line { min-height: 4.4em; }
.footer [data-offline]:empty { display: none; }

/* the app at the top of the page, and the Run all bar under it */
.app-top { margin-top: 8px; padding: 0 24px; }
@media (max-width: 600px) { .app-top { padding: 0 16px; } }
.app-top .ui-embed { margin-top: 0; }
.runall { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); }
.runall p { flex: 1 1 320px; margin: 0; font-size: .9rem; color: var(--text-2); }
.runall-state { font-size: .85rem; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 12em; }
.runall-state.err { color: var(--neg); }
.runall-link { font-size: .85rem; }
.teaser-wrap { padding: 28px 24px 0; }
.teaser-wrap .teaser { margin-top: 0; }

/* bug-report notice at the top of the page */
.bug-banner { margin: 0; padding: 7px 16px; background: #fff8e1; border-bottom: 1px solid #f0d98a; color: #4a3b00; font-size: .88rem; line-height: 1.45; text-align: center; overflow-wrap: anywhere; }
