/* start-from-here site — vanilla CSS, light/dark, responsive, accessible. */
:root {
  --bg: #f7f7f4;
  --bg-alt: #efeee9;
  --surface: #ffffff;
  --text: #1b1c20;
  --muted: #565a63;
  --border: #dcdad3;
  --accent: #3b4fd8;
  --accent-ink: #ffffff;
  --accent-2: #e8833a;
  --code-bg: #16171c;
  --code-text: #e9e9ee;
  --ok: #1f7a4d;
  --ok-bg: #e3f3ea;
  --warn: #8a5a00;
  --warn-bg: #fbf0d9;
  --mid: #3f4a8a;
  --mid-bg: #e6e9fb;
  --tier-l: #1f7a4d;
  --tier-s: #3b4fd8;
  --tier-e: #9b2c6f;
  --focus: #e8833a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Hiragino Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151a; --bg-alt: #1a1c22; --surface: #20222a; --text: #ececf0; --muted: #a6a9b3; --border: #33363f;
    --accent: #8d9bff; --accent-ink: #0f1020; --accent-2: #f2a265; --code-bg: #0c0d10; --code-text: #e9e9ee;
    --ok: #7fd4a6; --ok-bg: #1b3328; --warn: #f2c66b; --warn-bg: #3a2f17; --mid: #b3bcff; --mid-bg: #262b4a;
    --tier-l: #7fd4a6; --tier-s: #8d9bff; --tier-e: #f19ac9; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14151a; --bg-alt: #1a1c22; --surface: #20222a; --text: #ececf0; --muted: #a6a9b3; --border: #33363f;
  --accent: #8d9bff; --accent-ink: #0f1020; --accent-2: #f2a265; --code-bg: #0c0d10; --code-text: #e9e9ee;
  --ok: #7fd4a6; --ok-bg: #1b3328; --warn: #f2c66b; --warn-bg: #3a2f17; --mid: #b3bcff; --mid-bg: #262b4a;
  --tier-l: #7fd4a6; --tier-s: #8d9bff; --tier-e: #f19ac9; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .9em; background: var(--bg-alt); border: 1px solid var(--border); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin: 0 0 .5rem; }
h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
.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; }
.skip { position: absolute; left: 16px; top: -48px; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }
.wrap.narrow { max-width: 820px; }
.small { font-size: .875rem; }
.mt { margin-top: 3rem; }
.mt-s { margin-top: 2rem; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo { width: 28px; height: 28px; color: var(--text); }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: .4rem .6rem; border-radius: 8px; font-size: .92rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); background: var(--bg-alt); }
.tools { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--muted); }
.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; } }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap svg { position: absolute; left: 9px; width: 18px; height: 18px; pointer-events: none; color: var(--muted); }
.select-wrap select { appearance: none; -webkit-appearance: none; height: 38px; padding: 0 12px 0 32px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; max-width: 170px; cursor: pointer; }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 1080px) {
  .menu-btn { display: inline-grid; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--border); margin: 0; }
  .nav.open { display: flex; }
  .nav a { padding: .7rem .6rem; font-size: 1rem; }
  .tools { margin-left: 0; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .select-wrap select { max-width: 130px; }
}

/* hero */
.hero { padding: 56px 0 24px; background: radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.hero-grid { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; } }
.eyebrow { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: .25rem .7rem; border-radius: 999px; margin: 0 0 1rem; }
h1 { font-size: clamp(2.3rem, 6vw, 3.8rem); margin: 0 0 1rem; letter-spacing: -.02em; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 70ch; margin: 0 0 1.5rem; }
.label { font-weight: 600; margin: 1rem 0 .4rem; }
.label.small { font-weight: 500; color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.5rem; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: .65rem 1.1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: .4rem .75rem; font-size: .88rem; font-weight: 500; }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* code blocks + copy button */
pre.code { position: relative; margin: 0 0 .75rem; background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: .85rem 5rem .85rem 1rem; overflow-x: auto; font-size: .9rem; line-height: 1.55; }
pre.code code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; white-space: pre; overflow-wrap: normal; }
pre.code.prompt code { white-space: pre-wrap; }
.copy-btn { position: absolute; top: 8px; right: 8px; border: 1px solid #3a3d47; background: #24262e; color: #e9e9ee; border-radius: 7px; font: 500 .78rem var(--font); padding: .3rem .55rem; cursor: pointer; }
.copy-btn:hover { background: #30333d; }
.copy-btn.done { background: #1f7a4d; border-color: #1f7a4d; }

/* terminal illustration */
.term { background: var(--code-bg); color: var(--code-text); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; font: .88rem/1.6 var(--mono); }
.term-bar { display: flex; gap: 6px; padding: 10px 12px; background: #1f2128; }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #444955; }
.term-bar span:first-child { background: #e0605a; } .term-bar span:nth-child(2) { background: #e3b341; } .term-bar span:nth-child(3) { background: #4fb26c; }
.term-body { padding: 14px 16px; }
.term-body p { margin: 0 0 .2rem; overflow-wrap: anywhere; }
.term .u { color: #f2a265; } .term .m { color: #b7bac4; } .term i { color: #8fd3a8; font-style: normal; } .term .stop { color: #f19ac9; font-weight: 700; }

.stats { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 820px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: .92rem; }
.stats strong { display: block; color: var(--text); font-size: 1.6rem; }

/* sections */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel.problem { border-top: 4px solid #d0574f; }
.panel.solution { border-top: 4px solid var(--ok); }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.feature-list strong { display: block; }
.feature-list span { color: var(--muted); }
.cards { display: grid; gap: 16px; margin-top: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .cards.four, .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card p { margin: 0; color: var(--muted); }
.note { color: var(--muted); font-size: .95rem; margin-top: 1rem; }

/* diagram */
.diagram { margin: 24px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; color: var(--muted); }
.diagram svg { display: block; width: 100%; height: auto; }
.d-nodes rect { fill: var(--bg-alt); stroke: var(--border); stroke-width: 1.5; }
.d-nodes .d-final { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke: var(--accent); }
.d-num text { fill: var(--accent); font: 700 18px var(--font); }
.d-label text { fill: var(--text); font: 600 17px var(--font); }
.d-gates text { fill: var(--tier-e); font: 700 12px var(--font); letter-spacing: .05em; }
@media (max-width: 719px) { .diagram { display: none; } }
.phases { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .phases { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.phases li { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.phases li.final { border-color: var(--accent); }
.phases p { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
.num { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.gate { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--tier-e); border: 1px solid currentColor; border-radius: 999px; padding: 0 .5rem; margin-left: .3rem; vertical-align: 2px; }

/* docs map */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); }
.tier { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 5px; border-radius: 6px; font: 700 .75rem var(--font); border: 1.5px solid currentColor; }
.tier.l { color: var(--tier-l); } .tier.s { color: var(--tier-s); } .tier.e { color: var(--tier-e); } .tier.c { color: var(--muted); border-style: dashed; }
.docgrid { display: grid; gap: 16px; margin-top: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .docgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .docgroup.wide { grid-column: 1 / -1; } }
.docgroup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.docgroup dl { margin: 0; display: grid; gap: 12px; }
.docgroup dt { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.docgroup dt code { font-weight: 600; }
.docgroup dd { margin: .2rem 0 0; color: var(--muted); font-size: .94rem; }
.tiers { display: inline-flex; gap: 4px; }
.docgroup .note { margin-top: 0; }
.tier-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; }
.tier-card dl { margin: 0; }
.tier-card dt { font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: .7rem; }
.tier-card dd { margin: .1rem 0 0; }

/* tabs */
.tabs { margin-top: 24px; }
.tablist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tablist [role="tab"] { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .45rem .9rem; font: 500 .9rem var(--font); cursor: pointer; }
.tablist [role="tab"]:hover { color: var(--text); border-color: var(--muted); }
.tablist [role="tab"][aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabpanel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tabpanel > p { color: var(--muted); }
.needs { font-size: .92rem; }
.needs span { font-weight: 600; color: var(--text); }
.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: .35rem; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--bg-alt); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; }
table.cmds td:first-child { white-space: nowrap; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.mid { background: var(--mid-bg); color: var(--mid); }

/* chat example */
.chat { display: grid; gap: 12px; max-width: 860px; }
.msg { border-radius: 14px; padding: 12px 16px; border: 1px solid var(--border); background: var(--surface); }
.msg.you { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); margin-left: clamp(0px, 8vw, 80px); }
.msg.agent { margin-right: clamp(0px, 8vw, 80px); }
.msg.dim { opacity: .6; }
.msg .who { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.msg p { margin: .2rem 0 0; }

/* faq */
details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; position: relative; padding-right: 44px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); }
details[open] summary::after { content: "−"; }
details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

/* links */
.links { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .links { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.links a { display: block; height: 100%; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.links a:hover { border-color: var(--accent); }
.links span { display: block; color: var(--muted); font-size: .9rem; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 32px 0 48px; color: var(--muted); font-size: .94rem; }
.footer p { margin: .3rem 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: .5rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: .9rem; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 404 */
.nf { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 48px 16px; }
.nf .big { font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }

@media print { .topbar, .copy-btn, .tablist, .toast { display: none !important; } .tabpanel[hidden] { display: block !important; } }
