  :root {
    color-scheme: light;
    --paper: #f4efe4;
    --paper-sunk: #fffbf3;
    --ink: #18261f;
    --ink-soft: #3e4a43;
    --ink-muted: #5d6a62;
    --rule: #e2d8c4;
    --accent: #9c7631;
    --accent-soft: #c9a463;
    --action: #1f3a2e;
    --on-action: #f3ecda;
    --shadow: 0 14px 34px -24px rgba(60, 45, 15, 0.45);
    --bad: #b24a36;
    --good: #2f6b50;
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #111915;
    --paper-sunk: #18221d;
    --ink: #efe7d6;
    --ink-soft: #cfc7b5;
    --ink-muted: #a7b1a8;
    --rule: #2a3730;
    --accent: #d6b06c;
    --accent-soft: #b48d4b;
    --action: #ece2cb;
    --on-action: #13201a;
    --shadow: 0 14px 34px -24px rgba(0, 0, 0, 0.7);
    --bad: #ec9a86;
    --good: #8fcaa6;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --paper: #111915;
      --paper-sunk: #18221d;
      --ink: #efe7d6;
      --ink-soft: #cfc7b5;
      --ink-muted: #a7b1a8;
      --rule: #2a3730;
      --accent: #d6b06c;
      --accent-soft: #b48d4b;
      --action: #ece2cb;
      --on-action: #13201a;
      --shadow: 0 14px 34px -24px rgba(0, 0, 0, 0.7);
      --bad: #ec9a86;
      --good: #8fcaa6;
    }
  }

  body {
    background: var(--paper);
    color: var(--ink);
    font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }

  .wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding-inline: clamp(1.5rem, 4vw, 2.5rem);
    padding-block: 3.5rem 5rem;
  }

  h1, h2, h3 {
    font-family: Newsreader, Georgia, "Times New Roman", serif;
    font-weight: 600;
    text-wrap: balance;
    margin: 0;
    letter-spacing: -0.015em;
  }

  h1 {
    font-size: clamp(2.7rem, 7vw, 3.4rem);
    line-height: 1.04;
    font-variation-settings: "opsz" 72;
  }

  h2 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  h3 {
    font-family: "DM Sans", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  p { margin: 0; }
  strong { font-weight: 600; }

  a { color: var(--accent); }

  .stack { display: flex; flex-direction: column; }
  .gap-s > * + * { margin-top: 0.7rem; }

  section { margin-top: 3.25rem; }

  .lede {
    font-size: 1.22rem;
    line-height: 1.5;
    color: var(--ink-soft);
    margin-top: 1.5rem;
  }

  .calc { margin-top: 2rem; }
  .calc-ask {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
  }
  .calc-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 14rem;
  }
  .calc-sign {
    font-family: Newsreader, Georgia, serif;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--ink-muted);
  }
  .calc input {
    width: 100%;
    box-sizing: border-box;
    font-family: Newsreader, Georgia, serif;
    font-size: 1.8rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: var(--paper-sunk);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 0.35rem 0.6rem;
    appearance: textfield;
    -moz-appearance: textfield;
  }
  .calc input::-webkit-outer-spin-button,
  .calc input::-webkit-inner-spin-button { appearance: none; margin: 0; }
  .calc input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
  }
  .calc-figure {
    display: block;
    font-family: Newsreader, Georgia, serif;
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
  }
  .calc-note {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
  }

  ol.steps {
    list-style: none;
    padding: 0;
    margin: 1.4rem 0 0;
    counter-reset: step;
  }
  ol.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 1.9rem 1fr;
    gap: 0 0.85rem;
    padding-block: 0.85rem;
    border-top: 1px solid var(--rule);
    align-items: baseline;
  }
  ol.steps li::before {
    content: counter(step);
    font-family: Newsreader, Georgia, serif;
    font-size: 0.95rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }
  ol.steps li:last-child { border-bottom: 1px solid var(--rule); }
  ol.steps .what { font-weight: 600; }
  ol.steps .detail { color: var(--ink-soft); display: block; margin-top: 0.15rem; }
  p.after-steps { margin-top: 1.25rem; color: var(--ink-soft); }

  dl.plain { margin: 1.3rem 0 0; }
  dl.plain > div {
    padding-block: 0.95rem;
    border-top: 1px solid var(--rule);
  }
  dl.plain > div:last-child { border-bottom: 1px solid var(--rule); }
  dl.plain dt { font-weight: 600; }
  dl.plain dd { margin: 0.2rem 0 0; color: var(--ink-soft); }

  .note {
    background: var(--paper-sunk);
    border-left: 2px solid var(--accent);
    padding: 1.15rem 1.25rem;
    margin-top: 1.4rem;
  }
  .note p + p { margin-top: 0.7rem; }


  .topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: center;
    padding: calc(0.7rem + env(safe-area-inset-top, 0px)) clamp(1.5rem, 4vw, 2.5rem) 0.7rem;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule);
  }
  .mark {
    font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--accent);
  }
  .topright { display: flex; align-items: center; gap: 0.5rem; }
  .theme {
    display: inline-flex; gap: 2px; padding: 2px;
    border: 1px solid var(--rule); border-radius: 999px;
  }
  .theme button {
    display: grid; place-items: center;
    width: 2rem; height: 2rem; padding: 0;
    border-radius: 999px;
    background: transparent; color: var(--ink-muted);
  }
  .theme button[aria-pressed="true"] { background: var(--action); color: var(--on-action); }
  .theme svg { width: 1rem; height: 1rem; }
  .topbook {
    font-weight: 600; font-size: 0.92rem; text-decoration: none;
    color: var(--ink); border: 1px solid var(--rule); border-radius: 999px;
    padding: 0.4rem 0.9rem;
  }

  .hero { margin-top: 0; }

  .calc {
    margin-top: 2rem;
    padding: 1.4rem 1.3rem 1.5rem;
    background: var(--paper-sunk);
    border: 1px solid var(--rule);
    border-radius: 14px;
  }
  .calc-entry { max-width: none; }
  .calc .calc-sign { font-size: 2.6rem; }
  .calc input { font-size: 2.6rem; border-radius: 10px; padding: 0.3rem 0.7rem; }
  .calc-try { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
  .calc-try button {
    background: transparent; color: var(--ink-soft);
    border: 1px solid var(--rule); border-radius: 999px;
    font-size: 0.92rem; padding: 0.4rem 0.9rem;
  }
  .calc-out { margin-top: 1.2rem; min-height: 4.6rem; }
  .calc-wait { color: var(--ink-muted); font-size: 0.95rem; }
  .calc-sum { display: block; font-size: 0.95rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
  .calc .calc-figure { font-size: clamp(2.4rem, 11vw, 3.6rem); margin-top: 0.15rem; }

  .price {
    margin-top: 2.5rem;
    padding: 1.6rem 1.3rem;
    border: 1px solid var(--rule);
    border-radius: 14px;
    display: grid;
    gap: 1rem;
  }
  .price-top { display: flex; align-items: center; gap: 1rem; }
  .price .figure {
    font-family: Newsreader, Georgia, serif;
    font-size: 4rem; line-height: 1; font-weight: 600;
    font-variation-settings: "opsz" 72;
    font-variant-numeric: tabular-nums;
  }
  .price .unit { font-size: 1.05rem; color: var(--ink-soft); line-height: 1.35; }
  .facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .facts li {
    border: 1px solid var(--rule); border-radius: 10px; padding: 0.7rem 0.4rem;
    text-align: center; display: grid; gap: 0.1rem;
  }
  .facts b { font-family: Newsreader, Georgia, serif; font-size: 1.6rem; font-weight: 600; color: var(--accent); line-height: 1.1; }
  .facts span { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.25; }
  .price .anchor { font-size: 0.95rem; color: var(--ink-muted); }

  .btn {
    display: inline-block; text-align: center;
    background: var(--action); color: var(--on-action);
    font-weight: 600; font-size: 1.02rem; text-decoration: none;
    padding: 0.85rem 1.6rem; border-radius: 999px;
  }
  .btn.wide { display: block; }
  .btn:hover { filter: brightness(0.93); }
  .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

  .split, .buys { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.8rem; margin-top: 1.4rem; }
  .side, .buy { background: var(--paper-sunk); border: 1px solid var(--rule); border-radius: 14px; padding: 1.1rem 1.2rem; }
  .side.person, .buy.yes { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }
  .side-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.5rem; }
  .side.person .side-label, .buy.yes .side-label { color: var(--accent); }
  .side ul, .buy ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; color: var(--ink-soft); }
  .buy.no ul { list-style: "– "; }

  .pull {
    margin-top: 1.6rem;
    font-family: Newsreader, Georgia, serif;
    font-size: 1.45rem; line-height: 1.3;
    border-left: 2px solid var(--accent);
    padding-left: 1rem;
  }
  h3.sub { margin-top: 2.4rem; }
  .compare { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.5rem; }
  .compare li { border: 1px solid var(--rule); border-radius: 10px; padding: 0.7rem 0.4rem; text-align: center; display: grid; gap: 0.1rem; }
  .compare b { font-family: Newsreader, Georgia, serif; font-size: 1.15rem; font-weight: 600; line-height: 1.15; }
  .compare span { font-size: 0.78rem; color: var(--ink-muted); line-height: 1.2; }
  .compare li.me { border-color: var(--accent); }
  .compare li.me b { color: var(--accent); }

  .book { border: 1px solid var(--rule); border-radius: 14px; padding: 1.6rem 1.3rem; display: grid; gap: 1rem; }
  .ways { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
  .ways li { display: grid; gap: 0.05rem; border-top: 1px solid var(--rule); padding-top: 0.6rem; }
  .ways span { color: var(--ink-soft); font-size: 0.95rem; }
  .book .after { font-size: 0.95rem; color: var(--ink-muted); }

  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
    padding: 0.7rem clamp(1.5rem, 4vw, 2.5rem) calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--paper-sunk) 94%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--rule);
    font-size: 0.92rem; color: var(--ink-soft);
  }
  .dock[hidden] { display: none; }
  .dock b { font-family: Newsreader, Georgia, serif; font-size: 1.2rem; color: var(--ink); }
  .calc, .price, .book, .side, .buy { box-shadow: var(--shadow); }
  .price, .book { background: var(--paper-sunk); }
  .facts li, .compare li { background: var(--paper); }
  .topbook { color: var(--action); border-color: var(--action); }
  .calc-try button:hover { border-color: var(--accent-soft); color: var(--ink); }
  .dock .btn { padding: 0.6rem 1.1rem; font-size: 0.95rem; white-space: nowrap; }
  body { padding-bottom: 4.5rem; }

  footer {
    margin-top: 4rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--rule);
    font-size: 0.95rem;
    color: var(--ink-muted);
  }
  footer a { color: var(--accent); }

  a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
  }


.back {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-decoration: none;
  margin-bottom: 1.6rem;
}
.back:hover { color: var(--accent); }

form.fields { margin-top: 1.8rem; }

.field { margin-top: 1.4rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 0.15rem;
}
.field .hint {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.7rem 0.75rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
select { appearance: none; background-image: none; }

button {
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  background: var(--action);
  color: var(--on-action);
  border: 0;
  border-radius: 2px;
  padding: 0.85rem 1.6rem;
  cursor: pointer;
}
button:hover { filter: brightness(0.93); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
button[disabled] { opacity: 0.55; cursor: default; filter: none; }

button.quiet {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--rule);
  font-size: 0.92rem;
  padding: 0.5rem 0.9rem;
}
button.danger { background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); }

.actions { margin-top: 1.8rem; display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }

.msg {
  margin-top: 1.3rem;
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--accent);
  background: var(--paper-sunk);
  font-size: 0.98rem;
}
.msg.bad { border-left-color: var(--bad); }
.msg.good { border-left-color: var(--good); }

.status-line {
  margin-top: 1.6rem;
  padding-block: 1.3rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.status-line .label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.status-line .value a {
  font-family: "DM Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.status-line .value {
  font-family: Newsreader, Georgia, serif;
  font-size: 2.1rem;
  line-height: 1.1;
  font-weight: 600;
  margin-top: 0.3rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.big-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2.6rem;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  margin-top: 0.3rem;
}

.rows { margin-top: 1.6rem; }
.row {
  padding-block: 1.1rem;
  border-top: 1px solid var(--rule);
}
.row:last-child { border-bottom: 1px solid var(--rule); }
.row .meta { font-size: 0.9rem; color: var(--ink-muted); }
.row .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  word-break: break-all;
  margin-top: 0.35rem;
}
