:root {
  --ink: #1a1410;
  --ink-soft: #4a4038;
  --muted: #7a6f64;
  --paper: #fbf7f0;
  --paper-2: #f3ebe0;
  --card: #ffffff;
  --line: #e7ddcd;
  --saffron: #e8722a;
  --saffron-dark: #c95a18;
  --green: #1f7a52;
  --green-soft: #e6f2ea;
  --indigo: #2b3a67;
  --warn: #c0392b;
  --t0: #c0392b;
  --t1: #d98a1f;
  --t2: #1f7a52;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26,20,16,.04), 0 8px 28px rgba(26,20,16,.07);
  --shadow-lg: 0 12px 48px rgba(26,20,16,.14);
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
a { color: var(--saffron-dark); text-decoration: none; }
h1, h2, h3, h4 { font-family: Fraunces, Georgia, serif; line-height: 1.1; letter-spacing: -0.01em; color: var(--ink); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin: 0 0 .5rem; }
.hl { color: var(--saffron); }

/* NAV */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(251,247,240,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--ink); }
.brand-mark { font-size: 1.4rem; }
.brand-name { font-family: Fraunces, serif; font-size: 1.2rem; }
.brand-name b { color: var(--saffron-dark); font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; }
.nav-links a { color: var(--ink-soft); font-size: .92rem; font-weight: 500; }
.nav-links a:hover { color: var(--saffron-dark); }
@media (max-width: 860px) { .nav-links a:not(.btn) { display: none; } }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: .95rem; cursor: pointer; border: 1.5px solid transparent; transition: transform .12s ease, box-shadow .2s ease, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--saffron); color: #fff; box-shadow: 0 6px 18px rgba(232,114,42,.32); }
.btn-primary:hover { background: var(--saffron-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--saffron); color: var(--saffron-dark); }
.btn-ghost.light { color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost.light:hover { border-color: #fff; color: #fff; }

/* HERO */
.hero { padding: clamp(3rem, 7vw, 6rem) 0; background:
  radial-gradient(1100px 500px at 80% -10%, rgba(232,114,42,.10), transparent 60%),
  radial-gradient(900px 500px at 0% 10%, rgba(31,122,82,.08), transparent 55%); }
.hero-inner { display: grid; grid-template-columns: 1.3fr .9fr; gap: 3rem; align-items: center; }
@media (max-width: 900px) { .hero-inner { grid-template-columns: 1fr; gap: 2rem; } }
.eyebrow { font-size: .82rem; font-weight: 600; color: var(--green); letter-spacing: .01em; margin: 0 0 1rem; }
.hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.7rem); margin: 0 0 1.2rem; }
.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 38ch; }
.hero-copy .lede { max-width: 52ch; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.8rem 0 .8rem; }
.hero-note { font-size: .82rem; color: var(--muted); margin: 0; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.stat-num { font-family: Fraunces, serif; font-size: 1.9rem; font-weight: 700; color: var(--saffron-dark); line-height: 1; }
.stat-lbl { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.stat-warn .stat-num { color: var(--warn); }

/* SECTIONS */
.section { padding: clamp(3rem, 6vw, 5.5rem) 0; }
.section-alt { background: linear-gradient(180deg, var(--paper), #f6efe3); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kicker { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--saffron); margin: 0 0 .6rem; }
.kicker.light { color: #f5b98a; }
.section-lede { font-size: 1.06rem; color: var(--ink-soft); max-width: 66ch; margin: .4rem 0 2rem; }
.section-lede.light { color: rgba(255,255,255,.78); }
.source { font-size: .78rem; color: var(--muted); margin-top: 1.2rem; }

/* DIVIDE BARS */
.bars { display: grid; gap: .9rem; margin-top: 1.5rem; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 56px; align-items: center; gap: 1rem; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 110px 1fr 44px; gap: .6rem; } }
.bar-label { font-size: .9rem; font-weight: 500; color: var(--ink-soft); }
.bar-track { background: #eadfce; border-radius: 999px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); background: linear-gradient(90deg, var(--green), #2ea372); }
.bar-fill.low { background: linear-gradient(90deg, var(--warn), #e0654f); }
.bar-fill.mid { background: linear-gradient(90deg, var(--t1), #edb24f); }
.bar-val { font-family: var(--mono); font-size: .9rem; font-weight: 500; text-align: right; }

/* TIERS */
.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.3rem; margin-top: 1.5rem; }
@media (max-width: 880px) { .tier-grid { grid-template-columns: 1fr; } }
.tier-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.tier-card-mid { border-color: var(--saffron); box-shadow: var(--shadow-lg); position: relative; }
.tier-tag { display: inline-block; font-family: var(--mono); font-weight: 600; font-size: .8rem; color: #fff; padding: .2rem .6rem; border-radius: 6px; margin-bottom: .8rem; }
.tier-tag.t0 { background: var(--t0); } .tier-tag.t1 { background: var(--t1); } .tier-tag.t2 { background: var(--t2); }
.tier-card h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
.tier-card p { font-size: .94rem; color: var(--ink-soft); margin: 0 0 .8rem; }
.tier-card ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); }
.tier-card li { margin-bottom: .3rem; }

/* TABS + DEMO */
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 1.3rem; }
.tab { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1.1rem; font-weight: 600; font-size: .92rem; color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.tab:hover { border-color: var(--saffron); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel { display: none; }
.panel.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 880px) { .panel-grid { grid-template-columns: 1fr; } }
.form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .85rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.form .opt { font-weight: 400; color: var(--muted); }
.form input, .form select, .form textarea { font-family: inherit; font-size: .92rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%; resize: vertical; }
.form textarea { font-weight: 400; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(232,114,42,.35); border-color: var(--saffron); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row:has(> label:nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) { .row, .row:has(> label:nth-child(3)) { grid-template-columns: 1fr; } }
.form .btn { margin-top: .3rem; justify-content: center; }

.output { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); min-height: 240px; overflow: auto; }
.output-empty { color: var(--muted); font-size: .92rem; display: flex; align-items: center; justify-content: center; height: 210px; text-align: center; }
.demo-note { font-size: .82rem; color: var(--muted); margin-top: 1.2rem; text-align: center; }

/* OUTPUT INTERNALS */
.loading { display: flex; align-items: center; gap: .7rem; color: var(--ink-soft); font-size: .92rem; height: 210px; justify-content: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--saffron); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--warn); font-size: .9rem; background: #fdecea; border: 1px solid #f3c6bf; padding: .8rem; border-radius: 9px; }

.meta-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--line); }
.chip { font-family: var(--mono); font-size: .74rem; padding: .25rem .55rem; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft); }
.chip b { color: var(--ink); }
.chip-tier { background: var(--green-soft); border-color: #bfe0cc; color: var(--green); }
.chip-cost { background: #fff4e8; border-color: #f3d4b0; color: var(--saffron-dark); }

.score-big { font-family: Fraunces, serif; font-size: 2.6rem; font-weight: 700; color: var(--green); line-height: 1; }
.score-big small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.conf { font-size: .82rem; color: var(--muted); }
.flag-review { display: inline-block; background: #fdecea; color: var(--warn); font-size: .76rem; font-weight: 600; padding: .2rem .55rem; border-radius: 6px; border: 1px solid #f3c6bf; }
.crit { display: grid; grid-template-columns: 22px 1fr auto; gap: .5rem; align-items: start; font-size: .88rem; padding: .4rem 0; border-bottom: 1px solid var(--paper-2); }
.crit .ok { color: var(--green); } .crit .no { color: var(--warn); }
.crit .cm { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.fb { background: var(--paper); border-radius: 9px; padding: .8rem; margin-top: .8rem; font-size: .9rem; }
.fb h5 { margin: 0 0 .3rem; font-family: Inter; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.q { padding: .7rem 0; border-bottom: 1px solid var(--paper-2); font-size: .92rem; }
.q-h { display: flex; gap: .5rem; align-items: baseline; }
.q-n { font-weight: 700; color: var(--saffron-dark); }
.q-m { margin-left: auto; font-family: var(--mono); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.q-opts { margin: .3rem 0 0 1.2rem; font-size: .86rem; color: var(--ink-soft); }
.q-bloom { font-size: .72rem; color: var(--green); font-family: var(--mono); }
.akey { margin-top: 1rem; }
.akey summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--saffron-dark); }
.akey .q { font-size: .86rem; color: var(--ink-soft); }
.exp-block { margin-bottom: .9rem; }
.exp-block h5 { margin: 0 0 .3rem; font-family: Inter; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.exp-block ul { margin: .2rem 0; padding-left: 1.1rem; }

/* ROUTER */
.router-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 1.4rem; }
@media (max-width: 880px) { .router-grid { grid-template-columns: 1fr; } }
.rt-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.rt-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.rt-cheap::before { background: var(--t2); } .rt-reasoning::before { background: var(--t1); } .rt-hard::before { background: var(--indigo); }
.rt-share { font-family: Fraunces, serif; font-size: 2rem; font-weight: 700; }
.rt-cheap .rt-share { color: var(--t2); } .rt-reasoning .rt-share { color: var(--t1); } .rt-hard .rt-share { color: var(--indigo); }
.rt-card h4 { margin: .2rem 0 .1rem; font-size: 1.05rem; }
.rt-analogue { font-size: .76rem; color: var(--muted); font-weight: 500; }
.rt-model { font-family: var(--mono); font-size: .78rem; background: var(--paper-2); padding: .25rem .5rem; border-radius: 6px; display: inline-block; margin: .6rem 0; color: var(--ink-soft); word-break: break-all; }
.rt-desc { font-size: .86rem; color: var(--ink-soft); margin: 0; }
.router-levers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
@media (max-width: 880px) { .router-levers { grid-template-columns: 1fr; } }
.lever { background: var(--card); border: 1px dashed var(--line); border-radius: 11px; padding: 1rem; }
.lever b { color: var(--saffron-dark); display: block; font-size: .92rem; }
.lever span { font-size: .84rem; color: var(--muted); }

/* CATALOGUE */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-top: 1.4rem; }
.cat { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 1.1rem; box-shadow: var(--shadow); }
.cat.mvp { border-color: var(--saffron); }
.cat-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.cat-id { font-family: var(--mono); font-size: .76rem; font-weight: 600; background: var(--ink); color: #fff; padding: .15rem .45rem; border-radius: 5px; }
.cat.mvp .cat-id { background: var(--saffron); }
.cat-mvp-tag { font-size: .68rem; font-weight: 700; color: var(--saffron-dark); text-transform: uppercase; letter-spacing: .05em; margin-left: auto; }
.cat h4 { font-family: Inter; font-size: .95rem; margin: 0 0 .3rem; }
.cat p { font-size: .84rem; color: var(--muted); margin: 0; }
.cat-tiers { margin-top: .6rem; display: flex; gap: .3rem; }
.cat-tiers span { font-family: var(--mono); font-size: .68rem; padding: .1rem .35rem; border-radius: 4px; color: #fff; }

/* DARK / OSS */
.section-dark { background: linear-gradient(160deg, #1f2a1f, #1a2233); color: #fff; }
.section-dark h2 { color: #fff; }
.oss-inner { display: grid; grid-template-columns: 1.3fr .9fr; gap: 3rem; align-items: start; }
@media (max-width: 900px) { .oss-inner { grid-template-columns: 1fr; gap: 2rem; } }
.oss-points { list-style: none; padding: 0; margin: 1.2rem 0; }
.oss-points li { font-size: .96rem; color: rgba(255,255,255,.86); margin-bottom: .5rem; }
.oss-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 1.5rem; }
.oss-card h4 { color: #fff; margin: 0 0 .5rem; }
.oss-card > p { font-size: .9rem; color: rgba(255,255,255,.78); }
.roadmap { margin-top: 1rem; display: grid; gap: .5rem; }
.rm { font-size: .86rem; color: rgba(255,255,255,.86); display: flex; align-items: center; gap: .6rem; }
.rm-p { font-family: var(--mono); font-size: .74rem; font-weight: 600; background: var(--saffron); color: #fff; padding: .15rem .45rem; border-radius: 5px; }
.rm em { color: var(--saffron); font-style: normal; font-weight: 600; }

/* FOOTER */
.footer { background: #14100c; color: rgba(255,255,255,.7); padding: 2.5rem 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; align-items: start; }
.footer .brand-name { color: #fff; font-size: 1.1rem; }
.footer p { font-size: .85rem; max-width: 50ch; margin: .5rem 0 0; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { color: rgba(255,255,255,.8); font-size: .9rem; }
.footer-links a:hover { color: #fff; }
.footer-links .muted { color: rgba(255,255,255,.4); font-size: .8rem; }

/* ===== provider switch ===== */
.provider-switch { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.2rem; padding: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.ps-label { font-size: .82rem; font-weight: 600; color: var(--muted); padding: 0 .4rem; }
.ps-opt { flex: 1; min-width: 200px; background: transparent; border: 1.5px solid transparent; border-radius: 10px; padding: .6rem .9rem; font-family: inherit; font-weight: 600; font-size: .9rem; color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.ps-opt small { font-weight: 400; color: var(--muted); }
.ps-opt:hover { background: var(--paper); }
.ps-opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.ps-opt.active small { color: rgba(255,255,255,.7); }

/* ===== vision tools ===== */
.vpanel { display: none; } .vpanel.active { display: block; animation: fade .3s ease; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .3rem; }
.btn-row .btn { padding: .55rem 1rem; font-size: .88rem; }
.auto-toggle { font-size: .82rem; color: var(--ink-soft); display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.upload-zone { border: 2px dashed var(--line); border-radius: 12px; background: var(--paper); min-height: 200px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.upload-zone.has-img { border-style: solid; border-color: var(--saffron); }
.upload-hint { text-align: center; color: var(--muted); padding: 1rem; }
.upload-icon { font-size: 2.2rem; }
.upload-hint p { margin: .4rem 0 .2rem; color: var(--ink-soft); font-weight: 500; }
#ocrPreview, #ocrCam { max-width: 100%; max-height: 320px; display: block; border-radius: 10px; }
.proctor-stage { position: relative; background: #0a1018; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; }
#proctorCam, #ocrCam { width: 100%; height: 100%; object-fit: cover; }
.proctor-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: flex-start; justify-content: flex-end; padding: .6rem; }
.po-idle { color: var(--muted); font-size: .9rem; margin: auto; }
.proctor-badge { font-family: var(--mono); font-size: .74rem; font-weight: 600; padding: .25rem .6rem; border-radius: 6px; color: #fff; }
.pb-ok { background: var(--green); } .pb-attention { background: var(--t1); } .pb-flag { background: var(--warn); }
.ocr-trans { background: var(--paper); border-radius: 9px; padding: .7rem; font-size: .86rem; color: var(--ink-soft); margin: .6rem 0; white-space: pre-wrap; max-height: 140px; overflow: auto; border: 1px solid var(--line); }
.plog { display: flex; flex-direction: column; gap: .5rem; }
.plog-row { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; font-size: .84rem; padding: .5rem .6rem; border-radius: 8px; background: var(--paper); border-left: 3px solid var(--line); }
.plog-row.ok { border-left-color: var(--green); } .plog-row.attention { border-left-color: var(--t1); } .plog-row.flag { border-left-color: var(--warn); background: #fdecea; }
.plog-t { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.plog-be { font-family: var(--mono); font-size: .68rem; color: var(--muted); }

/* ===== scale + pricing ===== */
.scale-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-top: 1.4rem; }
@media (max-width: 860px) { .scale-grid { grid-template-columns: 1fr 1fr; } }
.scale-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; box-shadow: var(--shadow); }
.scale-n { font-family: Fraunces, serif; font-size: 1.8rem; font-weight: 700; color: var(--saffron-dark); }
.scale-l { font-size: .85rem; color: var(--ink-soft); margin-top: .3rem; }
.price-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.3rem; margin-top: 1.5rem; }
@media (max-width: 860px) { .price-grid { grid-template-columns: 1fr; } }
.price-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.price-feature { border-color: var(--saffron); box-shadow: var(--shadow-lg); position: relative; }
.price-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--saffron); color: #fff; font-size: .72rem; font-weight: 700; padding: .2rem .7rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.price-card h3 { font-size: 1.2rem; margin: 0 0 .4rem; }
.price { font-family: Fraunces, serif; font-size: 2.1rem; font-weight: 700; color: var(--ink); }
.price span { font-family: Inter; font-size: .9rem; font-weight: 400; color: var(--muted); }
.price-sub { font-size: .88rem; color: var(--muted); margin: .2rem 0 .9rem; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 1.2rem; flex: 1; }
.price-card li { font-size: .9rem; color: var(--ink-soft); margin-bottom: .5rem; }
.price-card .btn { justify-content: center; }
