/* ==========================================================================
   iCoder 技术笔记 · 样式表
   设计取向：浅色、克制、以书封为主角；信息层级靠留白与字重，不靠装饰。
   响应式：移动优先，3 档断点（540 / 768 / 1080）。
   ========================================================================== */

/* ---------------------------------------------------------------- 设计变量 */
:root {
  /* 主色：学术蓝，用于链接与焦点；正文用近黑，避免纯黑刺眼 */
  --c-primary:        #1d4ed8;
  --c-primary-dark:   #1e3a8a;
  --c-primary-soft:   #eff4ff;

  --c-text:           #14181f;
  --c-text-2:         #4a5260;
  --c-text-3:         #6b7280;

  --c-bg:             #f6f7f9;
  --c-surface:        #ffffff;
  --c-border:         #e3e6ec;
  --c-border-strong:  #cdd3dd;

  /* 反馈色 */
  --c-warn-bg:        #fff7ed;
  --c-warn-border:    #fed7aa;
  --c-warn-text:      #9a3412;

  /* 圆角与阴影 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 4px 10px rgba(16, 24, 40, .07), 0 12px 28px rgba(16, 24, 40, .08);
  --shadow-3: 0 8px 20px rgba(16, 24, 40, .10), 0 20px 48px rgba(16, 24, 40, .12);

  /* 版心与节奏 */
  --wrap: 1180px;
  --gutter: 20px;

  --t-fast: 140ms cubic-bezier(.4, 0, .2, 1);

  /* 封面统一比例（清华社封面约 1500×2108，约 1:1.4） */
  --cover-ratio: 1 / 1.405;
}

/* ---------------------------------------------------------------- 基础重置 */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点跳转让出 sticky 页头的高度。
     页头是 position:sticky 的，跳转到 #ch-第3章 时标题会被它盖住。
     以前靠 JS 在 DOMContentLoaded 里 scrollTo 补偿 —— 但浏览器原生的
     锚点滚动发生在这之后，会把补偿覆盖掉，实测标题被盖 65px。
     改用这个声明式属性：浏览器自己滚锚点时就会留出这段空间，
     不存在谁覆盖谁的问题。两个断点量出来的实际高度不同，所以用变量。 */
  scroll-padding-top: var(--head-h);
}

/* 页头实测高度：桌面 65px，手机（搜索框换行）101px */
:root { --head-h: 76px; }
@media (max-width: 620px) { :root { --head-h: 112px; } }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--c-primary); text-decoration: none; }

/* 焦点可见：无障碍硬要求，不要为了美观去掉 */
:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -.01em;
}

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------------------------------------------------------------- hidden 强制生效
   ⚠️ 这条不能删。浏览器默认的 [hidden] { display: none } 只是「用户代理样式」，
   优先级低于任何作者写的 display —— 而本站卡片 .book-card 是 display: flex，
   会把 hidden 覆盖掉，导致 JS 里 li.hidden = true 完全没效果（筛选按钮点了没反应）。
   用 !important 一劳永逸地兜住：今后给任何元素加 display 都不会再踩这个坑。 */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 工具类 */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--c-text-3); font-weight: 400; }

/* 键盘用户跳过导航 */
.skip-link {
  position: absolute;
  left: 50%;
  top: -60px;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--c-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 600;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 0; }

/* ---------------------------------------------------------------- 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding-block: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary), #4f6ef7);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.01em; }

/* 副标题：原来是英文装饰小字（uppercase + .06em 字距），
   换成中文正文后这套样式会挤得很难看 ——
   中文没有大小写，uppercase 无意义，字距 .06em 会把「计算机教学资料」
   拆得松松散散。改成正常中文排版：字号 12px、字距归常、颜色降一档。 */
.brand-text small {
  font-size: 12px;
  color: var(--c-text-3);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;       /* 副标题不折行，折成两行会把页头撑高 */
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* 搜索框：桌面靠右，移动端换行占满 */
.header-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 340px;
  margin-left: auto;
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: var(--c-surface);
  font-size: 14.5px;
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  /* 移动端 ≥16px 可避免 iOS 聚焦自动放大 */
}

.header-search input::placeholder { color: var(--c-text-3); }

.header-search input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .13);
}

.q-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--c-border);
  color: var(--c-text-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.q-clear:hover { background: var(--c-border-strong); }

/* ---------------------------------------------------------------- 首页 hero */
.hero {
  padding-block: 44px 8px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(26px, 4.6vw, 40px);
  letter-spacing: -.02em;
}

/* 副标题：放在 h1 上方，字号明显大于原来的 12px 页头小字。
   做成「眉题」（eyebrow）而不是副标题 —— 它定义的是整站是什么，
   不是这一页在做什么，所以位置在 h1 之前，字号介于正文与大标题之间。 */
.hero-tag {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--c-primary-soft, #eaf0ff);
  color: var(--c-primary-dark, #1e3a8a);
  font-size: clamp(14px, 1.5vw, 17.5px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.5;
}

.hero-sub {
  max-width: 640px;
  margin: 12px auto 0;
  color: var(--c-text-2);
  font-size: 15.5px;
}

.hero-sub strong { color: var(--c-primary); font-size: 17px; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.hero-stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 104px;
  padding: 14px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.hero-stats strong {
  font-size: 24px;
  line-height: 1.1;
  color: var(--c-primary);
  font-variant-numeric: tabular-nums;
}

.hero-stats span { font-size: 12.5px; color: var(--c-text-3); }

/* ---------------------------------------------------------------- 区块标题 */
.section-title {
  margin-block: 40px 18px;
  font-size: 20px;
  letter-spacing: -.01em;
}

/* ---------------------------------------------------------------- 学科卡片网格 */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.cat-card { display: flex; }

.cat-link {
  display: flex;
  gap: 16px;
  width: 100%;
  padding: 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  color: var(--c-text);
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              border-color var(--t-fast);
}

.cat-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #c3cdf5;
}

/* 三张封面叠view，快速传达该类内容 */
.cat-thumbs {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-left: 10px;
}

.cat-thumbs img {
  width: 40px;
  height: 56px;
  /* 封面按比例完整显示，裁切会让书名不可辨 */
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid var(--c-border);
  box-shadow: 0 2px 6px rgba(16, 24, 40, .14);
  margin-left: -10px;
  background: #fff;
}

.cat-main { min-width: 0; flex: 1; }

.cat-name {
  font-size: 16px;
  margin-bottom: 5px;
  letter-spacing: -.01em;
}

.cat-desc {
  font-size: 13px;
  color: var(--c-text-3);
  line-height: 1.55;
  /* 最多 2 行，保持卡片等高整齐 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--c-text-2);
}

.cat-meta strong { color: var(--c-primary); font-size: 15px; }

.cat-go {
  margin-left: auto;
  color: var(--c-primary);
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--t-fast);
}
.cat-link:hover .cat-go { transform: translateX(3px); }

/* ---------------------------------------------------------------- 书目封面网格 */
.book-grid {
  display: grid;
  /* 手机 2 列，桌面自适应到 4~6 列 */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.book-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  padding: 10px 10px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom: none;
  box-shadow: var(--shadow-1);
  color: var(--c-text);
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              border-color var(--t-fast);
}

.book-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3);
  border-color: #c3cdf5;
}

/* 底部操作区：课件按钮 */
.card-acts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: var(--shadow-1);
  transition: border-color var(--t-fast);
}

.book-card:hover .card-acts { border-color: #c3cdf5; }
.is-nolink:hover .card-acts { border-color: var(--c-border); }

.cw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cfd8ea;
  border-radius: 6px;
  background: #f4f7fd;
  color: var(--c-primary-dark);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast);
}

.cw-btn:hover {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

.cw-ico {
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.cw-kind {
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(29, 78, 216, .1);
  color: inherit;
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.5;
  opacity: .85;
}

.cw-btn:hover .cw-kind { background: rgba(255, 255, 255, .22); }

/* 无课件：不是禁用，而是引导扫码获取，所以要看起来可点 */
.cw-btn.is-off {
  border-color: #e3d3b8;
  border-style: solid;
  background: #fdf8ef;
  color: #96631a;
  font-weight: 600;
  cursor: pointer;
}

.cw-btn.is-off:hover {
  background: #f8edd8;
  border-color: #d8be8e;
  color: #7a4f10;
}

.cw-btn.is-off .cw-kind {
  background: rgba(150, 99, 26, .12);
  color: #96631a;
  font-weight: 500;
}

.book-link:hover .card-title { color: var(--c-primary); }

/* ---------------------------------------------------------------- 申请样书按钮
   默认：绿色系描边，与蓝色的「下载课件」区分开
   已加入申请单：实心绿 + 文案改为「已在申请单」
   已满 3 册：降饱和，提示不可再加（仍可点，点了给提示） */
.apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #b9dcc6;
  border-radius: 6px;
  background: #f2faf5;
  color: #1c6b3f;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.apply-btn:hover {
  background: #e3f5ea;
  border-color: #8fc9a5;
  color: #145230;
}

.apply-btn:focus-visible {
  outline: 2px solid #1c6b3f;
  outline-offset: 2px;
}

.apply-ico {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* 已在申请单：实心 */
.apply-btn.is-in {
  background: #1c6b3f;
  border-color: #1c6b3f;
  color: #fff;
}

.apply-btn.is-in:hover {
  background: #145230;
  border-color: #145230;
  color: #fff;
}

.apply-btn.is-in .apply-ico { font-size: 0; }
.apply-btn.is-in .apply-ico::after {
  content: "✓";
  font-size: 11px;
  font-weight: 700;
}

/* 申请单已满且本书不在其中 */
.apply-btn.is-full {
  background: #f6f6f4;
  border-color: #dedcd4;
  color: #9a978d;
  font-weight: 500;
}

.apply-btn.is-full:hover {
  background: #f0efec;
  border-color: #cfccc2;
  color: #7d7a71;
}

/* ---------------------------------------------------------------- 底部提示条 */
.apply-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 920;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 200px);   /* 右侧留出悬浮按钮的宽度，避免遮挡 */
  padding: 10px 12px 10px 14px;
  background: #1f2a37;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
  color: #fff;
  font-size: 13px;
  transform: translate(-50%, 16px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

.apply-toast[hidden] { display: none; }
.apply-toast.is-show { transform: translate(-50%, 0); opacity: 1; }

.at-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  background: #2f9e63;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.at-msg { line-height: 1.5; }

.at-act {
  flex: none;
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: #fff;
  color: #1f2a37;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.at-act:hover { background: #e8edf5; }

.at-x {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .6);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.at-x:hover { color: #fff; }

/* 悬浮菜单里的申请单数量角标 */
.fab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  margin-left: 6px;
  padding: 0 4px;
  background: #1c6b3f;
  border-radius: 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 640px) {
  /* 悬浮按钮在右下角（底距 24 + 高 56）。手机上提示条通栏，抬到它上方 */
  .apply-toast {
    left: 12px;
    right: 12px;
    bottom: 96px;
    max-width: none;
    transform: translateY(16px);
  }
  .apply-toast.is-show { transform: translateY(0); }
  .at-msg { font-size: 12.5px; }
  .at-act { padding: 5px 10px; }
}

/* 封面：用 aspect-ratio 锁定比例，避免图片加载前的布局跳动（CLS） */
.card-media {
  position: relative;
  aspect-ratio: var(--cover-ratio);
  background: #eef0f4;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 无封面占位：做成书脊的样子，写出书名，比空白块有信息量 */
.cover-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 14px 12px;
  background:
    linear-gradient(135deg, #eef1f9 0%, #f7f9fd 55%, #eaeefa 100%);
  border: 1px solid #e2e8f5;
  border-radius: 4px;
  text-align: center;
}

.cf-badge {
  padding: 2px 8px;
  border: 1px solid #cdd8ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: #8794b4;
  font-size: 9.5px;
  letter-spacing: .06em;
}

.cf-title {
  max-height: 8.4em;
  overflow: hidden;
  color: #5d6b8c;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0;
  /* 书名竖排观感更接近书脊，但不脱离可读性 */
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.card-body { display: flex; flex-direction: column; gap: 5px; flex: 1; }

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: 0;
  /* 书名最多 3 行，超出省略，保证卡片高度一致 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--t-fast);
}

.card-authors {
  font-size: 12px;
  color: var(--c-text-3);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- 获奖/荣誉标签
   视觉层级刻意高于「配套资源」色块：荣誉是选购判断的第一顺位信息。
   用金/红/紫三系 + 左侧竖条，避免与资源色块的浅底圆角混淆。 */
.card-award {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  min-width: 0;
}

.aw-pill {
  flex-shrink: 0;
  max-width: 100%;
  padding: 2px 6px 2px 6px;
  border-radius: 3px;
  border-left: 2.5px solid currentColor;
  font-size: 10px;
  line-height: 1.6;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 规划教材、重点教材：国家级/省部级认定，最有分量 → 金 */
.aw-plan,
.aw-key {
  background: #fff7e3;
  color: #8a5a00;
}

/* 获奖：红 */
.aw-award {
  background: #fdecec;
  color: #a92a25;
}

/* 荣誉称号：紫 */
.aw-honor {
  background: #f3edff;
  color: #5b21b6;
}

/* 推荐教材：蓝 */
.aw-rec {
  background: #e8f0fe;
  color: #174ea6;
}

/* 项目成果：青 */
.aw-project {
  background: #e5f5f6;
  color: #0d6469;
}

.aw-more {
  background: #f1f3f7;
  color: var(--c-text-2);
  border-left-color: #c9cfd8;
  cursor: help;
}

/* 一句话特点：书名看不出来的价值点，用浅色底与正文区分 */
.card-hook {
  margin-top: 3px;
  padding: 6px 8px;
  border-left: 2.5px solid #c7d5ff;
  background: #f7f9fe;
  border-radius: 0 4px 4px 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--c-text-2);
  /* 最多 3 行，超出省略，保证卡片高度整齐 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 出版年 / 书号：标签与值上下排，避免 13 位书号被挤成两行 */
.card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 7px 0 0;
  padding-top: 7px;
  border-top: 1px dashed var(--c-border);
  font-size: 10.5px;
}

.meta-i {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.card-meta dt {
  flex-shrink: 0;
  color: var(--c-text-3);
  white-space: nowrap;
}

.card-meta dd {
  margin: 0;
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -.02em;
}

.card-meta .isbn { letter-spacing: -.03em; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
  font-size: 10.5px;
  line-height: 1.6;
  white-space: nowrap;
}

.tag-year {
  background: #f1f3f7;
  color: var(--c-text-2);
}

.card-no {
  font-size: 10.5px;
  color: #9aa0ab;
  font-variant-numeric: tabular-nums;
}

.card-no span { letter-spacing: .02em; }

/* ---------------------------------------------------------------- 配套资源色块 */
.card-res {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--c-border);
  min-width: 0;
}

.res-label {
  color: var(--c-text-3);
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: .02em;
}

.res-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.res-pill {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.65;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: -.01em;
}

/* 8 组色系：浅底 + 深字 + 同色描边，一屏之内可区分 */
.res-r1 { background: #fee7e7; color: #b3261e; border-color: #f8cfcf; } /* 视频类 */
.res-r2 { background: #e6eeff; color: #1d4ed8; border-color: #cfdcfb; } /* 课件/大纲 */
.res-r3 { background: #e6f6ec; color: #15703c; border-color: #cbead6; } /* 教案/源码 */
.res-r4 { background: #fff2dd; color: #a45c00; border-color: #f9e0b8; } /* 习题/题库 */
.res-r5 { background: #f0e9ff; color: #5b21b6; border-color: #ddd0fa; } /* 数据集/实训 */
.res-r6 { background: #e4f5f6; color: #0f6b72; border-color: #c9eaed; } /* 素材/译文 */
.res-r7 { background: #fdeaf3; color: #a3195b; border-color: #f8d3e4; } /* 音频/网站 */
.res-r8 { background: #eef1f5; color: #42505f; border-color: #dde3ea; } /* 动画/导图 */

.res-more {
  background: #f1f3f7;
  color: var(--c-text-2);
  border-color: #e3e7ee;
  cursor: help;
}

.res-none {
  background: #f5f6f8;
  color: #9aa0ab;
  border-color: #eaecf0;
}

/* ---------------------------------------------------------------- 多维筛选区 */
.facet-bar {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.facet-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.facet-row + .facet-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
}

.facet-name {
  flex-shrink: 0;
  width: 62px;
  padding-top: 5px;
  color: var(--c-text-3);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.facet-row .chips {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.facet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
}

.facet-summary {
  margin: 0;
  color: var(--c-text-2);
  font-size: 12px;
}

.facet-reset {
  flex-shrink: 0;
  padding: 4px 12px;
  border: 1px solid #cfd8ea;
  border-radius: 999px;
  background: #f7f9fd;
  color: var(--c-primary-dark);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.facet-reset:hover {
  background: #eef3fd;
  border-color: #b9c7e6;
}

.card-cta {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--c-border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 无官网地址的卡片：弱化但不隐藏，明确告知 */
.is-nolink .book-link {
  cursor: default;
  box-shadow: none;
  border-style: dashed;
  border-bottom: none;
}
.is-nolink .book-link:hover { transform: none; box-shadow: none; border-color: var(--c-border); }
.is-nolink .card-acts { border-style: dashed; box-shadow: none; }
.card-cta-off { color: var(--c-warn-text); font-weight: 500; }

/* ---------------------------------------------------------------- 学科页 */
.breadcrumb {
  padding-block: 14px 0;
  font-size: 13px;
  color: var(--c-text-3);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
  color: var(--c-border-strong);
}

.breadcrumb a { color: var(--c-text-2); }
.breadcrumb a:hover { color: var(--c-primary); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--c-text); font-weight: 600; }

/* ---------------------------------------------------------------- 返回首页
   面包屑是灰色小字，在详情页这种长页面里根本找不到"回去"的路。
   这里给一个实打实的按钮，带边框与底色，一眼能看见。
   位置紧贴面包屑下方，不抢标题的视觉重心。 */
.page-back {
  margin-top: 10px;
  margin-bottom: 2px;
}
.page-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--c-text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: border-color var(--t-fast), background var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.page-back-btn:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  color: var(--c-primary);
  transform: translateX(-2px);
}
.page-back-btn span { font-size: 14px; }

.cat-hero { padding-block: 18px 22px; }

.cat-hero h1 {
  font-size: clamp(23px, 3.6vw, 32px);
  letter-spacing: -.02em;
}

.cat-hero .hero-sub {
  margin: 10px 0 0;
  max-width: 700px;
  text-align: left;
  font-size: 14.5px;
}

.cat-count {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--c-text-3);
}

.cat-count strong { color: var(--c-primary); font-size: 16px; }

/* 子类筛选 chip */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  /* 移动端可横向滚动，不挤压标题 */
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 13px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }

.chip.is-active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
  font-weight: 600;
}

.chip-n {
  font-size: 11px;
  opacity: .72;
  font-variant-numeric: tabular-nums;
}

/* 荣誉类型筛选：与普通 chip 同形但带金色描边，暗示"这是荣誉维度" */
.facet-row-award {
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 -10px 6px;
  background: #fffdf6;
  border: 1px solid #f3e7c4;
}

.chip-aw { color: #8a5a00; border-color: #e8d5a3; }
.chip-aw:hover { border-color: #c9971a; color: #6f4600; }
.chip-aw.is-active {
  background: #b8860b;
  border-color: #b8860b;
  color: #fff;
}

/* 首页「获奖图书推荐」卡片：金色描边 + 角标，与 12 个学科卡区分 */
.cat-card-award .cat-link {
  border-color: #e8d5a3;
  background: linear-gradient(180deg, #fffdf6 0%, #fff 42%);
}

.cat-card-award .cat-name { color: #8a5a00; }

/* 首页「教学资源」卡片：青色描边，与获奖金卡、普通学科卡三者区分。
   这张卡不放书，放的是「大纲/教案」这类物料，用青绿比蓝色更贴“教学”。 */
.cat-card-res .cat-link {
  border-color: #a7e0cf;
  background: linear-gradient(180deg, #f5fdfa 0%, #fff 42%);
}

.cat-card-res .cat-name { color: #0f6455; }

.cat-card-res .cat-dot { color: var(--c-text-3); }

/* 首页资源卡里没有封面可放时，thumbs 是空的会留一段空白。
   用 min-height 占位不现实（有封面的卡就对不齐了），
   所以让空的 thumbs 直接不占空间。 */
.cat-card-res .cat-thumbs:empty { display: none; }

.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  border-radius: 50%;
  background: #f6d97a;
  color: #7a4d00;
  font-size: 11px;
  line-height: 1;
  vertical-align: 1px;
}

/* 角标是「案」字，不是符号。.cat-badge 默认 20px 圆形是给「★」这种
   单字符图标用的，中文进去会被挤成一点。这里改成圆角矩形、宽度自适应。
   必须写在 .cat-badge 之后 —— 同权重选择器，写前面会被整条覆盖。 */
.cat-badge-res {
  width: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: #a7e0cf;
  color: #0b4f43;
  font-weight: 700;
}

.empty-hint {
  padding: 48px 0;
  text-align: center;
  color: var(--c-text-3);
  font-size: 14.5px;
}

/* 学科翻页 */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-block: 40px 8px;
  padding-top: 22px;
  border-top: 1px solid var(--c-border);
}

.pn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.pn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  box-shadow: var(--shadow-1);
}

.pn-next { margin-left: auto; }

/* ---------------------------------------------------------------- 搜索结果 */
.search-results { padding-bottom: 20px; }

/* ---------------------------------------------------------------- 页脚 */
.site-footer {
  margin-top: 56px;
  padding-block: 28px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: 13px;
  color: var(--c-text-2);
  text-align: center;
}

.site-footer .muted { margin-top: 6px; font-size: 12px; }

/* ICP 备案行：工信部要求页脚展示且可点击核验。
   用 11px + 弱化色，既满足展示要求，又不喧宾夺主。 */
.site-footer .icp-line {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: .2px;
}
.site-footer .icp-line a {
  color: var(--c-text-3, #8a93a3);
  text-decoration: none;
}
.site-footer .icp-line a:hover {
  color: var(--c-text-2);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- 响应式 */
/* 小屏：收紧留白，封面双列 */
@media (max-width: 540px) {
  :root { --gutter: 14px; }

  .hero { padding-block: 30px 4px; }
  .hero-sub { font-size: 14px; }
  .hero-stats { gap: 8px; margin-top: 20px; }
  .hero-stats li { min-width: 0; flex: 1; padding: 11px 8px; }
  .hero-stats strong { font-size: 19px; }
  .hero-stats span { font-size: 11px; }

  .section-title { margin-block: 28px 14px; font-size: 18px; }

  .cat-grid { grid-template-columns: 1fr; gap: 10px; }
  .cat-link { padding: 14px; gap: 12px; }
  .cat-thumbs img { width: 36px; height: 51px; }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .book-link { padding: 8px 8px 10px; }
  .card-title { font-size: 12.5px; -webkit-line-clamp: 3; }
  .card-authors { font-size: 11px; }
  .card-cta { font-size: 11px; }

  .pager { flex-direction: column; }
  .pn { width: 100%; justify-content: center; }
  .pn-next { margin-left: 0; }
}

/* 页头在移动端换行：品牌在上，搜索占满 */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: 10px; padding-block: 8px; min-height: 0; }
  .brand-text strong { font-size: 14.5px; }
  /* 副标题在手机上不再隐藏（原来是 display:none 藏掉英文小字）。
     它是站点的核心说明，手机上恰恰是最需要「这一站是干什么的」的场合。
     缩到 11px，靠 ellipsis 兜住窄屏溢出。 */
  .brand-text small { font-size: 11px; }
  .header-search { max-width: none; flex-basis: 100%; margin-left: 0; }
  .header-search input { height: 38px; font-size: 16px; } /* ≥16px 防 iOS 缩放 */
}

/* 平板：3 列起 */
@media (min-width: 541px) and (max-width: 768px) {
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 769px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
}

@media (min-width: 1080px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 18px; }
}

/* ---------------------------------------------------------------- 无障碍 */
/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .cat-link:hover,
  .book-link:hover { transform: none; }
}

/* 高对比模式兜底 */
@media (forced-colors: active) {
  .cat-link,
  .book-link,
  .chip,
  .pn { border: 1px solid ButtonBorder; }
  .chip.is-active { border: 2px solid Highlight; }
}

/* ---------------------------------------------------------------- 打印 */
@media print {
  .site-header, .pager, .chips, .site-footer, .skip-link { display: none; }
  body { background: #fff; }
  .book-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .book-link { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ==========================================================================
   悬浮按钮 · 样书申请 · 联系模态框
   ========================================================================== */

/* ---------------------------------------------------------------- 悬浮按钮 */
/* ---------------------------------------------------------------- 悬浮操作按钮
   四个动作常驻展示，不再折叠到「+」后面。
   竖排贴在右侧，纵向占用 ~200px；移动端收窄内边距，避免压住卡片按钮。
*/
.fab-wrap {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;   /* 容器本身不挡点击，只有按钮可点 */
}

.fab-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  pointer-events: auto;
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  animation: fabIn 200ms cubic-bezier(.4, 0, .2, 1) both;
}

.fab-item:nth-child(1) { animation-delay: 0ms; }
.fab-item:nth-child(2) { animation-delay: 50ms; }
.fab-item:nth-child(3) { animation-delay: 100ms; }
.fab-item:nth-child(4) { animation-delay: 150ms; }

@keyframes fabIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.fab-item:hover {
  border-color: #c3cdf5;
  box-shadow: var(--shadow-3);
  transform: translateY(-1px);
}

.fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fab-dot-apply { background: var(--c-primary); }
.fab-dot-cw { background: #d97706; }
.fab-dot-pwd { background: #dc2626; }
.fab-dot-contact { background: #16a34a; }
.fab-dot-more { background: #7c3aed; }

/* 悬浮菜单开关：桌面端不需要（菜单常驻），手机端才出现。
   原来五个胶囊在手机上是常驻竖排的，约 260px 高，固定在右下角会压住正文 ——
   详情页首屏的获奖标签、出版日期和操作按钮就是这么被盖掉的。
   改成「一个圆按钮 + 点开才展开」，收起时不占正文空间。 */
/* 开关上必须恢复 pointer-events：
   .fab-wrap 整体是 pointer-events:none（避免容器挡住正文点击），
   只有 .fab-menu 被显式设为 auto。新加的开关如果不一起恢复，
   它会变成"看得见点不着"—— 点击穿透到下面的页面内容。 */
.fab-toggle { display: none; pointer-events: auto; }

@media (max-width: 700px) {
  .fab-wrap { align-items: flex-end; }

  /* 开关上的申请单角标：绝对定位到右上角。
   不能沿用 .fab-count 的 margin-left —— 那是给横排胶囊用的，
   套到 52px 的圆按钮上会把数字挤到圆心，看着像按钮坏了。 */
.fab-toggle { position: relative; }
.fab-toggle .fab-count {
  position: absolute;
  top: -3px;
  right: -3px;
  margin-left: 0;
  min-width: 19px;
  height: 19px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: #dc2626;
  font-size: 10.5px;
}

/* 开关本身：圆、够大（44px 是触控最小可点尺寸）、不透明 */
  .fab-toggle {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(29, 78, 216, .32);
    transition: background var(--t-fast), transform var(--t-fast);
  }
  .fab-toggle:active { transform: scale(.94); }

  .fab-toggle-ico {
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    /* 展开时转成 ×：一条竖杠旋转 45°，比换字更平滑 */
    transition: transform 200ms cubic-bezier(.4, 0, .2, 1);
  }
  .fab-wrap.is-open .fab-toggle { background: var(--c-text-2); }
  .fab-wrap.is-open .fab-toggle-ico { transform: rotate(45deg); }

  /* 菜单收起时不可见也不可点，展开才浮出。
     用 visibility + opacity 而不是 display:none，
     这样过渡动画还能起作用，且收起后不会被误触。 */
  .fab-menu {
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px) scale(.96);
    transform-origin: bottom right;
    margin-bottom: 10px;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  }
  .fab-wrap.is-open .fab-menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  /* 展开后菜单项从下往上依次进入，位置感更清楚 */
  .fab-wrap.is-open .fab-item { animation: fabIn 180ms cubic-bezier(.4, 0, .2, 1) both; }
  .fab-wrap.is-open .fab-item:nth-child(1) { animation-delay: 0ms; }
  .fab-wrap.is-open .fab-item:nth-child(2) { animation-delay: 30ms; }
  .fab-wrap.is-open .fab-item:nth-child(3) { animation-delay: 60ms; }
  .fab-wrap.is-open .fab-item:nth-child(4) { animation-delay: 90ms; }
  .fab-wrap.is-open .fab-item:nth-child(5) { animation-delay: 120ms; }
}

/* ---------------------------------------------------------------- 微信二维码弹窗 */
.qr-lead {
  margin: 0 0 10px;
  color: var(--c-text-2);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.qr-book {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid #c7d5ff;
  background: #f7f9fe;
  border-radius: 0 4px 4px 0;
  color: var(--c-text);
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-all;
}

.qr-box {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}

.qr-box img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 4px;
}

.qr-hint {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff7e6;
  border: 1px solid #f5e2bb;
  color: #96631a;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

.qr-hint strong { font-weight: 600; }

/* 弹窗里的邮箱备选入口。
   邮箱不在页面 HTML 里，只有点了按钮才由 /api/contact 现取 ——
   所以这里是唯一能看到邮箱的地方，样式要够醒目、够可点。 */
.qr-mail {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--c-border);
  color: var(--c-text-3);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
}
.qr-mail-line {
  margin: 8px 0 0;
  text-align: center;
}
.qr-mail-line .btn {
  font-size: 13px;
  padding: 8px 16px;
}

/* ---------------------------------------------------------------- 课件密码弹窗
   设计意图：密码是用户唯一想要的东西，所以用大字 + 等宽数字突出；
   二维码降级为「出问题时」的兜底，视觉权重明显低于密码本身。 */
.fab-dot-pwd { background: #0891b2; }

.cwpwd-field { margin: 4px 0 12px; }

.cwpwd-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--c-text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.cwpwd-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md, 8px);
  background: #fff;
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.cwpwd-input::placeholder {
  color: #a9b0bd;
  letter-spacing: .02em;
}

.cwpwd-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.cwpwd-msg {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.6;
}

.cwpwd-msg.is-err {
  background: #fdecec;
  border: 1px solid #f3c9c9;
  color: #a92a25;
}

.cwpwd-msg.is-ok {
  background: #e9f7ef;
  border: 1px solid #bfe3ce;
  color: #1f7048;
}

/* 提示条里的「联系编辑」兜底按钮：被限流时用户不能没有出路 */
.cwpwd-msg.has-help {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.cwpwd-help-btn {
  flex: 0 0 auto; margin-left: auto;
  padding: 4px 12px; border: 1px solid #c9a3a1; border-radius: 999px;
  background: #fff; color: #a92a25; font-size: 12.5px; font-weight: 600;
  line-height: 1.5; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cwpwd-help-btn:hover { background: #fdf2f2; border-color: #b98b89; }
.cwpwd-help-btn:focus-visible { outline: 2px solid #a92a25; outline-offset: 2px; }

/* 结果卡：浅绿渐变底 + 大号等宽密码 */
.cwpwd-result { margin-top: 4px; }

.cwpwd-card {
  padding: 16px 14px 14px;
  border: 1px solid #cfe3d6;
  border-radius: var(--r-md, 8px);
  background: linear-gradient(180deg, #f4fbf6 0%, #fff 70%);
  text-align: center;
}

.cwpwd-cap {
  margin: 0 0 6px;
  color: #2f6b47;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.cwpwd-pwd {
  margin: 0 0 8px;
  color: #14603a;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .14em;
  font-variant-numeric: tabular-nums;
  /* 点击整段选中，方便复制 */
  user-select: all;
  -webkit-user-select: all;
  cursor: copy;
  word-break: break-all;
}

.cwpwd-isbn-line {
  margin: 0;
  color: var(--c-text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* 出问题时的兜底区：分隔线 + 弱化文案 + 小二维码 */
.cwpwd-help {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--c-border);
}

.cwpwd-help-t {
  margin: 0 0 4px;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 600;
}

.cwpwd-help-s {
  margin: 0 0 10px;
  color: var(--c-text-3);
  font-size: 12px;
  line-height: 1.6;
}

.qr-box-sm { padding: 8px; }

.qr-box-sm img { max-width: 190px; }

/* 移动端：密码字号收一点，避免撑破弹窗 */
@media (max-width: 540px) {
  .cwpwd-pwd { font-size: 28px; letter-spacing: .1em; }
  .qr-box-sm img { max-width: 160px; }
}

/* 移动端：缩小并贴近边缘，避免遮挡内容 */
@media (max-width: 540px) {
  .fab-wrap { right: 14px; bottom: 16px; gap: 8px; }
  .fab-main { width: 50px; height: 50px; font-size: 23px; }
  .fab-item { padding: 10px 15px; font-size: 13.5px; }
}

/* ---------------------------------------------------------------- 模态框 */
html.no-scroll { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, .52);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 160ms ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(16, 24, 40, .26);
  overflow: hidden;
  animation: panelIn 200ms cubic-bezier(.4, 0, .2, 1) both;
}

.modal-lg .modal-panel { max-width: 720px; }
.modal-sm .modal-panel { max-width: 420px; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 17px;
  letter-spacing: -.01em;
}

.modal-x {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-x:hover { background: #f1f3f7; color: var(--c-text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------- 表单 */
.form-section { margin-bottom: 22px; }
.form-section:last-of-type { margin-bottom: 12px; }

.form-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 11px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
}

.form-h-note {
  font-size: 12px;
  font-weight: 400;
  color: var(--c-text-3);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-full { grid-column: 1 / -1; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-text-2);
}

.field label em {
  color: #dc2626;
  font-style: normal;
  margin-left: 2px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.field textarea { resize: vertical; min-height: 58px; line-height: 1.5; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .13);
}

.field input::placeholder,
.field textarea::placeholder { color: #9aa0ab; }

/* 图书检索与选择 */
.pick-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
}
.pick-search input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .13);
}

.pick-results {
  margin-top: 8px;
  max-height: 208px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #fcfcfd;
}

.pick-tip {
  padding: 18px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--c-text-3);
}

.pick-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "t a" "m a";
  gap: 1px 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--c-border);
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}

.pick-row:last-child { border-bottom: 0; }
.pick-row:hover:not(:disabled) { background: var(--c-primary-soft); }

.pick-row:disabled { cursor: not-allowed; opacity: .45; }

.pick-row-t {
  grid-area: t;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-row-m {
  grid-area: m;
  font-size: 11.5px;
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-row-a {
  grid-area: a;
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-primary);
  white-space: nowrap;
}

.pick-row.is-chosen { background: #f0f6ff; }
.pick-row.is-chosen .pick-row-a { color: #16a34a; }

.picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 30px;
}

.picked-empty {
  font-size: 12.5px;
  color: var(--c-text-3);
  padding: 4px 0;
}

.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 6px 5px 11px;
  border: 1px solid #c7d5ff;
  border-radius: 999px;
  background: var(--c-primary-soft);
  font-size: 12.5px;
  color: var(--c-primary-dark);
}

.pick-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pick-chip-x {
  width: 19px;
  height: 19px;
  border: 0;
  border-radius: 50%;
  background: rgba(29, 78, 216, .12);
  color: var(--c-primary-dark);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.pick-chip-x:hover { background: rgba(29, 78, 216, .24); }

/* 自填书目：与列表书区分开，用琥珀色 —— 一眼能看出这本不是从推荐列表来的，
   提交前老师自己会多看一眼书号对不对。 */
.pick-chip.is-custom {
  border-color: #f0c894;
  background: #fdf3e3;
  color: #8a5000;
}
.pick-chip.is-custom .pick-chip-x {
  background: rgba(180, 110, 10, .14);
  color: #8a5000;
}
.pick-chip.is-custom .pick-chip-x:hover { background: rgba(180, 110, 10, .26); }

.pick-chip-tag {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  background: #e8a33d;
  color: #fff;
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: .3px;
}

.pick-chip-p {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}

/* ---------- 自填书号面板 ---------- */
.custom-add {
  margin-top: 10px;
  border-top: 1px dashed var(--c-line, #e3e7ef);
  padding-top: 10px;
}

.custom-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--c-primary, #1d4ed8);
  font-size: 12.5px;
  cursor: pointer;
}
.custom-toggle:hover { text-decoration: underline; }
.custom-toggle span[aria-hidden] { font-size: 13px; line-height: 1; }

.custom-box {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #e6eaf2;
  border-radius: 10px;
  background: #fafbfe;
}

.custom-grid {
  display: grid;
  grid-template-columns: 1.25fr 1.5fr .9fr auto;
  gap: 10px;
  align-items: end;
}

.custom-add-btn-field { justify-content: flex-end; }
.custom-add-btn { white-space: nowrap; height: 38px; }

.custom-box .field-hint { margin: 4px 0 0; }
.custom-box .field-hint#custom-err { margin-top: 8px; font-weight: 600; }

@media (max-width: 760px) {
  .custom-grid { grid-template-columns: 1fr; }
  .custom-add-btn-field { justify-content: stretch; }
  .custom-add-btn { width: 100%; }
}

/* 上传 */
.upload {
  position: relative;
  padding: 14px;
  border: 1.5px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  background: #fcfcfd;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.upload:hover { border-color: var(--c-primary); background: #fbfcff; }

.upload-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}

.upload-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.upload-ico {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.upload-txt { font-size: 13px; color: var(--c-text-2); }

.upload-input:focus-visible + .upload-label .upload-ico {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
}

.upload-preview { margin-top: 10px; }

.cred-fig {
  margin: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.cred-fig img {
  width: 88px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: #fff;
}

.cred-fig figcaption {
  font-size: 11.5px;
  color: var(--c-text-3);
  padding-bottom: 2px;
}

.field-hint {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--c-text-3);
}
.field-hint.is-ok { color: #15803d; }
.field-hint.is-err { color: #b91c1c; }

/* 错误与按钮 */
.form-error {
  padding: 10px 12px;
  border: 1px solid var(--c-warn-border);
  border-radius: var(--r-sm);
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  font-size: 13px;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost {
  background: var(--c-surface);
  border-color: var(--c-border-strong);
  color: var(--c-text-2);
}
.btn-ghost:hover { border-color: var(--c-text-3); color: var(--c-text); }

/* 联系模态框 */
.contact-lead { font-size: 14px; color: var(--c-text-2); margin-bottom: 14px; }

.contact-list { display: flex; flex-direction: column; gap: 10px; }

.contact-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 11px 14px;
  background: #fbfcfe;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 14px;
}

.contact-list .k {
  flex-shrink: 0;
  width: 42px;
  font-size: 12.5px;
  color: var(--c-text-3);
}

.contact-list a { word-break: break-all; }

.contact-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--c-text-3);
}

/* 提交成功 */
.thanks { text-align: center; padding: 12px 4px 4px; }

.thanks-ico {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 27px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.thanks h3 { font-size: 17px; margin-bottom: 8px; }

.thanks p {
  font-size: 13.5px;
  color: var(--c-text-2);
  line-height: 1.65;
  margin-bottom: 18px;
}

/* ---------------- 提交成功页：快递单号 / 二维码 / 三个去处 ---------------- */
.thanks-lead { margin-bottom: 14px !important; }
.thanks-lead strong { color: var(--c-text); font-weight: 700; }

.thanks-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #f4f7fb;
  border: 1px dashed #c8d4e6;
  border-radius: 10px;
  text-align: left;
}
.tt-k {
  flex: none;
  color: var(--c-text-2);
  font-size: 12.5px;
  font-weight: 600;
}
.tt-v {
  color: var(--c-text);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.thanks-qr {
  margin: 0 0 14px;
  padding: 12px 12px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
}
.thanks-qr img {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 8px;
  border-radius: 6px;
}
.thanks-qr-hint {
  margin: 0 !important;
  font-size: 12px !important;
  color: var(--c-text-3) !important;
  line-height: 1.5 !important;
  text-align: center;
}
.thanks-qr-hint strong { color: var(--c-text-2); font-weight: 600; }

.thanks-acts {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}
.thanks-act {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.thanks-act:hover {
  border-color: #c3cdf5;
  box-shadow: var(--shadow-3);
  transform: translateY(-1px);
  text-decoration: none;
}
.thanks-act .ta-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #eef3ff;
  color: var(--c-primary);
  font-size: 15px;
  font-weight: 700;
}
.thanks-act strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
}
.thanks-act em {
  display: block;
  color: var(--c-text-3);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.thanks-foot {
  margin: 0 0 14px !important;
  font-size: 12.5px !important;
  color: var(--c-text-3) !important;
}

.thanks .modal-actions { justify-content: center; border-top: 0; padding-top: 0; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 640px) {
  .modal { padding: 0; place-items: end stretch; }

  .modal-panel {
    max-width: none;
    max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: sheetIn 220ms cubic-bezier(.4, 0, .2, 1) both;
  }

  @keyframes sheetIn {
    from { transform: translateY(24px); opacity: .6; }
    to   { transform: none; opacity: 1; }
  }

  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }

  .form-grid { grid-template-columns: 1fr; gap: 11px; }

  /* 移动端输入框 ≥16px，防 iOS 聚焦自动放大 */
  .field input,
  .field textarea,
  .pick-search input { font-size: 16px; }

  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }

  .pick-results { max-height: 168px; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .fab-item,
  .modal-panel,
  .modal-backdrop { animation: none !important; }
  .fab-main:hover { transform: none; }
}

/* 打印时不带悬浮按钮与弹窗 */
@media print {
  .fab-wrap, .modal { display: none !important; }
}

/* ---------------------------------------------------------------- 蜜罐字段
   正常用户完全看不到、点不到，Tab 也不会停；只在 DOM 里留一个「网址」输入框，
   等自动填表脚本去填。不用 display:none / visibility:hidden ——
   部分脚本会识别并跳过这类型隐藏，改为裁切到 1px 定位到屏幕外。 */
.hp-trap {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
