:root{
  --bg:#f7f7f5; --card:#ffffff; --ink:#1c1c1e; --muted:#6b7280; --line:#e3e3df;
  --accent:#0f766e; --accent-soft:#e6f2f0; --accent-ink:#0b5d56;
  --amber:#b45309; --amber-soft:#fdf3e3; --radius:10px;
  --mono:"SF Mono",ui-monospace,Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--ink);
  font:15px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
}
a{color:var(--accent-ink)}
header{
  padding:20px 26px 16px; background:var(--card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:30;
}
header h1{margin:0; font-size:20px; letter-spacing:.2px}
header .sub{color:var(--muted); font-size:13px; margin-top:3px}
header .path{font-family:var(--mono); font-size:12px; color:var(--accent-ink); margin-top:6px}
main{display:grid; grid-template-columns:330px minmax(0,1fr); gap:0; align-items:start}
aside{
  padding:16px 14px 60px; border-right:1px solid var(--line); background:var(--card);
  /* 头部高度由 app.js 实测写入 --head-h（顶部多了主搜索栏，不能再写死 84px） */
  height:calc(100vh - var(--head-h, 84px)); overflow-y:auto; position:sticky; top:var(--head-h, 84px);
}
section.panel{margin-bottom:14px}
section.panel h2{
  margin:0 0 8px; font-size:12px; letter-spacing:.8px; text-transform:uppercase;
  color:var(--muted); font-weight:600; display:flex; justify-content:space-between; align-items:center;
}
section.panel h2 .reset{font-size:11px; color:var(--accent-ink); cursor:pointer; text-transform:none; letter-spacing:0; font-weight:500}
ul.opts{list-style:none; margin:0; padding:0; max-height:230px; overflow-y:auto;
        border:1px solid var(--line); border-radius:var(--radius)}
/* 「显示不全」修复（2026-09-26）：230px 的框只能露出 ~8 行，11 个大板块 / 13 个小板块
   会被内滚动条藏掉，看上去像「某些板块被删了、细分不够」。大板块/小板块列表短 → 不截断；
   考点/知识点可能几十条 → 放宽到视口 60%（最高 520px），侧栏本身也可滚动，不会丢内容。 */
#p-domain, #p-branch{max-height:none; overflow-y:visible}
#p-topic, #p-point{max-height:min(60vh, 520px)}
ul.opts.empty{max-height:none}
ul.opts li{
  display:flex; align-items:center; gap:8px; padding:6px 9px; cursor:pointer;
  border-bottom:1px solid #f0f0ec; font-size:13.5px;
}
ul.opts li:last-child{border-bottom:none}
ul.opts li:hover{background:#fafaf8}
ul.opts li.on{background:var(--accent-soft); color:var(--accent-ink); font-weight:600}
ul.opts li.zero{color:#b9bcc2; cursor:default}
ul.opts li .nm{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
ul.opts li .en{font-size:11px; color:var(--muted); font-weight:400; margin-left:4px}
ul.opts li .ct{font-family:var(--mono); font-size:11px; color:var(--muted); background:#f3f3f0;
               padding:1px 6px; border-radius:20px}
ul.opts li.zero .ct{background:#fafaf8}
.yearbar{display:flex; flex-wrap:wrap; gap:5px}
.yearbar button{
  font:inherit; font-size:12px; padding:3px 8px; border:1px solid var(--line);
  background:#fff; border-radius:20px; cursor:pointer; color:var(--ink)
}
.yearbar button.on{background:var(--accent); border-color:var(--accent); color:#fff}
input[type=search],input[type=text]{
  width:100%; font:inherit; font-size:13px; padding:7px 10px; border:1px solid var(--line);
  border-radius:var(--radius); background:#fff
}
.btn{
  font:inherit; font-size:13px; padding:6px 12px; border-radius:8px; cursor:pointer;
  border:1px solid var(--line); background:#fff; color:var(--ink)
}
.btn:hover{border-color:var(--accent); color:var(--accent-ink)}
.btn.primary{background:var(--accent); border-color:var(--accent); color:#fff}
.btn.primary:hover{background:var(--accent-ink)}
#results{padding:18px 22px 80px; min-width:0}
.toolbar{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:12px}
.toolbar .count{font-size:13.5px; color:var(--muted); margin-right:auto}
.toolbar .count b{color:var(--ink); font-size:15px}
.crumbs{display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:12px; font-size:13px}
.crumbs span.cr{background:var(--accent-soft); color:var(--accent-ink); padding:2px 9px; border-radius:20px; cursor:pointer}
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:12px 14px; margin-bottom:9px; cursor:pointer
}
.card:hover{border-color:#c9d8d5}
.card .top{display:flex; align-items:baseline; gap:9px; flex-wrap:wrap}
.card .lab{font-family:var(--mono); font-weight:700; color:var(--accent-ink); font-size:13.5px}
.card .ttl{font-weight:600; font-size:14.5px}
.card .yr{font-family:var(--mono); font-size:12px; color:var(--muted)}
.card .mk{font-size:11.5px; color:var(--amber); background:var(--amber-soft); padding:1px 7px; border-radius:20px}
.card .snip{color:#3f3f46; font-size:13.5px; margin-top:5px; max-height:44px; overflow:hidden}
.chips{display:flex; flex-wrap:wrap; gap:5px; margin-top:8px}
.chip{font-size:11.5px; padding:1.5px 8px; border-radius:20px; background:#f2f2ef; color:#4b5563; cursor:pointer}
.chip:hover{background:var(--accent-soft); color:var(--accent-ink)}
.chip.lv-domain{background:#eef2ff; color:#3730a3}
.chip.lv-branch{background:#e6f2f0; color:#0b5d56}
.chip.lv-topic{background:#fef3c7; color:#92400e}
.chip.lv-point{background:#fce7f3; color:#9d174d}
.chip.llm{outline:1px dashed #b9bcc2}
#drawer{
  position:fixed; top:0; right:0; width:min(760px,92vw); height:100vh; background:var(--card);
  border-left:1px solid var(--line); box-shadow:-8px 0 32px rgba(0,0,0,.09);
  transform:translateX(102%); transition:transform .22s ease; overflow-y:auto; z-index:60; padding:22px 26px 90px
}
#drawer.open{transform:none}
#drawer h3{margin:0 0 4px; font-size:17px}
#drawer .meta{color:var(--muted); font-size:12.5px; margin-bottom:14px; font-family:var(--mono)}
#drawer .close{position:absolute; top:14px; right:18px; font-size:22px; line-height:1; cursor:pointer; color:var(--muted)}
.block{margin-bottom:16px}
.block h4{margin:0 0 6px; font-size:12px; letter-spacing:.7px; text-transform:uppercase; color:var(--muted)}
.block .body{white-space:pre-wrap; font-size:14px; background:#fbfbf9; border:1px solid var(--line);
             border-radius:var(--radius); padding:10px 12px; max-height:340px; overflow-y:auto}
.block .body.ans{background:#f7faf8; border-color:#d9e8e4}
/* 数学符号：上下标用真上标/下标渲染，数学变量斜体；字体栈覆盖希腊字母与数学算符 */
.block .body, .card .snip, .crumbs, .path{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Apple Symbols","Segoe UI Symbol",
              "STIX Two Math","Cambria Math","DejaVu Sans",system-ui,sans-serif;
}
.block .body sup{font-size:.72em; vertical-align:super; line-height:0}
.block .body sub{font-size:.72em; vertical-align:sub; line-height:0}
.block .body i{font-style:italic; font-family:"Times New Roman",Cambria,Georgia,serif}
/* 教材索引 */
.refs{display:flex; flex-direction:column; gap:8px}
.ref{background:#fff; border:1px solid var(--line); border-left:3px solid #b45309; border-radius:8px; padding:8px 11px}
.ref .rbook{font-weight:600; font-size:13.5px}
.ref .rbook .red{font-weight:400; color:var(--muted); font-size:11.5px}
.ref .rloc{font-size:13px; color:#3f3f46; margin-top:2px}
.ref .rsec{font-size:12.5px; color:var(--muted); font-family:var(--mono)}
.ref .rpg{font-size:12.5px; color:#92400e; font-family:var(--mono)}
.ref .rpg.unver{color:#9ca3af}
.ref .ver{font-size:11px; color:#0b5d56; background:#e6f2f0; padding:0 6px; border-radius:20px}
.ref .unver{font-size:11px; color:#92400e; background:var(--amber-soft); padding:0 6px; border-radius:20px}
.ref a{font-size:11.5px}
.sub{border-left:2px solid var(--accent-soft); padding-left:10px; margin:7px 0}
.sub b{font-family:var(--mono); color:var(--accent-ink)}
#drawer img.qimg{width:100%; border:1px solid var(--line); border-radius:var(--radius); background:#fff; cursor:zoom-in}
img.zoomed{position:fixed; inset:0; width:100vw!important; height:auto; z-index:99; background:#fff; object-fit:contain}
.empty{color:var(--muted); padding:40px 6px; text-align:center; font-size:14px}
.fbadge{font-size:11px; color:var(--muted)}
/* —— 卡片完整题干：默认折叠到 ~4 行，点击展开 —— */
.card .stem-body{position:relative; margin-top:6px}
.card .stem-inner{font-size:14px; color:#3f3f46; line-height:1.55; white-space:pre-wrap;
  word-break:break-word; font-family:"Times New Roman",Cambria,Georgia,serif}
.card .stem-inner sup{font-size:.72em; vertical-align:super; line-height:0}
.card .stem-inner sub{font-size:.72em; vertical-align:sub; line-height:0}
.card .stem-inner i{font-style:italic}
.card .stem-body{position:relative}
.card .stem-body.foldable .stem-inner{max-height:150px; overflow:hidden}
.card .stem-body.foldable::after{content:'⋯ 点击展开全文（含结构式与数值）';
  position:absolute; bottom:0; left:0; right:0; text-align:center; padding:18px 0 4px; font-size:12px; color:var(--accent);
  background:linear-gradient(to bottom, transparent, #fff 60%); pointer-events:none}
.card .stem-body.foldable.expanded::after{display:none}
.card .stem-body.foldable.expanded .stem-inner{max-height:none}
/* —— 卡片默认全展开：题干+子小题+题图直接显示，可直接做题，无需回原卷 —— */
.card .stem-subs{margin-top:10px; padding-top:8px; border-top:1px dashed var(--line)}
.card .stem-subs .sub{font-size:14px}
.card .stem-img{margin-top:10px; border-top:1px dashed var(--line); padding-top:8px}
.card .stem-img img.qimg{max-width:100%; border:1px solid var(--line); border-radius:6px; background:#fff; cursor:zoom-in}
.card .card-open{margin-top:8px; font-size:12.5px; opacity:.75}
.card .card-open a{color:var(--accent-ink); text-decoration:underline; cursor:pointer}
/* 点击卡片本体即展开折叠再进抽屉 */
/* —— 知识点讲解 —— */
.block.knowledge{background:#fbfaf6; border:1px solid #e7e2d5; border-left:3px solid #7c3aed; border-radius:8px; padding:8px 12px}
.knowledge .kn-sum{font-size:14px; color:#3f3f46; font-weight:500; margin-bottom:6px}
.knowledge .body{background:#fff; border:none; padding:0; margin:0; font-size:14px; line-height:1.7; white-space:normal}
.knowledge .kn-eq{text-align:center; font-family:"Times New Roman",Cambria,Georgia,serif; font-size:15px; margin:6px 0; color:#111}
.knowledge .kn-formula{font-family:var(--mono); font-size:14px; background:#fff; border:1px dashed var(--line); border-radius:6px; padding:8px; margin:8px 0; text-align:center}
.knowledge .kn-sub{margin-top:8px}
.knowledge .kn-sub ul{margin:4px 0 0; padding-left:18px}
.knowledge .kn-sub li{font-size:13.5px; margin:3px 0; color:#3f3f46}
.knowledge .kn-pitfall{margin-top:8px; font-size:13px; color:#92400e; background:var(--amber-soft); border-radius:6px; padding:6px 10px}
.knowledge .kn-freq{margin-top:10px; font-size:13.5px; background:#eef2ff; border:1px solid #c7d2fe; border-radius:6px; padding:8px 10px; color:#312e81}
.knowledge .kn-freq .freq-tag{display:inline-block; font-weight:700; background:#4f46e5; color:#fff; border-radius:4px; padding:1px 8px; margin-right:8px; font-size:12.5px}
.knowledge .kn-freq .freq-body{line-height:1.6}
.knowledge .kn-papers{margin-top:8px; font-size:13px}
.knowledge .kn-papers ul{margin:4px 0 0; padding-left:18px}
.knowledge .kn-papers li{margin:4px 0; font-size:13px}
.knowledge .kn-papers a{color:var(--accent-ink); text-decoration:underline}
@media(max-width:900px){
  main{grid-template-columns:1fr}
  aside{position:static; height:auto; border-right:none; border-bottom:1px solid var(--line)}
}
@media print{
  header,aside,.toolbar .btn,#drawer .close{display:none!important}
  body{background:#fff}
  main{display:block}
  #results{padding:0}
  .card{break-inside:avoid; border:none; border-bottom:1px solid #ddd}
}

/* 大题归属标识：每道拆开的小题明确标注它属于哪一年的哪一道大题 */
.card .bo-group{font-size:12px; color:var(--amber); background:var(--amber-soft); padding:1px 9px; border-radius:20px; font-family:var(--mono); font-weight:600}
.card .bo-part{font-family:var(--mono); font-weight:700; color:var(--accent-ink); font-size:13.5px}
.drawer .bo-line{font-size:15px; font-weight:700; color:var(--accent-ink); margin-bottom:2px}
.drawer .bo-sub{font-size:12.5px; color:var(--muted); margin-bottom:8px}

/* 大题题干（条件区）：做题前先读背景/给定条件 */
.q-head{border-left:3px solid var(--amber); background:var(--amber-soft); padding:8px 10px; margin-bottom:6px; border-radius:0 6px 6px 0}
.q-head-title{font-weight:700; font-size:12.5px; color:var(--amber); margin-bottom:5px}
.q-head-text{font-size:12.5px; color:#333; line-height:1.55; margin-bottom:5px; white-space:pre-wrap}
.q-head img{max-height:340px; margin-top:4px}

/* 整题上下文（同一大题的其它小题） */
.qn-ctx{margin:10px 0;border:1px solid #d7e0dd;border-radius:8px;overflow:hidden;background:#fbfdfc}
.qn-ctx-bar{background:var(--accent-soft);color:var(--accent-ink);font-weight:600;padding:8px 12px;cursor:pointer;font-size:13px}
.qn-ctx-bar:hover{background:#dcefed}
.qn-ctx-body{display:none;padding:10px 12px;border-top:1px solid var(--line);max-height:80vh;overflow-y:auto}
.qn-ctx.open .qn-ctx-body{display:block}
.qn-ctx .part{border:1px solid var(--line);border-radius:6px;margin:8px 0;padding:8px 10px;background:#fff}
.qn-ctx .part.active{border-color:var(--accent);background:var(--accent-soft);box-shadow:inset 3px 0 0 var(--accent)}
.qn-ctx .part-tag{font-weight:700;font-size:12px;color:var(--accent-ink);margin-bottom:4px}
.qn-ctx .part.active .part-tag{color:var(--accent)}
.qn-ctx .part-body{font-size:14px;line-height:1.55;color:var(--ink)}
.qn-ctx .part .qimg{margin-top:6px;max-height:320px;object-fit:contain;background:#fff}

/* ================= 主搜索栏（顶部，含卷子 / 年份筛选项） ================= */
header .searchbar{margin-top:12px}
.searchbar .sb-row{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.searchbar .sb-ico{font-size:15px; opacity:.65}
.searchbar #m-kw{
  flex:1 1 340px; min-width:200px;
  padding:9px 12px; font-size:14.5px; font-family:inherit;
  border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink);
}
.searchbar #m-kw:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft)}
.searchbar #m-kw::placeholder{color:#9aa1ab}
.searchbar select{
  padding:9px 10px; font-size:14px; font-family:inherit;
  border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink);
  max-width:240px;
}
.searchbar select:focus{outline:none; border-color:var(--accent)}
.searchbar .sb-hint{font-size:12.5px; color:var(--muted); margin-top:7px; min-height:17px; line-height:1.5}
.searchbar .sb-hint b{color:var(--accent-ink); font-size:14px}
.searchbar .sb-hint .sb-sep{opacity:.45; margin:0 3px}
@media(max-width:900px){
  .searchbar #m-kw{flex:1 1 100%}
  .searchbar select{flex:1 1 130px; max-width:none}
}
