:root {
  --ink: #0e1a14;
  --muted: #4a5c52;
  --line: rgba(14, 26, 20, 0.1);
  --paper: #eef6f1;
  --panel: rgba(255, 255, 255, 0.86);
  --brand: #0b6b45;
  --brand-2: #148f5c;
  --accent: #c9851a;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(14, 26, 20, 0.08);
  --radius: 16px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -5%, rgba(20,143,92,.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(201,133,26,.12), transparent 50%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + 1.2rem);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1100px, calc(100% - 1.25rem)); margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(238,246,241,.86);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 0;
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.4rem;
  color: var(--ink); letter-spacing: -.02em; text-decoration: none;
}
.brand span { color: var(--brand); }
.top-actions { display: flex; gap: .45rem; align-items: center; }
.icon-btn, .chip, .btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer;
}
.icon-btn { padding: .45rem .75rem; font-size: .82rem; }
.btn {
  padding: .65rem 1rem; background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn.ghost { background: #fff; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hero { padding: 1.25rem 0 .75rem; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: -.03em; line-height: 1.1; max-width: 16ch;
}
.hero p { color: var(--muted); margin-top: .45rem; max-width: 54ch; }

.tool-rail {
  display: flex; gap: .45rem; overflow-x: auto; padding: .35rem 0 .9rem;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tool-rail::-webkit-scrollbar { display: none; }
.tool-rail a, .tool-rail button {
  flex: 0 0 auto; padding: .5rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.75);
  color: var(--muted); font: inherit; font-size: .84rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.tool-rail a.active, .tool-rail button.active,
.tool-rail a:hover, .tool-rail button:hover {
  background: var(--ink); color: #fff; border-color: var(--ink); text-decoration: none;
}

.layout { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(8px); padding: 1rem;
}
.calc { flex: 1 1 340px; }
.results { flex: 1 1 300px; display: flex; flex-direction: column; gap: .85rem; }

.field { margin-bottom: .9rem; }
.field label {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: .35rem;
}
.field label strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.field input[type="range"] { width: 100%; accent-color: var(--brand); }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .85rem; font: inherit; background: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .8rem; }
.chip { padding: .35rem .7rem; font-size: .78rem; background: #fff; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.stat {
  padding: .9rem; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(160deg, #fff, #f5faf7);
}
.stat .label { font-size: .75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value {
  font-family: var(--font-display); font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -.02em; margin-top: .15rem;
}
.stat.accent { background: linear-gradient(145deg, #0b6b45, #148f5c); color: #fff; border: 0; }
.stat.accent .label { color: rgba(255,255,255,.78); }
.stat.soft .value { font-size: 1.25rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }

.bar { height: 12px; border-radius: 999px; background: #dfe8e2; overflow: hidden; display: flex; }
.bar > span:first-child { background: var(--brand); }
.bar > span:last-child { background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: .7rem 1.1rem; font-size: .82rem; color: var(--muted); font-weight: 650; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; margin-right: .3rem; }
.dot.p { background: var(--brand); } .dot.i { background: var(--accent); }

.pie-wrap { display: flex; align-items: center; gap: 1rem; }
.pie {
  width: 88px; height: 88px; border-radius: 50%;
  background: conic-gradient(var(--brand) var(--p, 60%), var(--accent) 0);
  flex: 0 0 auto;
}

.year-bars { display: flex; align-items: flex-end; gap: 4px; height: 72px; margin-top: .4rem; }
.year-bars span {
  flex: 1; min-width: 0; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  opacity: .85;
}

.table-wrap { overflow: auto; max-height: 280px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: #f7fbf8; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 720px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card h3 { font-size: .9rem; margin-bottom: .6rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 12px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .65rem 1rem; border-radius: 999px;
  font-size: .85rem; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 80;
}
.toast.show { opacity: 1; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--nav-h); background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 750;
}
.bottom-nav a.active { color: var(--brand); }
.bottom-nav svg { width: 20px; height: 20px; }

.history-list { display: flex; flex-direction: column; gap: .55rem; }
.history-item {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  cursor: pointer; text-align: left; width: 100%; font: inherit;
}
.history-item strong { display: block; }
.history-item small { color: var(--muted); }

.seo-block { padding: 1.4rem 0 2rem; }
.seo-block h2 { font-family: var(--font-display); font-size: 1.45rem; margin: 0 0 .55rem; }
.seo-block p, .seo-block li { color: var(--muted); margin-bottom: .55rem; }
.seo-block ul { padding-left: 1.15rem; }
.seo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .65rem; margin-top: .9rem; }
.seo-card {
  display: block; padding: .9rem; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,.72); color: var(--ink); font-weight: 750; text-decoration: none;
}
.seo-card:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.seo-card small { display: block; margin-top: .3rem; font-weight: 500; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; color: var(--muted); font-size: .88rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; justify-content: space-between; }
.footer-grid h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin-bottom: .4rem; }
.footer-grid a { display: block; color: var(--muted); margin-bottom: .25rem; text-decoration: none; }
.footer-grid a:hover { color: var(--brand); }

.adslot { min-height: 90px; margin: .75rem 0; display: flex; align-items: center; justify-content: center; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.hidden { display: none !important; }

.article-lead {
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: .85rem;
}
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 1.1rem 0 .45rem;
  letter-spacing: -.02em;
}
.prose p, .prose li { color: var(--muted); margin-bottom: .55rem; }
.prose ul, .prose ol { padding-left: 1.15rem; margin-bottom: .7rem; }
.prose strong { color: var(--ink); }
.prose .meta { font-size: .78rem; color: var(--muted); margin-top: 1rem; }
