:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #13201b;
  --muted: #5b6b65;
  --border: #dde5e1;
  --accent: #0f8a5f;
  --accent-strong: #0a6b49;
  --accent-soft: #dff3ea;
  --accent-2: #f2a93b;
  --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 8px 24px rgba(16, 40, 30, .06);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1412;
    --surface: #141e1b;
    --surface-2: #1b2824;
    --text: #e6efeb;
    --muted: #9aaba4;
    --border: #26352f;
    --accent: #34c48d;
    --accent-strong: #5fd8a8;
    --accent-soft: #163a2d;
    --accent-2: #f5b95a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1412; --surface: #141e1b; --surface-2: #1b2824; --text: #e6efeb; --muted: #9aaba4;
  --border: #26352f; --accent: #34c48d; --accent-strong: #5fd8a8; --accent-soft: #163a2d; --accent-2: #f5b95a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent-strong); }
img, svg { max-width: 100%; }
.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer a { color: var(--muted); }

/* Hero */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.15rem; margin: 0 auto 28px; max-width: 560px; }
.search { position: relative; max-width: 480px; margin: 0 auto; }
.search input { width: 100%; padding: 14px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tool grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 32px; }
.card-link { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-link .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 1.4rem; }
.card-link h3 { margin: 4px 0 0; font-size: 1.1rem; }
.card-link p { margin: 0; color: var(--muted); font-size: .93rem; }
.tag { align-self: flex-start; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-strong); }
.empty { text-align: center; color: var(--muted); display: none; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 56px; }
.features div { padding: 4px; }
.features h3 { margin: 0 0 4px; font-size: 1rem; }
.features p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Tool page */
.crumbs { font-size: .88rem; color: var(--muted); margin: 24px 0 8px; }
.crumbs a { color: var(--muted); }
.page-title { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 24px; font-size: 1.05rem; }

.tool { display: grid; grid-template-columns: 1.05fr 1fr; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 1rem; margin: 0 0 14px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field label, .label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .95rem; }
.input-wrap { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; }
.input-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.input-wrap input, .input-wrap select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.1rem; font-weight: 600; padding: 11px 0; outline: none; }
.unit { color: var(--muted); font-weight: 600; padding-inline: 4px; white-space: nowrap; }
input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--accent); }
textarea { width: 100%; min-height: 260px; resize: vertical; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; padding: 14px; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: .92rem; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.stats { display: grid; gap: 12px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.stat:last-child { border-bottom: 0; }
.stat-label { color: var(--muted); font-weight: 600; font-size: .95rem; }
.stat-value { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; text-align: right; }
.stat--big { flex-direction: column; align-items: flex-start; gap: 2px; background: var(--accent-soft); border-radius: 12px; padding: 16px; border: 0; }
.stat--big .stat-value { font-size: clamp(1.8rem, 5vw, 2.4rem); color: var(--accent-strong); letter-spacing: -.02em; text-align: left; }

.donut-row { display: flex; align-items: center; gap: 18px; margin: 18px 0 4px; }
.donut { --p: 50; flex: none; width: 112px; height: 112px; border-radius: 50%; background: conic-gradient(var(--accent) 0 calc(var(--p) * 1%), var(--accent-2) 0); position: relative; }
.donut::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--surface); }
.legend { display: grid; gap: 6px; font-size: .92rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; font-size: .92rem; padding: 9px 16px; border-radius: 999px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); }

.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.mini .row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 600; }
.mini .row .input-wrap { width: 120px; flex: none; }
.mini .answer { margin-top: 14px; font-size: 1.6rem; font-weight: 800; color: var(--accent-strong); font-variant-numeric: tabular-nums; min-height: 2.4rem; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
details.schedule summary { cursor: pointer; font-weight: 700; color: var(--accent-strong); margin-top: 18px; }

/* Content */
.content { max-width: 760px; margin-top: 48px; }
.content h2 { font-size: 1.45rem; letter-spacing: -.01em; margin: 36px 0 10px; }
.content h3 { font-size: 1.1rem; margin: 24px 0 6px; }
.content p, .content li { color: var(--text); }
.formula { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; overflow-x: auto; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

.related h2 { margin-top: 48px; }
.related .grid { margin-top: 12px; }

/* Monetization blocks */
.ad { margin: 28px auto; min-height: 90px; text-align: center; }
.ad--placeholder { display: grid; place-items: center; border: 2px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.promo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-top: 20px; }
.promo p { margin: 0; }
.promo strong { display: block; }
.promo small { color: var(--muted); }
.tip { text-align: center; margin-top: 40px; color: var(--muted); }

.prose { max-width: 760px; }
.prose h1 { font-size: 2rem; letter-spacing: -.02em; }

@media (max-width: 820px) {
  .tool { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .nav a.hide-sm { display: none; }
}
