:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --canvas: #0e151a;
  --panel: #162127;
  --text: #edf4f1;
  --muted: #abbcbb;
  --subtle: #90a5a5;
  --divider: #304047;
  --mint: #83efc4;
  --violet: #b6b4ff;
  background: var(--canvas);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 85% 0%, #18312e55, transparent 38rem), var(--canvas); }
a { color: var(--mint); text-underline-offset: .2em; }
a, button, select, summary { -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; }
button, select, summary { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
a:hover { color: white; }
[hidden] { display: none !important; }
.wrap { width: min(1350px, calc(100% - clamp(32px, 8vw, 120px))); margin-inline: auto; }
.mast { background: #0f181dda; border-bottom: 1px solid #2a373c; }
.mast-inner { min-height: 64px; display: flex; align-items: center; gap: clamp(24px, 4vw, 66px); }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--text); font-size: 1.3rem; font-weight: 750; letter-spacing: -.05em; text-decoration: none; white-space: nowrap; }
.brand img { display: block; }
nav { display: flex; align-items: center; gap: clamp(16px, 2.6vw, 38px); }
nav a, .admin-link { text-decoration: none; color: var(--muted); font-size: .9rem; }
nav a:hover, .admin-link:hover { color: var(--mint); }
.admin-link { margin-left: auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.admin-link span { color: var(--mint); }
#main { padding-bottom: 48px; }
#overview, #search-trends, #genres, #evidence { scroll-margin-top: 20px; }
.header-row { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin: 34px 0 22px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.55vw, 3.15rem); line-height: 1.18; letter-spacing: -.065em; font-weight: 750; }
.subhead { margin: 10px 0 0; color: var(--muted); font-size: 1rem; }
.header-controls, .period { display: flex; align-items: center; }
.header-controls { gap: 13px; }
.market-select, .period { background: #18242a; border: 1px solid var(--divider); border-radius: 8px; }
.market-select { position: relative; display: flex; align-items: center; height: 40px; }
.market-select svg { position: absolute; pointer-events: none; width: 16px; height: 16px; left: 12px; fill: none; stroke: var(--mint); stroke-width: 1.5; }
.market-select::after { content: ''; position: absolute; pointer-events: none; right: 14px; width: 6px; height: 6px; border-bottom: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.market-select select { appearance: none; background: transparent; color: var(--text); font-size: .9rem; border: 0; border-radius: 7px; height: 100%; width: 100%; padding: 0 34px 0 36px; }
.market-select option { background: #1b272d; color: var(--text); }
.period { padding: 3px; align-items: stretch; height: 40px; }
.period button, .chip { border: 0; font-size: .875rem; border-radius: 5px; }
.period button { background: transparent; color: var(--muted); padding: 4px 10px; white-space: nowrap; }
.period button[aria-pressed="true"] { background: #35463f; color: #b0f8d8; font-weight: 650; }
.period button:hover, .chip:hover { color: white; }
.filter-row { display: flex; align-items: center; gap: 15px; border-top: 1px solid var(--divider); padding: 14px 0 20px; }
.filter-label { color: var(--muted); white-space: nowrap; font-size: .875rem; }
.keywords { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { font-size: .85rem; max-width: 100%; min-height: 34px; overflow-wrap: anywhere; background: #19262b; color: #d4e1df; padding: 5px 11px; border: 1px solid #324249; letter-spacing: .005em; }
.chip[aria-pressed="true"] { background: #254739; color: #b1f7d7; border-color: #416c57; }
.chip-more { max-width: min(100%, 21rem); cursor: pointer; text-overflow: ellipsis; padding-right: 8px; }
#request-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; margin-bottom: 16px; color: #ffe0c1; border: 1px solid #765640; border-radius: 8px; background: #32291f; }
#request-error button { border: 1px solid #927152; background: transparent; color: inherit; border-radius: 5px; font-size: .875rem; padding: 5px 9px; }
.detail-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.panel { --accent: var(--mint); display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--divider); border-radius: 14px; background: linear-gradient(145deg, #19262d, #151e24); padding: 22px 24px 16px; }
#dashboard { display: grid; gap: 18px; }
.trend-panel { border-color: #38554f; background: linear-gradient(120deg, #1b302f, #172429 54%, #162126); }
.thread-panel { background: linear-gradient(133deg, #272936, #1b232d 50%, #171f26); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.trend-layout { display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); gap: 14px; margin: 18px 0 0; }
.trend-metrics, .trend-timeline { min-width: 0; padding: 14px 16px; background: #101a1eab; border: 1px solid #31454a; border-radius: 10px; }
.trend-layout h3 { margin: 0 0 8px; color: #eef6f3; font-size: .95rem; line-height: 1.45; }
.trend-timeline-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 8px; }
.trend-timeline .plot { height: clamp(158px, 16vw, 212px); margin: 5px 0 0; }
.keyword-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.keyword-table th, .keyword-table td { padding: 9px 7px; border-bottom: 1px solid #2b4145; text-align: right; }
.keyword-table thead th { color: var(--muted); font-size: .78rem; font-weight: 550; vertical-align: bottom; white-space: nowrap; }
.keyword-table tr > :first-child { padding-left: 0; text-align: left; }
.keyword-table tr > :last-child { padding-right: 0; }
.keyword-table td { color: #d2fae8; font-size: .94rem; white-space: nowrap; }
.keyword-table tbody th { width: 42%; font-weight: 630; line-height: 1.45; font-size: .9rem; overflow-wrap: anywhere; }
.keyword-name { display: flex; align-items: baseline; gap: 7px; }
.keyword-name .swatch { position: relative; top: -.24em; }
.keyword-link { padding: 2px 0; border: 0; background: transparent; color: var(--text); text-decoration: underline; text-decoration-color: #648d81; text-underline-offset: .2em; text-align: left; overflow-wrap: anywhere; min-width: 0; }
.keyword-link:hover { color: var(--mint); text-decoration-color: currentColor; }
.keyword-table small { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; font-weight: 450; }
.keyword-table tbody th small { margin-left: 20px; }
.trend-note, .trend-definition { color: var(--muted); font-size: .81rem; line-height: 1.65; }
.trend-note { margin-top: 9px; }
.trend-definition { margin: 12px 0 2px; }
.trend-details .disclosure { margin: 2px 0 4px; }
.trend-details summary { color: #d6e8e3; }
.trend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 7px 0 10px; font-size: .83rem; }
.trend-actions:empty { display: none; }
.lead-coverage { margin: 14px 0 10px; }
.lead-coverage, .lead-note { color: var(--muted); font-size: .83rem; line-height: 1.6; overflow-wrap: anywhere; }
.lead-focus { border: 1px solid #36594e; border-radius: 9px; background: #1c352f; padding: 14px 16px; }
.lead-focus h3, .lead-module h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.lead-focus h3 { color: #b5f6db; }
.lead-focus p { margin-top: 5px; color: #ddede5; font-size: .88rem; line-height: 1.6; }
.lead-focus .lead-filter { margin-top: 8px; color: var(--mint); }
.lead-analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 14px; align-items: start; }
.lead-module { border: 1px solid var(--divider); border-radius: 9px; padding: 13px 14px; background: #121c21; min-width: 0; }
.lead-module .lead-note { margin-top: 8px; }
.lead-ranking, .lead-keywords { list-style: none; margin: 8px 0 0; padding: 0; }
.lead-ranking li, .lead-keywords li { display: grid; align-items: start; gap: 8px; padding: 8px 0; border-top: 1px solid #293940; }
.lead-ranking li { grid-template-columns: 24px minmax(0, 1fr) auto; }
.lead-keywords li { grid-template-columns: minmax(0, 1fr) auto; }
.lead-row-label small { display: block; margin-top: 2px; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.lead-row-label time { white-space: nowrap; }
.lead-rank { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: #b5f6db; background: #243c34; font-size: .78rem; font-variant-numeric: tabular-nums; }
.lead-ranking li > strong { color: #c5f5e1; font-size: .85rem; }
.lead-filter { border: 0; padding: 0; background: transparent; color: var(--text); font: inherit; font-weight: 620; text-align: left; overflow-wrap: anywhere; }
.lead-filter:hover, .lead-filter:focus-visible { color: var(--mint); text-decoration: underline; }
.lead-frequency { color: #c5f5e1; font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lead-early { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 9px; margin-top: 9px; font-size: .8rem; }
.lead-early > span { color: var(--muted); }
.lead-early .lead-filter { padding: 2px 6px; border-radius: 4px; background: #243238; }
.lead-evidence { margin-top: 14px; border-top: 1px solid var(--divider); }
.lead-evidence > summary { width: fit-content; padding: 10px 0; color: #d3e5df; font-size: .88rem; font-weight: 620; }
.ai-search { display: flex; align-items: stretch; gap: 8px; width: min(100%, 460px); margin: 3px 0 8px; }
.ai-search input, .ai-search button { border-radius: 7px; padding: 8px 12px; min-height: 40px; }
.ai-search input { flex: 1; min-width: 0; font: inherit; font-size: .875rem; color: var(--text); background: #10191e; border: 1px solid var(--divider); }
.ai-search input::placeholder { color: var(--subtle); }
.ai-search button { border: 1px solid #416c57; background: #254739; color: #b1f7d7; white-space: nowrap; }
.ai-search button:hover { color: white; }
.lead-originals .evidence-row { padding: 10px 0; }
.lead-originals .lead-topic-label { margin: 4px 0 0; }
.lead-originals .disclosure { margin: 3px 0 0; }
.provider { display: flex; gap: 7px; align-items: center; font-weight: 600; font-size: .875rem; color: var(--accent); }
.signal-mark { display: block; width: 14px; height: 14px; }
.google { background: linear-gradient(to top,var(--mint) 0 40%,transparent 40% 100%) left / 3px 100% no-repeat, linear-gradient(to top,var(--mint) 0 68%,transparent 68% 100%) center / 3px 100% no-repeat, linear-gradient(to top,var(--mint) 0 95%,transparent 95% 100%) right / 3px 100% no-repeat; }
.threads { border: 1.65px solid var(--violet); border-radius: 55%; position: relative; }
.threads::after { content: ''; position: absolute; top: 4px; left: 4px; width: 4px; height: 4px; border: 1.5px solid var(--violet); border-radius: 55%; }
h2 { font-weight: 680; line-height: 1.25; font-size: clamp(1.15rem, 1.7vw, 1.45rem); letter-spacing: -.04em; }
.unit { color: var(--muted); font-size: .8rem; line-height: 1.55; white-space: nowrap; }
.panel-sub { font-size: .875rem; line-height: 1.6; color: var(--muted); margin-top: 5px; }
.panel-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.waiting, .empty p { color: var(--muted); font-size: .875rem; line-height: 1.65; }
.waiting { margin: 18px 0; }
.empty { min-height: 125px; display: grid; align-content: center; padding: 20px 0; }
.empty strong { display: block; font-size: .95rem; line-height: 1.6; font-weight: 610; color: #d4e1de; }
.empty p { margin-top: 4px; max-width: 41ch; }
.grid-empty { min-height: 175px; margin: 13px 0 9px; text-align: center; justify-content: center; position: relative; isolation: isolate; }
.grid-empty::before { content: ''; position: absolute; z-index: -1; inset: 10px 0 22px; pointer-events: none; background: repeating-linear-gradient(to right, transparent 0 calc(16.66% - 1px), #71838317 calc(16.66% - 1px) 16.66%), repeating-linear-gradient(to bottom, transparent 0 calc(25% - 1px), #71838326 calc(25% - 1px) 25%); mask-image: linear-gradient(to right,transparent,black 10%,black 90%,transparent); }
.grid-empty > div { position: relative; padding: 10px 16px; border: 1px solid #35494b; border-radius: 7px; background: #19272bdd; }
.thread-panel .grid-empty > div { background: #222832ed; border-color: #3c434f; }
.plot { width: 100%; height: clamp(158px, 15vw, 205px); overflow: visible; margin: 16px 0 1px; }
.gridline { stroke: #3a494d; stroke-width: .8; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.tick { fill: #a5b6b5; font-family: inherit; font-size: 13px; }
.swatch { display: block; flex-shrink: 0; width: 13px; height: 3px; border-radius: 2px; }
.c0 { background: #77edbf; }.c1 { background: #acacff; }.c2 { background: #efc890; }.c3 { background: #75b9f5; }.c4 { background: #ed97bb; }
.card-footer { display: flex; gap: 5px 12px; justify-content: space-between; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--divider); color: var(--subtle); font-size: .79rem; line-height: 1.5; }
.thread-stat { display: flex; gap: 6px 9px; align-items: baseline; flex-wrap: wrap; margin: 13px 0 -6px; }
.thread-stat strong { font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; color: #d8d6ff; }
.thread-stat span, .thread-stat small { font-size: .82rem; color: var(--muted); }
.thread-stat small { margin-left: auto; }
.table-scroll { overflow: auto; max-height: 270px; }
.disclosure { color: var(--muted); margin: 5px 0 10px; font-size: .82rem; }
.disclosure summary { padding: 4px 0; width: fit-content; }
.disclosure table { width: 100%; font-variant-numeric: tabular-nums; font-size: .82rem; border-collapse: collapse; }
.disclosure th, .disclosure td { border-bottom: 1px solid var(--divider); text-align: right; padding: 6px 8px; vertical-align: top; }
.disclosure th:first-child { text-align: left; white-space: nowrap; }
.disclosure thead { position: sticky; top: 0; background: #223037; }
.genres, .evidence-list { padding: 0; margin: 15px 0 2px; }
.genre + .genre { border-top: 1px solid #2b3a40; }
.genre summary { display: grid; grid-template-columns: minmax(65px, 1.3fr) minmax(25px, 3fr) auto 10px; align-items: center; gap: 12px; padding: 9px 0; }
.genre summary::after { content: '+'; color: var(--subtle); font-size: .95rem; }
.genre[open] summary::after { content: '−'; }
.genre summary:hover .genre-name { color: var(--mint); }
.genre-name { overflow-wrap: anywhere; color: #dce8e3; font-size: .9rem; }
.genre progress { appearance: none; border: 0; background: #26383c; height: 7px; width: 100%; border-radius: 9px; overflow: hidden; }
.genre progress::-webkit-progress-bar { border-radius: 9px; background: #26383c; }
.genre progress::-webkit-progress-value { border-radius: 9px; background: linear-gradient(90deg,#448b7d,#84ecc0); }
.genre progress::-moz-progress-bar { border-radius: 9px; background: #74dbb0; }
.genre summary strong { font-size: .875rem; color: #b8f4d8; text-align: right; font-variant-numeric: tabular-nums; min-width: 3ch; }
.genre-details { font-size: .85rem; color: var(--muted); line-height: 1.65; margin: 2px 0 10px; overflow-wrap: anywhere; }
.genre-details p + p { margin-top: 2px; }
.genre-details .evidence-list small { display: block; }
.external { font-weight: 550; text-decoration: none; overflow-wrap: anywhere; }
.external:hover { text-decoration: underline; }
.external::after { content: ' ↗'; white-space: nowrap; font-size: .82em; color: var(--muted); }
.evidence-list { list-style: none; }
.evidence-row { padding: 12px 0; border-top: 1px solid var(--divider); }
.evidence-row small { display: block; color: var(--muted); font-size: .8rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.evidence-row > strong, .evidence-row > a { color: var(--text); font-weight: 600; line-height: 1.5; font-size: .98rem; }
.evidence-row p { margin-top: 5px; color: var(--muted); font-size: .85rem; line-height: 1.65; overflow-wrap: anywhere; }
.sources { border-top: 1px solid var(--divider); padding: 16px 0; }
.sources h2 { font-size: 1rem; }
.source-list { display: flex; flex-wrap: wrap; gap: 9px 22px; list-style: none; padding: 0; margin: 12px 0 0; }
.source-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; font-size: .825rem; }
.source-list strong { font-weight: 550; }
.source-list small, .source-list span { color: var(--muted); font-size: .8rem; }
.status-dot { width: 7px; height: 7px; background: #83969b; border-radius: 50%; }
.status-dot.ready { background: var(--mint); }
.sr-only, .skip:not(:focus) { position: absolute; height: 1px; width: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip:focus { position: absolute; top: 6px; left: 8px; padding: 10px; color: #19372a; background: var(--mint); z-index: 4; }
@media (max-width: 780px) {
  .wrap { width: calc(100% - 36px); }
  .panel { padding: 17px 15px 13px; }
  #dashboard, .detail-grid { gap: 12px; }
  .trend-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; }
  .mast-inner { gap: 24px; }
  .header-row { margin-top: 28px; }
  .header-controls { gap: 6px; }
  .period button { padding-inline: 7px; }
}
@media (max-width: 650px) {
  .wrap { width: calc(100% - 28px); }
  .mast-inner { flex-wrap: wrap; gap: 0; padding-top: 12px; }
  .brand { font-size: 1.12rem; }
  .brand img { width: 28px; height: 28px; }
  nav { order: 2; width: 100%; gap: 24px; padding: 12px 0 0; }
  nav a { padding-bottom: 10px; font-size: .85rem; }
  .header-row { flex-direction: column; align-items: stretch; gap: 16px; margin: 24px 0 14px; }
  .subhead { margin-top: 5px; font-size: .9rem; }
  .header-controls { justify-content: space-between; }
  .market-select, .period { height: 37px; }
  .period button { padding-inline: 12px; }
  .filter-row { flex-direction: column; align-items: stretch; padding: 11px 0 14px; gap: 8px; }
  .keywords { gap: 6px; }
  .chip { padding: 5px 9px; }
  .detail-grid { grid-template-columns: minmax(0,1fr); }
  .lead-analysis-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .trend-panel > .panel-heading { flex-wrap: wrap; gap: 8px; }
  .trend-panel .provider { font-size: .8rem; }
  .trend-metrics, .trend-timeline { padding: 12px; }
  .keyword-table th, .keyword-table td { padding-inline: 4px; }
  .keyword-table thead th:last-child span { display: block; }
  .grid-empty { min-height: 132px; margin: 8px 0; }
  .plot { height: 148px; }
  .source-list { display: grid; gap: 12px; }
}
@media (max-width: 340px) {
  .market-select select { padding-left: 29px; }
  .market-select svg { left: 8px; }
  .period button { padding-inline: 7px; }
}
.rising { padding: 8px 0 0; line-height: 1.55; }
.rising ul { padding: 0; margin: 5px 0 0; list-style: none; }
.rising li { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 12px; padding: 3px 0; align-items: baseline; }
.rising li span:first-child { overflow-wrap: anywhere; color: var(--text); }
.rising strong { color: var(--mint); font-variant-numeric: tabular-nums; }
