@view-transition { navigation: auto; }

:root {
  --bg: #f5f5f0;
  --bg-glow: rgba(132, 204, 22, 0.18);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #0f0f0d;
  --muted: #62625b;
  --border: rgba(15, 15, 13, 0.09);
  --border-strong: rgba(15, 15, 13, 0.18);
  --accent: #3f7d0a;
  --accent-bright: #84cc16;
  --accent-ink: #0f0f0d;
  --accent-soft: rgba(132, 204, 22, 0.14);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 40px -12px rgba(0,0,0,.12);
  --radius: 22px;
  --radius-sm: 12px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  --z1: #60a5fa; --z2: #34d399; --z3: #facc15; --z4: #fb923c; --z5: #f43f5e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0a;
    --bg-glow: rgba(190, 242, 100, 0.10);
    --surface: rgba(28, 28, 25, 0.66);
    --surface-solid: #1a1a17;
    --text: #f2f2ec;
    --muted: #9b9b92;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #bef264;
    --accent-bright: #bef264;
    --accent-ink: #0b0b0a;
    --accent-soft: rgba(190, 242, 100, 0.10);
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -20px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--bg-glow), transparent 70%),
    radial-gradient(40rem 24rem at -10% 10%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--accent-bright); }
::selection { background: var(--accent-bright); color: #0b0b0a; }

.wrap { width: min(100% - 32px, 980px); margin-inline: auto; }

/* ---------- Header ---------- */
header.site {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  view-transition-name: header;
}
header.site .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.03em; text-decoration: none; margin-right: auto;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-bright); color: #0b0b0a;
}
.logo-mark svg { width: 16px; height: 16px; }
nav.main { display: flex; gap: 2px; flex-wrap: wrap; }
nav.main a {
  text-decoration: none; color: var(--muted); font-size: 0.92rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; transition: color .2s, background .2s;
}
nav.main a:hover { color: var(--text); background: var(--accent-soft); }
nav.main a[aria-current="page"] { color: var(--text); background: var(--surface-solid); box-shadow: 0 0 0 1px var(--border); }

/* ---------- Hero ---------- */
main { padding: clamp(32px, 6vw, 72px) 0 64px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 16px;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 12px var(--accent-bright); }
h1 {
  font-size: clamp(2.3rem, 6.5vw, 4.4rem); line-height: 1.02; letter-spacing: -0.045em;
  font-weight: 700; margin: 0 0 16px; text-wrap: balance;
}
h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 46ch; margin: 0 0 clamp(28px, 5vw, 48px); text-wrap: pretty; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.03em; line-height: 1.15; margin: 64px 0 12px; text-wrap: balance; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; margin: 24px 0 4px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3.5vw, 32px);
}
.calc { display: grid; gap: 24px; }
@media (min-width: 820px) {
  .calc { grid-template-columns: 1.1fr 1fr; align-items: stretch; }
}

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--border); margin-bottom: 20px; max-width: 100%; overflow-x: auto;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: block; padding: 7px 16px; border-radius: 999px; font-size: 0.92rem; font-weight: 550; white-space: nowrap;
  color: var(--muted); transition: all .2s;
}
.segmented input:checked + span { background: var(--text); color: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented label:hover input:not(:checked) + span { color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- Fields ---------- */
.fields { display: grid; gap: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.01em; }
.input-wrap { position: relative; }
.field input, .field select {
  width: 100%; font: 500 1.35rem/1.2 var(--mono); letter-spacing: -0.02em;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field select { font-family: var(--font); font-size: 1.05rem; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent-bright); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[readonly] { background: transparent; border-style: dashed; color: var(--muted); }
.unit { position: absolute; right: 16px; top: 50%; translate: 0 -50%; color: var(--muted); font-size: 0.85rem; pointer-events: none; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button {
  font: 500 0.82rem var(--font); padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text); transition: all .15s;
}
.chips button:hover { border-color: var(--accent-bright); background: var(--accent-soft); }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Result panel ---------- */
.result {
  position: relative; overflow: hidden;
  border-radius: calc(var(--radius) - 6px);
  background: #0b0b0a; color: #f2f2ec;
  padding: clamp(20px, 4vw, 32px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px; min-height: 260px;
}
.result::before {
  content: ""; position: absolute; inset: auto -20% -60% auto; width: 80%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(190,242,100,.35), transparent 65%); pointer-events: none;
}
.result-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: #9b9b92; font-weight: 600; }
.result-big {
  font: 600 clamp(3rem, 10vw, 5.2rem)/1 var(--mono); letter-spacing: -0.06em; color: #bef264;
  font-variant-numeric: tabular-nums; margin-top: 8px; word-break: break-word;
}
.result-big small { font-size: 0.32em; letter-spacing: 0; color: #9b9b92; margin-left: 6px; font-family: var(--font); font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 16px; position: relative; }
.stat dt { font-size: 0.75rem; color: #9b9b92; text-transform: uppercase; letter-spacing: 0.1em; }
.stat dd { margin: 2px 0 0; font: 600 1.15rem var(--mono); letter-spacing: -0.02em; }
.result .error { color: #fda4af; font-weight: 600; position: relative; }
.result-empty { color: #9b9b92; position: relative; }

.result-big.pop { animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { font-family: var(--mono); font-size: 0.95rem; letter-spacing: -0.01em; }
td:first-child { font-family: var(--font); font-weight: 550; }
th { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; background: var(--accent-soft); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--accent-soft); }
tr.highlight td { background: var(--accent-soft); font-weight: 700; }

/* ---------- Zones ---------- */
.zones { display: grid; gap: 10px; }
.zone {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px;
  padding: 14px 18px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border);
}
.zone-tag { font: 700 0.85rem var(--mono); padding: 4px 10px; border-radius: 8px; color: #0b0b0a; }
.zone-name { font-weight: 600; }
.zone-desc { grid-column: 2 / -1; color: var(--muted); font-size: 0.88rem; }
.zone-range { font: 600 1.05rem var(--mono); letter-spacing: -0.02em; }
.zone-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--border); position: relative; overflow: hidden; }
.zone-bar i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }

/* ---------- Bento tools ---------- */
.bento { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.bento a { text-decoration: none; }
.bento .card { height: 100%; transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .25s; display: flex; flex-direction: column; gap: 6px; }
.bento a:hover .card { transform: translateY(-3px); border-color: var(--accent-bright); }
.bento .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.bento .icon svg { width: 20px; height: 20px; }
.bento strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.bento span { color: var(--muted); font-size: 0.92rem; }
.bento .arrow { margin-top: auto; padding-top: 10px; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

/* ---------- Prose / ads / footer ---------- */
.prose { max-width: 68ch; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }
.prose ul { padding-left: 1.2em; }
.formula { font-family: var(--mono); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; color: var(--text); }

.ad-slot {
  margin: 56px 0; min-height: 100px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em;
}

footer.site { border-top: 1px solid var(--border); padding: 32px 0 48px; color: var(--muted); font-size: 0.9rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--text); }

.share { margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: #9b9b92; font: 500 0.85rem var(--font); cursor: pointer; padding: 0; position: relative; }
.share:hover { color: #f2f2ec; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}
