:root {
    --ink: #172032;
    --muted: #677085;
    --line: #e7e9ef;
    --paper: #ffffff;
    --wash: #f5f7fb;
    --brand: #3457d5;
    --brand-dark: #213a98;
    --accent: #eef2ff;
    --radius: 18px;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--wash);
    font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
.shell { width: min(1160px, calc(100% - 36px)); margin: 0 auto; }
.site-header { position: relative; z-index: 20; flex: 0 0 auto; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); box-shadow: 0 8px 30px rgba(23,32,50,.04); backdrop-filter: blur(14px); }
.header-top { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-size: 23px; font-weight: 850; letter-spacing: -.045em; color: var(--brand-dark); white-space: nowrap; }
.header-stats { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.header-stats span, .header-stats a { padding: 5px 9px; background: var(--wash); border: 1px solid var(--line); border-radius: 999px; }
.header-stats a:hover { color: var(--brand-dark); border-color: #c7d2f5; }
.primary-nav { position: relative; padding-bottom: 14px; color: #465168; font-size: 13px; }
.primary-menu { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 6px; list-style: none; }
.nav-group-item { min-width: 0; }
.nav-group-control { min-height: 34px; display: flex; align-items: stretch; overflow: hidden; background: #f9faff; border: 1px solid #e8ebf3; border-radius: 9px; transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
.nav-group-control:hover { color: var(--brand); background: var(--paper); border-color: #cad3f4; transform: translateY(-1px); }
.nav-group-link { min-width: 0; padding: 6px 3px 6px 9px; display: flex; flex: 1 1 auto; align-items: center; overflow: hidden; white-space: nowrap; font-weight: 650; text-overflow: ellipsis; }
.nav-group-toggle { width: 27px; flex: 0 0 27px; padding: 0; color: #9aa2b4; background: transparent; border: 0; cursor: pointer; font: inherit; font-size: 11px; transition: transform .18s ease; }
.nav-group-link:focus-visible, .nav-group-toggle:focus-visible { outline: 3px solid rgba(52,87,213,.18); outline-offset: -2px; }
.nav-group-item.is-open .nav-group-control { color: white; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); border-color: transparent; box-shadow: 0 7px 18px rgba(52,87,213,.2); }
.nav-group-item.is-open .nav-group-link:hover { color: white; }
.nav-group-item.is-open .nav-group-toggle { color: rgba(255,255,255,.85); transform: rotate(180deg); }
.nav-topic-panel[hidden] { display: none; }
.nav-topic-panel { position: absolute; top: calc(100% + 2px); right: 0; left: 0; z-index: 50; max-height: min(62vh, 560px); padding: 22px; overflow-y: auto; background: rgba(255,255,255,.99); border: 1px solid #dfe4f0; border-radius: 18px; box-shadow: 0 26px 70px rgba(23,32,50,.2); }
.nav-topic-heading { margin-bottom: 16px; padding-bottom: 15px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.nav-panel-kicker { display: block; margin-bottom: 2px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.nav-topic-heading strong { color: var(--ink); font-size: 24px; letter-spacing: -.03em; }
.nav-group-overview { padding: 8px 13px; white-space: nowrap; color: var(--brand-dark); background: var(--accent); border-radius: 9px; font-size: 12px; font-weight: 750; }
.nav-group-overview::after { content: " →"; }
.nav-topic-list { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; list-style: none; }
.nav-topic-list a { min-height: 42px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #44506a; background: var(--wash); border: 1px solid transparent; border-radius: 10px; font-size: 13px; }
.nav-topic-list a::after { content: "›"; color: #9aa6c2; font-size: 17px; }
.nav-topic-list a:hover { color: var(--brand-dark); background: var(--paper); border-color: #cfd8f5; box-shadow: 0 7px 18px rgba(52,87,213,.08); }
.nav-topic-status { grid-column: 1 / -1; padding: 22px; text-align: center; color: var(--muted); background: var(--wash); border-radius: 10px; }
.page-shell { flex: 1 0 auto; padding: 44px 0 76px; }
.hero, .category-hero { padding: 58px; border-radius: 28px; background: linear-gradient(135deg, #15234a 0%, #314aa1 62%, #5a77df 100%); color: white; box-shadow: 0 24px 70px rgba(31,53,126,.18); }
.hero h1, .category-hero h1 { max-width: 790px; margin: 8px 0 16px; font-size: clamp(38px, 6vw, 68px); line-height: 1.08; letter-spacing: -.05em; }
.category-hero h1 { font-size: clamp(36px, 5vw, 58px); }
.hero-copy, .category-hero p { max-width: 680px; margin: 0; color: rgba(255,255,255,.78); font-size: 18px; }
.eyebrow { margin: 0; color: #9eb3ff; text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.section { margin-top: 48px; }
.homepage-feed { margin-top: 0; }
.topic-feed { margin-top: 0; }
.topic-page-title { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; letter-spacing: -.035em; }
.category-section-title { margin: 0 0 14px; font-size: 27px; line-height: 1.25; letter-spacing: -.03em; }
.compact-section { padding: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.related-topic-section { padding: 24px 26px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.section h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.section-heading { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-more { color: var(--brand-dark); font-size: 13px; font-weight: 750; white-space: nowrap; }
.muted { color: var(--muted); font-size: 14px; }
.topic-directory-header { margin-bottom: 22px; padding: 30px 34px; display: flex; align-items: end; justify-content: space-between; gap: 24px; color: white; background: linear-gradient(135deg, #15234a 0%, #314aa1 72%, #5a77df 100%); border-radius: 22px; }
.topic-directory-header h1 { margin: 5px 0 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.1; letter-spacing: -.045em; }
.topic-directory-header p:last-child { margin: 0; color: rgba(255,255,255,.75); }
.topic-directory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.topic-directory-card { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.topic-directory-heading { margin-bottom: 14px; padding-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.topic-directory-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.topic-directory-heading h2 a { color: var(--brand-dark); }
.topic-directory-heading span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.topic-directory-list { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; list-style: none; }
.topic-directory-link { min-height: 38px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #44506a; background: var(--wash); border: 1px solid transparent; border-radius: 9px; font-size: 13px; }
.topic-directory-link::after { content: "›"; color: #9aa6c2; }
.topic-directory-link:hover { color: var(--brand-dark); background: var(--paper); border-color: #cfd8f5; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.category-card { min-height: 150px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .2s ease, box-shadow .2s ease; }
.category-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(35,44,74,.08); }
.category-title { display: block; margin-bottom: 14px; font-size: 20px; font-weight: 800; }
.topic-cloud, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-cloud a, .chips a { padding: 5px 9px; border-radius: 999px; background: var(--accent); color: #435281; font-size: 12px; }
.topic-cloud.large a { padding: 8px 13px; font-size: 14px; }
.article-list { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.article-row { padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.article-row:last-child { border-bottom: 0; }
.article-row h3 { margin: 5px 0 8px; font-size: 19px; line-height: 1.45; }
.article-main { min-width: 0; }
.meta-line, .article-byline { display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 13px; }
.arrow { color: #9aa2b4; font-size: 23px; }
.empty-state { padding: 52px 24px; text-align: center; color: var(--muted); }
.pagination { margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.pagination-pages { display: flex; align-items: center; justify-content: center; gap: 7px; }
.pagination-control, .pagination-number { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); color: #435281; font-size: 13px; font-weight: 750; }
.pagination-control { padding: 8px 14px; }
.pagination-number { min-width: 40px; padding: 8px; }
.pagination-control:hover, .pagination-number:hover { color: var(--brand-dark); border-color: #c7d2f5; box-shadow: 0 6px 16px rgba(52,87,213,.08); }
.pagination-number.is-current { border-color: var(--brand); background: var(--brand); color: white; }
.pagination-control.is-disabled { color: #a7adba; background: #f2f4f8; cursor: default; }
.pagination-ellipsis { min-width: 20px; text-align: center; color: var(--muted); }
.breadcrumbs { margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 14px; }
.article-page { max-width: 850px; margin: 0 auto; padding: 46px 54px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; }
.article-header { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: 20px 0 18px; font-size: clamp(32px, 5vw, 52px); line-height: 1.18; letter-spacing: -.045em; }
.prose { padding: 28px 0; font-size: 18px; }
.prose img { max-width: 100%; height: auto; }
.source-notice { margin: 34px 0; padding: 28px; background: var(--wash); border-radius: var(--radius); }
.source-notice strong { font-size: 20px; }
.source-notice p { color: var(--muted); }
.primary-button { display: inline-flex; padding: 11px 17px; border-radius: 10px; background: var(--brand); color: white; font-weight: 700; }
.primary-button:hover { color: white; background: var(--brand-dark); }
.article-source { padding-top: 18px; display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.article-link-wheel { margin-top: 30px; padding-top: 28px; border-top: 1px solid var(--line); }
.article-link-wheel h2 { margin: 0 0 16px; font-size: 22px; }
.article-neighbors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.article-neighbors a { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
.article-neighbors span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.article-neighbors strong { display: -webkit-box; overflow: hidden; font-size: 15px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.related-articles { margin: 18px 0 0; padding-left: 20px; }
.related-articles li { margin: 7px 0; }
.related-articles a { color: var(--brand-dark); }
.site-footer { flex: 0 0 auto; padding: 11px 0 max(11px, env(safe-area-inset-bottom)); background: #111a31; color: #9ca8c4; font-size: 12px; line-height: 1.45; }
.site-footer a { color: white; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }

@media (max-width: 900px) {
    .primary-menu { grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); }
    .nav-topic-panel { padding: 18px; }
    .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topic-directory-grid { grid-template-columns: 1fr; }
    .hero, .category-hero { padding: 38px; }
}

@media (max-width: 600px) {
    .site-header { position: sticky; top: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .header-top { min-height: 52px; }
    .brand { font-size: 20px; }
    .header-stats span:first-child { display: none; }
    .primary-nav { padding-bottom: 8px; overflow: visible; }
    .primary-nav::after { content: ""; position: absolute; right: 0; bottom: 8px; z-index: 3; width: 28px; height: 40px; pointer-events: none; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.98)); }
    .primary-menu { display: flex; gap: 7px; padding-right: 24px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: auto; }
    .primary-menu::-webkit-scrollbar { display: none; }
    .nav-group-item { flex: 0 0 auto; scroll-snap-align: start; }
    .nav-group-control { min-height: 40px; border-radius: 10px; }
    .nav-group-link { padding: 7px 4px 7px 11px; }
    .nav-group-toggle { width: 30px; flex-basis: 30px; }
    .nav-topic-panel { position: fixed; top: 101px; right: 12px; left: 12px; z-index: 1000; max-height: calc(100dvh - 117px); padding: 16px; }
    body.nav-menu-open { overflow: hidden; }
    .nav-topic-heading { align-items: start; gap: 12px; }
    .nav-topic-heading strong { font-size: 21px; }
    .nav-group-overview { padding: 7px 9px; }
    .nav-topic-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .nav-topic-list a { min-height: 39px; padding: 8px 9px; font-size: 12px; }
    .page-shell { padding-top: 20px; padding-bottom: 28px; }
    .section-heading { margin-bottom: 13px; }
    .section h2 { font-size: 25px; }
    .section-more { font-size: 12px; }
    .empty-state { padding: 30px 18px; line-height: 1.7; }
    .pagination { flex-wrap: wrap; align-items: stretch; gap: 7px; }
    .pagination-pages { order: 2; flex: 0 0 100%; gap: 5px; }
    .pagination-control { flex: 1 1 0; padding: 8px 10px; white-space: nowrap; }
    .pagination-number { min-width: 36px; }
    .hero, .category-hero { padding: 30px 24px; border-radius: 20px; }
    .topic-directory-header { padding: 25px 22px; align-items: start; flex-direction: column; gap: 8px; border-radius: 18px; }
    .topic-directory-list { grid-template-columns: 1fr; }
    .topic-directory-card { padding: 18px; }
    .category-grid { grid-template-columns: 1fr; }
    .article-row { padding: 18px; }
    .article-page { padding: 28px 22px; border-radius: 18px; }
    .article-neighbors { grid-template-columns: 1fr; }
    .footer-row { gap: 3px 12px; }
    .article-source { flex-direction: column; }
}
