:root {
  --bg: #f6f8fb; --card: #fff; --ink: #0f1b2d; --muted: #55627a; --line: #dde3ec;
  --brand: #0b6bcb; --brand-ink: #fff; --accent: #f5a623; --ok: #12805c; --warn-bg: #fff4e5; --warn: #8a4b00;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,27,45,.06), 0 4px 16px rgba(15,27,45,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1420; --card: #152033; --ink: #e8eef7; --muted: #9fb0c8; --line: #263449; --brand: #4ea1ff; --brand-ink: #06111f; --warn-bg: #3a2a10; --warn: #ffd18a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--brand); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--ink); font-size: 1rem; }
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 56px; left: 0; right: 0; background: var(--card); flex-direction: column; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
  .nav-open .nav { display: flex; }
}

/* Tool hero: calculator first, compact title */
.tool-hero { padding: 18px 0 8px; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(1.35rem, 3.2vw, 1.9rem); line-height: 1.25; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 14px; }
h2 { font-size: 1.4rem; margin: 2em 0 .6em; line-height: 1.3; }
h3 { font-size: 1.1rem; margin: 0 0 .5em; }

/* Tool */
.tool-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .tool-grid { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.result { position: sticky; top: 72px; border-top: 4px solid var(--brand); }
@media (max-width: 860px) { .result { position: static; } }
.lbl { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 6px; }
.lbl small { font-weight: 400; color: var(--muted); }
.input { width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; }
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.input-sm { padding: 6px 8px; min-height: 38px; max-width: 92px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.hidden { display: none !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; min-height: 36px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.custom { display: flex; gap: 8px; margin: 8px 0; }
.custom .input:first-child { flex: 2; } .custom .input { flex: 1; }
.dev-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .95rem; }
.dev-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.dev-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dev-table .empty { color: var(--muted); text-align: center; padding: 14px; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; }
.x:hover { background: var(--bg); color: #c0392b; }
@media (max-width: 560px) {
  .dev-table thead { display: none; }
  .dev-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .dev-table td { border: 0; padding: 0; }
  .dev-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .dev-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); }
  .input-sm { max-width: 100%; }
}
.big { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; margin: 0 0 10px; color: var(--brand); line-height: 1.1; }
.big small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stats-4 { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.stat-l { font-size: .75rem; color: var(--muted); }
.stat-v { font-weight: 700; font-size: 1.05rem; }
.stat-s { font-size: .75rem; color: var(--muted); }
.hint { font-size: .85rem; color: var(--muted); margin: 8px 0; }
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.tip { background: var(--bg); border-left: 3px solid var(--ok); padding: 8px 12px; border-radius: 6px; font-size: .92rem; }
.empty { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; min-height: 44px; }
.btn-buy { background: var(--accent); color: #1d1300; width: 100%; }
.btn-buy:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-small { padding: 6px 12px; min-height: 40px; background: var(--brand); color: var(--brand-ink); }
.share { margin-top: 10px; }

/* Recommendations */
.recs-h { margin: 26px 0 6px; font-size: 1.2rem; }
.disclosure { font-size: .8rem; color: var(--muted); margin: 0 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.product h4 { margin: 8px 0 6px; font-size: 1.05rem; }
.product .specs { list-style: none; padding: 0; margin: 0 0 12px; font-size: .9rem; color: var(--muted); flex: 1; }
.product .specs li { padding: 2px 0; }
.product .specs b { color: var(--ink); }
.runtime { font-size: .92rem; margin: 0 0 10px; }
.badge { align-self: flex-start; background: var(--bg); color: var(--brand); border: 1px solid var(--line); font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }

/* Content */
.content { max-width: 760px; }
.content p, .content li { color: var(--ink); }
.content table, .table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: .95rem; background: var(--card); border-radius: 10px; overflow: hidden; }
.content th, .content td, .table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.content th, .table th { background: var(--bg); font-size: .85rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
th[data-k] { cursor: pointer; white-space: nowrap; }
th[data-k]::after { content: " ↕"; color: var(--muted); }
.formula { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 12px 14px; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; overflow-x: auto; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0; }
summary { font-weight: 600; cursor: pointer; }
.meta { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 28px; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 28px; }
.related a { text-decoration: none; color: var(--ink); }
.related .card:hover { border-color: var(--brand); }
.related p { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.guide-list { columns: 2 280px; padding-left: 18px; }
.guide-list li { break-inside: avoid; padding: 3px 0; }
.embed-box textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* Home */
.home-hero { padding: 40px 0 20px; text-align: center; }
.home-hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
.home-hero .lead { max-width: 640px; margin: 8px auto 0; font-size: 1.1rem; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin: 24px 0 40px; }
.tools a { text-decoration: none; color: var(--ink); }
.tools .card { height: 100%; transition: transform .1s; }
.tools .card:hover { transform: translateY(-2px); border-color: var(--brand); }
.tools .ico { font-size: 1.8rem; }
.tools h2 { font-size: 1.15rem; margin: 6px 0; }
.tools p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Mobile sticky result */
.result-bar { display: none; }
@media (max-width: 860px) {
  .result-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 20; padding: 12px 16px; border: 0; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font: inherit; font-size: .95rem; box-shadow: 0 6px 24px rgba(0,0,0,.25); cursor: pointer; text-align: left; transition: transform .2s, opacity .2s; }
  .result-bar[hidden], .result-bar.off { transform: translateY(150%); opacity: 0; pointer-events: none; }
  .result-bar span:last-child { white-space: nowrap; font-weight: 700; }
}

/* Ads: reserved space prevents layout shift */
.ad-slot { min-height: 280px; margin: 24px 0; display: flex; align-items: center; justify-content: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 48px; padding: 28px 0; font-size: .9rem; color: var(--muted); }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.site-footer a { color: var(--muted); display: block; padding: 2px 0; }
.site-footer h4 { color: var(--ink); margin: 0 0 6px; font-size: .95rem; }
.embed body, body.embed { background: var(--card); }
body.embed .wrap { padding: 8px; }
.powered { font-size: .8rem; text-align: right; margin-top: 8px; }
