/* ==========================================================
   学习乐园 · 设计系统 v2
   风格：柔和糖果色 + 大圆角白卡 + 轻拟物，面向 6-8 岁小朋友
   ========================================================== */

:root {
  /* 主色 */
  --brand: #5B8DEF;
  --brand-deep: #3D6FD8;
  --brand-soft: #EAF1FF;
  --coral: #FF7A6B;
  --coral-soft: #FFEDEA;
  --sun: #FFB63D;
  --sun-soft: #FFF5E0;
  --mint: #22C79B;
  --mint-soft: #E2F9F2;
  --lav: #9B87F5;
  --lav-soft: #F0ECFF;

  /* 中性 */
  --ink: #1E2A44;
  --ink-2: #4C5B78;
  --muted: #8794AB;
  --line: #E9EFFA;
  --bg: #F5F8FF;
  --card: #FFFFFF;

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;

  --sh-1: 0 2px 8px rgba(80, 105, 160, .06);
  --sh-2: 0 8px 24px rgba(80, 105, 160, .10);
  --sh-3: 0 16px 44px rgba(80, 105, 160, .16);

  --font: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei",
          "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

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

html, body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 12% -8%, #E8F0FF 0%, transparent 60%),
    radial-gradient(800px 460px at 92% 4%, #FFF1E8 0%, transparent 55%),
    radial-gradient(700px 520px at 50% 108%, #E9FBF5 0%, transparent 60%);
  background-attachment: fixed;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px 104px;
  position: relative;
  z-index: 1;
}

/* ================= 顶部栏 ================= */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(245,248,255,.96) 62%, rgba(245,248,255,0));
}

.topbar .back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--sh-1);
  transition: .18s;
}
.topbar .back:active { transform: scale(.95); }

.topbar h1 {
  flex: 1;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  letter-spacing: .5px;
}
.topbar .spacer { width: 78px; flex-shrink: 0; }

.topbar .stars {
  width: 78px;
  text-align: right;
  font-size: 15px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* ================= 首页 Hero ================= */
.hero {
  position: relative;
  padding: 20px 22px 22px;
  min-height: 240px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #5B8DEF 0%, #7C8CF8 48%, #9B87F5 100%);
  box-shadow: 0 18px 40px rgba(91,141,239,.30);
  overflow: hidden;
  color: #fff;
}
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.hero::before { width: 220px; height: 220px; top: -110px; right: -60px; }
.hero::after { width: 140px; height: 140px; bottom: -90px; left: 30%; background: rgba(255,255,255,.10); }

.hero-text { position: relative; z-index: 2; width: 100%; }
.hero h1 {
  font-size: 32px;
  line-height: 1.28;
  font-weight: 900;
  letter-spacing: .5px;
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(40,60,140,.20);
}
.hero p {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 700;
  letter-spacing: .2px;
  color: #FFF4E2;                  /* 暖奶白，与右下小星星的底色呼应，比纯白更柔和 */
  text-shadow: 0 1px 6px rgba(38,56,130,.18);
  max-width: calc(100% - 132px);   /* 给右下的小星星让位，避免文字压到图 */
}
.hero p span { white-space: nowrap; }
.hero-mascot {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 118px;
  z-index: 2;
  border-radius: 26px;
  border: 4px solid rgba(255,255,255,.9);
  box-shadow: 0 14px 28px rgba(26,44,110,.28);
  background: #FFF8EE;
  transform-origin: 50% 90%;
  animation: bob 4.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

/* ================= 区块标题 ================= */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 2px 14px;
}
.section-head h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .3px;
}
.section-head .more {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

/* ================= 主菜单卡片 ================= */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tile {
  position: relative;
  display: block;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  overflow: hidden;
  transition: transform .2s cubic-bezier(.34,1.4,.64,1), box-shadow .2s;
  cursor: pointer;
}
.tile:active { transform: scale(.965); }
@media (hover: hover) { .tile:hover { transform: translateY(-4px); box-shadow: var(--sh-3); } }

.tile-art {
  height: 124px;
  background-size: cover;
  background-position: center 62%;
  background-repeat: no-repeat;
  position: relative;
}
.tile-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(255,255,255,.55) 100%);
}
.tile-body { padding: 4px 16px 16px; }
.tile-title {
  font-size: 16.5px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 3px;
}
.tile-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}
.tile-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .3px;
  box-shadow: 0 4px 12px rgba(30,50,120,.18);
}
.t-blue { background: linear-gradient(135deg, #5B8DEF, #7C8CF8); }
.t-coral { background: linear-gradient(135deg, #FF8A7A, #FF6B8B); }
.t-mint { background: linear-gradient(135deg, #35D6A8, #22B5A0); }
.t-sun { background: linear-gradient(135deg, #FFC24B, #FF9E3D); }
.t-gold { background: linear-gradient(135deg, #F2A65A, #E4708A); }
.t-lav { background: linear-gradient(135deg, #A78BFA, #7C8CF8); }
.t-sky { background: linear-gradient(135deg, #4EC5F1, #5B8DEF); }
.t-rose { background: linear-gradient(135deg, #FF9AB0, #FF6F91); }

/* 宽卡片（错题本） */
.tile-wide {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  margin-top: 14px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  transition: transform .18s;
}
.tile-wide:active { transform: scale(.985); }
.tile-wide .ic {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 26px;
  background: var(--coral-soft);
  flex-shrink: 0;
}
.tile-wide .tx { flex: 1; }
.tile-wide .tx b { font-size: 15.5px; font-weight: 800; display: block; margin-bottom: 2px; }
.tile-wide .tx span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tile-wide .arrow { color: #C6D2E8; font-size: 22px; }

/* ================= 数据条 ================= */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.stat {
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--sh-1);
}
.stat b {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.5px;
  color: var(--brand);
  line-height: 1.2;
}
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 700; }

/* ================= 底部导航 ================= */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  width: min(480px, calc(100% - 28px));
  display: flex;
  gap: 2px;
  padding: 8px;
  border-radius: 26px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(233,239,250,.9);
  box-shadow: 0 12px 34px rgba(60,90,160,.16);
  backdrop-filter: blur(18px);
  z-index: 60;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 18px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
  transition: .18s;
}
.tabbar a i {
  font-size: 20px; font-style: normal; line-height: 1;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
/* 图标位：AI 软陶小图标（红花仍用 emoji） */
.tabbar a i.has-ic {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.tabbar a i.has-ic img {
  width: 26px; height: 26px; display: block; object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(60,90,160,.16));
  transition: transform .18s;
}
.tabbar a.on i.has-ic img { transform: scale(1.08) translateY(-1px); }
.tabbar a.on {
  color: var(--brand-deep);
  background: linear-gradient(180deg, #F2F7FF, #E4EEFF);
  box-shadow: inset 0 0 0 1px rgba(91,141,239,.10);
}
.tabbar a:active { transform: scale(.93); }

/* ===== 非首页：导航收进侧边，只留一个小动物球，点开才显示 ===== */
.tabbar.dock {
  transform: translateX(-50%) translateY(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.22,.9,.28,1.06), opacity .2s ease;
}
.tabbar.dock.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.tab-pet {
  position: fixed;
  right: 12px;
  bottom: 96px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(233,240,252,.95);
  box-shadow: 0 10px 22px rgba(60,90,160,.22);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: grab;
  touch-action: none;                 /* 拖动时不跟着页面滚 */
  -webkit-user-select: none;
  user-select: none;
  z-index: 61;
  transition: transform .2s, box-shadow .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
/* 拖动中：手型变抓取、微微放大、去掉位置过渡，跟手更紧 */
.tab-pet.dragging,
.tab-pet.dragging:active {
  cursor: grabbing;
  transform: scale(1.06);
  box-shadow: 0 16px 30px rgba(60,90,160,.32);
}
.tab-pet img {
  width: 38px; height: 38px; border-radius: 50%;
  display: block; pointer-events: none;
  transition: opacity .18s, transform .2s;
}
.tab-pet:active { transform: scale(.92); }
.tab-pet .x { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.tab-pet .x::before, .tab-pet .x::after {
  content: ''; position: absolute; width: 17px; height: 2.6px;
  border-radius: 2px; background: #fff;
  transform: rotate(45deg) scale(0); transition: transform .2s;
}
.tab-pet .x::after { transform: rotate(-45deg) scale(0); }
.tab-pet.open {
  background: linear-gradient(135deg,#5B8DEF,#9B87F5);
  border-color: transparent;
  box-shadow: 0 12px 26px rgba(91,141,239,.34);
}
.tab-pet.open img { opacity: 0; transform: scale(.5); }
.tab-pet.open .x::before { transform: rotate(45deg) scale(1); }
.tab-pet.open .x::after { transform: rotate(-45deg) scale(1); }

/* ================= 胶囊/分段控件 ================= */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--sh-1);
  transition: .18s;
  white-space: nowrap;
}
.chip:active { transform: scale(.95); }
.chip.active {
  background: linear-gradient(135deg, var(--brand), #7C8CF8);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(91,141,239,.34);
}
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; }
.chip-row::-webkit-scrollbar { display: none; }

.seg {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sh-1);
  overflow-x: auto;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
}
.seg button.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91,141,239,.32);
}

/* ================= 通用卡片 ================= */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: 22px 20px;
}

/* ================= 进度条 ================= */
.progress {
  height: 10px;
  border-radius: 999px;
  background: #EDF2FB;
  overflow: hidden;
  position: relative;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5B8DEF, #8E7CF8);
  transition: width .45s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.progress > i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shine 1.8s linear infinite;
}
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ================= 题目 ================= */
.q-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: 22px 18px 24px;
}
.q-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.q-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.q-badge.pinyin { background: var(--lav-soft); color: #6D5BD0; }
.q-badge.hanzi { background: var(--coral-soft); color: #D9503F; }
.q-badge.choice { background: var(--mint-soft); color: #10856A; }
.q-index { font-size: 12.5px; font-weight: 800; color: var(--muted); }

.q-text {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.62;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: .2px;
}

/* 听发音大按钮 */
.sound-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 20px;
  padding: 16px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #7C8CF8, #9B87F5);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(124,140,248,.36);
  transition: transform .14s;
}
.sound-btn:active { transform: scale(.96); }
.sound-btn.playing { animation: pulse .65s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ============ 选项：上下两排，每排两个 ============ */
.options-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 12px;
}

.option-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 78px;
  padding: 14px 12px;
  border-radius: 20px;
  background: #F8FAFF;
  border: 2px solid #E9EFFA;
  cursor: pointer;
  transition: transform .16s, border-color .16s, background .16s, box-shadow .16s;
  text-align: center;
}
.option-item:active { transform: scale(.97); }
@media (hover: hover) {
  .option-item:hover { border-color: #C8D8F8; background: #F2F6FF; }
}

.option-item .option-letter {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: #E9EFFA;
  color: #7A88A6;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.option-item .option-text {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

.option-item.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(91,141,239,.20);
}
.option-item.selected .option-letter { background: var(--brand); color: #fff; }

.option-item.correct {
  background: var(--mint-soft);
  border-color: var(--mint);
  box-shadow: 0 8px 20px rgba(34,199,155,.22);
}
.option-item.correct .option-letter { background: var(--mint); color: #fff; }
.option-item.wrong {
  background: var(--coral-soft);
  border-color: var(--coral);
  animation: shake .4s;
}
.option-item.wrong .option-letter { background: var(--coral); color: #fff; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  22% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}

/* ================= 输入框 ================= */
.answer-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  border: 2px solid #E9EFFA;
  border-radius: 18px;
  background: #F8FAFF;
  outline: none;
  transition: .18s;
  text-align: center;
}
.answer-input::placeholder { color: #AEB9CE; font-weight: 600; }
.answer-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(91,141,239,.10); }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform .14s, box-shadow .18s;
  text-decoration: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; }
.btn-primary {
  background: linear-gradient(135deg, #5B8DEF, #7C8CF8);
  color: #fff;
  box-shadow: 0 10px 24px rgba(91,141,239,.32);
}
.btn-coral {
  background: linear-gradient(135deg, #FF8A7A, #FF6B8B);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255,122,107,.30);
}
.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}
.btn-lg { padding: 17px 32px; font-size: 16.5px; border-radius: 22px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ================= 弹窗 ================= */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(24,36,66,.42);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .18s;
}
.modal {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 30px;
  padding: 28px 22px 22px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(20,35,80,.32);
  animation: pop .38s cubic-bezier(.34,1.56,.64,1);
}
.modal .big { font-size: 62px; line-height: 1; margin-bottom: 10px; }
.modal .t { font-size: 21px; font-weight: 900; margin-bottom: 10px; }
.modal .t.ok { color: #12A87E; }
.modal .t.no { color: #E85D4A; }
.modal .a { font-size: 14.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.modal .a b { color: #12A87E; font-size: 19px; }
.modal .e {
  font-size: 13.5px;
  color: #7A6524;
  background: var(--sun-soft);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 14px 0 18px;
  line-height: 1.6;
  text-align: left;
  font-weight: 600;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { transform: scale(.86) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.confetti { position: fixed; pointer-events: none; font-size: 22px; z-index: 300; }

/* ================= 空状态 ================= */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-emoji { font-size: 58px; margin-bottom: 14px; }
.empty-text { font-size: 17px; font-weight: 800; color: var(--ink-2); margin-bottom: 6px; }
.empty-hint { font-size: 13.5px; color: var(--muted); font-weight: 600; }
/* 古诗词加载失败时：显示具体原因 + 重试 */
.po-why {
  margin-top: 10px; font-size: 11.5px; font-weight: 700;
  color: var(--muted); opacity: .6; word-break: break-all;
}
.po-retry {
  margin-top: 18px; font-family: inherit; font-size: 13.5px; font-weight: 900;
  color: #fff; border: 0; border-radius: 999px; padding: 11px 26px;
  background: linear-gradient(135deg, #F5A98F, #EB8368);
  box-shadow: 0 10px 20px rgba(235,131,104,.30); cursor: pointer;
  transition: transform .16s;
}
.po-retry:active { transform: scale(.95); }

/* ================= 错题本 ================= */
.summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px;
  box-shadow: var(--sh-1);
}
.summary-icon {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--brand-soft);
  flex-shrink: 0;
}
.summary-card:nth-child(2) .summary-icon { background: var(--mint-soft); }
.summary-num { font-size: 21px; font-weight: 900; color: var(--brand); line-height: 1.2; }
.summary-card:nth-child(2) .summary-num { color: #12A87E; }
.summary-label { font-size: 12px; color: var(--muted); font-weight: 700; }

.filter-row { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--sh-1);
  transition: .18s;
}
.filter-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-btn.clear-all { margin-left: auto; color: #E85D4A; border-color: #FFE2DD; background: #FFF6F4; }

.wrong-list { display: flex; flex-direction: column; gap: 12px; }
.wrong-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-1);
  border-left: 4px solid var(--coral);
}
.wrong-item.math { border-left-color: var(--mint); }
.wrong-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.subject-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--coral-soft);
  color: #D9503F;
}
.subject-tag.math { background: var(--mint-soft); color: #10856A; }
.chapter-tag { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.delete-btn {
  margin-left: auto;
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: #F2F5FC;
  color: #98A6C0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.wrong-q { font-size: 15.5px; font-weight: 800; line-height: 1.55; margin-bottom: 12px; }
.answers { background: #F8FAFF; border-radius: 14px; padding: 12px 14px; }
.answer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding: 4px 0;
}
.answer-row .lbl { color: var(--muted); font-weight: 700; flex-shrink: 0; }
.answer-row .val { font-weight: 800; }
.answer-row.user .val { color: #E85D4A; }
.answer-row.ok .val { color: #12A87E; }
.exp-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #E1E9F7;
  font-size: 12.5px;
  color: #7A6524;
  line-height: 1.6;
  font-weight: 600;
}

/* ================= 测试结果 ================= */
.result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 22px 24px;
  text-align: center;
  box-shadow: var(--sh-3);
}
.result-ring {
  width: 148px; height: 148px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, #5B8DEF calc(var(--score, 0) * 1%), #EEF3FC 0);
  display: grid;
  place-items: center;
  position: relative;
}
.result-ring::before {
  content: '';
  position: absolute;
  width: 118px; height: 118px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 2px 8px rgba(80,105,160,.07);
}
.result-ring .num {
  position: relative;
  font-size: 40px;
  font-weight: 900;
  color: var(--brand);
  line-height: 1;
}
.result-ring .num small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.result-title { font-size: 21px; font-weight: 900; margin-bottom: 6px; }
.result-desc { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-bottom: 22px; }
.result-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.split-item { border-radius: 18px; padding: 14px 10px; background: var(--mint-soft); }
.split-item.bad { background: var(--coral-soft); }
.split-item .k { font-size: 11.5px; font-weight: 800; color: #10856A; margin-bottom: 2px; }
.split-item.bad .k { color: #D9503F; }
.split-item .v { font-size: 24px; font-weight: 900; color: #12A87E; }
.split-item.bad .v { color: #E85D4A; }

/* ================= 拼音页 ================= */
.py-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 380px) { .py-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.py-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 6px 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--sh-1);
  transition: transform .16s, box-shadow .18s, border-color .18s;
  overflow: hidden;
}
.py-card:active { transform: scale(.93); }
@media (hover: hover) { .py-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: #D3E0F8; } }
.py-card .py-char {
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  color: #3E6EE0;
  font-family: "Georgia", "Times New Roman", var(--font);
  letter-spacing: .5px;
}
.py-card .py-two { font-size: 24px; }
.py-card .py-hint {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #A7B4CC;
  letter-spacing: .3px;
}
.py-card .py-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  opacity: .5;
}
.py-card.playing { border-color: var(--lav); box-shadow: 0 0 0 4px rgba(155,135,245,.16); }
.py-card.playing .py-char { color: #7C5CE6; animation: pulse .6s infinite; }

.py-card.c-shengmu { background: linear-gradient(180deg, #F4F8FF, #FFFFFF); }
.py-card.c-yunmu { background: linear-gradient(180deg, #F6F3FF, #FFFFFF); }
.py-card.c-yunmu .py-char { color: #7C5CE6; }
.py-card.c-zhengti { background: linear-gradient(180deg, #FFF7F0, #FFFFFF); }
.py-card.c-zhengti .py-char { color: #E2762F; }

.letters-img {
  width: 100%;
  border-radius: 20px;
  box-shadow: var(--sh-2);
  display: block;
}

.unlock-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #FFB63D, #FF8A5C);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(255,150,60,.28);
  cursor: pointer;
  margin-bottom: 14px;
  transition: .2s;
}
.unlock-bar.done {
  background: var(--mint-soft);
  color: #10856A;
  box-shadow: none;
  font-size: 12.5px;
}

/* ================= 响应式 ================= */
@media (min-width: 560px) {
  .py-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tile-art { height: 140px; }
  .hero { min-height: 300px; }
  .hero h1 { font-size: 32px; }
  .hero p { max-width: calc(100% - 200px); font-size: 16.5px; }
  .hero-mascot { width: 176px; right: 6px; }
  .q-text { font-size: 21px; }
  .option-item { min-height: 86px; }
  .option-item .option-text { font-size: 21px; }
}

@media (min-width: 768px) {
  .container { max-width: 760px; padding-bottom: 110px; }
  .tile-grid { gap: 16px; }
}

@media (max-width: 359px) {
  .hero { min-height: 218px; padding: 18px; }
  .hero h1 { font-size: 27px; }
  .hero-mascot { width: 88px; }
  .hero p { max-width: calc(100% - 102px); font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* 年级由首页统一选择，板块页不再有年级栏（选择器样式已移除） */

/* ================= 单元/课文 弹窗选择器 ================= */
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pick-row.only-one { grid-template-columns: 1fr; }
.pick-btn {
  display: flex; align-items: center; gap: 9px; min-width: 0; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 9px 11px; font-family: inherit; box-shadow: var(--sh-1);
  transition: transform .16s, border-color .16s;
}
.pick-btn:active { transform: scale(.975); }
.pick-btn.on { border-color: #C6D8FF; background: linear-gradient(180deg, #F7FAFF, #fff); }
.pk-ico {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px; background: var(--brand-soft);
}
.pick-btn.on .pk-ico { background: #DCE9FF; }
.pk-body { flex: 1; min-width: 0; }
.pk-k { display: block; font-size: 10px; font-weight: 900; color: var(--muted); letter-spacing: .4px; }
.pk-v {
  display: block; font-size: 12.5px; font-weight: 900; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pk-arrow { flex-shrink: 0; font-size: 10px; color: #B9C6DC; }

.pk-mask {
  position: fixed; inset: 0; z-index: 420; background: rgba(15,23,42,.44);
  backdrop-filter: blur(3px); display: none; align-items: flex-end; justify-content: center;
}
.pk-mask.on { display: flex; }
.pk-sheet {
  width: 100%; max-width: 520px; max-height: 74vh; background: #fff;
  border-radius: 24px 24px 0 0; display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 6px);
  animation: pkUp .24s cubic-bezier(.3,1.2,.5,1);
}
@keyframes pkUp { from { transform: translateY(46px); opacity: .5; } to { transform: none; opacity: 1; } }
.pk-head {
  display: flex; align-items: center; gap: 8px; padding: 15px 16px 11px;
  border-bottom: 1px solid #F1F5FB; flex-shrink: 0;
}
.pk-head b { font-size: 15.5px; font-weight: 900; color: var(--ink); }
.pk-sub { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.pk-x {
  margin-left: auto; width: 28px; height: 28px; flex-shrink: 0; border: 0;
  border-radius: 50%; background: #F1F4FA; color: #7B8794; font-size: 13px; font-family: inherit;
}
.pk-list {
  overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 12px 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; align-content: start;
}
.pk-item {
  display: flex; align-items: flex-start; gap: 6px; text-align: left;
  font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--ink-2);
  border: 1.5px solid #EEF2F9; background: #FBFCFE; border-radius: 14px; padding: 10px;
  transition: transform .16s, background .16s;
}
.pk-item:active { transform: scale(.97); }
.pk-item .n { flex: 1; min-width: 0; line-height: 1.35; word-break: break-word; }
.pk-item .c {
  flex-shrink: 0; margin-top: 1px; font-size: 9.5px; font-weight: 900; color: var(--muted);
  background: #F0F4FB; border-radius: 999px; padding: 2px 6px;
}
.pk-item .pk-e { font-size: 12px; }
.pk-item.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.pk-item.active .c { background: #fff; color: var(--brand); }

/* 已学完的单元：绿色底 + 对勾，仍可点进去复习 */
.pk-item.done {
  border-color: #BFE7CC;
  background: linear-gradient(180deg, #F2FBF5, #E7F7ED);
  color: #2C7A52;
}
.pk-item.done .c { background: #fff; color: #3F9C68; }
.pk-item.done .pk-ok {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px;
  border-radius: 50%; background: #46B477; color: #fff;
  font-size: 10px; font-weight: 900; line-height: 16px; text-align: center;
}
.pk-item.active.done {
  border-color: #57BA83;
  background: linear-gradient(180deg, #E8F8EF, #D8F1E1);
  color: #1E6B45;
  box-shadow: 0 6px 16px rgba(70, 168, 112, .16);
}
.pk-item.active.done .c { color: #1E6B45; }

/* 大屏上做成居中的小窗，手机上是底部抽屉 */
@media (min-width: 640px) {
  .pk-mask { align-items: center; padding: 24px; }
  .pk-sheet { border-radius: 24px; max-height: 76vh; }
}

/* ================= 工具入口（吟唱 / 跟读） ================= */
.tool-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
/* 吟唱/跟读没有该年级资料时只剩手写练习，让它占满一行 */
.tool-row.solo { grid-template-columns: 1fr; }
.tool-row.solo .tool-btn { padding: 11px 12px; }
.tool-btn {
  display: flex; align-items: center; gap: 6px; text-align: left; font-family: inherit;
  border: 1.5px solid transparent; border-radius: 16px; padding: 10px 8px;
  transition: transform .16s; min-width: 0;
}
.tool-btn i { font-style: normal; font-size: 17px; line-height: 1; flex-shrink: 0; }
.tool-btn span { min-width: 0; }
.tool-btn b { display: block; font-size: 12px; font-weight: 900; white-space: nowrap; }
.tool-btn .t { display: block; font-size: 9.5px; font-weight: 700; opacity: .72; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-btn.sing { background: #FFF5F8; border-color: #FFD9E3; color: #E8506F; }
.tool-btn.read { background: #EFF6FF; border-color: #D3E3FF; color: var(--brand-deep); }
.tool-btn.write { background: #F0ECFF; border-color: #DDD2FF; color: #6C55C9; }
.tool-btn:active { transform: scale(.97); }

/* 题目上方的一排小入口 */
.cta-row { display: grid; gap: 8px; margin-bottom: 12px; }
.cta-row.two { grid-template-columns: 1fr 1fr; }
.cta-pill {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px dashed #FFC2D1; background: #FFF6F9; color: #E8506F;
  font-family: inherit; font-size: 12.5px; font-weight: 900; padding: 10px 8px;
  border-radius: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cta-pill.read { border-color: #C9DDFF; background: #F3F8FF; color: var(--brand-deep); }
.cta-pill:active { transform: scale(.97); }

/* ================= 课文在线跟读 ================= */
.rd-box {
  position: fixed; inset: 0; z-index: 460; display: none; flex-direction: column;
  background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background-image:
    radial-gradient(700px 420px at 8% -6%, #E8F0FF 0%, transparent 62%),
    radial-gradient(640px 400px at 94% 2%, #FFF1E8 0%, transparent 58%);
}
.rd-box.on { display: flex; }
.rd-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: rgba(245,248,255,.94); backdrop-filter: blur(10px);
}
.rd-back {
  flex-shrink: 0; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 13px; font-family: inherit; font-size: 12.5px; font-weight: 900;
  color: var(--ink-2); box-shadow: var(--sh-1);
}
.rd-title {
  flex: 1; min-width: 0; font-size: 14.5px; font-weight: 900; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rd-prog {
  flex-shrink: 0; font-size: 11px; font-weight: 900; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: 5px 10px;
}
.rd-main {
  width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 16px 12px;
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.rd-dots { display: flex; gap: 5px; margin: 2px 2px 14px; }
.rd-dot { height: 5px; flex: 1; border-radius: 999px; background: #E3EAF6; transition: background .2s; }
.rd-dot.on { background: linear-gradient(90deg, #7FD9BF, #22C79B); }

.rd-card {
  background: #fff; border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--sh-2); padding: 18px 18px 22px; min-height: 168px;
  display: flex; flex-direction: column; justify-content: center;
}
.rd-tag { font-size: 10.5px; font-weight: 900; color: var(--brand); letter-spacing: .4px; margin-bottom: 14px; }
.rd-line { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 6px; }
.rd-ch { display: flex; flex-direction: column; align-items: center; margin: 0 1px; }
.rd-ch i {
  font-style: normal; font-size: 11px; font-weight: 800; color: #93A6C6;
  line-height: 1.3; height: 15px; letter-spacing: .2px;
}
.rd-ch b {
  font-size: clamp(26px, 7.2vw, 34px); font-weight: 800; color: var(--ink);
  line-height: 1.22; padding: 0 2px; border-radius: 9px; transition: color .12s, background .12s;
}
.rd-ch.read b { color: #BFCCDF; }
.rd-ch.on b {
  color: #fff; background: linear-gradient(135deg, var(--brand), #7C8CF8);
  box-shadow: 0 6px 14px rgba(91,141,239,.3);
}
.rd-ch.on i { color: var(--brand); }

.rd-hint {
  margin: 14px 4px 0; font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center;
}
.rd-hint:empty { display: none; margin: 0; }
.rd-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 14px; }
#rdPlay { border-color: #A9E3BF; background: #EFFBF3; }
#rdPlay i { color: #2E9459; }
#rdPlay b { color: #2E9459; }
#rdPlay.on { border-color: #47B87B; background: #DDF6E7; }
#rdPause { border-color: #FBD3A0; background: #FFF8ED; }
#rdPause i { color: #E0913A; }
#rdPause b { color: #C4801B; }
#rdPause.on { border-color: #F0A94A; background: #FFEED6; }
#rdPause.on b { color: #B87418; }
#rdRecite { border-color: #DCD3FF; background: #F6F3FF; }
#rdRecite i { color: #6C55C9; }
#rdRecite b { color: #5B46B4; }
@media (max-width: 360px) {
  .rd-act b { font-size: 10.5px; }
  .rd-act { padding: 10px 2px; }
  .rd-act i { font-size: 18px; }
}
.rd-act {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px solid var(--line); background: #fff; border-radius: 18px;
  padding: 11px 4px; font-family: inherit; box-shadow: var(--sh-1); transition: transform .16s;
}
.rd-act:active { transform: scale(.96); }
.rd-act i { font-style: normal; font-size: 20px; line-height: 1; }
.rd-act b { font-size: 11.5px; font-weight: 900; color: var(--ink-2); }
.rd-act.on { border-color: var(--brand); background: var(--brand-soft); }
.rd-act.on b { color: var(--brand-deep); }
.rd-next {
  margin-top: 12px; width: 100%; border: 0; border-radius: 18px; padding: 14px;
  font-family: inherit; font-size: 15px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7C8CF8);
  box-shadow: 0 10px 24px rgba(91,141,239,.32);
}
.rd-next:active { transform: scale(.98); }

/* ===== 麦克风录音「我读」：录音按钮 + 回放对比 ===== */
.rd-rec { border-color: #FFC6D8; background: #FFF2F7; }
.rd-rec i { color: #E06A96; }
.rd-rec b { color: #D2507E; }
.rd-rec.recing {
  border-color: #F0755A; background: #FFECE5;
  animation: rdPulse 1.1s ease-in-out infinite;
}
.rd-rec.recing b { color: #D6452B; }
@keyframes rdPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,117,90,.34); }
  50% { box-shadow: 0 0 0 7px rgba(240,117,90,0); }
}
.rd-replay:empty { display: none; }
.rd-replay {
  margin-top: 12px; padding: 12px 14px; border: 1.5px dashed #C9DDFF;
  background: #F6FAFF; border-radius: 18px;
}
.rd-replay-h { font-size: 11.5px; font-weight: 900; color: var(--brand-deep); margin-bottom: 9px; }
.rd-replay-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-replay-b {
  flex-shrink: 0; border: 0; border-radius: 999px; padding: 9px 15px;
  font-family: inherit; font-size: 12.5px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7C8CF8);
}
.rd-replay-b:active { transform: scale(.96); }
.rd-replay-row audio { flex: 1; min-width: 170px; height: 36px; }
.rd-replay-tip { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }

/* ===== 逐字评分：读对标绿、漏读标红 ===== */
.rd-line .rd-ch.rd-ok b { color: #0F6E56; background: #E1F5EE; }
.rd-line .rd-ch.rd-bad b { color: #D6452B; background: #FFECE5; }
.rd-score {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed #C9DDFF;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.rd-score b { font-size: 18px; font-weight: 900; color: var(--brand-deep); }
.rd-score .rd-no {
  font-style: normal; font-size: 10.5px; font-weight: 900; color: #D6452B;
  background: #FFECE5; border-radius: 999px; padding: 3px 9px;
}
.rd-pass b { color: #0F6E56; }
.rd-score i {
  font-style: normal; font-size: 10.5px; color: #96690C;
  background: #FFF3D6; border-radius: 999px; padding: 3px 9px;
}
.rd-score em { font-style: normal; width: 100%; font-size: 11px; color: var(--muted); word-break: break-all; }

.rd-fin { text-align: center; align-items: center; padding: 26px 18px; }
.rd-fin-e { font-size: 54px; line-height: 1; margin-bottom: 10px; }
.rd-fin-t { font-size: 19px; font-weight: 900; color: var(--ink); margin-bottom: 6px; }
.rd-fin-d { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 18px; }
.rd-fin-btns { display: flex; gap: 10px; width: 100%; }
.rd-fin-btns .btn { flex: 1; }
.rd-li { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-empty { grid-column: 1 / -1; padding: 26px 10px; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 700; }

/* ===== 整篇课文一次显示：字号自适应 + 当前句高亮 + 逐字游标同步 ===== */
.rd-dots { margin: 2px 2px 8px; }
.rd-dot.now { box-shadow: 0 0 0 2px #C9DDFF; }
.rd-paper {
  --rd-fs: 30px;
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--sh-2); padding: 10px 12px;
}
.rd-sent {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 3px 6px; border-radius: 12px;
  border-left: 3px solid transparent;
  cursor: pointer; transition: background .18s, border-color .18s;
}
.rd-sent.on { background: linear-gradient(90deg, #EAF2FF 0%, #F5F9FF 100%); border-left-color: var(--brand); }
.rd-sn {
  flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 900; color: #97AAC9; background: #EEF3FB;
  margin-top: calc(var(--rd-fs) * .42);
}
.rd-sent.on .rd-sn { color: #fff; background: var(--brand); }
.rd-paper .rd-line { flex: 1; min-width: 0; row-gap: 1px; }
.rd-paper .rd-ch i {
  font-size: calc(var(--rd-fs) * .38);
  height: calc(var(--rd-fs) * .5); line-height: calc(var(--rd-fs) * .5);
}
.rd-paper .rd-ch { flex: 0 0 auto; }
.rd-paper .rd-ch b { font-size: var(--rd-fs); line-height: 1.14; padding: 0 1px; }
/* ================= 汉字注音（拼音标注） ================= */
ruby.zz {
  ruby-position: over;
  ruby-align: center;
  padding: 0 1px;
}
ruby.zz rt {
  font-size: .56em;
  font-weight: 800;
  color: #7B8FB2;
  line-height: 1.15;
  letter-spacing: .2px;
  font-family: var(--font);
}
/* 注音后行高需要让位，否则上一行拼音会压到下一行 */
.q-text { line-height: 2.15; }
.modal .e ruby.zz rt { color: #A98A6E; }
.modal .a ruby.zz rt { color: #93A6C6; }

/* ===== 看图题插图 ===== */
.q-imgwrap {
  display: flex; justify-content: center;
  margin: 6px 0 16px;
}
.q-img {
  width: 100%; max-width: min(300px, 44vh); height: auto;
  border-radius: 16px; display: block;
  background: #fff;
  box-shadow: 0 8px 22px rgba(78,110,180,.14);
  border: 3px solid #fff;
}
.wrong-img { max-width: min(200px, 32vh); border-radius: 14px; box-shadow: 0 4px 12px rgba(78,110,180,.10); }
@media (max-width: 420px) {
  .q-img { max-width: min(260px, 40vh); }
}

/* ===== 轻提示（替代 alert 弹窗） ===== */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 14px);
  background: rgba(46,58,84,.93); color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
  padding: 11px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity .2s ease, transform .2s ease; z-index: 9999;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 古诗词 · 诗词小书房 ================= */
.po-hero {
  position: relative;
  margin-top: 4px;
  padding: 20px 20px 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #FFEEDB 0%, #FFDFC8 46%, #FFCEDD 100%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 16px 34px rgba(214, 150, 110, .24);
  overflow: hidden;
}
.po-hero::after {
  content: '🏮';
  position: absolute;
  right: -4px;
  bottom: -18px;
  font-size: 84px;
  opacity: .3;
  transform: rotate(-8deg);
}
.po-hero-t { position: relative; z-index: 1; font-size: 20px; font-weight: 900; color: #8A4B24; letter-spacing: .5px; }
.po-hero-s { position: relative; z-index: 1; margin-top: 6px; font-size: 12px; font-weight: 700; color: #A9764C; line-height: 1.6; }
.po-hero-btn {
  position: relative; z-index: 1;
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 9px 16px;
  font-family: inherit; font-size: 12.5px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #F2955C, #E4708A);
  box-shadow: 0 8px 18px rgba(226, 112, 138, .32);
  transition: transform .16s;
}
.po-hero-btn:active { transform: scale(.95); }

.po-chips { margin: 16px 0 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.po-chips::-webkit-scrollbar { display: none; }

.po-ghead {
  display: flex; align-items: center; gap: 7px;
  margin: 18px 2px 10px;
  font-size: 13.5px; font-weight: 900; color: var(--ink-2);
}
.po-ghead em { font-style: normal; font-size: 14px; }
.po-ghead span { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--muted); }

.po-list { display: flex; flex-direction: column; gap: 10px; }

.po-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: transform .16s, box-shadow .18s, border-color .18s;
}
.po-item:active { transform: scale(.985); }
@media (hover: hover) { .po-item:hover { box-shadow: var(--sh-2); border-color: #E1E9F8; } }

.po-item-ic {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 15px;
  display: grid; place-items: center;
  font-size: 23px;
  background: linear-gradient(150deg, #FFF4E6, #FFE6DC);
  box-shadow: inset 0 -2px 6px rgba(190, 140, 100, .10);
}
.po-cat-nation .po-item-ic { background: linear-gradient(150deg, #FFF1D9, #FFE1B8); }
.po-cat-g1 .po-item-ic { background: linear-gradient(150deg, #EAF4FF, #D9E8FF); }
.po-cat-g2 .po-item-ic { background: linear-gradient(150deg, #EAFBF3, #D5F3E4); }
.po-cat-g3 .po-item-ic { background: linear-gradient(150deg, #F1ECFF, #E2D9FF); }
.po-cat-g4 .po-item-ic { background: linear-gradient(150deg, #FFF3F6, #FFDEe7); }
.po-cat-g5 .po-item-ic { background: linear-gradient(150deg, #EFF7F2, #DDF0E4); }
.po-cat-g6 .po-item-ic { background: linear-gradient(150deg, #FFF6E3, #FFE9C4); }

.po-item-body { flex: 1; min-width: 0; }
.po-item-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 900; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.po-dyn {
  flex-shrink: 0;
  font-size: 9.5px; font-weight: 900; color: #B0763F;
  background: #FFF3E2; border: 1px solid #FFE6C4;
  border-radius: 999px; padding: 2px 7px;
}
.po-item-meta { margin-top: 2px; font-size: 11px; font-weight: 800; color: var(--muted); }
.po-item-first {
  display: block; margin-top: 3px;
  font-size: 11.5px; font-weight: 700; color: #98A6BE;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
}
.po-play {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 0; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: 13px; line-height: 1;
  display: grid; place-items: center;
  transition: transform .16s, background .16s;
}
.po-play:active { transform: scale(.9); }
.po-play.on { background: linear-gradient(135deg, var(--brand), #7C8CF8); color: #fff; animation: pulse .7s infinite; }

/* ---------- 诗词详情（全屏书页） ---------- */
.po-view {
  position: fixed; inset: 0; z-index: 470;
  display: none; flex-direction: column;
  background: #FDF6EA;
  background-image:
    radial-gradient(620px 380px at 8% -8%, #FFF3DC 0%, transparent 62%),
    radial-gradient(560px 360px at 96% 4%, #FFE9EC 0%, transparent 58%),
    radial-gradient(700px 420px at 50% 110%, #FBF0DC 0%, transparent 60%);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.po-view.on { display: flex; }
.po-vbar {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(253, 246, 234, .93);
  backdrop-filter: blur(10px);
}
.po-vback {
  flex-shrink: 0; border: 1px solid #F0E1CB; background: #fff;
  border-radius: 999px; padding: 7px 13px;
  font-family: inherit; font-size: 12.5px; font-weight: 900; color: #8A6B4A;
  box-shadow: var(--sh-1);
}
.po-vtitle {
  flex: 1; min-width: 0;
  font-size: 14.5px; font-weight: 900; color: #6B4A2A;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.po-vprog {
  flex-shrink: 0; font-size: 11px; font-weight: 900; color: #B0763F;
  background: #FFF1DC; border-radius: 999px; padding: 5px 10px;
}
.po-vmain { width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 16px 34px; }

.po-paper {
  position: relative;
  background: linear-gradient(180deg, #FFFDF7, #FFF9EC);
  border: 1px solid #F1E3CB;
  border-radius: 26px;
  padding: 22px 16px 20px;
  box-shadow: 0 14px 34px rgba(180, 140, 95, .14);
}
.po-paper::before {
  content: '';
  position: absolute; left: 14px; right: 14px; top: 10px; bottom: 10px;
  border: 1px dashed #F0DFC1;
  border-radius: 18px;
  pointer-events: none;
}
.po-title {
  position: relative;
  text-align: center;
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
  font-size: 23px; font-weight: 900; color: #5C3B22;
  letter-spacing: 2px;
  padding: 0 6px;
}
.po-author {
  position: relative;
  text-align: center; margin-top: 5px;
  font-size: 11.5px; font-weight: 800; color: #A9835C; letter-spacing: .5px;
}
.po-author::after {
  content: ''; display: block; width: 42px; height: 3px; margin: 10px auto 4px;
  border-radius: 999px; background: linear-gradient(90deg, #F3C6A0, #EFA9B8);
}
.po-lines { position: relative; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.po-line {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center;
  row-gap: 2px;
  padding: 9px 6px; border-radius: 16px;
  transition: background .18s, box-shadow .18s;
  cursor: pointer;
}
.po-seg { display: inline-flex; flex-wrap: nowrap; align-items: flex-end; }
.po-line:active { background: rgba(255, 236, 210, .7); }
.po-line.on { background: linear-gradient(135deg, #FFF1D8, #FFE8EE); box-shadow: 0 8px 18px rgba(226, 158, 120, .16); }

.po-ch { display: inline-flex; flex-direction: column; align-items: center; margin: 0 1.5px; }
.po-ch i {
  font-style: normal;
  font-size: calc(var(--po-fs, 26px) * .38); font-weight: 800; color: #C09A72;
  line-height: 1.25; height: calc(var(--po-fs, 26px) * .52); letter-spacing: .2px;
  font-family: var(--font); white-space: nowrap;
}
.po-ch b {
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
  font-size: var(--po-fs, clamp(21px, 6.2vw, 27px)); line-height: 1.2;
  font-weight: 700; color: #4A3524;
  transition: color .12s;
}
.po-ch.read b { color: #C6B49C; }
.po-ch.on b { color: #D9564F; text-shadow: 0 2px 10px rgba(217, 86, 79, .18); }
.po-punc {
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
  font-size: var(--po-fs, clamp(21px, 6.2vw, 27px)); line-height: 1.2;
  color: #9C8163; padding: 0 1px;
}

.po-note {
  display: flex; gap: 10px;
  margin: 14px 2px 0;
  padding: 13px 14px;
  border-radius: 18px;
  background: #FFF8E9;
  border: 1.5px dashed #F4DDB7;
  font-size: 12px; line-height: 1.7; font-weight: 700; color: #8A6B3F;
}
.po-note em { font-style: normal; flex-shrink: 0; font-size: 15px; }

.po-acts { display: grid; grid-template-columns: 1.15fr 1fr; gap: 8px; margin-top: 14px; }
.po-act {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1.5px solid #F0E1CB; background: #fff;
  border-radius: 18px; padding: 10px 4px;
  font-family: inherit; box-shadow: var(--sh-1);
  transition: transform .16s, border-color .16s, background .16s;
}
.po-act:active { transform: scale(.96); }
.po-act i { font-style: normal; font-size: 19px; line-height: 1; }
.po-act b { font-size: 11.5px; font-weight: 900; color: #7A5B37; }
.po-act.on { border-color: #F2A08C; background: #FFF3EC; }
.po-act.recite { border-color: #D8CCF7; background: #F7F4FF; }
.po-act.recite b { color: #6C55C9; }
.po-act.on b { color: #D9564F; }
.po-act:disabled { opacity: .45; }
.po-tip { margin: 12px 4px 0; text-align: center; font-size: 11px; font-weight: 700; color: #B79C7B; }

.po-next {
  margin-top: 12px; width: 100%; border: 0; border-radius: 18px; padding: 13px;
  font-family: inherit; font-size: 14.5px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #F2955C, #E4708A);
  box-shadow: 0 10px 22px rgba(226, 112, 138, .28);
}
.po-next:active { transform: scale(.98); }

/* ================= 背诵模式：磨砂玻璃蒙版 + AI 检测 ================= */
.rc-host { position: relative; }
.rc-veil {
  position: fixed; inset: 0; z-index: 900; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(238,244,255,.42);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition: backdrop-filter .22s ease, background .22s ease;
}
.rc-veil.peek {
  background: rgba(243,247,255,.10);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}
.rc-card {
  text-align: center; padding: 22px 20px; display: flex; flex-direction: column;
  gap: 9px; align-items: center; width: min(90vw, 350px); max-height: 84vh;
  overflow-y: auto; border-radius: 26px; background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 20px 54px rgba(38,48,96,.24);
}
.rc-t { font-size: 18px; font-weight: 900; color: #4A3AA8; }
.rc-s { font-size: 12.5px; font-weight: 900; color: #6B5FC0; }
.rc-s2 { font-size: 11.5px; font-weight: 700; color: #8B93B8; max-width: 250px; line-height: 1.65; }
.rc-btns { display: flex; gap: 8px; }
.rc-b {
  border: 0; border-radius: 14px; padding: 10px 14px; font-family: inherit;
  font-size: 12.5px; font-weight: 900; cursor: pointer;
  box-shadow: 0 3px 12px rgba(60,60,140,.16); transition: transform .15s;
}
.rc-b:active { transform: scale(.95); }
.rc-b.peek { background: #FFF6E8; color: #C98A2D; }
.rc-b.go {
  background: linear-gradient(180deg, #8A7AFA, #6C55C9); color: #fff;
  display: inline-flex; align-items: center; gap: 6px;
}
.rc-b.go i { font-style: normal; font-size: 15px; }
.rc-b.go.recing { background: linear-gradient(180deg, #FF8A5C, #F56B3A); }
.rc-x { border: 0; background: transparent; color: #9AA3C0; font-size: 11.5px; font-weight: 800;
  font-family: inherit; cursor: pointer; padding: 4px 8px; }
.rc-x:active { opacity: .7; }
/* 逐字检测结果：绿=读对 红=漏读/读错 */
.rc-cand { border-radius: 4px; transition: background .35s, color .35s; }
.rc-cand.rc-ok { background: #E1F5EE; color: #0F6E56; }
.rc-cand.rc-ok rt { color: #3F9C68; }
.rc-cand.rc-miss { background: #FFECE5; color: #D6452B; box-shadow: 0 1px 4px rgba(214,69,43,.25); }
.rc-cand.rc-miss rt { color: #D6452B; }
/* 跟读/诗词的逐字单元是「拼音+汉字」两行，只给汉字上色更干净 */
.rd-ch.rc-cand.rc-ok, .rd-ch.rc-cand.rc-miss,
.po-ch.rc-cand.rc-ok, .po-ch.rc-cand.rc-miss { background: transparent; box-shadow: none; }
.rd-ch.rc-ok b, .po-ch.rc-ok b { color: #0F6E56; background: #E1F5EE; border-radius: 7px; }
.rd-ch.rc-miss b, .po-ch.rc-miss b { color: #D6452B; background: #FFECE5; border-radius: 7px; }
.rd-ch.rc-ok i, .po-ch.rc-ok i { color: #3F9C68; }
.rd-ch.rc-miss i, .po-ch.rc-miss i { color: #D6452B; }
/* 回放：我背的录音 */
.rc-mine { width: 100%; }
.rc-mine-h { font-size: 10.5px; font-weight: 900; color: #8B93B8; margin-bottom: 3px; letter-spacing: .3px; }
.rc-mine audio, .rc-bar audio {
  width: 100%; height: 36px; display: block;
  border-radius: 12px; background: #F4F7FE;
}
.rc-card .rc-mine { margin-top: 2px; }
/* 底部结果条（背诵完弹出） */
.rc-bar {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 950; background: #fff; border-radius: 18px;
  border: 1px solid #EEF2F8;
  box-shadow: 0 12px 34px rgba(30,50,90,.24);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  animation: rcUp .25s ease-out;
  max-width: 496px; margin: 0 auto;
  /* 结果条内容多（分数 + 诊断 + 原因 + 听到的内容 + 回放 + 按钮）时不许顶出屏幕 */
  max-height: calc(100vh - 160px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
@keyframes rcUp { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.rc-bar-score { font-size: 13px; font-weight: 900; color: #2B3A55; }
.rc-bar-score b { color: #F56B3A; font-size: 16px; }
.rc-bar-missed { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 800; color: #D6452B; }
/* 只有一字不差才显示「通过」；其它情况一律标红「未通过」 */
.rc-pass .rc-bar-score { color: #0F6E56; }
.rc-bar-no {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 900; color: #D6452B; background: #FFECE5;
  vertical-align: 1px;
}
.rc-mock { font-size: 10.5px; font-weight: 700; color: #9AA3C0; }
.rc-bar-btns { display: flex; gap: 8px; }
.rc-bar-btns .rc-b { flex: 1; }

/* ================= 我会写：书写练习浮层 ================= */
.hw-mask {
  position: fixed; inset: 0; z-index: 980;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; overflow-y: auto;
  background: rgba(18, 28, 48, .44);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  animation: hwFade .18s ease-out;
}
@keyframes hwFade { from { opacity: 0 } to { opacity: 1 } }

.hw-sheet {
  width: 100%; max-width: 430px; margin: auto; background: #fff;
  border-radius: 26px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 26px 64px rgba(12, 30, 70, .34);
  animation: hwIn .26s cubic-bezier(.2, .9, .32, 1.06);
}
@keyframes hwIn { from { transform: translateY(16px) scale(.94); opacity: 0 } to { transform: none; opacity: 1 } }

.hw-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid #F1F5FC;
  background: linear-gradient(100deg, #FFF8EF, #FFFDFB);
}
.hw-idx {
  font-size: 10.5px; font-weight: 900; color: #B4701A;
  background: #FFF1DC; border-radius: 999px; padding: 4px 9px; white-space: nowrap;
}
.hw-t {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 900; color: #6B4A16;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hw-x {
  flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #F3F6FC; color: #7A879F; font-family: inherit;
  font-size: 12px; font-weight: 900; line-height: 1;
}
.hw-x:active { transform: scale(.92); }

.hw-main { padding: 12px 14px 14px; }

/* 字头：范字 + 拼音 + 词语 */
.hw-top { display: flex; align-items: center; gap: 12px; }
.hw-zi-box {
  width: 78px; height: 78px; flex-shrink: 0; border-radius: 14px;
  border: 1.5px solid #FFE0C2; background: #FFFCF6;
  display: flex; align-items: center; justify-content: center;
  background-image:
    linear-gradient(#F7EBDD 1px, transparent 1px),
    linear-gradient(90deg, #F7EBDD 1px, transparent 1px);
  background-size: 50% 50%; background-position: 0 0;
}
.hw-zi {
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
  font-size: 52px; font-weight: 700; color: #F0562F; line-height: 1;
  text-shadow: 0 1px 0 #fff;
}
.hw-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.hw-py { font-size: 14px; font-weight: 900; color: var(--brand-deep); letter-spacing: .6px; }
.hw-cz { font-size: 11.5px; font-weight: 800; color: var(--muted); line-height: 1.5; }

/* 笔顺：一排田字格，逐格累进（已写黑 / 当前红 / 未写淡灰） */
.hw-order {
  margin-top: 11px; border: 1.5px solid #FFE0C2; border-radius: 16px;
  background: linear-gradient(135deg, #FFFBF3, #FFF6EA);
  padding: 9px 10px 10px;
}
.hw-order.hw-na { opacity: .72; }
.hw-order-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hw-order-hd b { font-size: 12.5px; font-weight: 900; color: #B4701A; }
.hw-names {
  margin-top: 3px; font-size: 11px; font-weight: 800; color: #AE8A57;
  line-height: 1.5; letter-spacing: .3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hw-load { display: block; padding: 14px 0; text-align: center; font-size: 11px; font-weight: 800; color: #C0A67F; }
.hw-cells {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  margin-top: 7px;
}
.hw-cell {
  flex: 0 0 calc((100% - (var(--cols, 5) - 1) * 4px) / var(--cols, 5));
  max-width: 84px;
  transition: transform .18s ease;
}
.hw-ge {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: #fff; border: 1.5px solid #8CCBF2; border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(76, 140, 190, .08);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.hw-ge svg { display: block; width: 100%; height: 100%; }
.hw-cell.on { transform: translateY(-1px) scale(1.04); }
.hw-cell.on .hw-ge {
  border-color: #2E9FE0;
  box-shadow: 0 4px 10px rgba(46, 159, 224, .3), 0 0 0 2px rgba(46, 159, 224, .16);
}
.hw-cell.is-full .hw-ge { border-color: #E9A34A; }
.hw-cell.is-full.on .hw-ge {
  border-color: #E08A22;
  box-shadow: 0 4px 10px rgba(224, 138, 34, .3), 0 0 0 2px rgba(224, 138, 34, .16);
}
.hw-replay {
  flex-shrink: 0; border: 1.5px solid #F0D3AC; background: #fff; color: #B4701A;
  border-radius: 999px; padding: 4px 10px; font-family: inherit;
  font-size: 10.5px; font-weight: 900;
}
.hw-replay:active { transform: scale(.96); }
.hw-replay[disabled] { opacity: .45; }

/* 田字格 + 手写层 */
.hw-pad {
  position: relative; width: 100%; aspect-ratio: 1 / 1; margin-top: 12px;
  border-radius: 18px; overflow: hidden; border: 1.5px solid #FFE7CF;
  background-color: #FFFEFA;
  background-image:
    linear-gradient(#F5E6D6 1px, transparent 1px),
    linear-gradient(90deg, #F5E6D6 1px, transparent 1px);
  background-size: 50% 50%; background-position: 0 0;
  box-shadow: inset 0 2px 10px rgba(120, 90, 60, .05);
}
.hw-pad::before, .hw-pad::after {
  content: ''; position: absolute; z-index: 1; pointer-events: none;
  background: #F7DFC8; opacity: .75;
}
.hw-pad::before { left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -.5px; }
.hw-pad::after { top: 50%; left: 0; right: 0; height: 1px; margin-top: -.5px; }
.hw-ghost {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-family: "KaiTi", "STKaiti", "楷体", var(--font);
  font-size: min(54vw, 220px); line-height: 1; font-weight: 700;
  color: rgba(196, 206, 226, .62);
}
.hw-pad canvas {
  position: absolute; inset: 0; z-index: 2; display: block;
  touch-action: none; cursor: crosshair;
}
.hw-ph {
  position: absolute; left: 50%; bottom: 8px; z-index: 3;
  transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-size: 10.5px; font-weight: 800; color: #C3CCDD;
  transition: opacity .25s;
}
.hw-ph.hide { opacity: 0; }

/* 底部按钮 */
.hw-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.hw-tools button {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 14px; padding: 12px 4px; font-family: inherit;
  font-size: 12px; font-weight: 900;
}
.hw-tools button:active { transform: scale(.97); }
.hw-tools button[disabled] { opacity: .4; }
.hw-tools button.ok {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7C8CF8);
  box-shadow: 0 6px 14px rgba(91, 141, 239, .26);
}

/* 完成页 */
.hw-fin { text-align: center; padding: 26px 18px 22px; }
.hw-fin-e { font-size: 54px; line-height: 1; }
.hw-fin-t { font-size: 17px; font-weight: 900; color: var(--ink); margin: 8px 0 4px; }
.hw-fin-d { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 18px; }
.hw-fin-btns { display: flex; gap: 10px; }
.hw-fin-btns button {
  flex: 1; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 15px; padding: 13px 6px; font-family: inherit;
  font-size: 13px; font-weight: 900;
}
.hw-fin-btns button.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7C8CF8);
  box-shadow: 0 8px 18px rgba(91, 141, 239, .3);
}
.hw-fin-btns button.ghost { background: var(--bg); border-color: transparent; color: var(--muted); }

/* 知识块标题里的「我会写」按钮 */
.bk-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.bk-tools .ra-hint { margin-left: 0; }
.bk-write {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1.5px solid #FFD2A8; background: #FFF6EC; color: #D2601A;
  border-radius: 999px; padding: 3px 9px; font-family: inherit;
  font-size: 10px; font-weight: 900; white-space: nowrap;
}
.bk-write:active { transform: scale(.95); }
.ra-block.ra-on .bk-write { background: #fff; }

@media (max-width: 360px) {
  .hw-zi-box { width: 66px; height: 66px; }
  .hw-zi { font-size: 44px; }
  .hw-cell { max-width: 62px; }
  .hw-tools button { font-size: 11px; padding: 11px 2px; }
}

/* 矮屏手机：田字格按视口高度收一点，保证底部按钮不用滚动就能点到 */
@media (max-height: 780px) {
  .hw-pad { aspect-ratio: auto; height: min(50vh, 330px); }
  .hw-ghost { font-size: min(38vh, 190px); }
  .hw-zi-box { width: 64px; height: 64px; }
  .hw-zi { font-size: 42px; }
}

/* ================= AI 语音识别：科技感加载动效 ================= */
.ai-l {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity .28s ease;
}
.ai-l.on { opacity: 1; }
.ai-l.out { opacity: 0; pointer-events: none; }

.ai-l-grid {
  position: absolute; inset: 0;
  background: rgba(6, 13, 32, .78);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
.ai-l-grid::before {
  content: ''; position: absolute; inset: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(86, 156, 255, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 156, 255, .10) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 78%);
}
.ai-l-grid::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(46, 130, 255, .28), transparent 58%);
}
.ai-l-scan {
  position: absolute; left: 0; right: 0; height: 2px; top: -10%;
  background: linear-gradient(90deg, transparent, rgba(110, 231, 255, .75), transparent);
  box-shadow: 0 0 18px rgba(110, 231, 255, .55);
  animation: aiScan 3.2s linear infinite;
}
@keyframes aiScan { from { top: -5% } to { top: 105% } }

.ai-l-card {
  position: relative; width: min(92vw, 322px); padding: 15px 18px 16px;
  border-radius: 22px; overflow: hidden; color: #E8F4FF;
  background: linear-gradient(160deg, rgba(26, 42, 82, .96), rgba(11, 21, 47, .97));
  border: 1px solid rgba(98, 190, 255, .38);
  box-shadow: 0 26px 62px rgba(0, 0, 0, .5),
              0 0 46px rgba(48, 145, 255, .22),
              inset 0 1px 0 rgba(255, 255, 255, .09);
  transform: translateY(10px) scale(.96);
  transition: transform .34s cubic-bezier(.2,.9,.3,1.1), border-color .3s;
}
.ai-l.on .ai-l-card { transform: none; }

.ai-l-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; letter-spacing: .6px; color: #9FC6F5;
  border-bottom: 1px solid rgba(120, 180, 255, .16); padding-bottom: 9px;
}
.ai-l-head b { font-weight: 900; color: #DDF0FF; font-size: 11.5px; }
.ai-l-ver { margin-left: auto; font-size: 9px; font-weight: 800; opacity: .7; }
.ai-l-led {
  width: 7px; height: 7px; border-radius: 50%; background: #5EF0C0;
  box-shadow: 0 0 9px #5EF0C0; animation: aiLed 1.3s ease-in-out infinite;
}
@keyframes aiLed { 0%,100% { opacity: .35 } 50% { opacity: 1 } }

.ai-l-orb { position: relative; width: 132px; height: 132px; margin: 14px auto 8px; }
.ai-l-ring {
  position: absolute; border-radius: 50%; pointer-events: none;
  animation: aiSpin linear infinite;
}
.ai-l-ring.r1 {
  inset: 0; border: 1.5px dashed rgba(110, 205, 255, .5); animation-duration: 9s;
}
.ai-l-ring.r2 {
  inset: 16px; border: 1.5px solid rgba(126, 150, 255, .38);
  border-left-color: rgba(126, 240, 255, .9); border-top-color: rgba(126, 240, 255, .65);
  animation-duration: 5.2s; animation-direction: reverse;
}
.ai-l-ring.r3 {
  inset: 34px; border: 1px solid rgba(94, 240, 206, .3);
  border-right-color: rgba(120, 255, 220, .85);
  animation-duration: 3.4s;
}
@keyframes aiSpin { from { transform: rotate(0) } to { transform: rotate(360deg) } }

.ai-l-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(70, 220, 255, 0) 0deg, rgba(70, 220, 255, .30) 42deg,
    rgba(70, 220, 255, 0) 96deg, rgba(70, 220, 255, 0) 360deg);
  animation: aiSpin 2.5s linear infinite;
}
.ai-l-dots i {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px; border-radius: 50%;
  background: #8DEBFF; box-shadow: 0 0 9px #6ED8FF;
  animation: aiDot 2.6s linear infinite; animation-delay: var(--d);
}
@keyframes aiDot {
  from { transform: rotate(var(--a)) translateY(-61px); opacity: .25 }
  50%  { opacity: 1 }
  to   { transform: rotate(calc(var(--a) + 360deg)) translateY(-61px); opacity: .25 }
}
.ai-l-core {
  position: absolute; inset: 47px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 34% 28%, #93EDFF, #2F80EC 58%, #173E9E);
  box-shadow: 0 0 26px rgba(72, 190, 255, .75), inset 0 0 12px rgba(255, 255, 255, .35);
  font-size: 15px; font-weight: 900; letter-spacing: 1px; color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
  animation: aiPulse 1.9s ease-in-out infinite;
}
@keyframes aiPulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.07) } }

.ai-l-wave {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  height: 26px; margin: 2px 0 8px;
}
.ai-l-wave i {
  width: 3px; height: 6px; border-radius: 2px;
  background: linear-gradient(#75EEFF, #4C7BFF);
  animation: aiWave .85s ease-in-out infinite alternate;
  animation-delay: var(--d);
}
@keyframes aiWave { from { height: 5px; opacity: .45 } to { height: 24px; opacity: 1 } }

.ai-l-msg {
  text-align: center; font-size: 12px; font-weight: 800; color: #A9D8FF;
  letter-spacing: .3px; min-height: 18px;
}
.ai-l-bar {
  height: 6px; border-radius: 999px; margin-top: 11px; overflow: hidden;
  background: rgba(120, 170, 255, .16);
  border: 1px solid rgba(120, 190, 255, .16);
}
.ai-l-bar span {
  display: block; height: 100%; width: 4%; border-radius: 999px;
  background: linear-gradient(90deg, #4C7BFF, #63E8FF 70%, #9BFFF0);
  box-shadow: 0 0 12px rgba(99, 232, 255, .8);
  transition: width .18s linear;
}
.ai-l-meta {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: 9.5px; font-weight: 800; color: #7FA8D8;
}
.ai-l-meta span:first-child { color: #8FEEFF; }

.ai-l.err .ai-l-card {
  border-color: rgba(255, 120, 120, .65);
  box-shadow: 0 26px 62px rgba(0,0,0,.5), 0 0 40px rgba(255, 90, 90, .28);
}
.ai-l.err .ai-l-core { background: radial-gradient(circle at 34% 28%, #FFB1A0, #E0513F 60%, #8C2018); }
.ai-l.err .ai-l-msg { color: #FFC0B6; }
.ai-l.err .ai-l-led { background: #FF7B6B; box-shadow: 0 0 9px #FF7B6B; }
.ai-l.ok .ai-l-card { border-color: rgba(110, 255, 196, .55); }
.ai-l.ok .ai-l-core { background: radial-gradient(circle at 34% 28%, #A8FFDA, #28B27E 60%, #126347); }

@media (prefers-reduced-motion: reduce) {
  .ai-l-ring, .ai-l-sweep, .ai-l-dots i, .ai-l-core,
  .ai-l-wave i, .ai-l-scan, .ai-l-led { animation-duration: 3s; }
}

/* ===== 识别结果：范围 / 错漏 / AI 听到的内容 ===== */
.rd-scope {
  font-size: 10.5px; font-weight: 800; color: #4B6FC0;
  background: #EEF4FF; border-radius: 999px; padding: 3px 9px;
}
.rd-warn {
  font-size: 10.5px; font-weight: 800; color: #C0532A;
  background: #FFF0E6; border-radius: 999px; padding: 3px 9px;
}
.rd-only {
  width: 100%; margin-top: 2px; border: 1.5px solid #DDE7FA;
  background: #F7FAFF; color: #4B6FC0; border-radius: 12px;
  padding: 8px; font-family: inherit; font-size: 11.5px; font-weight: 900;
}
.rd-only:active { transform: scale(.98); }

.rc-diag {
  font-size: 11px; font-weight: 800; color: #6B7A9B;
  display: flex; flex-wrap: wrap; gap: 4px 10px;
}
.rc-said {
  font-size: 11px; font-weight: 700; color: #7A879F;
  word-break: break-all; line-height: 1.55;
  background: #F7F9FE; border-radius: 10px; padding: 7px 9px;
}
.rc-reason {
  font-size: 11px; font-weight: 800; color: #C0532A;
  background: #FFF2E9; border-radius: 10px; padding: 7px 9px;
}
