
:root {
  --bg: #f7f8fa; --card: #ffffff; --ink: #0f172a; --muted: #5b6474; --line: #e4e7ec;
  --brand: #2f5bea; --brand-ink: #ffffff; --brand-soft: #eaf0fe; --accent: #b45309; --accent-soft: #fef3e2;
  --ok: #15803d; --ok-soft: #e7f6ec; --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 3px rgb(15 23 42 / 0.06);
  --hero: #2f5bea; --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --card: #121a2b; --ink: #e6eaf2; --muted: #94a0b8; --line: #223049;
    --brand: #6b8cff; --brand-ink: #0b1220; --brand-soft: #1a2647; --accent: #f59e0b; --accent-soft: #33260f;
    --ok: #4ade80; --ok-soft: #12301f; --shadow: none; --hero: #16244f;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
a { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.95rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); padding: 0.7rem 1.3rem; font-size: 1rem; }
.logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo .logo-light { display: none; } .logo .logo-dark { display: block; } }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0.7rem 16px; display: flex; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; flex: none; }
.logo img { height: 22px; width: auto; display: block; }
.logo-tag { font-weight: 600; color: var(--muted); padding-left: 0.55rem; border-left: 1px solid var(--line); font-size: 0.95rem; }
.top-space { flex: 1; }
.top-search { flex: 1; max-width: 420px; margin-left: auto; }
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; gap: 0.6rem; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  .top .btn { margin-left: auto; }
  html { scroll-padding-top: 8.5rem; }
}

/* Search */
.search { position: relative; display: flex; align-items: center; }
.search > svg { position: absolute; left: 0.8rem; color: var(--muted); pointer-events: none; }
.search input { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.8rem 0.5rem 2.4rem; outline: none; }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(15 23 42 / 0.16); max-height: 70vh; overflow: auto; z-index: 20; text-align: left; }
.results a { display: block; padding: 0.7rem 0.9rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.on { background: var(--brand-soft); }
.results strong { display: inline; }
.r-cat { margin-left: 0.5rem; font-size: 0.78rem; color: var(--muted); }
.r-snip { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.results mark { background: var(--accent-soft); color: inherit; border-radius: 3px; }
.r-none { padding: 0.9rem; color: var(--muted); font-size: 0.92rem; }

/* Hub */
.hero { background: var(--hero); color: #fff; }
.hero-in { max-width: 720px; margin: 0 auto; padding: 3.5rem 16px 3.2rem; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 0.5rem; }
.hero p { margin: 0 0 1.6rem; color: #dbe4ff; font-size: 1.05rem; }
.hero-search input { background: #fff; color: #0f172a; border: 0; padding: 0.95rem 1rem 0.95rem 2.9rem; font-size: 1.05rem; border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); }
.hero-search > svg { left: 1rem; color: #5b6474; z-index: 1; }
.block { margin: 2.5rem 0; }
.sec { font-size: 1.15rem; margin: 0 0 1rem; }
.qs-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.qs { display: flex; gap: 0.85rem; align-items: flex-start; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.qs:hover, .cat:hover { border-color: var(--brand); }
.qs-n { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; }
.qs strong { display: block; }
.qs span span { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.cat-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cat { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s; }
.cat:hover { transform: translateY(-1px); }
.cat-icon { width: 2.5rem; height: 2.5rem; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 0.35rem; }
.cat strong { font-size: 1.05rem; }
.cat-desc { color: var(--muted); font-size: 0.92rem; line-height: 1.45; flex: 1; }
.cat-count { font-size: 0.8rem; color: var(--brand); font-weight: 600; margin-top: 0.3rem; }
.popular { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.popular a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.1rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.popular li:last-child a { border-bottom: 0; }
.popular a:hover { background: var(--brand-soft); }
.popular .muted { font-size: 0.85rem; white-space: nowrap; }
@media (max-width: 560px) { .popular a { flex-direction: column; gap: 0; } }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2.5rem 0 3rem; padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--brand-soft); }
.cta strong { display: block; font-size: 1.1rem; }
.cta span { color: var(--muted); }

/* Category pages */
.layout { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-top: 1.5rem; }
@media (min-width: 960px) { .layout { grid-template-columns: 260px minmax(0, 1fr); gap: 3rem; padding-top: 2rem; } }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list > li > a { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: 0.93rem; }
.side-list > li > a:hover { background: var(--card); color: var(--ink); }
.side-list > li.on > a { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.side-list ul { list-style: none; margin: 0.2rem 0 0.5rem 1.55rem; padding: 0 0 0 0.75rem; border-left: 1px solid var(--line); }
.side-list ul a { display: block; padding: 0.25rem 0.5rem; font-size: 0.86rem; color: var(--muted); text-decoration: none; line-height: 1.4; }
.side-list ul a:hover { color: var(--brand); }
.side-desk { display: none; }
.side-toggle { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.2rem 0.5rem; }
.side-toggle summary { padding: 0.55rem 0.3rem; font-weight: 600; cursor: pointer; }
.side-toggle .side-list { padding-bottom: 0.5rem; }
@media (min-width: 960px) {
  .side-toggle { display: none; }
  .side-desk { display: block; position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow: auto; }
}
.doc { min-width: 0; max-width: 760px; padding-bottom: 2rem; }
.crumbs { font-size: 0.88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.doc h1 { display: flex; align-items: center; gap: 0.7rem; font-size: clamp(1.7rem, 4vw, 2.2rem); margin: 0.5rem 0 0.3rem; }
.h1-icon { width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 0 0 1.5rem; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.2rem; margin-bottom: 1rem; }
.toc-h { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.toc ol { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.toc li { margin: 0.15rem 0; }
article { border-top: 1px solid var(--line); padding-top: 1.6rem; margin-top: 2rem; }
article h2 { font-size: 1.4rem; margin: 0 0 0.8rem; display: flex; align-items: center; gap: 0.4rem; }
.anchor { opacity: 0; color: var(--muted); display: inline-flex; transition: opacity 0.15s; }
article h2:hover .anchor, .anchor:focus { opacity: 1; }
article h4 { margin: 1.4rem 0 0.4rem; font-size: 1.02rem; }
article p, article li { max-width: 68ch; }
article li { margin: 0.25rem 0; }
.tbl { margin: 1rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
thead th { background: var(--bg); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tbody th { font-weight: 650; white-space: nowrap; }
@media (max-width: 640px) { tbody th { white-space: normal; } }
td ul { margin: 0; padding-left: 1.1rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rates td:not(:first-child) { font-variant-numeric: tabular-nums; }
.formula { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.9rem; background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; }
.path { font-weight: 600; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 0.05rem 0.4rem; white-space: nowrap; font-size: 0.92em; }
@media (max-width: 640px) { .path { white-space: normal; } }
.ex { border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--card); border-radius: 10px; padding: 0.8rem 1rem; margin: 1rem 0; }
.ex-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand); }
.ex p { margin: 0.4rem 0; }
.ex .tbl { margin: 0.6rem 0 0.3rem; }
.ex table { font-size: 0.88rem; }
.callout { border-radius: 10px; padding: 0.75rem 1rem; margin: 1rem 0; font-size: 0.95rem; }
.callout.tip { background: var(--ok-soft); }
.callout.tip strong { color: var(--ok); }
.callout.note { background: var(--accent-soft); }
.callout.note strong { color: var(--accent); }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 0.6rem 0; }
.faq summary { padding: 0.9rem 1.1rem; font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq-a { padding: 0 1.1rem 0.4rem; }
.faq-a p { margin: 0 0 0.8rem; }
.gloss { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.gloss > div { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--line); }
.gloss > div:last-child { border-bottom: 0; }
.gloss > div:target, article:target h2 { background: var(--accent-soft); border-radius: 6px; }
.gloss dt { font-weight: 700; }
.gloss dd { margin: 0.15rem 0 0; }
.gloss dd p { margin: 0; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 3rem; }
.pager a { display: flex; flex-direction: column; padding: 0.9rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--brand); }
.pager .next { text-align: right; grid-column: 2; }
.pager .muted { font-size: 0.8rem; }

.hol-group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 0.6rem 0; padding: 0 1rem; }
.hol-group summary { padding: 0.8rem 0; font-weight: 650; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; }
.hol-group[open] summary { border-bottom: 1px solid var(--line); }
.hol-group .muted { font-weight: 400; font-size: 0.88rem; }
.hol-group .tbl { border: 0; border-radius: 0; margin: 0.3rem 0 1rem; }
.src { font-size: 0.88rem; margin: 0.7rem 0 0.3rem; }
.small { font-size: 0.88rem; }
.hol-years { display: grid; gap: 0 1.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.hol-years h5 { margin: 0.8rem 0 0; font-size: 0.95rem; }
.num-l { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.tag.regular { background: var(--brand-soft); color: var(--brand); }
.tag.special { background: var(--accent-soft); color: var(--accent); }
.tag.special-working { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* Support dialog */
dialog.support { border: 0; border-radius: 16px; padding: 1.2rem 1.4rem 1.3rem; max-width: min(360px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / 0.3); text-align: center; }
dialog.support::backdrop { background: rgb(15 23 42 / 0.5); }
.support-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.support-head h2 { font-size: 1.1rem; margin: 0; }
.support-x { background: none; border: 0; font-size: 1.1rem; color: var(--muted); cursor: pointer; width: 2.2rem; height: 2.2rem; border-radius: 50%; }
.support-x:hover { background: var(--bg); }
dialog.support img { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 0.8rem; border-radius: 12px; background: #fff; }
dialog.support p { font-size: 0.92rem; margin: 0 0 0.5rem; text-align: left; }
.support-fine { color: var(--muted); font-size: 0.82rem !important; }

/* Footer */
.foot { border-top: 1px solid var(--line); background: var(--card); }
.foot-in { max-width: 1120px; margin: 0 auto; padding: 1.5rem 16px 2rem; font-size: 0.88rem; color: var(--muted); }
.foot p { margin: 0.3rem 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
