:root {
  --bg: #f6f7fa;
  --panel: #ffffff;
  --text: #15181e;
  --muted: #5f6877;
  --line: #e3e6ec;
  --line-strong: #cfd4dd;
  --accent: #2f6df6;
  --accent-ink: #ffffff;
  --accent-soft: #e9efff;
  --ok: #1a8f5c;
  --warn: #c0392b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --i-informational: #2f6df6; --i-commercial: #b45309; --i-transactional: #1a8f5c; --i-local: #7c3aed; --i-unclear: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --panel: #161a22; --text: #e8ebf1; --muted: #9aa3b2; --line: #262c37; --line-strong: #353d4b;
    --accent: #5b8cff; --accent-soft: #1a2540; --ok: #3ccf8a; --warn: #ff6b5b;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 10px 30px -14px rgba(0,0,0,0.6);
    --i-informational: #7da2ff; --i-commercial: #f0a35e; --i-transactional: #4fd59a; --i-local: #b08cff; --i-unclear: #9aa3b2;
  }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -0.015em; }
kbd { font: 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; background: rgba(255,255,255,0.18); margin-left: 8px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.hidden, [hidden] { display: none !important; }

/* header */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 9px; }
.brand:hover { text-decoration: none; }
.dots { display: inline-flex; gap: 2px; align-items: flex-end; }
.dots i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.dots i:nth-child(2) { opacity: 0.7; height: 9px; width: 9px; } .dots i:nth-child(3) { opacity: 0.45; }
.top nav { display: flex; gap: 18px; align-items: center; }
.top nav a { color: var(--muted); font-size: 14px; }
.top nav a:hover { color: var(--text); text-decoration: none; }
.nav-cta { background: var(--accent); color: var(--accent-ink) !important; padding: 7px 12px; border-radius: 8px; font-weight: 600; }
@media (max-width: 640px) { .top nav a:not(.nav-cta) { display: none; } }

/* hero */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 56px 16px 32px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 12px; }
.hero h1 { font-size: clamp(30px, 4.6vw, 44px); line-height: 1.1; margin: 0 0 14px; }
.lede { color: var(--muted); font-size: 18px; margin: 0 0 22px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.facts b { color: var(--text); font-weight: 700; }

.hero-preview { display: grid; gap: 10px; transform: rotate(-1deg); }
.mini { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; }
.mini:nth-child(2) { transform: translateX(14px); } .mini:nth-child(3) { transform: translateX(-6px); }
.mini-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.mini-meta { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.mini ul { list-style: none; margin: 0; padding: 0; }
.mini li { display: flex; justify-content: space-between; padding: 2px 0; border-top: 1px dashed var(--line); color: var(--muted); }
.mini li span { font-family: var(--mono); font-size: 11px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 36px; } .hero-preview { display: none; } .hero h1 { font-size: clamp(28px, 8vw, 36px); } .lede { font-size: 17px; } }

/* buttons + inputs */
button, .ghost, .primary, select, input[type="search"] { font: inherit; }
button { cursor: pointer; }
.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.file input { display: none; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; box-shadow: 0 1px 0 rgba(0,0,0,0.05); }
.primary.small { padding: 8px 12px; font-size: 14px; }
.primary:disabled { opacity: 0.6; cursor: wait; }
.primary:hover:not(:disabled) { filter: brightness(1.06); text-decoration: none; }
textarea { width: 100%; resize: vertical; min-height: 210px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: 14px/1.55 var(--mono); }
textarea:focus, input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input[type="search"] { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 14px; }
input[type="search"] { min-width: 150px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* panels */
.app { display: grid; gap: 14px; padding-bottom: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head.sticky { position: sticky; top: 58px; z-index: 3; background: var(--panel); padding: 8px 0; margin: -8px 0 8px; }
.panel h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.controls { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
@media (max-width: 720px) { .controls { grid-template-columns: 1fr; } }
label.range, label.select { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
label.range > span:first-child { display: flex; justify-content: space-between; font-weight: 600; }
label.range output { font-family: var(--mono); color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.range-ends em { font-style: normal; }
label.select > span { font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
label.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.run-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 14px; }
.status.err { color: var(--warn); }
.progress { height: 6px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

/* results */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--panel); color: var(--muted); border: 0; padding: 8px 12px; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; min-width: 120px; display: flex; flex-direction: column; }
.stat b { font-size: 20px; letter-spacing: -0.01em; }
.stat span { color: var(--muted); font-size: 12px; }

.topic { margin-bottom: 22px; }
.topic-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 0 2px 8px; border-bottom: 2px solid var(--line); margin-bottom: 12px; }
.topic-head h3 { margin: 0; font-size: 16px; }
.topic-head .meta { color: var(--muted); font-size: 13px; }
.clusters { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cluster { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg); }
.cluster-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cluster h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.cluster .meta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.cluster ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.cluster li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--line); }
.cluster li:first-child { border-top: 0; }
.cluster li .vol { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.cluster details summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 6px; }
.cluster details ul li:first-child { border-top: 1px dashed var(--line); }

.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-style: normal; border: 1px solid currentColor; }
.pill-informational { color: var(--i-informational); } .pill-commercial { color: var(--i-commercial); }
.pill-transactional { color: var(--i-transactional); } .pill-local { color: var(--i-local); } .pill-unclear { color: var(--i-unclear); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
table.compare td:first-child { color: var(--muted); }
table.compare td:nth-child(2) { font-weight: 600; }

/* bands + prose */
.band { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 48px 0; margin-top: 24px; }
.band h2, .prose h2 { font-size: 24px; margin: 0 0 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.stepcard { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stepcard .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.stepcard h3 { margin: 0 0 6px; font-size: 16px; }
.stepcard p { margin: 0; color: var(--muted); font-size: 14.5px; }
.note { color: var(--muted); margin: 18px 0 0; max-width: 820px; font-size: 15px; }
.prose { padding: 44px 16px 8px; }
.prose p { color: var(--muted); max-width: 800px; margin: 0 0 16px; }
.prose details { border-top: 1px solid var(--line); padding: 12px 0; max-width: 800px; }
.prose details:last-of-type { border-bottom: 1px solid var(--line); }
.prose summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.prose summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 20px; }
.prose details[open] summary::after { content: "−"; }
.prose details p { margin: 10px 0 0; }

.signup { background: var(--accent-soft); border-radius: var(--radius); padding: 26px 28px; margin: 36px auto 8px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.signup h2 { margin: 0 0 6px; font-size: 20px; }
.signup p { margin: 0; color: var(--muted); max-width: 560px; }

.foot { display: flex; justify-content: space-between; gap: 12px; padding: 32px 16px 44px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
