:root {
  color-scheme: light;
  --ground: #f6f5f2;
  --surface: #fff;
  --surface-alt: #f5ece8;
  --ink: #231e1b;
  --muted: #625b56;
  --line: #e5e0db;
  --accent: #b92c25;
  --accent-strong: #9f241e;
  --accent-ink: #fff;
  --radius: 12px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

[data-theme="blue"] {
  --ground: #edf3f8;
  --surface: #fff;
  --surface-alt: #e6eff8;
  --ink: #192a3e;
  --muted: #4f6275;
  --line: #d4e0ea;
  --accent: #225ea4;
  --accent-strong: #194d8b;
  --radius: 8px;
}

[data-theme="paper"] {
  --ground: #f3f0e7;
  --surface: #fffdf5;
  --surface-alt: #eeebd8;
  --ink: #2e3225;
  --muted: #615e50;
  --line: #dbd5bf;
  --accent: #4e6336;
  --accent-strong: #394e24;
  --radius: 4px;
}

[data-theme="night"] {
  color-scheme: dark;
  --ground: #10151b;
  --surface: #19212a;
  --surface-alt: #2b3031;
  --ink: #f6f1e9;
  --muted: #b7c1cc;
  --line: #36414d;
  --accent: #ffae68;
  --accent-strong: #ffc68d;
  --accent-ink: #24170d;
  --radius: 11px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font: 16px/1.6 var(--font); color: var(--ink); background: var(--ground); }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1200px, calc(100% - 60px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 8; transform: translateY(-150%); background: var(--surface); padding: 7px 14px; }
.skip-link:focus { transform: none; }

.masthead { background: var(--surface); }
.masthead-inner { min-height: 92px; display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(220px, 2.4fr) minmax(max-content, 1fr); align-items: center; gap: 28px; }
.brand { display: block; width: fit-content; line-height: 1.2; }
.brand strong { font-size: 2rem; letter-spacing: .025em; font-weight: 800; }
.search { display: flex; align-items: center; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 46px; padding: 3px; }
.search input { width: 100%; min-width: 0; border: 0; color: var(--ink); background: none; padding: 8px 12px; }
.search input::placeholder { color: var(--muted); }
.search .select-wrap { flex: none; border-right: 1px solid var(--line); }
.search .field-select { border: 0; background: var(--surface); }
.search .button { padding-inline: 21px; }
.masthead-actions, .quote-links { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.quote-links .button { padding-inline: 10px; }
.navigation-band { border-block: 1px solid var(--line); background: var(--surface); }
#navigation { display: flex; gap: clamp(15px, 3vw, 44px); align-items: stretch; min-height: 47px; }
.nav-item { position: relative; display: grid; align-items: stretch; }
.nav-link { display: flex; align-items: center; justify-content: center; min-width: 64px; white-space: nowrap; color: var(--muted); border-bottom: 3px solid transparent; padding: 3px 12px 0; font-weight: 650; }
.nav-link[aria-current="page"] { border-color: var(--accent); color: var(--accent-strong); }
.nav-dropdown { display: none; position: absolute; z-index: 3; left: 0; top: 100%; min-width: 132px; background: var(--surface); padding: 5px; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 7px 20px #0002; }
.nav-dropdown a { display: block; padding: 7px 10px; white-space: nowrap; font-size: 14px; border-radius: 4px; }
.nav-dropdown a:hover, .nav-dropdown a:focus-visible { background: var(--surface-alt); }
.nav-item:hover .nav-dropdown, .nav-item:focus-within .nav-dropdown { display: block; }

.themes { position: relative; flex: none; z-index: 4; }
.themes summary { display: flex; align-items: center; gap: 7px; list-style: none; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.themes summary::-webkit-details-marker { display: none; }
.themes summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); }
.theme-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.theme-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 180px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 26px #0002; }
.theme-option { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: var(--ink); background: none; border: 0; border-radius: 5px; text-align: left; }
.theme-option:hover, .theme-option[aria-pressed="true"] { background: var(--surface-alt); }
.theme-option[aria-pressed="true"]::after { content: "✓"; margin-left: auto; color: var(--accent); }
.swatch { border: 1px solid #0002; border-radius: 50%; width: 15px; height: 15px; background: var(--swatch); }

#main { min-height: 71vh; padding-block: 24px 50px; scroll-margin-top: 12px; }
.portal-layout, .section-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 308px); gap: 18px; align-items: start; }
.portal-layout { grid-template-columns: 92px minmax(0, 1fr) minmax(0, 308px); }
.home-topics { display: grid; align-items: start; gap: 4px; padding: 3px 0; }
.home-topics a { display: block; text-align: center; padding: 8px 10px; font-weight: 650; border-radius: 6px; }
.home-topics a:hover { background: var(--surface-alt); }
.home-topics a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.portal-side, .section-main { display: grid; min-width: 0; gap: 13px; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 17px 20px; }
.portal-side .card { padding: 14px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.panel-heading h1, .panel-heading h2 { font-size: 20px; line-height: 1.4; }
.panel-heading a { color: var(--accent-strong); flex: none; font-size: 13px; font-weight: 650; }
.portal-side .panel-heading h2 { font-size: 17px; }
.portal-side .panel-heading a { font-size: 12px; }
.portal-banner { display: grid; align-items: end; position: relative; isolation: isolate; overflow: hidden; border-radius: var(--radius); min-height: 141px; color: #fff; background: #44332f; }
.portal-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 54%; z-index: -2; }
.portal-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 22%, #1a1311df); z-index: -1; }
.portal-banner span { font-size: 21px; font-weight: 750; padding: 11px 15px; }
.portal-banner:hover { color: #fff; }
.link-list { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.link-list { padding-top: 9px; }
.link-list a { color: var(--accent-strong); padding: 3px 7px; border-radius: 4px; }
.link-list a:hover { background: var(--surface-alt); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 9px 0; }
.row-title { overflow-wrap: anywhere; font-size: 15px; font-weight: 620; }
.row-link time, .feed-meta { color: var(--muted); font-size: 13px; }
.row-link time { white-space: nowrap; }
.news-row { min-height: 74px; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 14px; padding: 13px 0; }
.news-row .row-title { display: block; font-size: 17px; }
.feed-meta { display: flex; gap: 10px; align-items: center; margin-top: 5px; }
.feed-meta span { color: var(--accent-strong); }
.feed-summary { color: var(--muted); font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }

.page-heading { margin: 0 0 12px; }
.page-heading h1 { font-size: clamp(25px, 3vw, 35px); letter-spacing: -.02em; overflow-wrap: anywhere; }
.page-heading p { margin-top: 4px; color: var(--muted); }
.category-strip { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 14px; padding: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.category-strip a { padding: 6px 10px; border-radius: 5px; white-space: nowrap; font-size: 14px; }
.category-strip a[aria-current], .category-strip a:hover { background: var(--surface-alt); color: var(--accent-strong); }
.category-strip a[aria-current] { font-weight: 700; }
.event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 10px; }
.event-grid a { display: block; min-width: 0; padding: 10px; border-radius: 5px; background: var(--surface-alt); overflow-wrap: anywhere; }
.event-grid time { display: block; color: var(--muted); font-size: 13px; }

.filter-card { padding: 12px; }
#main > .filter-card { margin-bottom: 13px; }
.filters, .results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.results-head { justify-content: space-between; padding-bottom: 8px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 37px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; white-space: nowrap; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 650; }
.button:hover { color: var(--accent-strong); border-color: var(--accent); }
.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { color: var(--accent-ink); background: var(--accent-strong); }
.button:disabled { opacity: .5; cursor: default; }
.field-select { min-height: 37px; border: 1px solid var(--line); border-radius: 6px; appearance: none; color: var(--ink); background: var(--surface); padding: 6px 28px 6px 9px; }
.select-wrap { display: inline-flex; align-items: center; position: relative; font-size: 14px; }
.select-wrap::after { content: ""; position: absolute; right: 11px; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); pointer-events: none; }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 0; }
.result-text { display: flex; align-items: center; gap: 9px; min-width: 0; }
.result-text > div { min-width: 0; }
.result-row h2 { font-size: 16px; overflow-wrap: anywhere; }
.result-row p { color: var(--muted); font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }
.meta-line { color: var(--muted); font-size: 13px; margin-bottom: 3px; overflow-wrap: anywhere; }
.status-tag { height: fit-content; background: var(--surface-alt); color: var(--accent-strong); border-radius: 5px; padding: 3px 7px; font-size: 12px; white-space: nowrap; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 9px; margin-top: 16px; font-size: 14px; }
.backlink { display: inline-block; margin-bottom: 17px; color: var(--accent-strong); font-weight: 700; }
#main > .detail, .about { max-width: 960px; margin-inline: auto; }
.detail h1 { font-size: clamp(25px, 3vw, 37px); letter-spacing: -.03em; line-height: 1.3; overflow-wrap: anywhere; }
.detail .meta-line { margin: 13px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; padding-block: 14px; }
.prose { padding-top: 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.prose p { margin: 10px 0; }
.included { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.included h2 { font-size: 19px; }
.included summary { color: var(--accent-strong); font-weight: 650; }
.answer { padding-block: 9px; border-bottom: 1px solid var(--line); }
.answer p { white-space: pre-line; overflow-wrap: anywhere; margin-top: 4px; }
.facts { margin: 13px 0; }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.facts dd { margin: 0; text-align: end; }
.empty { padding: 15px 0; color: var(--muted); }
.footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 20px; padding-block: 20px; font-size: 14px; }
.footer-inner > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 15px; }
.footer-record { flex: 0 0 100%; text-align: center; }
.footer strong { color: var(--ink); }

@media (max-width: 990px) {
  .shell { width: calc(100% - 34px); }
  .masthead-inner { gap: 13px; }
  .portal-layout, .section-layout { grid-template-columns: minmax(0, 1fr) minmax(220px, 29%); gap: 12px; }
  .portal-layout { grid-template-columns: 72px minmax(0, 1fr) minmax(220px, 29%); }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 25px); }
  .masthead-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 11px; padding-block: 11px; }
  .brand strong { font-size: clamp(1.5rem, 4.7vw, 2rem); }
  .header-search { flex: 0 0 100%; order: 3; }
  #navigation { gap: 0; justify-content: space-between; min-height: 44px; }
  .nav-link { min-width: 0; padding-inline: clamp(6px, 1.5vw, 12px); font-size: 14px; }
  .nav-item:hover .nav-dropdown, .nav-item:focus-within .nav-dropdown { display: none; }
  #main { padding-top: 13px; }
  .portal-layout, .section-layout { grid-template-columns: minmax(0, 1fr); }
  .home-topics { display: flex; overflow: auto; gap: 4px; padding: 3px; }
  .home-topics a { flex: 0 0 auto; padding: 6px 9px; font-size: 14px; }
  .card { padding: 13px; }
  .news-row .row-title { font-size: 16px; }
}
@media (max-width: 390px) {
  .masthead-actions, .quote-links { gap: 6px; }
  .masthead-actions { flex: 1; min-width: 0; flex-wrap: wrap; }
  .quote-links { flex-wrap: wrap; }
  .quote-links .button { min-height: 32px; padding-inline: 7px; font-size: 13px; }
  .themes summary { font-size: 12px; padding-inline: 6px; }
  .themes summary::after { display: none; }
  .result-row { grid-template-columns: minmax(0, 1fr); }
  .status-tag { justify-self: start; }
}
