:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #5f6368;
  --border: #e2e2de;
  --accent: #d9480f;
  --accent-soft: #fff1e8;
  --code-bg: #f1f1ee;
  --error: #b42318;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --surface: #1d1f22;
    --text: #e8e8e6;
    --muted: #a0a3a8;
    --border: #2e3135;
    --accent: #ff8a4c;
    --accent-soft: #2b1d15;
    --code-bg: #26292d;
    --error: #ff7b72;
  }
}
* { 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, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--border); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo svg { width: 22px; height: 22px; }
header.site nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: .95rem; }
header.site nav a:hover { color: var(--text); }

.crumbs { font-size: .85rem; color: var(--muted); margin: 20px 0 4px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 8px 0 8px; }
.lede { color: var(--muted); margin: 0 0 24px; font-size: 1.05rem; }
h2 { font-size: 1.35rem; margin: 40px 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: .92em; }

.tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .tool { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
form .field { margin-bottom: 14px; }
form .field[hidden] { display: none; }
form label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.inputline { display: flex; align-items: stretch; }
.inputline input, .inputline select { flex: 1; min-width: 0; }
input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.unit { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.help { color: var(--muted); font-size: .82rem; margin-top: 3px; }

.results { position: sticky; top: 16px; }
.results h2 { margin: 0 0 12px; font-size: 1.1rem; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .label { color: var(--muted); }
.row .value { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.row.main { flex-direction: column; gap: 2px; background: var(--accent-soft); border: 0; border-radius: 8px; padding: 14px 16px; margin-bottom: 8px; }
.row.main .label { color: var(--text); font-size: .9rem; }
.row.main .value { font-size: 1.9rem; text-align: left; color: var(--accent); line-height: 1.2; }
.row.sub { padding: 4px 0 4px 14px; font-size: .9rem; }
.row.code { flex-direction: column; align-items: stretch; }
.row.code pre { margin: 6px 0; background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.row.code pre code { background: none; padding: 0; }
.error { color: var(--error); margin: 0; }
button {
  font: inherit; font-size: .9rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 6px 12px;
}
button:hover { border-color: var(--accent); }
.row.code button { align-self: flex-start; }
.share { margin-top: 14px; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .85rem; }

.mobilebar { display: none; }
@media (max-width: 760px) {
  .mobilebar:not(:empty) {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 2px solid var(--accent);
    color: var(--text); text-decoration: none; font-size: .9rem;
  }
  .mobilebar strong { color: var(--accent); font-size: 1.2rem; white-space: nowrap; }
  .results { position: static; }
  footer.site { padding-bottom: 80px; }
}

.prose { max-width: 720px; }
.prose li { margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.grid a.card { display: block; text-decoration: none; color: var(--text); transition: border-color .15s; }
.grid a.card:hover { border-color: var(--accent); }
.grid .tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.grid h3 { margin: 4px 0 6px; }
.grid p { margin: 0; color: var(--muted); font-size: .92rem; }

.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }

footer.site { margin-top: 64px; border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: .88rem; }
footer.site a { color: var(--muted); margin-right: 14px; }
