:root {
  --bg: #090c0b;
  --surface: #101512;
  --surface-raised: #151c18;
  --text: #e9efeb;
  --muted: #849189;
  --line: #29332d;
  --line-strong: #46534b;
  --healthy: #70f0a8;
  --rank: #ff7058;
  --link: #79aefc;
  --warning: #f4c66a;
  --focus: #a7c7ff;
  --max: 1440px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

[data-theme="light"] {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-raised: #edf1ed;
  --text: #172019;
  --muted: #58635c;
  --line: #d1d8d2;
  --line-strong: #9ca79f;
  --healthy: #08783d;
  --rank: #c63e2b;
  --link: #155fc0;
  --warning: #805d06;
  --focus: #125fca;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

a { color: inherit; }
button, input { font: inherit; }
button, summary, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, summary, .brand, .category-nav-inner a { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.masthead-inner,
main,
.footer {
  width: min(calc(100% - 48px), var(--max));
  margin-inline: auto;
}

.masthead-inner {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
}

.brand {
  min-width: 0;
  min-height: 44px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--healthy);
  color: var(--healthy);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.brand-name {
  display: block;
  font: 600 18px/1.1 Newsreader, Georgia, "Songti SC", "SimSun", serif;
}

.brand-cn {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.masthead-status,
.service-state,
.header-actions {
  display: flex;
  align-items: center;
}

.masthead-status {
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.service-state { gap: 7px; }

.service-state i,
.health-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--healthy);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--healthy) 16%, transparent);
}

.service-state i.is-warning,
.health-dot.is-warning {
  background: var(--rank);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rank) 16%, transparent);
}

.header-actions { gap: 4px; }

.icon-button,
.text-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.text-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button:disabled { cursor: wait; opacity: 0.55; }
.icon-button.is-loading svg { animation: spin 800ms linear infinite; }

.radar-intro {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.55fr);
  align-items: end;
  gap: 64px;
  padding: 54px 0 34px;
  border-bottom: 1px solid var(--line-strong);
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--healthy);
  font: 700 11px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.eyebrow span { width: 20px; height: 1px; background: currentColor; }

.radar-intro h1,
.section-heading h2,
.dialog-heading h2 {
  font-family: Newsreader, Georgia, "Songti SC", "SimSun", serif;
  letter-spacing: 0;
}

.radar-intro h1 {
  margin: 0;
  font-size: 48px;
  font-weight: 600;
  line-height: 1.1;
}

.intro-dek {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.signal-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 2px solid var(--text);
}

.signal-stats div {
  min-width: 0;
  padding: 14px 12px 12px 0;
  border-bottom: 1px solid var(--line);
}

.signal-stats dt { color: var(--muted); font-size: 11px; }
.signal-stats dd { margin: 5px 0 0; font: 600 17px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; }

.section-band {
  padding: 34px 0 42px;
  border-bottom: 1px solid var(--line-strong);
}

.section-heading {
  min-height: 56px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.section-kicker { margin-bottom: 7px; }

.section-heading h2,
.dialog-heading h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
}

.section-note {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.top-stories {
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  grid-template-rows: repeat(3, minmax(112px, auto));
  border-top: 2px solid var(--text);
}

.story {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  animation: reveal 260ms both;
  animation-delay: var(--delay, 0ms);
}

.story-body,
.story-meta,
.story h3,
.summary,
.category-section,
.story-list,
.source-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.top-stories .story:not(.story-lead) {
  grid-column: 2;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.top-stories .story-lead {
  grid-row: 1 / span 3;
  padding: 24px 32px 24px 0;
}

.story-number,
.section-index,
.section-count {
  color: var(--rank);
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.story-meta,
.story-foot,
.tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.story-meta { gap: 8px; min-height: 24px; color: var(--muted); font-size: 11px; }

.category-chip {
  padding: 2px 6px;
  border: 1px solid var(--healthy);
  border-radius: 2px;
  color: var(--healthy);
  font-weight: 700;
}

.story h3 {
  margin: 9px 0 7px;
  font: 600 18px/1.4 Newsreader, Georgia, "Songti SC", "SimSun", serif;
  letter-spacing: 0;
}

.story-lead h3 { max-width: 760px; font-size: 32px; line-height: 1.25; }
.story h3 a { text-decoration: none; }
.story h3 a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 4px; }

.summary { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.story-lead .summary { max-width: 760px; color: var(--text); font-size: 15px; }

.story-foot {
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.tags { gap: 5px; }
.tags span { padding: 2px 5px; background: var(--surface-raised); }
.related { max-width: 260px; text-align: right; }

.brief-skeleton,
.board-placeholder {
  overflow: hidden;
  background: transparent;
}

.brief-skeleton {
  min-height: 112px;
  padding: 22px 0 18px 24px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.brief-skeleton-lead {
  min-height: 390px;
  grid-row: 1 / span 3;
  padding: 28px 32px 24px 0;
  border-left: 0;
}

.brief-skeleton span,
.board-placeholder span {
  display: block;
  height: 12px;
  margin-bottom: 13px;
  background: var(--surface-raised);
  animation: breathe 1.6s ease-in-out infinite;
}

.brief-skeleton span:first-child { width: 24%; height: 9px; }
.brief-skeleton span:nth-child(2) { width: 82%; height: 20px; }
.brief-skeleton span:nth-child(3) { width: 64%; }
.brief-skeleton span:nth-child(4) { width: 48%; }

.board-tabs {
  position: sticky;
  top: 64px;
  z-index: 20;
  margin-inline: calc(50% - 50vw);
  padding-left: max(24px, env(safe-area-inset-left), calc((100vw - var(--max)) / 2));
  padding-right: max(24px, env(safe-area-inset-right), calc((100vw - var(--max)) / 2));
  border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.category-nav-inner {
  min-height: 48px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: thin;
}

.category-nav-inner a,
.category-nav-inner .board-tab {
  min-width: 112px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
}

.category-nav-inner a:hover,
.category-nav-inner a[aria-selected="true"],
.category-nav-inner .board-tab:hover,
.category-nav-inner .board-tab[aria-selected="true"] {
  border-bottom-color: var(--healthy);
  color: var(--text);
}

.category-nav-inner a span,
.category-nav-inner .board-tab span { color: var(--rank); font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.board-grid { min-height: 520px; padding-top: 24px; }

.category-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 24px;
}

.category-section {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}

.category-section .section-heading {
  min-height: 48px;
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 2px solid var(--text);
}

.category-section .section-heading > div { display: flex; align-items: baseline; gap: 9px; }
.category-section .section-heading h2 { font-size: 21px; }
.story-list { min-width: 0; }
.story-list .story { grid-template-columns: 28px minmax(0, 1fr); }
.story-list .story h3 { font-size: 16px; }
.story-list .summary { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.story-list .related { text-align: left; }

.board-placeholder {
  min-height: 410px;
  padding-top: 18px;
  border-top: 2px solid var(--text);
}

.board-placeholder span { height: 58px; margin-bottom: 1px; }

.disclosure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  border-top: 2px solid var(--text);
}

.source-disclosure,
.ai-disclosure { min-width: 0; }

.source-disclosure summary,
.ai-disclosure summary {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  list-style-position: inside;
}

.source-disclosure summary span,
.ai-disclosure summary span { color: var(--muted); font-size: 11px; font-weight: 400; }
.source-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.source-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 10px minmax(100px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.source-row span { color: var(--muted); }
.source-row span:last-child { grid-column: 2 / -1; }
.disclosure-copy { padding: 14px 0; color: var(--muted); font-size: 13px; }
.disclosure-copy p { margin: 0 0 10px; }
.disclosure-copy strong { color: var(--warning); }

.loading,
.empty {
  min-height: 90px;
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 0;
  color: var(--muted);
}

.footer {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font: 500 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.search-dialog {
  width: min(calc(100% - 32px), 720px);
  max-height: min(80vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overscroll-behavior: contain;
}

.search-dialog::backdrop { background: rgba(3, 7, 5, 0.76); }
.search-shell { padding: 24px; }

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.text-button { padding: 0 12px; }
.search-shell label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }

.search-shell input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

.search-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.search-results {
  width: 100%;
  min-width: 0;
  min-height: 160px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.search-results .story {
  width: 100%;
  min-width: 0;
  display: block;
  padding: 18px 0;
}

.search-results .story-body {
  width: 100%;
  min-width: 0;
}

.search-results .story-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 6px;
}

.search-results .story h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.search-results .summary {
  margin-top: 8px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1024px) {
  .masthead-inner, main, .footer { width: min(calc(100% - 32px), var(--max)); }
  .masthead-status #today { display: none; }
  .radar-intro { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.7fr); gap: 36px; }
  .category-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-health { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .masthead-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .masthead-status { display: none; }
  .brand-cn { display: none; }
  .radar-intro { min-height: 0; grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .radar-intro h1 { font-size: 38px; }
  .top-stories { display: block; min-height: 390px; }
  .top-stories .story,
  .top-stories .story:not(.story-lead),
  .top-stories .story-lead { grid-column: auto; grid-row: auto; padding: 18px 0; border-left: 0; }
  .story-lead h3 { font-size: 25px; }
  .brief-skeleton, .brief-skeleton-lead { min-height: 112px; padding: 22px 0 18px; border-left: 0; }
  .disclosure-grid { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .masthead-inner, main, .footer { width: min(calc(100% - 24px), var(--max)); }
  .masthead-inner { min-height: 60px; }
  .brand-name { font-size: 16px; }
  .header-actions { gap: 0; }
  .icon-button { min-width: 44px; }
  .radar-intro h1 { font-size: 34px; }
  .intro-dek { font-size: 16px; }
  .signal-stats { grid-template-columns: 1fr 1fr; }
  .signal-stats div:last-child { grid-column: 1 / -1; }
  .section-band { padding: 28px 0 34px; }
  .section-heading { min-height: 0; align-items: start; margin-bottom: 18px; }
  .section-heading h2, .dialog-heading h2 { font-size: 24px; }
  .section-note { display: none; }
  .story, .story-list .story { grid-template-columns: 26px minmax(0, 1fr); gap: 8px; }
  .story h3, .story-list .story h3 { font-size: 18px; }
  .story-foot { align-items: start; flex-direction: column; }
  .related { max-width: none; text-align: left; }
  .board-tabs {
    top: 60px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .category-nav-inner a { min-width: 96px; padding-inline: 12px; }
  .category-sections { grid-template-columns: 1fr; gap: 28px; }
  .board-placeholder:nth-child(n + 2) { display: none; }
  .footer { min-height: 104px; align-items: start; flex-direction: column; justify-content: center; gap: 6px; }
  .search-shell { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
