:root, [data-theme="light"] {
  --bg: #f5f3ee; --panel: #ffffff; --ink: #16202b; --muted: #59636e; --line: #dcd8cf; --soft: #efece5;
  --accent: #24508f; --accent-ink: #ffffff; --accent-soft: #e2eaf6; --bad: #b3261e; --ok: #1e6f45; --warn-bg: #fff3d6;
  --pool: #a8a49b; --shadow: 0 1px 2px rgba(20,30,40,.05), 0 6px 18px rgba(20,30,40,.05);
}
[data-theme="dark"] {
  --bg: #10151c; --panel: #18202a; --ink: #e7ecf2; --muted: #a3adb9; --line: #2c3643; --soft: #212a35;
  --accent: #8fb4ea; --accent-ink: #0d1a2c; --accent-soft: #1d2b40; --bad: #f28b82; --ok: #7fcf9f; --warn-bg: #2f2815;
  --pool: #6b7380; --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow-x: hidden; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .bad { color: var(--bad); } .strong { font-weight: 600; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { color: var(--accent); flex: none; }
.brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sep { color: var(--muted); }
.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.backlink { text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.credits { font-size: .86rem; color: var(--muted); }
.topup { font-size: .86rem; }

button { font: inherit; cursor: pointer; border-radius: 10px; min-height: 40px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 8px 20px; font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary.big { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-size: 1.05rem; min-height: 48px; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 6px 12px; }
.ghost:hover:not(:disabled) { background: var(--soft); }
.ghost.sq { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ghost.strong { font-weight: 600; border-color: var(--accent); color: var(--accent); }
.quiet { background: none; border: none; color: var(--accent); padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
button.small { min-height: 40px; }
.linkbtn { background: none; border: none; color: var(--accent); padding: 4px 0; min-height: 40px; text-align: left; font-weight: 600; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.hero { padding: 22px 0 8px; max-width: 760px; }
h1 { font-size: clamp(1.55rem, 4.6vw, 2.25rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { margin: 0 0 10px; color: var(--muted); font-size: 1.04rem; }
.perks { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; }
.perks li { font-size: .82rem; background: var(--accent-soft); color: var(--ink); padding: 3px 10px; border-radius: 999px; }
textarea, input[type=text], input[type=month], select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.start { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.start > label.field { color: var(--ink); font-weight: 600; margin: 0; }
.msgarea { display: block; width: 100%; font-size: 1rem; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.start .primary { justify-self: start; min-width: 180px; min-height: 46px; }
.startsub { margin: 0; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
.chipbtn { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .9rem; min-height: 40px; }
.chipbtn:hover, .chipbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.msg { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--soft); }
.msg.bad { background: var(--warn-bg); color: var(--ink); border-left: 3px solid var(--bad); }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; margin-top: 16px; align-items: start; scroll-margin-top: 64px; }
.viewer { padding: 14px; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.headline { margin: 0 0 10px; line-height: 1.6; font-size: 1.05rem; overflow-wrap: anywhere; }
.verdict { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--soft); vertical-align: 1px; }
.verdict.good { background: #dcf3e5; color: #135c35; }
.verdict.consider { background: #fff1cc; color: #6b4b00; }
.verdict.avoid { background: #fde2df; color: #8c1d17; }
.h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.hintp { margin: 0 0 8px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
label.field output { color: var(--ink); font-weight: 600; }
label.field select, label.field input { width: 100%; min-height: 40px; padding: 4px 8px; }
label.field input[type=range] { padding: 0; }
.hintline { font-size: .8rem; color: var(--muted); }

/* the split */
.splitfig { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: center; margin: 4px 0 14px; }
.pie { width: 180px; height: 180px; display: block; }
.pie .slice { stroke: var(--panel); stroke-width: 1.5; }
.pie-big { font-size: 34px; font-weight: 700; fill: var(--ink); }
.pie-small { font-size: 12px; fill: var(--muted); }
.tablewrap { overflow-x: auto; max-width: 100%; }
.splittable, .vesttable { border-collapse: collapse; width: 100%; font-size: .92rem; }
.splittable th, .splittable td, .vesttable th, .vesttable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.splittable td.nm { white-space: normal; overflow-wrap: anywhere; }
.splittable th, .vesttable th { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.poolrow td { color: var(--muted); }
.totalrow td { font-weight: 700; border-bottom: none; border-top: 2px solid var(--ink); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; }
.exportbox { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.exp-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.exp-grid .ghost { flex: 1 1 auto; }
#exportMsg { margin: 0; } #exportMsg:empty { display: none; }

/* controls */
.segrow { display: flex; flex-wrap: wrap; gap: 6px; }
.segbtn { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 40px; }
.segbtn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.founders { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 0 0 8px; }
.founders.dim .fgrid { opacity: .5; }
.fcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg); min-width: 0; }
.fhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fhead .swatch { flex: none; }
.fname { flex: 1; min-width: 0; min-height: 40px; padding: 4px 8px; font-weight: 600; }
.fremove { flex: none; font-size: .82rem; padding: 4px 10px; }
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rate { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--muted); }
.rate select { min-height: 40px; padding: 4px 6px; width: 100%; }
.more { margin-top: 14px; }
.more summary { cursor: pointer; color: var(--accent); padding: 8px 0; min-height: 40px; font-weight: 600; }
.weights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.weights .hintp { grid-column: 1 / -1; }
.optgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 14px; margin-top: 6px; }

/* vesting */
.vestbox { margin: 0 0 8px; }
.vestchart { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.vestchart .axis { stroke: var(--line); stroke-width: 1; }
.vestchart .cliffline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.vestchart .lbl { font-size: 10px; fill: var(--muted); font-family: system-ui, -apple-system, sans-serif; }
.vestbox figcaption { text-align: center; margin-top: 4px; }

/* checks */
.checks { list-style: none; margin: 6px 0 0; padding: 0; font-size: .92rem; }
.checks li { padding: 6px 10px 6px 30px; border-radius: 8px; margin: 4px 0; position: relative; background: var(--soft); }
.checks li::before { position: absolute; left: 10px; top: 6px; font-weight: 700; }
.checks li.ok::before { content: "\2713"; color: var(--ok); }
.checks li.warn { background: var(--warn-bg); } .checks li.warn::before { content: "!"; color: #a05a00; }
.checks li.bad { background: var(--warn-bg); border-left: 3px solid var(--bad); } .checks li.bad::before { content: "!"; color: var(--bad); }
.checks li.info::before { content: "i"; color: var(--accent); }

/* AI */
.ai { padding: 12px 14px; }
.ai summary { cursor: pointer; font-weight: 600; padding: 4px 0; min-height: 40px; }
.sum-t { font-weight: 600; }
.badge { font-size: .74rem; font-weight: 500; background: var(--soft); color: var(--muted); border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.hint { font-size: .88rem; color: var(--muted); margin: 8px 0; }
.hint.bad { color: var(--bad); }
.warn-soft { background: var(--warn-bg); color: var(--ink); padding: 8px 10px; border-radius: 8px; }
.ai textarea { width: 100%; min-height: 96px; padding: 8px 10px; resize: vertical; }
.ai-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.progress { margin-top: 10px; padding: 10px; background: var(--soft); border-radius: 10px; }
.progresshead { display: flex; justify-content: space-between; }
.steps { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; color: var(--muted); }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.done { color: var(--ok); }
.report { margin-top: 10px; font-size: .9rem; }
.report p { margin: 6px 0; }
.report ul { margin: 4px 0 8px; padding-left: 20px; }
.report h3 { font-size: .95rem; margin: 14px 0 4px; }
.report table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.report th, .report td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.report .flags { background: var(--warn-bg); border-radius: 8px; padding: 6px 10px 6px 26px; }
.report .flags li { color: var(--bad); }
.disclaimer { margin: 0 4px; }

.history { margin-top: 16px; padding: 14px; }
.historylist { list-style: none; padding: 0; margin: 8px 0 0; }
.historylist li { padding: 2px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }

.about { margin-top: 32px; max-width: 760px; }
.about h2 { font-size: 1.2rem; margin: 22px 0 8px; }
.howlist { padding-left: 20px; } .howlist li { margin: 6px 0; }
.faq dt { font-weight: 600; margin-top: 12px; } .faq dd { margin: 4px 0 0; color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding: 18px 16px 30px; text-align: center; color: var(--muted); font-size: .88rem; }
.foot p { margin: 4px 0; }

/* docs pages */
.doc { max-width: 900px; padding-top: 18px; }
.doc h1 { font-size: 1.8rem; } .doc h2 { margin-top: 28px; }
.doc table { border-collapse: collapse; width: 100%; font-size: .9rem; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc pre { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: .84rem; line-height: 1.45; margin: 0; }
.codegroup { margin: 10px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tab { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 4px 10px; min-height: 34px; font-size: .84rem; }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.statebox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--panel); }
.statebox p { margin: 4px 0; }
.tokenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tokenbox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); width: 100%; }
.mini { background: var(--panel); border: 1px solid var(--line); color: var(--ink); padding: 6px 12px; border-radius: 10px; }

@media (max-width: 880px) {
  .work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .topbar { padding: 8px 12px; }
  .hero { padding-top: 14px; }
  .lede { font-size: .98rem; }
  .start .primary { justify-self: stretch; }
  .splitfig { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .splitfig .tablewrap { width: 100%; }
  .splittable th, .splittable td { padding: 6px 5px; font-size: .86rem; }
  .splittable th:nth-child(5), .splittable td:nth-child(5) { display: none; }
  .weights, .optgrid { grid-template-columns: minmax(0, 1fr); }
  .optgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .founders { grid-template-columns: minmax(0, 1fr); }
}
