:root {
  --bg: #fafaf9; --surface: #ffffff; --text: #1c1917; --muted: #57534e;
  --line: #e7e5e4; --accent: #1d4ed8; --accent-soft: #bfdbfe; --result: #eff6ff;
  --radius: 12px; --max: 960px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09; --surface: #1c1917; --text: #f5f5f4; --muted: #a8a29e;
    --line: #292524; --accent: #60a5fa; --accent-soft: #1e3a8a; --result: #0b1a3a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.logo { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--surface); font-weight: 900; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--accent); }

h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.25; margin: 0.4em 0 0.4em; }
h2 { font-size: 1.4rem; line-height: 1.3; margin-top: 2em; }
h3 { font-size: 1.12rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.crumbs { font-size: 0.9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.byline, .updated, .meta { color: var(--muted); font-size: 0.9rem; }

.prose { max-width: 720px; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--surface); }
.prose blockquote, .note { margin: 1.2em 0; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.prose code { background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 0.92em; }
.formula { font-family: ui-monospace, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; }

.hero { padding: 32px 0 8px; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.btn, .tool button { display: inline-block; background: var(--accent); color: var(--surface); border: 0; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover, .tool button:hover { filter: brightness(1.08); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); text-decoration: none; transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; color: var(--accent); }
.card p { margin: 0 0 6px; color: var(--muted); font-size: 0.95rem; }

.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 24px 0; }
.tool .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tool label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.93rem; }
.tool label small { font-weight: 400; color: var(--muted); }
.tool input, .tool select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.tool input:focus, .tool select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.result { margin-top: 18px; padding: 16px; background: var(--result); border-radius: var(--radius); border: 1px solid var(--accent-soft); }
.result:empty { display: none; }
.result .big { font-size: 1.6rem; font-weight: 800; color: var(--accent); display: block; }
.result table { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin-top: 10px; }
.result td, .result th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.result td:first-child, .result th:first-child { text-align: left; }
.result .scroll { max-height: 320px; overflow: auto; }
.error { color: #dc2626; font-weight: 600; }

.author-box { margin-top: 40px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.author-box p { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }
.related { margin-top: 32px; }

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 28px 0 16px; font-size: 0.93rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner > div { max-width: 460px; }
.footer-nav { display: flex; flex-direction: column; gap: 4px; }
.footer-nav a { color: var(--muted); }
.copyright { margin-top: 20px; font-size: 0.85rem; }
