:root {
  color-scheme: light;
  --color-primary: #1976d2;
  --color-primary-strong: #0d5fae;
  --color-primary-soft: #eaf4fd;
  --color-accent: #0f8a60;
  --color-background: #f3f6f9;
  --color-surface: #ffffff;
  --color-foreground: #172033;
  --color-muted: #637083;
  --color-border: #dce3ea;
  --color-ring: #58a6e7;
  --color-danger: #c93636;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-sm: 6px;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow: 0 5px 18px rgb(28 54 82 / 8%);
  --container: 1200px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #58a6e7;
  --color-primary-strong: #8fc6f0;
  --color-primary-soft: #172c43;
  --color-accent: #48c79c;
  --color-background: #0e1621;
  --color-surface: #152131;
  --color-foreground: #edf4fb;
  --color-muted: #a7b4c4;
  --color-border: #2c3b4d;
  --color-ring: #78baf0;
  --shadow: 0 6px 20px rgb(0 0 0 / 22%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--color-background); color: var(--color-foreground); font-size: 15px; line-height: 1.65; }
a { color: var(--color-primary-strong); text-decoration: none; transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease; }
a:hover { color: var(--color-primary); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, a, input, select { touch-action: manipulation; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--color-ring) 70%, transparent); outline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.container { width: min(calc(100% - 32px), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; background: var(--color-surface); border: 2px solid var(--color-primary); border-radius: var(--radius-sm); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; z-index: 50; top: 0; background: color-mix(in srgb, var(--color-surface) 94%, transparent); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
.header-inner { display: flex; min-height: 72px; align-items: center; gap: var(--space-4); }
.brand { display: flex; flex: 0 0 auto; align-items: center; }
.brand img { width: 164px; height: 48px; }
.primary-nav { margin-left: auto; }
.primary-nav ul { display: flex; align-items: center; gap: 2px; padding: 0; margin: 0; list-style: none; }
.primary-nav a { display: grid; min-height: 44px; padding: 10px 16px; place-items: center; border-radius: var(--radius-sm); color: var(--color-foreground); font-weight: 600; }
.primary-nav a:hover { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.primary-nav a.active { background: var(--color-primary); color: white; }
.icon-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; color: var(--color-foreground); background: transparent; border: 1px solid transparent; border-radius: 50%; transition: background-color 180ms ease, border-color 180ms ease; }
.icon-button:hover { background: var(--color-primary-soft); border-color: var(--color-border); }
.nav-toggle { display: none; margin-left: auto; }

.page-shell { min-height: 68vh; padding-block: var(--space-5) var(--space-6); }
.breadcrumb { display: flex; min-height: 36px; align-items: center; gap: 8px; margin-bottom: var(--space-3); overflow: hidden; color: var(--color-muted); font-size: 13px; white-space: nowrap; }
.breadcrumb span:last-child { overflow: hidden; text-overflow: ellipsis; }
.content-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: var(--space-4); align-items: start; }
.main-column, .sidebar { display: grid; min-width: 0; gap: var(--space-4); }
.sidebar { position: sticky; top: 88px; }
.card { min-width: 0; padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; min-height: 40px; align-items: center; gap: 10px; margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4); padding: 10px 14px; color: white; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong)); border-radius: var(--radius) var(--radius) 0 0; }
.section-heading h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.heading-icon { display: grid; width: 28px; height: 28px; place-items: center; color: var(--color-primary-strong); background: white; border-radius: 50%; }
.heading-icon .icon { width: 16px; height: 16px; }
.snapshot-pill { margin-left: auto; padding: 2px 8px; color: #143654; background: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; }
.heading-link { display: inline-flex; min-height: 32px; align-items: center; margin-left: auto; color: white; font-size: 13px; font-weight: 700; }
.heading-link:hover { color: white; text-decoration: underline; }

.converter { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(180px, 1.2fr) 44px minmax(180px, 1.2fr) auto; gap: var(--space-3); align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: var(--color-muted); font-size: 13px; font-weight: 700; }
.field input, .field select { width: 100%; min-height: 46px; padding: 9px 12px; color: var(--color-foreground); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.field input:hover, .field select:hover { border-color: var(--color-ring); }
.field input:focus, .field select:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 24%, transparent); }
.primary-button, .swap-button { min-height: 46px; border: 0; border-radius: var(--radius-sm); font-weight: 700; transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, opacity 180ms ease; }
.primary-button { display: inline-grid; padding: 10px 18px; place-items: center; color: white; background: var(--color-accent); box-shadow: 0 4px 10px rgb(15 138 96 / 16%); }
.primary-button:hover { color: white; background: color-mix(in srgb, var(--color-accent) 86%, black); }
.primary-button:active { opacity: .82; }
.swap-button { display: grid; width: 44px; padding: 0; place-items: center; color: var(--color-primary-strong); background: var(--color-primary-soft); border: 1px solid var(--color-border); }
.swap-button:hover { color: white; background: var(--color-primary); }
.conversion-result { margin-top: var(--space-4); padding: 14px 16px; text-align: center; background: var(--color-primary-soft); border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border)); border-radius: var(--radius-sm); }
.result-equation { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 7px; font-size: 16px; }
.result-equation strong { color: var(--color-danger); font-size: clamp(22px, 3vw, 30px); font-variant-numeric: tabular-nums; }
.result-equation .equals { margin-inline: 8px; color: var(--color-muted); font-weight: 800; }
.conversion-result p { margin: 3px 0 0; color: var(--color-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.data-note { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0; color: var(--color-muted); font-size: 12px; }
.data-note .icon { width: 16px; height: 16px; margin-top: 2px; }

.article-card { padding: clamp(20px, 4vw, 36px); }
.archive-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: var(--color-muted); font-size: 12px; }
.archive-status span { display: inline-flex; align-items: center; gap: 5px; }
.archive-status .icon { width: 15px; height: 15px; }
.article-card h1 { max-width: 25em; margin: 0; font-size: clamp(25px, 4vw, 36px); line-height: 1.3; letter-spacing: -.02em; }
.lead { max-width: 68ch; margin: 14px 0 0; color: var(--color-muted); font-size: 16px; }
.answer-box { margin-top: var(--space-5); padding: var(--space-4); background: var(--color-background); border-left: 4px solid var(--color-primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.answer-box h2 { margin: 0 0 6px; font-size: 18px; }
.answer-box p { margin: 0; }

.chart { min-height: 240px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--color-border); stroke-width: 1; }
.chart .area { fill: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.chart .trend { fill: none; stroke: var(--color-primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--color-surface); stroke: var(--color-primary); stroke-width: 3; }
.chart text { fill: var(--color-muted); font-family: inherit; font-size: 11px; }
.chart-summary { margin: 4px 0 12px; color: var(--color-muted); font-size: 13px; }
.chart-data { max-width: 100%; overflow-x: auto; border-radius: var(--radius-sm); }
.chart-data table { width: 100%; min-width: 500px; border-collapse: collapse; font-size: 12px; }
.chart-data th, .chart-data td { padding: 6px 8px; text-align: center; border: 1px solid var(--color-border); font-variant-numeric: tabular-nums; }

.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.rate-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rate-table th, .rate-table td { padding: 8px 9px; text-align: right; border-bottom: 1px solid var(--color-border); }
.rate-table thead th { color: var(--color-foreground); background: var(--color-primary-soft); font-weight: 800; white-space: nowrap; }
.rate-table th:first-child { text-align: left; }
.rate-table tbody tr:last-child > * { border-bottom: 0; }
.rate-table tbody tr:hover { background: color-mix(in srgb, var(--color-primary-soft) 58%, transparent); }
.rate-table small { display: inline-block; margin-left: 4px; color: var(--color-muted); font-size: 10px; }
.card-subtitle { margin: -5px 0 10px; color: var(--color-muted); font-size: 12px; }
.text-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 4px; font-weight: 700; }
.disclaimer h2 { margin: 0 0 8px; font-size: 17px; }
.disclaimer p { margin: 0; color: var(--color-muted); font-size: 13px; }

.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 24px; padding: 0; margin: 0; list-style: none; }
.link-grid a { display: block; min-height: 42px; padding: 9px 0; overflow: hidden; border-bottom: 1px dashed var(--color-border); text-overflow: ellipsis; white-space: nowrap; }
.article-list, .directory-list { padding: 0; margin: 0; list-style: none; }
.article-list li + li, .directory-list li + li { border-top: 1px solid var(--color-border); }
.article-list a, .directory-list a { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 4px; }
.article-list span, .directory-list span { overflow-wrap: anywhere; }
.article-list small, .directory-list small { flex: 0 0 auto; color: var(--color-muted); }
.directory-list { columns: 2; column-gap: 32px; }
.directory-list li { break-inside: avoid; }
.directory-list li + li { border-top: 0; }
.directory-list a { border-bottom: 1px solid var(--color-border); }

.home-intro { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-4); padding: clamp(22px, 5vw, 42px); color: white; background: linear-gradient(125deg, #0d5fae, #1976d2 55%, #2590e8); border-radius: 14px; box-shadow: var(--shadow); }
.home-intro h1, .page-title h1 { margin: 4px 0 8px; font-size: clamp(28px, 5vw, 42px); line-height: 1.25; letter-spacing: -.025em; }
.home-intro p { max-width: 64ch; margin: 0; color: rgb(255 255 255 / 84%); font-size: 16px; }
.hero-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 12px; padding: 8px 14px; color: #124875; background: white; border-radius: var(--radius-sm); font-weight: 800; }
.hero-link:hover { color: var(--color-primary-strong); background: #eef8ff; }
.eyebrow { color: inherit; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.intro-badge { display: grid; flex: 0 0 auto; min-width: 150px; padding: 20px; place-items: center; background: rgb(255 255 255 / 12%); border: 1px solid rgb(255 255 255 / 20%); border-radius: var(--radius); }
.intro-badge strong { font-size: 34px; font-variant-numeric: tabular-nums; }
.intro-badge span { font-size: 13px; }
.home-page .converter-card { margin-bottom: var(--space-4); }
.directory-overview { margin-bottom: var(--space-4); }
.directory-cards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.directory-card { display: grid; min-width: 0; min-height: 92px; padding: 12px; align-content: center; justify-items: center; color: var(--color-foreground); background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--radius-sm); text-align: center; }
.directory-card:hover { color: var(--color-primary-strong); background: var(--color-primary-soft); border-color: var(--color-ring); }
.directory-card span { max-width: 100%; overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.directory-card strong { margin-top: 2px; color: var(--color-primary-strong); font-size: 21px; font-variant-numeric: tabular-nums; }
.directory-card small { color: var(--color-muted); font-size: 11px; }
.page-title { margin-bottom: var(--space-4); padding: clamp(12px, 3vw, 24px) 0; }
.page-title .eyebrow { color: var(--color-primary); }
.page-title p { max-width: 68ch; margin: 0; color: var(--color-muted); font-size: 16px; }
.daxie-card form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: end; }
.daxie-result { margin-top: var(--space-4); padding: 20px; color: var(--color-primary-strong); background: var(--color-primary-soft); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: clamp(18px, 3vw, 25px); font-weight: 800; }
.empty-state { display: grid; max-width: 620px; min-height: 50vh; margin: auto; place-content: center; justify-items: center; text-align: center; }
.empty-state strong { color: var(--color-primary); font-size: clamp(72px, 16vw, 160px); line-height: 1; }
.empty-state h1 { margin: 10px 0 0; }
.empty-state p { color: var(--color-muted); }
.archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.archive-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-bottom: 10px; border-bottom: 1px solid var(--color-border); }
.archive-group-head .eyebrow { color: var(--color-muted); }
.archive-group-head h2 { margin: 1px 0 0; font-size: 23px; }
.archive-group-head > strong { color: var(--color-primary-strong); font-size: 28px; font-variant-numeric: tabular-nums; }
.archive-group-head > strong small { color: var(--color-muted); font-size: 12px; }
.archive-group ul { padding: 8px 0 0; margin: 0; list-style: none; }
.archive-group li + li { border-top: 1px dashed var(--color-border); }
.archive-group li a { display: block; min-height: 40px; padding: 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-footer { color: #d8e6f3; background: #15314b; }
.footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); padding-block: 26px; }
.site-footer strong { color: white; font-size: 17px; }
.site-footer p { margin: 4px 0 0; }
.footer-link { display: inline-flex; min-height: 40px; align-items: center; color: white; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.footer-link:hover { color: #d8efff; }
.footer-note { align-self: center; color: #aac0d2; font-size: 13px; }
.back-top { position: fixed; z-index: 40; right: 18px; bottom: 18px; display: grid; width: 46px; height: 46px; padding: 0; place-items: center; color: white; background: var(--color-primary); border: 0; border-radius: 50%; box-shadow: 0 8px 20px rgb(13 95 174 / 28%); opacity: 0; pointer-events: none; transition: opacity 180ms ease, background-color 180ms ease; }
.back-top.visible { opacity: 1; pointer-events: auto; }
.back-top:hover { background: var(--color-primary-strong); }

@media (max-width: 1024px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .converter { grid-template-columns: minmax(110px, .8fr) minmax(180px, 1fr) 44px minmax(180px, 1fr); }
  .converter .primary-button { grid-column: 1 / -1; }
  .directory-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .nav-toggle { display: grid; }
  .theme-toggle { order: 4; }
  .primary-nav { position: absolute; top: calc(100% + 1px); right: 0; left: 0; display: none; margin: 0; padding: 8px 16px 14px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow); }
  .primary-nav.open { display: block; }
  .primary-nav ul { align-items: stretch; flex-direction: column; }
  .primary-nav a { justify-content: flex-start; }
  .home-intro { align-items: flex-start; flex-direction: column; }
  .intro-badge { width: 100%; min-width: 0; grid-template-columns: auto auto; justify-content: center; gap: 12px; }
  .directory-list { columns: 1; }
  .archive-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { width: min(calc(100% - 20px), var(--container)); }
  .page-shell { padding-top: 14px; }
  .brand img { width: 146px; height: auto; }
  .header-inner { min-height: 64px; gap: 6px; }
  .converter { grid-template-columns: 1fr 44px 1fr; }
  .amount-field { grid-column: 1 / -1; }
  .converter .primary-button { grid-column: 1 / -1; }
  .card { padding: 14px; }
  .section-heading { margin: -14px -14px 14px; }
  .section-heading h2 { font-size: 15px; }
  .snapshot-pill { display: none; }
  .result-equation strong { font-size: 22px; }
  .link-grid { grid-template-columns: 1fr; }
  .directory-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
  .daxie-card form { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .theme-toggle { display: none; }
  .converter { grid-template-columns: 1fr; }
  .swap-button { width: 100%; }
  .rate-table { min-width: 470px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
