/* ===== 课后习题 · 原书影印版 ===== */
body.hw-page { background: #eef1f6; }

.hwbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #d8dee9;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.hwbar .hw-title { font-size: 16px; font-weight: 700; color: #1f2937; }
.hwbar .hw-title small { font-weight: 400; color: #6b7280; font-size: 12px; margin-left: 8px; }
.hwbar .grow { flex: 1; }
.hwbar input[type=search] {
  width: 210px; padding: 7px 11px; font-size: 13px;
  border: 1px solid #cbd5e1; border-radius: 8px; outline: none;
}
.hwbar input[type=search]:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.14); }
.hwbar button {
  padding: 7px 13px; font-size: 13px; cursor: pointer;
  border: 1px solid #cbd5e1; background: #fff; color: #374151;
  border-radius: 8px;
}
.hwbar button:hover { background: #f3f4f6; border-color: #9ca3af; }
.hwbar button.on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.hwbar a.back { font-size: 13px; color: #4f46e5; text-decoration: none; }
.hwbar a.back:hover { text-decoration: underline; }

.hwwrap { max-width: 900px; margin: 0 auto; padding: 22px 16px 90px; }

.hw-ch {
  margin: 26px 0 12px;
  display: flex; align-items: baseline; gap: 10px;
  scroll-margin-top: 64px;
}
.hw-ch .cnum {
  font-size: 12px; font-weight: 700; color: #fff;
  background: #4f46e5; border-radius: 6px;
  padding: 3px 9px;
}
.hw-ch .cname { font-size: 17px; font-weight: 700; color: #111827; }
.hw-ch .ccount { font-size: 12px; color: #9ca3af; }

.hw-item {
  background: #fff; border: 1px solid #dfe4ec; border-radius: 12px;
  margin: 0 0 16px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(16,24,40,.05);
  scroll-margin-top: 64px;
}
.hw-item .no {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #f7f9fc;
  border-bottom: 1px solid #e5eaf2;
}
.hw-item .no b { font-size: 14px; color: #1e293b; }
.hw-item .no .pg { font-size: 11px; color: #94a3b8; margin-left: auto; }
.hw-item .no .jump {
  font-size: 11px; color: #4f46e5; cursor: pointer;
  border: 1px solid #c7d2fe; background: #eef2ff;
  border-radius: 6px; padding: 2px 8px;
}
.hw-item .no .jump:hover { background: #e0e7ff; }

.hw-item .cap {
  font-size: 12px; color: #64748b; font-weight: 600;
  padding: 9px 14px 5px; letter-spacing: .02em;
}
.hw-item .cap.a { color: #047857; }
.hw-item .cap.a::before { content: "✓ "; }

.hw-item img {
  display: block; width: 100%; height: auto;
  background: #fff;
}
.hw-item .shot { padding: 0 8px 10px; }
.hw-item .shot.ans { border-top: 1px dashed #e2e8f0; padding-top: 4px; }
.hw-item .ans-open { display: none; }
.hw-item.closed .ans-open { display: none; }
.hw-item.closed .shot.ans img { display: none; }
.hw-item.closed .shot.ans::after {
  content: "答案已折叠 · 点击题目右上方「展开答案」查看";
  display: block; padding: 18px 6px; text-align: center;
  font-size: 12px; color: #94a3b8;
}

.hw-empty { text-align: center; color: #94a3b8; padding: 60px 0; font-size: 14px; }

@media (max-width: 640px) {
  .hwwrap { padding: 14px 10px 70px; }
  .hwbar input[type=search] { width: 130px; }
  .hw-item .no .pg { display: none; }
}
@media print {
  .hwbar { display: none; }
  .hw-item { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
}
