/* ============ 单词卡 · 移动端优先 ============ */
:root {
  --brand: #4F7DF9;
  --brand-soft: #EBF0FF;
  --ink: #1C1E26;
  --muted: #8A8FA3;
  --line: #EDEEF2;
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --good: #2FA968;
  --good-soft: #E7F6EE;
  --again: #E8875B;
  --again-soft: #FCEFE8;
  --shadow: 0 6px 24px rgba(28, 30, 38, .08);
  --radius: 20px;
  --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
}

/* ============ 顶部栏 ============ */
.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}
.brand-mark {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  background: var(--brand);
  color: #fff;
  border-radius: 11px;
  font-size: 19px; font-weight: 600;
}
.brand-text {
  min-width: 0;
}
.brand-text h1 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
.unit-label { font-size: 12px; color: var(--muted); }

.switch-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
/* 模式切换独立行 */
.mode-bar {
  flex: none;
  display: flex;
  justify-content: center;
  padding: 0 16px 6px;
}
.mode-switch {
  display: flex;
  background: var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .25s ease;
  white-space: nowrap;
}
.mode-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(28,30,38,.10);
}

/* 自动重复开关 */
.repeat-toggle {
  position: relative;
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s ease;
}
.repeat-toggle svg { width: 20px; height: 20px; }
.repeat-toggle.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* 悬停提示气泡（桌面端） */
.repeat-toggle::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  white-space: nowrap;
  background: rgba(28, 30, 38, .88);
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}
@media (hover: hover) {
  .repeat-toggle:hover::after {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 轻量 toast（移动端点击反馈） */
.toast {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(28, 30, 38, .88);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ 分类导航 ============ */
.category-bar { flex: none; padding: 6px 0 2px; }
.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-scroll::-webkit-scrollbar { display: none; }

.category-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .22s ease;
  white-space: nowrap;
}
.category-chip .cnt {
  font-size: 11px;
  background: var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 600;
}
.category-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.category-chip.active .cnt {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ============ 主舞台 ============ */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  min-height: 0;
}

.progress-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
  flex: none;
}

.card-viewport {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  position: relative;
}

/* 卡片两侧切换箭头 */
.side-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.9);
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .18s ease;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(28,30,38,.08);
}
.side-arrow:active { transform: translateY(-50%) scale(.9); }
.side-arrow svg { width: 20px; height: 20px; }
.prev-arrow { left: -2px; }
.next-arrow { right: -2px; }
@media (max-width: 360px) {
  .side-arrow { width: 34px; height: 34px; }
  .side-arrow svg { width: 16px; height: 16px; }
}

.card {
  width: 100%;
  height: 100%;
  max-height: 460px;
  perspective: 1200px;
  cursor: pointer;
}
.card-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,.1,.2,1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 普通居中（不用 safe）：内容超高溢出时上下对称，
     缩放原点=卡片中心 → scale 后内容精确填满可用区且保持居中 */
  justify-content: center;
  gap: 12px;
  padding: 22px 20px;
  text-align: center;
  /* 溢出防线：自身绝不产生滚动条，由 JS 缩放适配 */
  overflow: hidden;
  /* 允许 flex 子项收缩（长文本不再以 max-content 撑破卡片） */
  min-height: 0;
}
.card-back { transform: rotateY(180deg); }

/* 卡片切换动画：淡入淡出 + 滑动 */
.card.switching {
  animation: card-in .32s ease both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateX(34px) scale(.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.card.switching-back {
  animation: card-in-back .32s ease both;
}
@keyframes card-in-back {
  from { opacity: 0; transform: translateX(-34px) scale(.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* 正面内容 */
.type-tag {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: .5px;
  max-width: 96%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.word-main {
  flex: none;
  font-size: clamp(26px, 10vw, 48px);
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.character-avatar {
  flex: none;
  max-width: 190px;
  max-height: 200px;
  width: auto;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
.word-image {
  flex: none;
  max-width: 180px;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
/* 有图的卡片：英文单词略缩小，避免图片+文字超出卡片 */
.card-face.has-image .word-main {
  font-size: clamp(24px, 8vw, 34px);
}
.spell-row {
  flex: none;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
.spell-row .spell-char {
  font-size: clamp(18px, 6vw, 26px);
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  width: clamp(40px, 12vw, 52px);
  height: clamp(40px, 12vw, 52px);
  display: grid; place-items: center;
  border-radius: 12px;
}

/* 背面内容 */
.zh-main {
  flex: none;
  font-size: clamp(24px, 8.5vw, 38px);
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.zh-sub {
  flex: none;
  font-size: clamp(17px, 5.5vw, 26px);
  font-weight: 500;
  color: var(--muted);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.note-text {
  flex: none;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 14px;
  border-radius: 10px;
  line-height: 1.5;
  max-width: 94%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.speaker-btn {
  border: none;
  background: var(--brand-soft);
  color: var(--brand);
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.speaker-btn:active { transform: scale(.9); }
.speaker-btn svg { width: 26px; height: 26px; }
.speaker-btn.playing { background: var(--brand); color: #fff; animation: pulse 1s ease infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(79,125,249,.35); }
  50% { box-shadow: 0 0 0 12px rgba(79,125,249,0); }
}

/* 进度条 */
.progress-track {
  flex: none;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  margin: 12px 0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .3s ease;
}

/* 操作区 */
.actions {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.action-btn {
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: all .15s ease;
}
.action-btn:active { transform: scale(.92); }
.action-btn .ico {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.action-btn .ico svg { width: 24px; height: 24px; }
.action-btn.primary .ico { background: var(--brand); color: #fff; width: 62px; height: 62px; }
.action-btn.primary .ico svg { width: 28px; height: 28px; }

/* 练习模式自评按钮 */
.practice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.practice-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.practice-btn {
  border: none;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.practice-btn:active { transform: scale(.96); }
.practice-btn.again { background: var(--again-soft); color: var(--again); }
.practice-btn.good { background: var(--good-soft); color: var(--good); }
/* 「还不熟」翻面展示答案期间：锁定自评按钮，防连点 */
.practice-btn.no-pointer { pointer-events: none; opacity: .5; }

/* 卡片上的喇叭（练习模式） */
.card-speaker {
  flex: none;
  border: none;
  background: var(--brand-soft);
  color: var(--brand);
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.card-speaker:active { transform: scale(.9); }
.card-speaker svg { width: 22px; height: 22px; }

/* ============ 测试（quiz） ============ */
.word-main-sm { font-size: clamp(16px, 4.8vw, 26px); line-height: 1.45; }
.word-main-lg { font-size: clamp(26px, 8vw, 42px); }
.quiz-stem {
  flex: none;
  font-size: 13px;
  color: var(--muted);
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: var(--brand-soft);
  padding: 4px 12px;
  border-radius: 999px;
}
.sit-scene {
  flex: none;
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 500;
  line-height: 1.5;
  max-width: 94%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sit-img {
  flex: none;
  max-width: 200px;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
.quiz-options.two-opt {
  grid-template-columns: 1fr;
  width: 92%;
}
.quiz-options.two-opt .quiz-option {
  font-size: 18px;
  padding: 18px 14px;
  min-height: 60px;
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.quiz-option {
  border: 1.5px solid var(--line);
  background: var(--surface);
  padding: 14px 10px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
  min-height: 52px;
}
.quiz-option:active { transform: scale(.96); }
.quiz-option.right {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}
.quiz-option.wrong {
  background: var(--again-soft);
  border-color: var(--again);
  color: var(--again);
}
.quiz-option.no-pointer { pointer-events: none; }

/* 结算页 */
.grade-face { font-size: 56px; line-height: 1.1; }
.grade-big {
  font-size: 72px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.1;
}
.grade-sub { font-size: 15px; color: var(--ink); font-weight: 500; }
.grade-note {
  font-size: 14px;
  color: var(--muted);
  background: var(--bg);
  padding: 8px 16px;
  border-radius: 10px;
}

/* ===== 全部完成 · 庆祝结算卡 ===== */
.result-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  width: 100%;
  animation: result-pop .5s cubic-bezier(.2,.9,.3,1.3) both;
}
@keyframes result-pop {
  from { opacity: 0; transform: scale(.7); }
  to { opacity: 1; transform: scale(1); }
}
.result-confetti { font-size: 40px; line-height: 1; animation: confetti-float 1.2s ease infinite alternate; }
@keyframes confetti-float {
  from { transform: translateY(0) rotate(-6deg); }
  to { transform: translateY(-6px) rotate(8deg); }
}
.result-face { font-size: 54px; line-height: 1.1; }
.result-stars { display: flex; gap: 4px; font-size: 26px; }
.result-star { color: #D8DBE0; }
.result-star.on { color: #F5B301; text-shadow: 0 2px 6px rgba(245,179,1,.35); }
.result-title { font-size: 20px; font-weight: 700; }
.result-sub { font-size: 14px; color: var(--muted); }
.result-bar {
  width: 86%;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.result-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width .8s ease;
}
.result-metrics {
  display: flex;
  gap: 22px;
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}
.result-metrics b { color: var(--ink); font-size: 16px; }
/* 等级主题色 */
.result-wrap.g-gold .grade-big { color: #F5A800; }
.result-wrap.g-gold .result-title { color: #B8860B; }
.result-wrap.g-gold .result-bar-fill { background: linear-gradient(90deg,#F5B301,#F5A800); }
.result-wrap.g-blue .grade-big { color: var(--brand); }
.result-wrap.g-blue .result-bar-fill { background: var(--brand); }
.result-wrap.g-gray .grade-big { color: #8A8FA3; }
.result-wrap.g-gray .result-bar-fill { background: #8A8FA3; }

/* 移动端全屏自适应 */
@media (max-width: 400px) {
  .card { max-height: 400px; }
}

/* ============ 卡片内容自适应（防内容超出卡片） ============ */
/* JS 对 .card-content 包裹层施加的缩放：内容超高时按比例缩小 */
/* 包裹层：宽铺满、高自适应内容（height:auto → offsetHeight=真实内容高，测量可靠）；
   由 .card-face 的 justify-content:center 垂直居中；scale 以自身中心为原点，
   内容整体缩小后仍保持在卡片中心。 */
.card-content {
  flex: none; /* 关键：禁止 flex 压缩——wrap 高度恒=内容真实高度，测量/缩放行为才确定 */
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transform-origin: center center;
}

/* ============ 视图切换 ============ */
.hidden { display: none !important; }
.view { display: flex; flex-direction: column; height: 100%; }
.view.hidden { display: none; }

/* ============ 单元加载覆盖层（儿童友好：彩虹进度条 + 彩色飞鸟） ============ */
.unit-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.unit-loading.hidden { display: none !important; }
.loading-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 30px 26px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.loading-track {
  position: relative;
  width: min(72vw, 280px);
}
/* 彩色小鸟：沿进度条飞行（left 由 JS 按进度更新），紧贴轨道上方 */
.loading-bird {
  position: absolute;
  bottom: 14px;            /* 贴近进度条：鸟下缘轻搭轨道上沿 */
  left: 0;
  transform: translateX(-6px);
  transition: left .3s ease;
  z-index: 2;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.12));
}
/* 双翅同步扑扇（绕各自根部轴旋转，像真实飞鸟） */
.bird-wing {
  /* 不用 transform-box（兼容不稳），按 SVG viewBox 坐标设固定根轴 */
}
/* 后翅（深红）：根在身体左肩 ≈ (20, 10) */
.bird-wing.back {
  transform-origin: 20px 11px;
  animation: flapWing .42s ease-in-out infinite;
}
/* 前翅（亮红）：根在身体右肩 ≈ (30, 8) */
.bird-wing.front {
  transform-origin: 30px 8px;
  animation: flapWing .42s ease-in-out infinite;
  animation-delay: .08s; /* 微错位增强层次 */
}
@keyframes flapWing {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(-56deg); }   /* 双翅同时上抬 → 看起来在扑扇 */
}
/* 彩虹分段进度条 */
.loading-bar {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #F0EAFF;
  border: 2px solid #E4DBFF;
  box-shadow: inset 0 2px 4px rgba(70, 40, 130, .07);
}
.loading-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  /* 首尾同色(#FF9A62)，位移循环时无缝衔接，看不到"颜色往回退" */
  background: linear-gradient(90deg,
    #FF9A62 0%, #FFB454 12%, #FFD166 25%,
    #9BE15D 37%, #3ECFC0 50%, #57A0FF 62%,
    #8B7BFF 75%, #FF9A62 100%);
  background-size: 200% 100%;
  animation: fillShimmer 1.2s linear infinite;
  transition: width .25s ease;
}
@keyframes fillShimmer {
  from { background-position: 0% 0; }
  to { background-position: -200% 0; }
}

/* ============ 单元库 ============ */
.library-main {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px calc(30px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.alphabet-entry {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: 20px; text-decoration: none;
  background: linear-gradient(115deg, #547df8, #8662db); color: white;
  box-shadow: var(--shadow);
}
.alphabet-entry-icon { display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 16px; background: #ffffff33; font-size: 23px; font-weight: 800; }
.alphabet-entry strong, .alphabet-entry small { display: block; }
.alphabet-entry strong { font-size: 18px; }
.alphabet-entry small { margin-top: 4px; font-size: 12px; opacity: .9; }
.alphabet-entry-arrow { margin-left: auto; white-space: nowrap; font-size: 13px; }
.lib-hint {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 14px 0 18px;
}
.lib-section {
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 12px;
  color: var(--ink);
}
.lib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (min-width: 420px) {
  .lib-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.grade-card, .unit-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all .18s ease;
  text-align: center;
}
.grade-card:active, .unit-card:active { transform: scale(.96); }
.grade-card.locked { opacity: .5; }
.grade-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 600;
}
.grade-name { font-size: 16px; font-weight: 600; }
.grade-sub { font-size: 12px; color: var(--muted); }
.unit-card {
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  padding: 16px;
  min-height: 108px;
  justify-content: center;
}
.unit-no { font-size: 13px; color: var(--muted); font-weight: 500; }
.unit-title { font-size: 17px; font-weight: 600; line-height: 1.3; min-height: 22px; }
.unit-go { font-size: 13px; color: var(--brand); margin-top: 6px; }
.lib-empty { text-align: center; padding-top: 20px; }

.back-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  color: var(--muted);
  cursor: pointer;
}
.back-btn svg { width: 20px; height: 20px; }
.back-btn.big {
  width: auto;
  padding: 8px 14px;
  display: inline-flex;
  gap: 6px;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}
.back-btn.big svg { width: 16px; height: 16px; }

/* ============ 无障碍 ============ */
/* 屏幕阅读器 live 播报区（视觉隐藏但可被读屏读出） */
.sr-live {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* 键盘焦点指示：仅键盘导航时显示清晰焦点环 */
:focus-visible {
  outline: 3px solid rgba(79, 125, 249, .55);
  outline-offset: 2px;
  border-radius: 8px;
}
.category-chip:focus-visible,
.mode-btn:focus-visible,
.action-btn:focus-visible,
.quiz-option:focus-visible {
  outline: 3px solid rgba(79, 125, 249, .6);
  outline-offset: 1px;
}

/* 动画减弱偏好：关闭装饰性动画，保留必要反馈 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
