@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(/fonts/inter-latin.woff2) format('woff2');
}

:root {
    --bg: #f5f5f3;
    --surface: #ffffff;
    --surface-2: #efefec;
    --border: #e2e2dd;
    --border-strong: #cdcdc6;
    --text: #17181b;
    --text-2: #3a3c42;
    --muted: #6b6e76;
    --accent: #f2a900;
    --accent-ink: #17181b;
    --link: #8a5a00;
    --link-hover: #5f3e00;
    --ring: rgba(242, 169, 0, .45);
    --header-bg: #17181b;
    --header-text: #f3f3f0;
    --header-muted: #a6a8ae;
    --code-bg: #f0efe9;
    --ok: #1f7a4d;
    --ok-soft: #e7f4ec;
    --warn-soft: #fff6dc;
    --danger: #b3261e;
    --ad-bg: #ffffff;
    --ad-border: #e2e2dd;
    --ad-label: #6b6e76;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(20, 20, 20, .05);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --wrap: 1160px;
}

[data-theme="dark"] {
    --bg: #111214;
    --surface: #1a1b1f;
    --surface-2: #222328;
    --border: #2b2d33;
    --border-strong: #3a3c44;
    --text: #ececea;
    --text-2: #c9cac6;
    --muted: #9a9ca3;
    --accent: #ffbf2e;
    --accent-ink: #111214;
    --link: #ffc94d;
    --link-hover: #ffdd8a;
    --ring: rgba(255, 191, 46, .4);
    --header-bg: #0b0c0d;
    --code-bg: #24252b;
    --ok: #6fd3a0;
    --ok-soft: rgba(111, 211, 160, .1);
    --warn-soft: rgba(255, 191, 46, .1);
    --danger: #ff8a80;
    --ad-bg: #f8f8f6;
    --ad-border: #3a3c44;
    --ad-label: #9a9ca3;
    --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.65 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .6em; color: var(--text); }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 3px solid var(--accent); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--header-text); font-weight: 800; font-size: 1.2rem; letter-spacing: .04em; text-transform: uppercase; }
.brand:hover { color: var(--header-text); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand span b { color: var(--accent); font-weight: 800; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--header-muted); font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: var(--radius-sm); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--header-text); background: rgba(255,255,255,.07); text-decoration: none; }
.theme-toggle { background: none; border: 1px solid #3a3c44; color: var(--header-text); width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; margin-left: 6px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (max-width: 640px) {
    .site-header .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 6px; gap: 6px 12px; }
    .nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
    .theme-toggle { margin-left: auto; }
}

main { min-height: 60vh; }
.page-head { padding: 44px 0 24px; }
.page-head p { color: var(--text-2); font-size: 1.1rem; max-width: 720px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 6px; }

.hero { padding: 56px 0 40px; }
.hero h1 { max-width: 760px; }
.hero p { font-size: 1.15rem; color: var(--text-2); max-width: 640px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 700 .95rem/1 var(--font); padding: 12px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.05); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-2); }
.btn-danger { background: none; color: var(--danger); border-color: var(--danger); }

.section { padding: 28px 0 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card:hover { border-color: var(--border-strong); }
.card a.cover { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); }
.card a.cover img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 1.08rem; }
.card h3 a { color: var(--text); }
.card p { color: var(--text-2); font-size: .95rem; margin: 0; }
.meta { font-size: .82rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--link); }

.tool-card { padding: 18px; gap: 10px; flex-direction: row; align-items: flex-start; }
.tool-card .icon { width: 42px; height: 42px; flex: none; border-radius: var(--radius-sm); background: var(--header-bg); color: var(--accent); display: grid; place-items: center; }
.tool-card .icon svg { width: 22px; height: 22px; }
.tool-card h3 { margin-bottom: 4px; }
.tool-card h3 a { color: var(--text); }
.tool-card p { font-size: .92rem; color: var(--text-2); margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 22px; }
.chip { font-size: .88rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface); }
.chip:hover, .chip[aria-current="page"] { border-color: var(--accent); color: var(--text); text-decoration: none; }
.chip[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

.empty { padding: 36px; text-align: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; padding-bottom: 48px; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.aside-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.aside-block h2 { font-size: 1rem; margin-bottom: 10px; }
.aside-block ul { list-style: none; margin: 0; padding: 0; }
.aside-block li { padding: 7px 0; border-top: 1px solid var(--border); font-size: .94rem; }
.aside-block li:first-child { border-top: 0; }

.article-cover { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.article-cover img { width: 100%; }
.article-cover figcaption { font-size: .8rem; color: var(--muted); padding: 8px 2px 0; background: var(--bg); }
.toc { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 28px; }
.toc strong { display: block; margin-bottom: 6px; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 3px 0; }

.prose { font-size: 1.06rem; color: var(--text-2); max-width: 760px; }
.prose h2 { margin-top: 1.9em; color: var(--text); }
.prose h3 { margin-top: 1.5em; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin: .35em 0; }
.prose strong { color: var(--text); }
.prose blockquote { margin: 1.4em 0; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--warn-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote p:last-child { margin: 0; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: 2px 5px; border-radius: 4px; }
.prose img { border-radius: var(--radius-sm); margin: 1.4em 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 1.3em 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prose table, .data-table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); }
.prose th, .prose td, .data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th, .data-table th { background: var(--surface-2); color: var(--text); font-weight: 700; }
.prose tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }

.callout { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 28px 0; }
.callout h2 { font-size: 1.05rem; margin-bottom: 10px; }
.sources ol { padding-left: 1.3em; margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.credits { font-size: .85rem; color: var(--muted); }
.credits p { margin: 0 0 .4em; }

.related-tools { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.related-tools a { display: block; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 650; }
.related-tools a:hover { border-color: var(--accent); text-decoration: none; }
.related-tools small { display: block; color: var(--muted); font-weight: 400; }

.ad-slot { margin: 32px 0; padding: 10px 12px 12px; background: var(--ad-bg); border: 1px solid var(--ad-border); border-radius: var(--radius); overflow: hidden; clear: both; }
.ad-slot .ad-label { display: block; margin-bottom: 6px; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ad-label); }
.ad-slot ins.adsbygoogle { min-width: 250px; }
.ad-slot:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

.calc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 0 0 32px; box-shadow: var(--shadow); }
.calc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.calc fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; min-width: 0; }
.calc legend { font-weight: 700; font-size: .92rem; padding: 0 6px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label, .label { font-size: .86rem; font-weight: 600; color: var(--text-2); }
.input, .field input, .field select, .field textarea {
    font: 500 1rem var(--font); color: var(--text); background: var(--bg);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.field .hint { font-size: .8rem; color: var(--muted); }
.unit-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.unit-toggle button { font: 600 .88rem var(--font); background: var(--surface); color: var(--text-2); border: 0; padding: 8px 14px; cursor: pointer; }
.unit-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.results { margin-top: 20px; }
.result-big { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.stat .s { font-size: .84rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.diff-pos { color: var(--ok); }
.diff-neg { color: var(--danger); }
.note { font-size: .88rem; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text-2); margin-top: 12px; }
.note.ok { background: var(--ok-soft); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.faq details { border-top: 1px solid var(--border); padding: 12px 0; }
.faq details:last-child { border-bottom: 1px solid var(--border); }
.faq summary { font-weight: 700; cursor: pointer; color: var(--text); }
.faq details p { margin: 10px 0 0; color: var(--text-2); }

.form { max-width: 620px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; background: var(--ok-soft); color: var(--text); border: 1px solid var(--ok); }
.alert.error { background: transparent; border-color: var(--danger); }
.hp { position: absolute; left: -5000px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 28px; }
.pagination a, .pagination span { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; font-size: .9rem; }
.pagination span[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pagination .disabled { color: var(--muted); }

.site-footer { margin-top: 40px; background: var(--header-bg); color: var(--header-muted); font-size: .92rem; padding: 36px 0 28px; }
.site-footer .cols { display: grid; gap: 28px; grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
.site-footer h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--header-text); margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--header-muted); }
.site-footer a:hover { color: var(--header-text); }
.site-footer .legal { border-top: 1px solid #2b2d33; margin-top: 26px; padding-top: 16px; font-size: .84rem; }

.err { text-align: center; padding: 80px 0; }
.err .code { font-size: 4rem; font-weight: 800; color: var(--accent); line-height: 1; }
