/* ============================================================
   news/wy/home · DOM 语义索引检索页
   ============================================================ */

:root {
  --ink: #0f172a;
  --muted: #5b6675;
  --faint: #8a94a3;
  --line: #e3e7ec;
  --bg: #f3f5f8;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e6f4f1;
  --mark: #fde68a;
  --mark-strong: #fbbf24;

  --person: #6d28d9;
  --time: #0e7490;
  --location: #15803d;
  --organization: #b45309;
  --event: #be123c;
  --topic: #475569;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, .mono {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: .88em;
}
code {
  background: #eef1f4;
  border: 1px solid #e2e6ea;
  border-radius: 4px;
  padding: .05em .35em;
}

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- 顶部 ---------- */
.masthead {
  position: relative;
  overflow: hidden;
  color: #e8eef6;
  background:
    radial-gradient(900px 400px at 12% -20%, rgba(20, 184, 166, .22), transparent 60%),
    radial-gradient(700px 380px at 92% 0%, rgba(59, 130, 246, .16), transparent 62%),
    linear-gradient(160deg, #0b1220 0%, #0f1b2c 55%, #101c2e 100%);
  padding: 26px 0 74px;
}
.masthead::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .8), transparent 80%);
}
.masthead .wrap { position: relative; z-index: 1; }

.brandline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  letter-spacing: .04em;
  color: #aebccd;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: #dfe8f2; font-weight: 600; }
.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, .12);
}
.badge {
  padding: 2px 8px;
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 999px;
  color: #9fb0c4;
  font-size: 11px;
  letter-spacing: .08em;
}
.ghost-link { margin-left: auto; color: #9fd8d2; font-size: 12.5px; }

h1 {
  margin: 26px 0 12px;
  font-size: 42px;
  line-height: 1.22;
  letter-spacing: -.015em;
  font-weight: 700;
  color: #f6f9fc;
}
.lede {
  margin: 0 0 24px;
  max-width: 62ch;
  color: #b9c6d6;
  font-size: 14.5px;
  line-height: 1.8;
}
.lede code { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #d9e5f1; }
.lede strong { color: #eaf3f7; font-weight: 600; }

/* 搜索框 */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 780px;
  padding: 8px 8px 8px 16px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
}
.search-icon {
  color: var(--faint);
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px);
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16.5px;
  padding: 8px 0;
}
.search input::placeholder { color: #9aa4b2; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid #d9dee5;
  border-bottom-width: 2px;
  border-radius: 5px;
  color: #8b95a3;
  font-size: 12px;
  font-family: inherit;
}
.search button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}
.search button:hover { background: var(--accent-strong); }
.search button:active { transform: translateY(1px); }

/* 类型筛选 */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: #c7d3e1;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.chip:hover { border-color: rgba(148, 163, 184, .5); background: rgba(255, 255, 255, .08); }
.chip.is-active {
  background: #f8fafc;
  border-color: #f8fafc;
  color: var(--ink);
}
.chip .chip-n {
  font-size: 11px;
  color: #8b9aab;
  font-variant-numeric: tabular-nums;
}
.chip.is-active .chip-n { color: var(--muted); }

.statline {
  margin-top: 14px;
  color: #8fa0b4;
  font-size: 12px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 主区域 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 26px;
  align-items: start;
  margin-top: -40px;
  padding-bottom: 48px;
}
.col-main { min-width: 0; }
.col-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
}

/* 概览 */
.overview-head { margin: 0 0 14px; }
.overview-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -.01em;
}
.overview-head p { margin: 0; color: var(--muted); font-size: 13px; }

.doc-grid { display: grid; gap: 12px; }

.doc-tile {
  display: block;
  padding: 18px 20px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.doc-tile:hover {
  text-decoration: none;
  border-color: #bcd7d2;
  box-shadow: 0 10px 28px -16px rgba(15, 118, 110, .35);
  transform: translateY(-1px);
}
.doc-tile-top {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: .04em;
}
.doc-tile-top .mono { color: var(--accent); font-weight: 600; }
.doc-tile-top time { font-variant-numeric: tabular-nums; }
.doc-tile h3 {
  margin: 8px 0 6px;
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: -.005em;
}
.doc-tile p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}
.doc-tile-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.doc-tile-foot .go { margin-left: auto; color: var(--accent); font-weight: 600; }

/* ---------- 左列手风琴（实体分布 / 高频实体 / 索引说明 / 索引状态） ---------- */
.acc {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  overflow: hidden;
}
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-item > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--faint);
  user-select: none;
  transition: color .16s ease, background-color .16s ease;
}
.acc-item > summary::-webkit-details-marker { display: none; }
.acc-item > summary:hover { color: var(--accent-strong); background: #fafcfb; }
.acc-item[open] > summary { color: var(--muted); }
.acc-caret {
  margin-left: auto;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid #b3bcc8;
  border-bottom: 2px solid #b3bcc8;
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.acc-item[open] > summary .acc-caret { transform: rotate(-135deg); }
.acc-body { padding: 0 18px 16px; }
.acc-body .how { margin-bottom: 0; }
.acc-body .side-note { margin-top: 10px; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: 44px 1fr 28px; align-items: center; gap: 10px; }
.bar-label { font-size: 12.5px; color: var(--muted); }
.bar-track { display: block; height: 7px; border-radius: 999px; background: #eef1f4; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; min-width: 4px; }
.bar-n { text-align: right; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.bar-person .bar-fill { background: var(--person); }
.bar-time .bar-fill { background: var(--time); }
.bar-location .bar-fill { background: var(--location); }
.bar-organization .bar-fill { background: var(--organization); }
.bar-event .bar-fill { background: var(--event); }
.bar-topic .bar-fill { background: var(--topic); }

.hc { display: flex; flex-wrap: wrap; gap: 6px; }

/* 浅色 chips */
.overview .chip,
.empty .chip,
.acc .chip {
  border-color: var(--line);
  background: #fbfcfd;
  color: var(--muted);
}
.overview .chip:hover,
.empty .chip:hover,
.acc .chip:hover {
  border-color: #b9d8d2;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.overview .chip .n,
.empty .chip .n,
.acc .chip .n { color: var(--faint); font-size: 11px; }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.dot-person { background: var(--person); }
.dot-time { background: var(--time); }
.dot-location { background: var(--location); }
.dot-organization { background: var(--organization); }
.dot-event { background: var(--event); }
.dot-topic { background: var(--topic); }

/* ---------- 结果 ---------- */
.results { padding-top: 2px; }
.result-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 22px 0 10px;
}
.result-head:first-child { margin-top: 2px; }
.result-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: .01em;
}
.count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hint { margin: 0; color: var(--faint); font-size: 12px; }

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  padding: 14px 17px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.card:hover { border-color: #cfdad8; box-shadow: 0 6px 20px -14px rgba(15, 23, 42, .3); }

.card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.tag {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  background: #f1f3f5;
  color: var(--muted);
}
.tag-person { background: #f3ecfe; color: var(--person); }
.tag-time { background: #e6f6fa; color: var(--time); }
.tag-location { background: #eaf6ec; color: var(--location); }
.tag-organization { background: #fdf1e3; color: var(--organization); }
.tag-event { background: #fdecef; color: var(--event); }
.tag-topic { background: #eef1f5; color: var(--topic); }
.tag-doc { background: var(--accent-soft); color: var(--accent-strong); }

.entity-value {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16.5px;
  line-height: 1.4;
  font-weight: 650;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.raw { color: var(--faint); font-size: 12px; font-weight: 400; margin-left: 2px; }
.occur-count {
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.entity-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.context {
  margin: 8px 0 0;
  color: #313b49;
  font-size: 13.5px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  box-shadow: inset 0 -1px 0 rgba(180, 83, 9, .18);
}

.card-meta {
  margin-top: 8px;
  color: var(--faint);
  font-size: 11.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.card-meta .sec { color: #6b7686; }

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}
.jump:hover { background: var(--accent-strong); text-decoration: none; }
.copy {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 7px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.copy:hover { border-color: #bcd7d2; color: var(--accent-strong); background: var(--accent-soft); }

.occur {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.occur summary {
  cursor: pointer;
  color: var(--faint);
  font-size: 12px;
  list-style: none;
}
.occur summary::-webkit-details-marker { display: none; }
.occur summary::before { content: "＋ "; color: #b3bcc8; }
.occur[open] summary::before { content: "－ "; }
.occur summary:hover { color: var(--accent); }
.occur ol {
  margin: 8px 0 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.occur li {
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid #eef1f4;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
}
.occur li p { margin: 2px 0 4px; color: #3b4655; }
.occur .sec { color: var(--faint); font-size: 11px; }
.occur a { font-size: 11.5px; }

/* 空状态 */
.empty {
  margin-top: 22px;
  padding: 30px 24px;
  text-align: center;
  background: #fff;
  border: 1px dashed #d5dbe3;
  border-radius: 14px;
  color: var(--muted);
}
.empty-title { margin: 0 0 6px; color: var(--ink); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 0 12px; font-size: 13px; }
.empty .chips { justify-content: center; }

/* ---------- 侧栏 ---------- */
.side-card {
  padding: 16px 17px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.side-card h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--faint);
}
.side-doc { display: block; color: inherit; }
.side-doc:hover { text-decoration: none; }
.side-doc .mono { color: var(--accent); font-size: 11.5px; font-weight: 600; }
.side-doc strong {
  display: block;
  margin: 5px 0 4px;
  font-size: 14.5px;
  line-height: 1.5;
}
.side-doc:hover strong { color: var(--accent-strong); }
.side-date { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.side-counts { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.how {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}
.how li { margin-bottom: 8px; }
.how code { font-size: .9em; }
.side-note {
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--faint);
  font-size: 12px;
  line-height: 1.7;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12.5px;
}
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- 页脚 / toast ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  justify-content: space-between;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  padding: 9px 16px;
  border-radius: 9px;
  background: #101a2b;
  color: #e8eef6;
  font-size: 13px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

:focus-visible {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .side-card { flex: 1 1 260px; }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .masthead { padding: 20px 0 60px; }
  h1 { font-size: 30px; }
  .lede { font-size: 13.5px; }
  .search { padding-left: 12px; gap: 8px; }
  .search input { font-size: 15px; }
  .search kbd { display: none; }
  .search button { padding: 9px 15px; }
  .brandline { flex-wrap: wrap; }
  .ghost-link { margin-left: 0; }
  .result-head { flex-wrap: wrap; gap: 4px 10px; }
  .side-card { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
