* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* ============================================================
   设计基座(2026-09-14 重建)
   旧版只有一层色变量,卡片/背景/正文几乎无明度差,主色被"加深达对比"后
   变成焦糖棕 —— 这是"整体看着糙"的根因。这里建立完整的一层体系:
   明度阶梯 / 字阶 / 圆角节奏 / 间距 / 双层阴影。

   ⚠️ 颜色规则(改色前必读):
   亮橙是浅色,白字放上去最多 2.7:1,永远不可能达 AA 4.5:1。
   所以**橙色面上用深棕字(--ink-on)**,实测 6.04:1 —— 既保住鲜艳,又达标。
   需要白字的场合请用 --green(#268050, 白字 4.90:1)。
   ============================================================ */
:root {
  /* ============================================================
     成长手账 · 原味手账(明亮糖果)
     主张:这不是 App,是孩子自己贴出来的一本成长手账。
     元素是"纸"——方正、有厚度、被胶带贴上去,允许一点点歪。

     ⚠️ 颜色规则:彩色便利贴上一律压深棕字(--ink)。
     白字压在浅色上永远达不到 AA(亮橙白字最多 2.7:1)。
     括号内为实测对比度。
     ============================================================ */
  --paper:   #FDFBF6;
  --grid:    rgba(122,160,190,.13);
  --card:    #FFFFFF;

  --ink:     #3A3226;   /* 正文        纸底 12.2:1 */
  --ink-2:   #6E6355;   /* 次级         纸底  5.7:1 */
  --ink-3:   #8A7E6A;

  --coral:   #FF8A6B;   /* 主色        深字  5.47:1 */
  --coral-d: #D96A4C;
  --blue:    #5BA8D8;   /* 辅助色      深字  4.83:1 */
  --blue-d:  #3E86AF;
  --green:   #7BC47F;   /* 完成/成功   深字  6.04:1 */
  --green-d: #5C9A62;
  --sticky:  #FFE27A;   /* 荧光笔/便利贴黄     深字  9.86:1 */

  --tape:    rgba(255,226,122,.80);
  --tape-b:  rgba(91,168,216,.42);
  --tape-g:  rgba(123,196,127,.48);
  --tape-p:  rgba(255,138,107,.38);
  --stamp:   #D2453A;
  --clip:    #C9BBA0;
  --line:    #EAE3D6;

  /* 兼容别名:重命名设计变量时,定义改了而引用没改,var() 会**静默失效**
     (不是报错,是样式悄悄不生效)。tools/check_css_vars.py 专门扫这个。 */
  --primary: var(--coral);
  --primary-soft: var(--soft);
  --ink-on: var(--ink);
  --line-strong: #E0D5C2;
  --bg: var(--paper);
  --sub: var(--ink-2);
  --accent: var(--coral);
  --accent-strong: var(--coral);
  --soft: #FFF3EC;
  --ok: var(--green);
  --surface: var(--card);
  --surface-2: #FFFDF8;
  --surface-3: #F4EFE6;

  --sh-1: 0 1px 2px rgba(70,50,20,.07);
  --sh-2: 0 2px 6px rgba(70,50,20,.10);
  --sh-3: 0 3px 11px rgba(70,50,20,.15);

  --r-note: 4px;
  --r-m: 8px;
  --r-l: 12px;
  --r-xl: 16px;
  --r-s: 6px;
  --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --t-xs: 11px; --t-s: 12px; --t-m: 13px; --t-l: 15px; --t-xl: 17px; --t-2xl: 20px;
}
/* 全局按压反馈 + 防误触(低龄孩子点下去要有即时视觉反馈) */
button {
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; transition: transform .1s, box-shadow .1s;
}
button:active { transform: scale(.97); }
/* 面向"注意力困难"儿童的产品,常亮脉冲灯(lampGlow/pigs-pulse 等无限循环动画)
   恰恰是最该能关掉的。系统开了"减少动态效果"就全部停掉。 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
/* 手贴感:每张纸的旋转角都不一样 —— "有控制的随意"是手做的信号,
   机器排版默认永远对齐。角度很小(<=.62deg),不影响阅读。
   只作用于视图区的直接子卡片;嵌套的卡片保持端正。 */
main > section > .card:nth-of-type(3n+1) { transform: rotate(-.55deg); }
main > section > .card:nth-of-type(3n+2) { transform: rotate(.62deg); }
main > section > .card:nth-of-type(3n)   { transform: rotate(-.22deg); }
/* 可展开的家长专区不参与旋转:展开后它能到 8000px 高,
   旋转这么大的元素会让包围盒横向膨胀几十像素,直接把页面撑出横向滚动条。 */
main > section > .card.parent-zone { transform: none; }
@media (hover: hover) {
  .island-card, .level-row, .pg-module, .game { transition: transform .12s, box-shadow .12s; }
  .island-card:hover, .level-row:hover, .pg-module:hover, .game:hover {
    transform: translateY(-1px); box-shadow: 0 4px 14px rgba(120, 80, 20, .12);
  }
}
html, body { height: 100%; }
/* 方格纸底放在 html 上:body 一旦有自己的背景就会向画布传播,
   那样就没法把"桌面"和"应用纸面"分开 ——
   桌面浏览器下整个应用是 480px 窄列浮在宽屏中央,两边全是空格纹,像没做完。 */
html {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink);
  background: var(--paper);
  display: flex; flex-direction: column; max-width: 480px; margin: 0 auto;
  height: 100vh; height: 100dvh; overflow: hidden;
}
/* 宽屏下:应用读作"放在格纹桌面上的一个 App",而不是一条浮着的窄条。手机/平板不触发 */
@media (min-width: 560px) {
  body { box-shadow: 0 0 0 1px rgba(70, 50, 20, .07), 0 26px 70px -30px rgba(70, 50, 20, .3); }
}
/* 主应用容器必须是 flex 列,header/main/tabbar 才能正确布局 */
#view-app { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.hidden { display: none !important; }

/* ============ 顶栏 ============ */
header {
  flex: 0 0 auto; padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  /* 半透明 + 模糊:让方格纸透上来,页眉像"写在纸上"而不是一块色板 */
  background: rgba(253,251,246,.9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px dashed #D6CCB9;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
header .htitle { font-size: var(--t-2xl); font-weight: 900; letter-spacing: -.02em; }
header .hdate { font-size: var(--t-xs); color: var(--ink-2); font-weight: 700; margin-top: 3px; letter-spacing: .04em; }
header .hright { display: flex; align-items: center; gap: 6px; }
.child-chip {
  background: rgba(255,255,255,.9); border: none; border-radius: var(--r-pill); padding: 8px 14px;
  font-size: var(--t-m); font-weight: 800; cursor: pointer; color: var(--ink); min-height: 36px;
  box-shadow: var(--sh-1);
}
.streak-pill { display: inline-flex; align-items: center; gap: 4px; }
.streak-pill svg { display: block; }
.streak-pill {
  background: rgba(255,255,255,.9); border-radius: var(--r-pill); padding: 8px 12px;
  font-size: var(--t-m); font-weight: 800; white-space: nowrap; min-height: 36px;
  box-shadow: var(--sh-1);
}

/* ============ 主区 ============ */
main {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) 96px; min-height: 0;
  /* 卡片有微旋转,视觉包围盒会比布局宽一点点(普通卡片只有 1-3px,落在内边距里)。
     用 clip 而不是 hidden:不新建滚动容器,只是把这点越界裁掉。 */
  overflow-x: clip;
}

.card {
  /* 纸是方的,不是大圆角;阴影很浅(纸贴上去几乎不浮) */
  background: var(--card); border-radius: var(--r-note); padding: 15px 15px 16px; margin-bottom: 14px;
  box-shadow: var(--sh-2);
  position: relative;
}
.card h2 { font-size: var(--t-l); font-weight: 900; letter-spacing: -.01em; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.card .sub { font-size: var(--t-s); color: var(--ink-2); line-height: 1.7; }

.dim-banner {
  border-radius: 5px; padding: 16px; color: #fff; margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.dim-banner .icon { font-size: 34px; }
.dim-banner .txt .d { font-size: 13px; opacity: .9; }
.dim-banner .txt .n { font-size: 20px; font-weight: 800; margin-top: 2px; }

.week-pills { display: flex; gap: 6px; margin: 4px 0 12px; }
.week-pill {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 5px; font-size: 13px; font-weight: 700;
  background: var(--soft); color: var(--sub); border: none; cursor: pointer;
}
.week-pill.active { background: var(--primary); color: var(--ink-on); }

.game { border: 1.5px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 10px; }
.game.primary { border-color: var(--accent); background: #fffdf7; }
.game .ghead { display: flex; align-items: center; justify-content: space-between; }
.game .gname { font-size: 14.5px; font-weight: 800; }
.game .ghead .pill { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--soft); border-radius: 999px; padding: 3px 8px; }
.game .ghow { font-size: 12.5px; color: var(--sub); margin-top: 6px; line-height: 1.6; }
.game .glad { margin-top: 8px; font-size: 12px; }
.game .glad .w { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.game .glad .tag { width: 34px; flex: 0 0 auto; font-size: 11px; color: var(--sub); }
.game .glad .dot { width: 8px; height: 8px; border-radius: 50%; background: #d9cbb3; flex: 0 0 auto; }
.game .glad .w.cur .dot { background: var(--accent); }
.game .glad .w.cur .txt { font-weight: 700; }

/* 计时器 */
.timer-box { text-align: center; padding: 6px 0 2px; }
.timer-time { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.timer-phase { font-size: 14px; font-weight: 800; margin-top: 2px; }
.timer-tip { font-size: 12px; color: var(--sub); margin-top: 4px; line-height: 1.5; }
.timer-bar { height: 8px; background: #f0e2cc; border-radius: 999px; margin: 10px 0; overflow: hidden; }
.timer-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff8a5c); width: 0%; transition: width .3s; }
.timer-phases { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); }
.timer-phases .ph { text-align: center; flex: 1; }
.timer-phases .ph.on { color: var(--accent); font-weight: 800; }
.timer-btns { display: flex; gap: 8px; margin-top: 10px; }
.tbtn { flex: 1; padding: 11px 0; border-radius: var(--r-m); font-size: 15px; font-weight: 900; border: none; cursor: pointer; }
.tbtn.go { background: var(--coral); color: var(--ink); box-shadow: 0 2px 0 var(--coral-d); }
.tbtn.ghost { background: #fff; border: 1.5px solid var(--coral); color: var(--coral-d); }
.tbtn.ghost:active { transform: translateY(1px); }

.check-btn {
  width: 100%; padding: 14px 0; border-radius: 6px; font-size: 16px; font-weight: 800; border: none; cursor: pointer;
  background: var(--green); color: var(--ink); box-shadow: 0 2px 0 var(--green-d);
}
.check-btn.done { background: #EDEAE3; color: var(--ink-2); box-shadow: 0 2px 0 #D8D3C8; }
.check-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--green-d); }

/* 课表 */
/* 课表(竖版):每周一张纸,纸里一天一行。
   原来是 6 列表格 —— 390px 下每格只剩约 50px,长文案断成三行,家长读不了。 */
.sched-list { display: flex; flex-direction: column; gap: 10px; }
.sched-week {
  background: var(--card); border-radius: var(--r-note);
  box-shadow: var(--sh-1); padding: 11px 12px 8px; position: relative;
}
.sched-week .sw-h {
  font-size: 12px; font-weight: 900; color: var(--coral-d);
  letter-spacing: .05em; margin-bottom: 6px;
}
.sched-week .sw-row {
  display: flex; gap: 9px; padding: 6px 0;
  border-bottom: 1px dashed var(--line); font-size: 12.5px; line-height: 1.55;
}
.sched-week .sw-row:last-child { border-bottom: none; }
.sched-week .sw-d { flex: 0 0 34px; color: var(--ink-2); font-weight: 800; }
.sched-week .sw-c { flex: 1; }

/* 错题回顾 */
.wb-list { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.wb-row { background: var(--soft); border-radius: 5px; padding: 8px 10px; }
.wb-q { font-size: 14px; font-weight: 700; line-height: 1.5; }
.wb-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  font-size: 11.5px; color: var(--sub);
}
.wb-meta span:last-of-type { margin-left: auto; }
.wb-del {
  border: none; background: transparent; color: var(--sub); cursor: pointer;
  font-size: 13px; padding: 2px 4px; min-width: 28px; min-height: 28px;
}
.wb-explain { font-size: 12px; color: #6b4d2a; margin-top: 4px; line-height: 1.5; }

/* 话术 */
.talk { margin-bottom: 12px; }
.talk .tt { font-size: 14.5px; font-weight: 800; margin-bottom: 6px; }
.talk li { font-size: 12.5px; color: var(--sub); line-height: 1.7; margin: 4px 0 4px 18px; }
.talk li.bad { color: #c0503c; }

/* 成长记录 */
/* 打卡热力格 → 方格纸上的小格子:打过卡=绿底,今天=珊瑚虚线框 */
.log-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.log-grid .dow { text-align: center; font-size: 11px; color: var(--ink-2); font-weight: 700; padding: 2px 0 4px; }
.log-cell {
  aspect-ratio: 1; border-radius: 3px; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1.2px solid var(--line);
  font-size: 12.5px; font-weight: 800; color: var(--ink-2);
}
.log-cell.done { background: var(--green); border-color: var(--green-d); color: var(--ink); }
.log-cell.today { border: 2px dashed var(--coral); color: var(--coral-d); }
.log-cell.today.done { border-style: solid; }
/* 三个数字块 → 三张便利贴(黄 / 珊瑚浅 / 绿浅),和手上贴的纸是同一种东西 */
.log-stats { display: flex; gap: 9px; margin-bottom: 13px; }
.log-stat {
  flex: 1; text-align: center; border-radius: var(--r-note);
  padding: 11px 4px 9px; box-shadow: var(--sh-1);
  background: #FFF6E2;
}
.log-stat:nth-child(2) { background: #FFF0E9; }
.log-stat:nth-child(3) { background: #EDF7EF; }
.log-stat .v { font-size: 25px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.log-stat .k { font-size: 11px; color: var(--ink-2); font-weight: 700; margin-top: 1px; }
.log-line { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-line .ll-s { color: var(--accent); font-weight: 700; white-space: nowrap; }

/* 底栏 */
nav.tabbar {
  flex: 0 0 auto; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); position: relative;
}
.tab { flex: 1; border: none; background: none; cursor: pointer; padding: 7px 0 5px; text-align: center; color: var(--ink-3); }
.tab .ti { display: block; height: 24px; }
.tab .ti svg { display: block; margin: 0 auto; }
.tab .tl { font-size: 11.5px; font-weight: 800; margin-top: 2px; }
.tab.active { color: var(--coral-d); }
/* 页眉小图标 */
.htitle { display: flex; align-items: center; gap: 6px; }
.logo-ic { display: inline-flex; color: var(--coral-d); }
.child-chip { display: inline-flex; align-items: center; gap: 5px; }
.cc-ic { display: inline-flex; color: var(--coral-d); }

/* 学习游戏 */
.lv-pills { display: flex; gap: 6px; margin: 4px 0 10px; }
.lv-pill { flex: 1; padding: 7px 0; border-radius: 9px; font-size: 12.5px; font-weight: 700; background: var(--soft); color: var(--sub); border: none; cursor: pointer; }
.lv-pill.active { background: var(--primary); color: var(--ink-on); }
.quiz .q { font-size: 15px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.quiz .objs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; font-size: 30px; margin-bottom: 12px; min-height: 42px; line-height: 1; }
.opts, .quiz .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
/* 选项 → 纸答案卡:白底 + 细边 + 浅阴影,答对=绿、答错=红 */
.opt, .quiz .opt {
  padding: 15px 6px; border-radius: var(--r-note); font-size: 20px; font-weight: 900;
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); box-shadow: var(--sh-1); cursor: pointer;
}
.opt:active { transform: translateY(1px); box-shadow: none; }
.opt.right, .quiz .opt.right { background: var(--green); border-color: var(--green-d); }
.opt.wrong, .quiz .opt.wrong { background: #FFE6E0; border-color: #E0907E; }
.quiz .q .spk { border: none; background: #fff2d4; border-radius: 8px; padding: 2px 7px; font-size: 13px; cursor: pointer; vertical-align: middle; margin-left: 3px; }
/* 顶部这条现在只留给**真正的异常**(在线语音不可用 / 没有可朗读的内容)。
   正常朗读的反馈在源头(按钮)和底部的朗读条上,不再弹这条。
   样式也从深色胶囊改成手账的纸片 —— 深色胶囊像调试提示。 */
.tts-toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-200%);
  background: #FFF8EC; color: var(--ink); font-size: 13.5px; font-weight: 700;
  padding: 10px 16px; border-radius: var(--r-note);
  border: 1.5px solid var(--line-strong); border-left: 4px solid var(--coral);
  max-width: 84%; text-align: center; z-index: 99; pointer-events: none;
  opacity: 0; transition: transform .25s, opacity .2s;
  box-shadow: var(--sh-3); line-height: 1.55;
}
.tts-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.quiz .opt.py { font-size: 15px; line-height: 1.5; }
.quiz .opt.right, .opts .opt.right { background: #d9f2dd; border-color: var(--ok); }
.quiz .opt.wrong, .opts .opt.wrong { background: #f8d9d2; border-color: #c0503c; animation: shake .3s; }
.quiz .score { text-align: center; font-size: 13px; color: var(--sub); margin-top: 9px; }
.quiz .corr-hint { text-align: center; font-size: 15px; font-weight: 600; color: #2e7d32; margin-top: 10px; }

/* 拼音「先认一认」学习卡片 */
.learn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.learn-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--soft); border: 1.5px solid var(--line); border-radius: 6px;
  padding: 10px 4px; cursor: pointer; color: var(--ink); font-family: inherit;
}
.learn-item:active { transform: scale(.96); }
.learn-item .li-main { font-size: 22px; font-weight: 800; line-height: 1.1; }
.learn-item .li-sub { font-size: 12px; color: var(--sub); line-height: 1.3; }
.learn-item .li-spk { font-size: 12px; opacity: .6; }

/* 诗词「先读一读」学习卡片 */
.poem-view { margin-top: 10px; }
.poem-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.poem-emoji { font-size: 36px; }
.poem-title { font-size: 20px; font-weight: 800; }
.poem-by { font-size: 12px; color: var(--sub); }
.poem-lines { background: var(--soft); border-radius: 6px; padding: 12px 8px; margin: 0 auto; }
.poem-line { display: flex; justify-content: center; padding: 3px 0; }
.pl-unit { display: flex; flex-direction: column; align-items: center; width: 40px; gap: 1px; }
.pl-char { font-size: 24px; font-weight: 700; line-height: 1.3; }
.pl-py { font-size: 10.5px; color: var(--sub); line-height: 1.1; }
.poem-btns { display: flex; gap: 8px; margin-top: 10px; }
.poem-btns .tbtn { flex: 1; }
.poem-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.poem-nav .tbtn { flex: 0 0 auto; padding: 8px 12px; }
.poem-prog { font-size: 13px; font-weight: 700; color: var(--sub); }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.type-chips { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 8px; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.type-chip { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--soft); color: var(--sub); border: none; cursor: pointer; }
.type-chip.active { background: var(--primary); color: var(--ink-on); }
.quiz .qlbl { text-align: center; font-size: 14px; color: var(--sub); margin-top: 2px; }
.quiz .calc { font-size: 40px; text-align: center; font-weight: 800; margin: 6px 0 12px; letter-spacing: 2px; }
.quiz .two { display: flex; gap: 16px; justify-content: center; align-items: flex-start; margin-bottom: 8px; }
.quiz .two .lbl { text-align: center; font-size: 12px; color: var(--sub); margin-top: 2px; }
.ref-box { background: var(--soft); border-radius: 5px; padding: 9px 11px; margin-top: 7px; font-size: 12.5px; color: var(--ink); line-height: 1.7; }
.ref-box b { color: var(--accent); }

/* 线上游戏 */
.sg-top { text-align: center; font-size: 15px; font-weight: 800; margin: 2px 0 10px; }
.sg-grid { display: grid; gap: 8px; }
.sg-cell { aspect-ratio: 1; border-radius: 6px; font-size: 24px; font-weight: 800; background: var(--soft); color: var(--ink); border: none; cursor: pointer; }
.sg-cell.done { background: #d9f2dd; color: #2f7d40; }
.sg-cell.wrong { background: #f8d9d2; color: #c0503c; animation: shake .3s; }
.sg-cell.found { background: #d9f2dd; color: #2f7d40; }
.mem-info { text-align: center; font-size: 14px; font-weight: 700; margin: 2px 0 10px; }
.mem-grid { display: grid; gap: 8px; }
.mem-card {
  aspect-ratio: 1; border-radius: 6px; font-size: 26px; font-weight: 800;
  background: var(--soft); color: var(--ink); border: none; cursor: pointer;
  /* 承载插画的卡面必须居中：.art-tile 是 display:block,会成为匿名 flex 容器的
     块级子项,默认 flex-start 就贴左了;text-align 对块级子项无效。
     见 .game-tile 的同款处理。 */
  display: flex; align-items: center; justify-content: center;
}
.mem-card.up { background: #eaf4ff; }
.mem-card.matched { background: #d9f2dd; }

/* ============================================================
   游戏画面 · 插画承载（2026-09-15）
   ============================================================
   img/count 那批插画是 RGB **无 alpha** 的纯白底（见 pic-art.js 头部）。
   放在 --soft(#FFF3EC) 上会露出一块更亮的白方块,所以：
   凡是承载插画的格子/卡片正面,一律用 --card 纯白。
   卡背没有图,不受这条约束,保留 --soft 的暖意。 */
.art-tile { object-fit: contain; display: block; max-width: 100%; max-height: 100%; }
.art-fallback { line-height: 1; }

/* 承载插画的游戏格子 */
.game-tile {
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
}

/* 记忆翻牌卡背:低对比斜纹 + 纸的厚度。没有图,所以可以用 --soft */
.mem-card.back {
  background-color: var(--soft);
  background-image: repeating-linear-gradient(
    45deg, rgba(255, 138, 107, .055) 0 6px, transparent 6px 12px);
  box-shadow: inset 0 0 0 1.5px rgba(70, 50, 20, .07);
}
.cb-mark { opacity: .28; }

/* 翻开:白底(承载插画) + 一圈浅蓝读作"已翻开" */
.mem-card.up {
  background: var(--card);
  background-image: none;
  box-shadow: inset 0 0 0 2px rgba(91, 168, 216, .35);
}
/* 配对成功:白底 + 绿圈 + 轻微放大,像被"盖章"确认。
   ⚠️ background 必须显式写 var(--card) —— existing 的 `.mem-card.matched { background:#d9f2dd }`
   在第 396 行,它会生效;绿底压白底图会露白方块,正好违反 spec D2。 */
.mem-card.matched {
  background: var(--card);
  box-shadow: inset 0 0 0 2.5px var(--green-d);
  transform: scale(1.04);
  transition: transform .18s ease;
}

/* 找不同:两张"纸"。
   手账的设计语言写着"允许一点点歪"(--tilt),但格子的对齐不能破坏,
   所以歪的是整张纸,不是单个格子。角度必须极小,且要过 M2 无横向溢出。
   --tilt 在这里定义默认值(0deg),Task 5 用内联 style 覆盖 —— 内联的自定义属性
   优先级高于类规则。**不要写 var(--tilt, 0deg) 就当没定义**:tools/check_css_vars.py
   会把它算成"引用了但没定义"并打警告。 */
.spot-paper {
  --tilt: 0deg;
  background: var(--card);
  border-radius: var(--r-note);
  box-shadow: var(--sh-1);
  padding: 8px;
  transform: rotate(var(--tilt));
}

/* 答错时 spotTap 给格子加 .wrong。它是 (0,2,0),优先级高于 .game-tile (0,1,0),
   红底会压在白底插画后面露白方块。所以承载插画的格子用描边表达"错",不用底色 ——
   与 .mem-card.up / .mem-card.matched 同一个理由。 */
.sg-cell.game-tile.wrong {
  background: var(--card);
  box-shadow: inset 0 0 0 2.5px #c0503c;
}

.game-result { text-align: center; font-size: 15px; font-weight: 800; margin-top: 7px; }
.sg-cell.hint { background: #fff3b8; box-shadow: inset 0 0 0 3px var(--accent); }
.listen-q { text-align: center; font-size: 15px; font-weight: 800; margin: 6px 0 2px; line-height: 1.5; }

/* 报告图表 */
.radar-wrap { display: flex; justify-content: center; margin-top: 6px; }
.line-legend { display: flex; gap: 12px; justify-content: center; font-size: 11.5px; color: var(--sub); margin-top: 6px; }
.ach-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ach-row .aic { font-size: 26px; }
.ach-row .at { flex: 1; font-size: 13.5px; font-weight: 700; }
.ach-row .as { font-size: 11.5px; color: var(--sub); }
.ach-row.unlocked .as { color: var(--accent); }
.tree-wrap { display: flex; justify-content: center; padding: 10px 0 4px; }

/* 弹层 */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(40,30,20,.45); }
.modal-body {
  position: relative; width: 100%; max-width: 480px; background: #fff; border-radius: 6px 6px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(40%); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.child-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; margin-bottom: 8px; background: var(--soft); }
.child-row.active { outline: 2px solid var(--accent); background: #fffdf7; }
.child-row .ca { font-size: 24px; }
.child-row .cn { flex: 1; font-weight: 700; }
.child-add-row { display: flex; gap: 8px; margin-top: 8px; }
.modal-close { width: 100%; margin-top: 10px; padding: 11px 0; border-radius: 6px; font-size: 14px; font-weight: 700; background: var(--soft); color: var(--sub); border: none; cursor: pointer; }

/* 登录 */
/* 登录页 = 手账的封面:一张贴了胶带的纸,灯灯贴在正中 */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--card); border-radius: var(--r-note);
  padding: 30px 24px 22px; text-align: center; position: relative;
  box-shadow: 0 3px 14px rgba(70, 50, 20, .15);
  transform: rotate(-.6deg);
}
.auth-card::before {
  content: ''; position: absolute; left: 50%; top: -11px; width: 84px; height: 22px;
  transform: translateX(-50%) rotate(-3deg);
  background-color: var(--tape);
  background-image: linear-gradient(102deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.10) 45%, rgba(255,255,255,.42) 100%);
  box-shadow: 0 1px 2px rgba(60,40,15,.10);
}
.auth-logo { line-height: 0; }
.auth-logo img {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(70, 50, 20, .22);
}
.auth-title { font-size: 24px; font-weight: 900; letter-spacing: -.02em; margin-top: 14px; }
.auth-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.auth-tabs { display: flex; gap: 8px; margin: 18px 0 14px; }
.auth-tab {
  flex: 1; padding: 10px 0; border-radius: var(--r-note); font-size: 14px; font-weight: 900;
  background: var(--card); color: var(--ink-2); border: 1.5px solid var(--line); cursor: pointer;
}
.auth-tab.active { background: var(--coral); color: var(--ink); border-color: var(--coral-d); }
.auth-input {
  width: 100%; padding: 12px 14px; border-radius: var(--r-note); font-size: 15px;
  border: 1.5px solid var(--line); background: #FFFDF8; margin-bottom: 10px;
}
.auth-input:focus { outline: none; border-color: var(--coral); background: #fff; }
.auth-btn { width: 100%; padding: 13px 0; border-radius: 6px; font-size: 16px; font-weight: 800; background: var(--coral);
  color: var(--ink); border: none; cursor: pointer; box-shadow: 0 2px 0 var(--coral-d); }
.auth-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--coral-d); }
.auth-msg { font-size: 13px; color: #c0503c; min-height: 18px; margin-top: 8px; }
.auth-hint { font-size: 11px; color: var(--sub); margin-top: 10px; }

.btn-link {
  display: block; width: 100%; text-align: center; text-decoration: none;
  padding: 12px 0; border-radius: var(--r-m); font-size: var(--t-l); font-weight: 900;
  background: #fff; border: 1.5px solid var(--coral); color: var(--coral-d);
  box-shadow: var(--sh-1); cursor: pointer; margin-top: 6px;
}
.mine-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; font-weight: 700; }
.mine-item .mi { font-size: 20px; }

/* ============ 成长小镇 ============ */
/* 灯灯语音引导狐狸 */
.town-mascot {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  background: #fff; border-radius: var(--r-note);
  border-left: 4px solid var(--green);
  padding: 10px 14px; cursor: pointer;
  box-shadow: var(--sh-1); transform: rotate(.5deg);
  position: relative;
}
.town-mascot::before {
  content: ''; position: absolute; left: -12px; top: 13px; width: 46px; height: 16px;
  transform: rotate(-44deg); background-color: var(--tape-g);
  background-image: linear-gradient(102deg, rgba(255,255,255,.5) 0%, rgba(255,255,255,.08) 45%, rgba(255,255,255,.4) 100%);
  box-shadow: 0 1px 2px rgba(60,40,15,.08);
}
/* 灯灯:AI 生成的手绘插画(水彩彩铅),做成"圆形贴纸"——
   外面一圈白边 + 轻投影,和手账上贴的贴纸是同一种东西。 */
.town-mascot .mascot-fox {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: block;
  object-fit: cover;
  box-shadow: 0 0 0 2.5px #fff, 0 2px 6px rgba(70, 50, 20, .18);
}
.town-mascot .mascot-bubble { flex: 1; font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.5; }
.town-mascot .mascot-spk { font-size: 14px; opacity: .7; }

.town-hero {
  border-radius: var(--r-note); padding: 16px 16px 15px; margin-bottom: 16px;
  /* 蓝紫渐变不属于这套语言。改成一张黄色便利贴,顶上贴一条胶带 */
  background: var(--sticky); color: var(--ink);
  box-shadow: var(--sh-2);
  position: relative; transform: rotate(-.7deg);
}
.town-hero::before {
  content: ''; position: absolute; left: 50%; top: -10px; width: 82px; height: 20px;
  transform: translateX(-50%) rotate(-3.5deg);
  background-color: var(--tape);
  background-image: linear-gradient(102deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.10) 38%, rgba(255,255,255,.42) 62%, rgba(255,255,255,.06) 100%);
  box-shadow: 0 1px 2px rgba(60,40,15,.10);
  box-shadow: 0 1px 2px rgba(60,40,15,.10);
}
/* 原来这里浮着一个 ☀️ emoji 当装饰,和手账语言冲突。去掉 —— 顶上的胶带本身就是装饰。 */
.town-hero .town-greet { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.town-hero .town-date { font-size: 13px; opacity: .92; margin-top: 3px; }

.town-party {
  background: linear-gradient(160deg, #fff6d6, #ffe6a8);
  border: 1.5px solid #ffc24d; text-align: center;
  font-size: 16px; font-weight: 800; color: #7a5200;
}

.town-task { position: relative; }
.task-head { display: flex; align-items: center; gap: 12px; }
.town-head-click { cursor: pointer; }
.task-label { font-size: 11px; font-weight: 800; color: var(--sub); letter-spacing: .5px; }
.task-title { font-size: 16.5px; font-weight: 800; margin-top: 2px; }
.task-sub { font-size: 12px; color: var(--sub); margin-top: 3px; line-height: 1.55; }
.task-cta { margin-top: 11px; width: 100%; padding: 13px 16px; box-sizing: border-box; }
.task-note {
  margin-top: 10px; display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--ok);
  background: #eef8ef; border-radius: 5px; padding: 8px 11px;
}
#learnCta:disabled { opacity: .75; }

/* 未点亮的灯:以前是没有轮廓的灰球,看着像"样式没写完"。
   给它明确的环 + 浅底,读作"一盏还没点亮的灯",这才是有意的状态。 */
.town-lamp {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
  background: var(--surface-3);
  border: 1.5px solid var(--line-strong);
  box-shadow: inset 0 1px 2px rgba(90, 60, 20, .07);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.town-lamp.on {
  background: radial-gradient(circle at 35% 30%, #FFF8D8, #FFC93D 62%, #F0A41F);
  border-color: #E8A317;
  box-shadow: 0 0 10px 3px rgba(255, 190, 50, .55);
  animation: lampGlow 1.8s ease-in-out infinite;
}

/* 首页 hero 里的今日完成度(替代原来重复显示的日期) */
.town-prog { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.town-prog .tp-n { font-size: var(--t-s); font-weight: 900; color: var(--ink); white-space: nowrap; }
.town-prog .tp-bar { flex: 1; height: 7px; border-radius: 999px; background: rgba(58,50,38,.16); overflow: hidden; }
.town-prog .tp-bar i { display: block; height: 100%; border-radius: 999px; background: var(--coral); transition: width .35s; }
@keyframes lampGlow {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(255,190,50,.55); }
  50% { box-shadow: 0 0 15px 5px rgba(255,190,50,.9); }
}

.timer-wrap { margin-top: 12px; border-top: 1.5px dashed var(--line); padding-top: 12px; }

/* ============ 探索 · 学科岛 + 关卡 ============ */
.island-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 12px; }
/* 7 个学科岛排 3 列会剩 1 个孤零零占一行(原来看起来像"没排完")。
   让最后一个横跨整行 —— 它就成了有意的"宽卡",不是残行。 */
.island-card:last-child { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 10px; padding: 12px; }
.island-card {
  background: var(--card); border-radius: var(--r-note);
  padding: 13px 8px 11px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; position: relative;
  box-shadow: var(--sh-1);
}
/* 手贴感:三张一循环的微旋转 */
.island-card:nth-child(3n+1) { transform: rotate(-.7deg); }
.island-card:nth-child(3n+2) { transform: rotate(.6deg); }
.island-card:nth-child(3n)   { transform: rotate(-.3deg); }
/* 每张纸顶上贴一小段胶带 */
.island-card::before {
  content: ''; position: absolute; left: 50%; top: -7px; width: 34px; height: 13px;
  transform: translateX(-50%) rotate(-4deg);
  background-color: var(--tape);
  background-image: linear-gradient(102deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.10) 45%, rgba(255,255,255,.42) 100%);
}
.island-card:nth-child(3n+1)::before { background-color: var(--tape-b); }
.island-card:nth-child(3n)::before   { background-color: var(--tape-g); }
.island-card.open { box-shadow: var(--sh-2), inset 0 0 0 1.5px var(--coral); }
.island-icon { line-height: 1; display: flex; }
.island-name { font-size: 13.5px; font-weight: 900; }
.island-prog { font-size: 11px; color: var(--ink-2); }

/* 游乐场:游戏模块网格 → 点进单个游戏 */
.pg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.pg-module {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 16px 10px; cursor: pointer; text-align: center; position: relative;
  color: var(--ink); font-family: inherit; box-shadow: var(--sh-1);
}
.pg-module.today { border-color: var(--accent); background: #fffdf7; box-shadow: 0 2px 10px rgba(255,122,60,.14); }
.pg-module:active { transform: scale(.97); }
.pg-icon { display: flex; line-height: 1; }
.pg-name { font-size: 14px; font-weight: 800; }
.pg-sub { font-size: 11px; color: var(--sub); line-height: 1.4; }
.pg-badge {
  font-size: 10.5px; font-weight: 800; color: #5a2f00; margin-top: 3px;
  background: linear-gradient(135deg, #ffc978, #ff9d5c);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.pg-back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pg-back-row .tbtn { flex: 0 0 auto; }
.pg-open-title { font-size: 15px; font-weight: 800; }

/* 首次引导弹层 */
.ob-overlay {
  position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center;
  background: rgba(60, 40, 20, .45); padding: 20px;
}
.ob-card {
  width: 100%; max-width: 340px; background: var(--card); border-radius: var(--r-note);
  padding: 24px 20px 18px; text-align: center; position: relative;
  box-shadow: 0 12px 40px rgba(60, 40, 20, .32);
}
.ob-card::before {
  content: ''; position: absolute; left: 50%; top: -11px; width: 78px; height: 21px;
  transform: translateX(-50%) rotate(-3.5deg);
  background-color: var(--tape);
  background-image: linear-gradient(102deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.10) 45%, rgba(255,255,255,.42) 100%);
}
.ob-card .ob-icon { line-height: 0; margin-bottom: 8px; }
.ob-card .ob-icon img { border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(70,50,20,.2); }
.ob-card h2 { font-size: 19px; font-weight: 800; margin: 6px 0; }
.ob-sub { font-size: 13px; color: var(--sub); line-height: 1.6; margin: 6px 0 12px; }
.ob-card .auth-input { width: 100%; margin: 4px 0 12px; }
.ob-steps { text-align: left; margin: 10px 0 4px; }
.ob-step { display: flex; align-items: center; gap: 10px; padding: 10px; background: #FFF8EC; border-radius: var(--r-note); margin-bottom: 8px; font-size: 13.5px; font-weight: 800; }
.ob-step span { font-size: 17px; }
.ob-btns { display: flex; gap: 10px; margin-top: 12px; }
.ob-btns .tbtn { flex: 1; }

/* 成长页:各学科正确率 + 游戏最佳记录 */
.rate-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.rr-name { flex: 0 0 78px; font-weight: 700; }
.rr-bar { flex: 1; height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.rr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, #ff7a3c); border-radius: 999px; }
.rr-v { flex: 0 0 38px; text-align: right; font-weight: 800; color: var(--ok); }
.game-best-pill {
  font-size: 11.5px; font-weight: 700; color: var(--ink);
  background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

.island-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.island-detail-head .island-icon { font-size: 26px; }
.island-detail-head .island-name { font-size: 16px; font-weight: 800; }
.island-detail-head .island-prog { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--sub); }

.level-list { display: flex; flex-direction: column; gap: 7px; }
/* 家长「手动难度」档位选择(仅手动模式出现) */
.manual-lv { background: var(--soft); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.manual-lv .ml-title { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.level-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--soft); border: 1.5px solid transparent; border-radius: 6px;
  padding: 10px 12px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left;
}
.level-row.locked { color: var(--sub); background: #f3ece0; cursor: default; opacity: .82; }
.level-row .level-name { flex: 1; }
.level-stars { display: inline-flex; gap: 1px; font-size: 13px; letter-spacing: 1px; }
.level-star { opacity: .28; }
.level-star.on { opacity: 1; }
.level-lock { font-size: 15px; }

.quiz-hint { text-align: center; font-size: 12.5px; color: var(--sub); margin-bottom: 8px; }

.level-result { text-align: center; padding: 8px 0 4px; }
.result-stars { font-size: 34px; letter-spacing: 4px; margin-bottom: 4px; }
.result-score { font-size: 14px; font-weight: 800; }
.result-sub { font-size: 12px; color: var(--sub); margin: 3px 0 12px; }
.result-btns { display: flex; gap: 8px; }

/* ============ Task 7: 游乐场 + 家长专区 ============ */
.today-badge {
  display: inline-block; margin-left: 6px; vertical-align: middle;
  font-size: 10.5px; font-weight: 800; color: #5a2f00;
  background: linear-gradient(135deg, #ffc978, #ff9d5c);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(255, 122, 60, .3);
}
.week-summary {
  text-align: center; font-size: 13px; font-weight: 800;
  color: var(--ok); margin-top: 8px;
}

/* 家长专区:折叠面板 */
details.card.parent-zone { padding: 0; overflow: hidden; }
details.card.parent-zone > summary {
  cursor: pointer; padding: 14px; list-style: none;
  font-size: 15px; font-weight: 800;
  display: flex; align-items: baseline; gap: 8px;
}
details.card.parent-zone > summary::-webkit-details-marker { display: none; }
details.card.parent-zone > summary::before {
  content: '▸'; color: var(--accent); transition: transform .2s;
  align-self: center;
}
details.card.parent-zone[open] > summary::before { transform: rotate(90deg); }
.pz-sub { font-size: 11px; color: var(--sub); font-weight: 700; }
.parent-zone .pz-body { padding: 2px 14px 14px; }
.parent-zone .card {
  background: #fdfbf5; border: 1.5px solid var(--line); box-shadow: none;
}

/* ============ 三只小猪(空间推理拼块) ============ */
.pigs-top { text-align: center; font-size: 14px; font-weight: 800; margin-bottom: 4px; line-height: 1.5; }
.pigs-top-sub { display: block; font-size: 11.5px; font-weight: 600; color: var(--sub); }

.pigs-dots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 6px 0 10px; }
.pigs-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line);
  background: #fff; color: var(--sub); font-size: 12px; font-weight: 800; cursor: pointer; padding: 0;
}
.pigs-dot.done { background: #d9f2dd; border-color: var(--ok); color: var(--ok); }
.pigs-dot.cur { background: var(--primary); border-color: var(--primary); color: var(--ink-on); }
.pigs-dot.open { background: var(--soft); }
.pigs-dot.lock { background: #f3ece0; cursor: default; }

.pigs-board {
  position: relative; width: 100%; max-width: 340px; margin: 0 auto;
  /* 浅色底 + 独立绿格:缺角处露出浅底,异形轮廓一目了然 */
  background: #fffdf4;
  border: 3px solid #d8c9a6; border-radius: 6px; touch-action: none; overflow: hidden;
  box-shadow: 0 3px 8px rgba(120, 90, 30, .15);
}
.pigs-cell {
  position: absolute; display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: linear-gradient(160deg, #c9ea9f, #a3d87c);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.65), 0 1px 2px rgba(80, 120, 40, .25);
  border-radius: 8px;
}
.pigs-house { position: absolute; z-index: 2; border-radius: 5px; }
.pigs-house svg { display: block; pointer-events: none; }
.pigs-house.placed { cursor: pointer; pointer-events: auto; box-shadow: 0 3px 7px rgba(60, 40, 10, .28); transition: transform .18s, box-shadow .12s; }
.pigs-house.placed.selected { box-shadow: 0 4px 10px rgba(60, 40, 10, .32), 0 0 0 3px var(--accent); }
.pigs-char { display: block; width: 66%; height: 66%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }
.pigs-ghost { opacity: .72; z-index: 6; pointer-events: none; outline: 2px dashed rgba(0, 0, 0, .3); outline-offset: -3px; box-shadow: none; filter: drop-shadow(0 6px 10px rgba(60, 40, 10, .3)); }
.pigs-ghost.invalid { filter: grayscale(.85); outline: 3px solid #c0503c; }
.pigs-tray-item .pigs-house { z-index: 1; box-shadow: none; }
/* 放下吸附:从缩放弹入目标格 */
.pigs-house.drop-in { animation: pigs-drop-in .22s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pigs-drop-in { 0% { transform: scale(.7); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
/* 拖拽目标格高亮:可行绿闪 / 不可行红框 */
.pigs-cell.valid { box-shadow: inset 0 0 0 3px var(--ok), inset 0 0 0 100px rgba(63, 168, 85, .16); }
.pigs-cell.invalid { box-shadow: inset 0 0 0 3px #c0503c; }
/* 场景装饰(白天/夜晚角标 + 草地小花) */
.pigs-deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; font-size: 17px; }
.pigs-deco .d-sun { position: absolute; right: 7px; top: 5px; font-size: 24px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .15)); }
.pigs-deco .d-moon { position: absolute; right: 7px; top: 5px; font-size: 21px; }
.pigs-deco .d-star { position: absolute; font-size: 11px; }
.pigs-deco .d-star.s1 { left: 9px; top: 7px; }
.pigs-deco .d-star.s2 { left: 47px; top: 3px; }
.pigs-deco .d-flower { position: absolute; left: 8px; bottom: 6px; }
.pigs-deco .d-grass { position: absolute; left: 44px; bottom: 4px; font-size: 14px; }
.pigs-pig-in { position: absolute; z-index: 3; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.pigs-night { position: absolute; inset: 0; z-index: 4; background: rgba(15, 30, 60, .16); pointer-events: none; border-radius: 6px; }
.pigs-hint-target { position: absolute; z-index: 5; background: rgba(255, 215, 90, .55); border: 2px dashed #e8a100; border-radius: 8px; animation: pigs-pulse .7s ease-in-out infinite alternate; pointer-events: none; }
@keyframes pigs-pulse { from { opacity: .5; } to { opacity: 1; } }
/* 过关庆祝:房子跳动闪光 + 棋盘晕轮 + 星星雨 + 结果弹入 */
.pigs-celebrate { animation: pigs-board-glow .5s ease-in-out 3; }
@keyframes pigs-board-glow { 50% { box-shadow: 0 0 0 5px rgba(255, 215, 90, .8), 0 0 26px rgba(255, 215, 90, .55); } }
.pigs-celebrate .pigs-house.placed { animation: pigs-flash .45s ease-in-out 3; }
@keyframes pigs-flash { 50% { filter: brightness(1.6) drop-shadow(0 0 12px rgba(255, 215, 90, 1)); transform: scale(1.06); } }
.pigs-result { position: relative; }
.pigs-confetti { position: absolute; left: 0; right: 0; top: -6px; height: 0; pointer-events: none; }
.pigs-confetti span { position: absolute; font-size: 20px; opacity: 0; animation: pigs-confetti-up .9s ease-out forwards; }
@keyframes pigs-confetti-up {
  0% { transform: translateY(6px) scale(.4); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-52px) scale(1.25); opacity: 0; }
}
.pigs-win { animation: pigs-win-pop .55s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pigs-win-pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }

.pigs-msg { min-height: 20px; text-align: center; font-size: 13px; font-weight: 700; color: #c0503c; margin: 7px 0 2px; }
.pigs-controls { display: flex; gap: 8px; max-width: 340px; margin: 6px auto 0; }
.pigs-controls .tbtn { flex: 1; padding: 9px 0; font-size: 13.5px; }
.pigs-tray { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 10px; min-height: 64px; }
.pigs-tray-item { position: relative; background: #fffdf8; border: 1.5px solid var(--line); border-radius: 6px; touch-action: none; cursor: grab; transition: transform .1s; }
.pigs-tray-item:active { cursor: grabbing; transform: scale(.94); }
.pigs-tray-item .pigs-house { z-index: 1; }
.pigs-tray-item svg { width: 100%; height: 100%; display: block; }

.pigs-result { text-align: center; margin-top: 12px; }
.pigs-win { font-size: 22px; font-weight: 800; margin-bottom: 10px; }

/* 三只小猪:房子上的旋转按钮 */
.pigs-rotate {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  border-radius: 50%; border: 2.5px solid #fff;
  background: var(--primary); color: var(--ink-on);
  font-size: 20px; font-weight: 900; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3); z-index: 8; pointer-events: auto;
  animation: pigs-pulse .8s ease-in-out infinite alternate;
}

/* ============================================================
   手账元素工具箱
   ============================================================ */
/* 荧光笔划线 —— 标题的那道黄底 */
.hl, .hl-b { background: linear-gradient(transparent 58%, var(--sticky) 58%); }

/* 胶带:半透明 + 双向斜纹,像真的胶带纸 */
.tape {
  position: absolute; width: 68px; height: 19px; z-index: 3;
  /* 原来用 repeating-linear-gradient 做条纹,压在同色底上会变成一排竖条(像梳子)。
     胶带的真实感来自"半透明 + 一道柔和的斜向反光 + 边缘略深",不是条纹。 */
  background-color: var(--tape);
  background-image: linear-gradient(102deg,
    rgba(255,255,255,.55) 0%, rgba(255,255,255,.10) 38%,
    rgba(255,255,255,.42) 62%, rgba(255,255,255,.06) 100%);
  box-shadow: 0 1px 2px rgba(60,40,15,.10), inset 0 0 0 .5px rgba(255,255,255,.35);
  pointer-events: none;
}
.tape.top { left: 50%; top: -10px; transform: translateX(-50%) rotate(-3.5deg); }
.tape.tl  { left: -14px; top: 12px; transform: rotate(-42deg); }
.tape.tr  { right: -14px; top: 12px; transform: rotate(42deg); }
.tape.blue { --tape: var(--tape-b); }
.tape.green { --tape: var(--tape-g); }
.tape.coral { --tape: var(--tape-p); }

/* 印章:圆形墨章,盖在完成项上 */
.stamp {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto;
  border: 2.5px solid var(--stamp); color: var(--stamp);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; letter-spacing: .04em;
  transform: rotate(-14deg); opacity: .78;
}

/* 长尾夹装饰 */
.clip-deco {
  position: absolute; right: 16px; top: 12px; width: 28px; height: 38px;
  border: 3px solid var(--clip); border-radius: 4px 4px 6px 6px; border-top: none;
  pointer-events: none;
}
.clip-deco::before {
  content: ''; position: absolute; left: 50%; top: 3px; width: 3px; height: 20px;
  background: var(--clip); transform: translateX(-50%); border-radius: 2px;
}

/* 便签纸的左侧色条 */
.note-bar { border-left: 4px solid var(--coral); }
.note-bar.blue { border-left-color: var(--blue); }
.note-bar.green { border-left-color: var(--green); }

/* 方格纸上的虚线分隔(手账里常见的撕线) */
.perf { border-top: 1.5px dashed #D6CCB9; margin: 14px 0; }
/* 自绘星的两种状态:拿到=金黄,没拿到=浅灰描边 */
.level-star { display: inline-flex; }
/* 自绘星的两种状态。用通用选择器:星级既出现在关卡列表,也出现在游戏结果行里 */
svg.st-on { color: #E0A11C; }
svg.st-off { color: var(--ink-3); opacity: .45; }
.sg-top svg, .game-result svg { vertical-align: -2px; }
/* 答题进行中:收起关卡列表,把题目顶到最上面 */
.island-detail.quiz-live .level-list { display: none; }
.island-detail.quiz-live .manual-lv { display: none; }
.quiz-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.quiz-head .qh-t { font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; }
.quiz .corr-hint { color: #2E7D46; }

/* ============================================================
   语音交互
   ============================================================ */
/* 题面插图:来自成套蜡笔插图的真图,取代 emoji */
.word-pic {
  width: 120px; height: auto; display: block; margin: 0 auto;
  border-radius: var(--r-note);
}

/* 朗读时,源头按钮进入"正在读"态:换成珊瑚底 + 一圈向外扩的呼吸光环。
   反馈就在手边,不用抬头看屏幕顶部。 */
.spk { position: relative; transition: background .15s, color .15s; }
.spk.speaking {
  background: var(--coral); color: var(--ink);
  box-shadow: 0 0 0 2px var(--coral-d) inset;
}
.spk.speaking::after {
  content: ''; position: absolute; inset: -3px; border-radius: inherit;
  border: 2px solid var(--coral); pointer-events: none;
  animation: spkHalo 1.15s ease-out infinite;
}
@keyframes spkHalo {
  0%   { transform: scale(.92); opacity: .8; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* 底部朗读条:只在朗读时出现,是唯一需要"停止"动作的地方 */
.speak-bar {
  position: fixed; left: 50%; z-index: 98;
  bottom: calc(74px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 14px;
  background: var(--card); border-radius: var(--r-pill);
  box-shadow: var(--sh-3);
  font-size: 12.5px; font-weight: 800; color: var(--ink-2);
  transform: translateX(-50%) translateY(150%);
  opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.2,.9,.3,1), opacity .18s;
}
.speak-bar.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.sb-wave { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 15px; }
.sb-wave i {
  width: 3px; border-radius: 2px; background: var(--coral);
  animation: sbWave .86s ease-in-out infinite;
}
.sb-wave i:nth-child(1) { animation-delay: 0s; }
.sb-wave i:nth-child(2) { animation-delay: .12s; }
.sb-wave i:nth-child(3) { animation-delay: .24s; }
.sb-wave i:nth-child(4) { animation-delay: .36s; }
.sb-wave i:nth-child(5) { animation-delay: .48s; }
@keyframes sbWave { 0%, 100% { height: 4px; } 50% { height: 15px; } }
.sb-stop {
  border: none; cursor: pointer; border-radius: var(--r-pill);
  padding: 6px 13px; font-size: 12px; font-weight: 900;
  background: var(--coral); color: var(--ink);
}
.sb-stop:active { transform: translateY(1px); }

/* 计数题面:插画版。
   间距要均匀、物件要够大 —— 数数的前提是"一眼扫得清几个"。 */
.count-objs { gap: 5px; flex-wrap: wrap; row-gap: 6px; }
.count-obj { width: 38px; height: 38px; object-fit: contain; display: block; }
/* 比多少是左右两栏并排,物件要更小才放得下 */
.two .count-obj { width: 30px; height: 30px; }

/* ============================================================
   返回类按钮 + 答题页减负(按评审意见)
   ============================================================ */
/* 退出是低频操作,不该有最高视觉权重 —— 原来是珊瑚色描边(品牌色),
   孩子容易被它吸引着点出去,做完的题就白做了。改中性灰细线。 */
.back-btn {
  flex: 0 0 auto; background: #fff; border: 1.5px solid var(--line);
  color: var(--ink-2); font-size: 12.5px; font-weight: 800;
  padding: 7px 13px; border-radius: var(--r-pill); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.back-btn:active { transform: translateY(1px); }

/* 答题进行中:把规则说明和外层返回行收起来 ——
   那段规则是后台逻辑(满2星解锁…),孩子看不懂,却占着屏幕最上面;
   真正该占屏幕的是题目。外层返回行也收掉:它和答题头里的「← 关卡」
   同时存在会让人分不清点了去哪。 */
.quiz-mode .explore-intro,
.quiz-mode .pg-back-row,
/* 做题时也不需要"已通关 8/13 关" —— 那是家长看的进度,孩子在答题 */
.quiz-mode .island-prog { display: none; }

/* ============================================================
   专注游玩:进游戏/答题时把外壳收起来,屏幕让给孩子
   ============================================================
   与上面的 .quiz-mode 是同一个思路,只是往上提了一层 ——
   那个收的是**视图内部**(规则说明、外层返回行、家长看的进度),
   这个收的是**外壳**(顶栏、底栏)。

   为什么值得收底栏:它是常驻的"误触出口"。孩子正玩到一半点一下就跑掉了,
   做完的题也白做了 —— 答题页为此专门把退出按钮从珊瑚色降成中性灰细线
   (见 .back-btn 的注释),同一个道理再往前一步。

   退出仍然给:每个游戏/答题头部都有 .back-btn(已经是降权过的中性灰细线)。
   完成前不给出口是错的 —— 孩子卡住或不想玩时会被困住,家长也没法把他弄出来。 */
#view-app.play-mode > header,
#view-app.play-mode > nav.tabbar { display: none; }

/* 游乐场那张介绍卡(标题+说明+「打开记忆小灯塔」按钮)也收掉 ——
   进了游戏还留着它,游戏就还是只占半屏,等于没收。与 .quiz-mode 收 .explore-intro 同理。 */
#view-app.play-mode .pg-intro { display: none; }

/* main 底部那 96px 内边距是给底栏留的,底栏没了就该还回来,否则底下空一道 */
#view-app.play-mode > main {
  padding-bottom: var(--sp-4);
  /* 内容比屏幕短时(记忆翻牌这种格子少的)让它垂直居中,否则全堆在顶部、下面一片空白。
     用 margin-block:auto 而不是 justify-content:center —— 内容超屏时 auto 退化成 0、
     正常滚动,而 justify-content:center 会把顶部裁掉(找不同那种长内容就会中招)。 */
  display: flex; flex-direction: column;
}
#view-app.play-mode > main > section:not(.hidden) { margin-block: auto; }

/* 朗读条是 position:fixed、按底栏高度(74px)算的 —— 底栏没了它会悬在半空。
   听词拍手会用 TTS,这条会真的显形。 */
#view-app.play-mode .speak-bar { bottom: calc(12px + env(safe-area-inset-bottom)); }
