:root {
  --bg: #f6f1ea;
  --paper: #fffaf4;
  --ink: #2a2420;
  --muted: #7a7068;
  --line: #e4d8cc;
  --accent: #b4533c;
  --accent-soft: #f3ddd4;
  --chip: #efe6dc;
  --shadow: 0 18px 40px rgba(80, 52, 36, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 20px 28px 16px; background: rgba(246, 241, 234, 0.94);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; display: flex; align-items: center; gap: 8px; }
.eyebrow select { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0.04em; }
.topbar-meta { display: flex; gap: 12px; align-items: center; color: var(--muted); }

.filters { padding: 16px 28px 8px; display: flex; flex-direction: column; gap: 12px; }
.scope-row { display: grid; grid-template-columns: minmax(240px, 360px); }
#question-filter .menu { min-width: 280px; max-height: 360px; }
.q-all { margin: 6px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
.q-source { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.q-children { margin: 4px 0 8px 28px; display: flex; flex-direction: column; gap: 2px; }
.q-children label { color: var(--muted); }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}
.range, .multi, .choice, .edu-wrap {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  box-shadow: var(--shadow);
}
.range { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.range span { display: flex; align-items: center; gap: 6px; }
.range input, .multi input[type="search"], .edu-panel input {
  width: 100%; border: 0; background: #f4eee7; border-radius: 8px; padding: 7px 8px; color: var(--ink);
}
.optional { outline: 1px dashed transparent; }
.optional.active { outline-color: var(--accent); }

.choice-title, #edu-open {
  border: 0; background: none; padding: 0; color: var(--ink); font-weight: 600; cursor: pointer;
}
.choice-body { margin-top: 8px; display: flex; gap: 10px; color: var(--muted); }
.hidden { display: none !important; }

.multi { position: relative; }
.multi-title { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.multi-title b { font-size: 13px; }
.multi-title span { color: var(--muted); font-size: 12px; }
.menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 8;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  box-shadow: var(--shadow); max-height: 280px; overflow: auto;
}
.menu label { display: flex; gap: 8px; padding: 4px 0; }
.more-hint { color: var(--muted); font-size: 12px; padding: 6px 0 2px; }
.loc-multi .menu { min-width: 280px; max-height: 360px; }
.loc-all { margin: 6px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
.loc-group { margin: 2px 0; }
.loc-parent { display: flex; align-items: center; gap: 6px; }
.twist, .loc-parent .twist { border: 0; background: none; width: 18px; padding: 0; color: var(--muted); cursor: pointer; }
.loc-children { margin: 0 0 4px 28px; }
.loc-children label { font-size: 13px; color: var(--muted); }
.edu-wrap { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.edu-wrap span { color: var(--muted); font-size: 12px; }

.pager { display: flex; gap: 8px; align-items: center; padding: 0 28px 8px; color: var(--muted); }
.pager button { min-width: 36px; }
.table-wrap { overflow: auto; padding: 8px 28px 16px; }
table { width: max-content; min-width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 16px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 0; background: #faf4ee; font-size: 12px; color: var(--muted); font-weight: 600; z-index: 2; }
th.name-col { max-width: 128px; white-space: normal; overflow: visible; }
th.name-col input {
  display: block; width: 100%; margin-top: 0px; border: 0; background: #f4eee7;
  border-radius: 8px; padding: 2px 3px; color: var(--ink); font: inherit; font-weight: 400;
}
mark.hit { background: #f3c9a0; color: inherit; padding: 0 1px; border-radius: 2px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--accent-soft); }

.mask { position: fixed; inset: 0; background: rgba(42, 36, 32, 0.28); display: grid; place-items: center; z-index: 20; }
.edu-panel { width: min(960px, calc(100vw - 32px)); height: min(620px, calc(100vh - 32px)); background: var(--paper); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.edu-panel header { display: flex; justify-content: space-between; align-items: center; }
.edu-cols { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 12px; min-height: 0; flex: 1; }
.edu-cols section { min-height: 0; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chip-list { overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.chip { display: flex; gap: 8px; align-items: center; padding: 4px 0; }

.ghost, button.ghost { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
button { font: inherit; }

.detail-body { max-width: 880px; margin: 0 auto; }
.detail { padding: 8px 28px 48px; }
.links { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 20px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0 0 24px; }
.facts div { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 4px 0 0; }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.block h2 { margin: 0 0 10px; font-size: 16px; }
.block p, .block pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 900px) {
  .filter-grid, .facts, .edu-cols { grid-template-columns: 1fr; }
  .topbar, .filters, .table-wrap, .detail { padding-left: 16px; padding-right: 16px; }
}
