:root {
  --bg: #eef2e6; --card: #fbfcf7; --panel: #f1f5ea; --ink: #1d2b22; --muted: #56665a; --line: #d3dcc8; --field: #ffffff;
  --accent: #2f6f5e; --accent-btn: #2f6f5e; --accent-ink: #ffffff; --reed: #7a5a2e; --frog: #3f7d2a;
  --ok: #24663d; --ok-bg: #e2f1e7; --bad: #9b1f2c; --bad-bg: #f8e1e3; --info-bg: #e6eee0; --warn: #87470e; --warn-bg: #fbeedb;
  --shadow: 0 1px 2px rgba(30, 50, 30, 0.06), 0 12px 28px rgba(30, 50, 30, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111814; --card: #18221c; --panel: #1f2b24; --ink: #e7efe6; --muted: #a9bcac; --line: #314238; --field: #131b16;
    --accent: #8fd3bd; --accent-btn: #8fd3bd; --accent-ink: #0d2019; --reed: #e2c08a; --frog: #a7dc8c;
    --ok: #9ad8ab; --ok-bg: #1b3326; --bad: #ffabb4; --bad-bg: #3b1d24; --info-bg: #23312a; --warn: #f4c28c; --warn-bg: #382a1b; --shadow: none;
  }
}
html[data-theme="dark"] {
  --bg: #111814; --card: #18221c; --panel: #1f2b24; --ink: #e7efe6; --muted: #a9bcac; --line: #314238; --field: #131b16;
  --accent: #8fd3bd; --accent-btn: #8fd3bd; --accent-ink: #0d2019; --reed: #e2c08a; --frog: #a7dc8c;
  --ok: #9ad8ab; --ok-bg: #1b3326; --bad: #ffabb4; --bad-bg: #3b1d24; --info-bg: #23312a; --warn: #f4c28c; --warn-bg: #382a1b; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; letter-spacing: 0.005em; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.88rem; } .muted { color: var(--muted); }

.top, .bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.back { text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.logo { width: 26px; height: 26px; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-s { font-size: 0.85rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

.btn, .pill { font: inherit; font-size: 0.9rem; border: 1.5px solid var(--accent); color: var(--accent); background: transparent; border-radius: 10px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover:not(:disabled), .pill:hover { background: var(--info-bg); }
.btn.solid, .pill.solid { background: var(--accent-btn); color: var(--accent-ink); }
.btn.solid:hover:not(:disabled), .pill.solid:hover { filter: brightness(1.1); background: var(--accent-btn); color: var(--accent-ink); }
.btn.big { font-size: 1.05rem; padding: 10px 24px; }
.btn.tiny, .pill.tiny { font-size: 0.8rem; padding: 4px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 24px; }
.hero { padding: 22px 0 8px; text-align: center; }
.eyebrow { margin: 0; color: var(--reed); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; font-weight: 600; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); margin: 4px 0 6px; line-height: 1.05; }
h1 .sub { display: block; font-size: 1.05rem; font-weight: 400; color: var(--muted); margin-top: 8px; font-family: system-ui, sans-serif; }
.lede { max-width: 680px; margin: 8px auto; color: var(--ink); }
.samples { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.sample { font: inherit; font-size: 0.88rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.sample.on { border-color: var(--accent); background: var(--info-bg); font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
.ch { font-size: 1.2rem; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-btn); color: var(--accent-ink); font-size: 0.85rem; font-family: system-ui, sans-serif; }
.free, .paid { font: 600 0.7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; }
.free { background: var(--ok-bg); color: var(--ok); } .paid { background: var(--warn-bg); color: var(--warn); }
.lab { display: block; font-weight: 600; font-size: 0.9rem; margin: 8px 0 4px; }
.inp { width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
textarea.inp { resize: vertical; min-height: 150px; }
.row2 { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; align-items: center; }

.gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.ticks { border-collapse: collapse; font-size: 0.85rem; min-width: 100%; }
table.ticks th, table.ticks td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: center; }
table.ticks th.trow { text-align: left; font-weight: 600; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--card); }
table.ticks th.tcol { vertical-align: bottom; height: 120px; font-weight: 500; color: var(--muted); }
table.ticks th.tcol span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; max-height: 112px; overflow: hidden; text-overflow: ellipsis; }
table.ticks th.corner { position: sticky; left: 0; background: var(--card); }
table.ticks input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.pond-wrap { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.pond-wrap svg { display: block; width: 100%; height: auto; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; font-size: 0.88rem; counter-reset: lg; }
.legend li { counter-increment: lg; display: flex; align-items: center; gap: 6px; min-width: 0; }
.legend li::before { content: counter(lg) "."; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,0.25); }
.sw.big { width: 18px; height: 18px; margin-top: 4px; }
.findings { padding-left: 18px; margin: 8px 0 0; font-size: 0.92rem; }
.findings li { margin: 3px 0; }

.progress { background: var(--panel); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.steps { list-style: none; padding: 0; margin: 6px 0; font-size: 0.9rem; }
.step { color: var(--muted); } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--ok); }
.step-ic { display: inline-block; width: 1em; font-family: ui-monospace, monospace; }
.raw { white-space: pre-wrap; background: var(--panel); padding: 10px; border-radius: 8px; font-size: 0.82rem; max-height: 300px; overflow: auto; }
.result { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.rhead { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { font: 700 0.72rem system-ui, sans-serif; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 999px; background: var(--info-bg); color: var(--muted); }
.badge.v-kept { background: var(--ok-bg); color: var(--ok); } .badge.v-flagged { background: var(--warn-bg); color: var(--warn); }
.answers { list-style: none; padding: 0; margin: 10px 0; }
.answers li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.answers h4 { margin: 2px 0; font-size: 1rem; overflow-wrap: anywhere; }
.answers p { margin: 4px 0 0; }
.verdict { font: 700 0.68rem system-ui, sans-serif; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 6px; background: var(--info-bg); color: var(--accent); }
.verdict.v-alone { color: var(--reed); } .verdict.v-pair { color: var(--frog); }
.keeper { font-family: Georgia, serif; font-style: italic; font-size: 1.05rem; border-left: 4px solid var(--accent); padding: 4px 12px; margin: 10px 0; }
.keeper:empty { display: none; }
.recon { padding-left: 18px; font-size: 0.88rem; }
.recon li.warn { color: var(--warn); } .recon li.info { color: var(--muted); } .recon li.none { color: var(--ok); list-style: none; margin-left: -18px; }
.kh { font-size: 1rem; margin: 12px 0 4px; }

.saved { list-style: none; padding: 0; margin: 8px 0 0; }
.hrow { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hrow.none { color: var(--muted); }
.hthumb svg { display: block; border-radius: 6px; }
.hinfo { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.hbtns { display: flex; gap: 6px; }
.about p { max-width: 820px; }
.foot { max-width: 1120px; margin: 0 auto; padding: 10px 16px 40px; color: var(--muted); font-size: 0.88rem; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 20; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 14px; font-size: 0.9rem; transition: opacity 0.5s; }
.toast.err { background: var(--bad); color: #fff; } .toast.gone { opacity: 0; }
.toast a { color: inherit; font-weight: 700; }
@media (max-width: 520px) {
  .top { gap: 8px; padding: 8px 12px; } .back-t { display: none; } .brand strong { font-size: 1rem; }
  .btn { padding: 5px 10px; } main { padding: 6px 12px 20px; } .card { padding: 12px; }
}
@media print { .top, .samples, .actions, .runcard .actions, .toasts, #formCard, .foot { display: none !important; } .card { box-shadow: none; } }
