/* =============================================================
   小小科学家实验室 · 设计系统 theme.css
   风格关键词：真实自然 / 亲切柔和 / 纸质绘本 / 圆润有机
   移动优先：320px 起步 → 576 → 768 → 992 → 1200
   ============================================================= */

/* ---------- 1. 设计令牌 Design Tokens ---------- */
:root {
  /* 纸感底色（暖白，避免纯白刺眼） */
  --paper:        #FBF6EE;
  --paper-deep:   #F3EADB;
  --card:         #FFFFFF;
  --card-soft:    #FFFDF8;

  /* 文字：暖棕而非纯黑，柔和不生硬（对比度均 ≥ 4.5:1） */
  --ink:          #4A3B2F;  /* 主文 12.0:1 */
  --ink-2:        #6B5B4C;  /* 次文  6.9:1 */
  --ink-3:        #7A6857;  /* 辅助  5.3:1 */

  /* 主色 森林绿 50→700 */
  --brand-50:  #EEF6EF;
  --brand-100: #DDEFE0;
  --brand-300: #A6CFAE;
  --brand-500: #5C9A6B;
  --brand-600: #3F7A50;  /* 承载白字 5.1:1 */
  --brand-700: #2F5E3D;

  /* 语义色 */
  --sky:        #7FB3D5;  /* 天空／水 */
  --sky-deep:   #4E8BB3;
  --sun:        #F0B357;  /* 暖阳橙（装饰／填充） */
  --amber-600:  #966A22;  /* 提示按钮底（白字 4.8:1） */
  --soil:       #A0785A;  /* 土壤棕 */
  --soil-deep:  #7A5638;
  --coral:      #E08A7A;  /* 花蕊粉珊瑚 */
  --coral-600:  #A9522F;  /* 强调／重置按钮（白字 5.3:1） */
  --violet:     #A78BCA;
  --leaf:       #7FB069;

  --ok:   #3F7A50;
  --warn: #966A22;
  --err:  #A9522F;

  /* 圆角（有机形态） */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* 间距：8px 基线 */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* 字体刻度（儿童向整体上调 1 级） */
  --f-caption: 12px;
  --f-xs:      14px;
  --f-sm:      16px;   /* 手机正文 */
  --f-base:   17px;   /* 桌面正文 */
  --f-md:     19px;
  --f-lg:     22px;
  --f-xl:     26px;
  --f-2xl:    32px;

  /* 柔和暖调阴影（不用灰黑，避免脏） */
  --sh-1: 0 2px 6px rgba(122, 86, 56, .08), 0 1px 2px rgba(122, 86, 56, .06);
  --sh-2: 0 6px 16px rgba(122, 86, 56, .10), 0 2px 6px rgba(122, 86, 56, .06);
  --sh-3: 0 14px 32px rgba(122, 86, 56, .14), 0 4px 10px rgba(122, 86, 56, .07);
  --sh-in: inset 0 1px 0 rgba(255, 255, 255, .85);

  /* 动效 */
  --ease-bounce: cubic-bezier(.34, 1.42, .64, 1);
  --ease-soft:   cubic-bezier(.4, 0, .2, 1);
  --t-fast: .18s;
  --t-base: .26s;

  /* 舞台（实验窗）高度 */
  --stage-h: 300px;
}

/* ---------- 2. 基础重置与纸感肌理 ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Baloo 2', 'PingFang SC', 'HarmonyOS Sans SC',
               'Hiragino Sans GB', 'Microsoft YaHei UI',
               'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  font-size: var(--f-sm);
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  /* 极淡纸纹 + 顶部天光，营造真实纸面 */
  background-image:
    radial-gradient(1200px 520px at 50% -12%, #FFFDF7 0%, rgba(255,253,247,0) 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.035'/></svg>");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.35; letter-spacing: .01em; }
p { margin: 0; }
button { font-family: inherit; font-size: inherit; }

/* 键盘焦点：醒目暖环，符合 WCAG 2.2 焦点可见 */
:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 3. 页面骨架（移动优先：单列） ---------- */
.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-3) var(--s-3) var(--s-6);
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0 var(--s-4);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
  font-size: var(--f-xl);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title h1 .emoji-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  font-size: 19px; border-radius: 12px;
  background: var(--brand-100);
  box-shadow: var(--sh-in);
}
.topbar-title .subtitle {
  font-size: var(--f-caption);
  color: var(--ink-3);
  margin-top: 2px;
}
.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px;   /* ≥44px 触摸目标 */
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 14px;
  background: var(--card);
  color: var(--ink-2);
  box-shadow: var(--sh-1);
  cursor: pointer;
  font-size: 18px; text-decoration: none;
  transition: transform var(--t-fast) var(--ease-bounce),
              box-shadow var(--t-fast) var(--ease-soft), background var(--t-fast);
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--sh-2); background: var(--brand-50); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-pressed="true"] { background: var(--brand-100); color: var(--brand-700); }

/* 主布局：手机单列 */
.layout { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }

/* ---------- 4. 实验舞台（"真实"质感画框） ---------- */
.stage-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  box-shadow: var(--sh-2), var(--sh-in);
}
.stage {
  position: relative;
  width: 100%;
  height: var(--stage-h);
  border-radius: var(--r-md);
  overflow: hidden;
  /* 柔和天光渐变，像一扇望向自然的窗 */
  background: linear-gradient(180deg, #DCEDF7 0%, #EEF6F1 55%, #F6F1E4 100%);
  box-shadow: inset 0 2px 10px rgba(90, 110, 90, .13),
              inset 0 -14px 24px rgba(160, 120, 90, .07);
  touch-action: manipulation;
}
/* 画布独占触摸手势，保证移动端拖拽不被页面滚动打断 */
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
/* 画框暗角，增强纵深感 */
.stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 40px rgba(80, 70, 55, .10);
}
.stage-hint {
  position: absolute; left: 10px; bottom: 8px;
  font-size: var(--f-caption); color: var(--ink-3);
  background: rgba(255, 253, 248, .82);
  padding: 2px 10px; border-radius: var(--r-pill);
  pointer-events: none;
}
/* 深色舞台（星空、夜景等场景）：不用纯黑，保持柔和 */
.stage.dark {
  background: linear-gradient(180deg, #1B2340 0%, #2A3350 52%, #3E4A6B 100%);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, .34),
              inset 0 -16px 26px rgba(0, 0, 0, .26);
}
.stage.dark::after { box-shadow: inset 0 0 46px rgba(8, 12, 28, .34); }
.stage.dark .stage-hint {
  background: rgba(26, 32, 54, .72);
  color: #DDE4F5;
}
.stage.dark + .readout .pill {
  background: #27304E; border-color: #3A456B; color: #DDE4F5;
}
.stage.dark + .readout .pill b { color: #BFE0F1; }

/* 数据读数条 */
.readout {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  margin-top: var(--s-3);
}
.pill {
  display: inline-flex; align-items: baseline; gap: 4px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-size: var(--f-caption);
  white-space: nowrap;
}
.pill b {
  font-size: var(--f-xs);
  color: var(--brand-700);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pill.warm { background: #FDF1E3; border-color: #F6E0C2; }
.pill.warm b { color: var(--amber-600); }
.pill.sky { background: #E6F1F8; border-color: #C8E0EF; }
.pill.sky b { color: var(--sky-deep); }
.pill.violet { background: #F0E9F7; border-color: #DDD0EE; }
.pill.violet b { color: #7A5FA0; }

/* ---------- 5. 卡片 ---------- */
.panel { display: grid; gap: var(--s-4); align-content: start; }
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  box-shadow: var(--sh-2), var(--sh-in);
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--f-md); color: var(--ink);
  margin-bottom: var(--s-3);
}
.card-title .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-500); flex: 0 0 10px;
  box-shadow: 0 0 0 4px var(--brand-50);
}
.card-title .dot.amber { background: var(--sun); box-shadow: 0 0 0 4px #FDF1E3; }
.card-title .dot.sky   { background: var(--sky-deep); box-shadow: 0 0 0 4px #E6F1F8; }

/* ---------- 6. 控件：滑块（大圆头、彩色轨道） ---------- */
.ctrl { margin-bottom: var(--s-4); }
.ctrl:last-child { margin-bottom: 0; }
.ctrl-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-2);
  font-size: var(--f-xs);
  color: var(--ink-2);
  margin-bottom: 8px;
}
.ctrl-head .val {
  font-weight: 800; color: var(--brand-700);
  font-variant-numeric: tabular-nums;
  background: var(--brand-50);
  padding: 1px 10px; border-radius: var(--r-pill);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px;              /* 加大触摸区 */
  background: transparent; cursor: pointer; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-300), var(--brand-500));
  box-shadow: inset 0 1px 2px rgba(90, 70, 50, .18);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -8px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 4px solid var(--brand-600);
  box-shadow: 0 2px 6px rgba(90, 70, 50, .28);
  transition: transform var(--t-fast) var(--ease-bounce);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(.94); }
input[type="range"]::-moz-range-track {
  height: 10px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-300), var(--brand-500));
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #FFFFFF; border: 4px solid var(--brand-600);
  box-shadow: 0 2px 6px rgba(90, 70, 50, .28);
}
input[type="range"].warm::-webkit-slider-runnable-track { background: linear-gradient(90deg, #F6D9A8, var(--sun)); }
input[type="range"].warm::-webkit-slider-thumb { border-color: var(--amber-600); }
input[type="range"].warm::-moz-range-track { background: linear-gradient(90deg, #F6D9A8, var(--sun)); }
input[type="range"].warm::-moz-range-thumb { border-color: var(--amber-600); }
input[type="range"].sky::-webkit-slider-runnable-track { background: linear-gradient(90deg, #BFE0F1, var(--sky-deep)); }
input[type="range"].sky::-webkit-slider-thumb { border-color: var(--sky-deep); }
input[type="range"].sky::-moz-range-track { background: linear-gradient(90deg, #BFE0F1, var(--sky-deep)); }
input[type="range"].sky::-moz-range-thumb { border-color: var(--sky-deep); }

/* 按钮 */
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.btn {
  flex: 1 1 96px;
  min-height: 46px;                        /* 触摸友好 */
  padding: 10px 18px;
  border: none; border-radius: var(--r-pill);
  font-size: var(--f-sm); font-weight: 800;
  color: #FFFFFF;
  background: var(--brand-600);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .10), var(--sh-1);
  transition: transform var(--t-fast) var(--ease-bounce),
              box-shadow var(--t-fast) var(--ease-soft), filter var(--t-fast);
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 5px 0 rgba(0,0,0,.10), var(--sh-2); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.97); box-shadow: 0 1px 0 rgba(0,0,0,.10); }
.btn:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }
.btn-amber { background: var(--amber-600); }
.btn-coral { background: var(--coral-600); }
.btn-sky   { background: var(--sky-deep); }
.btn-ghost {
  background: var(--paper-deep); color: var(--ink-2);
  box-shadow: inset 0 0 0 2px rgba(122, 86, 56, .16);
}

/* 分段选择（Segmented） */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--paper-deep);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 3px rgba(122, 86, 56, .12);
}
.seg button {
  flex: 1 1 auto; min-width: 0; min-height: 38px;
  padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: none; background: transparent;
  border-radius: var(--r-pill);
  font-size: var(--f-xs); font-weight: 700; color: var(--ink-2);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-soft);
}
/* 选项多到一行放不下时自动换行（默认横向压缩，加 .wrap 改为网格铺满） */
.seg.wrap { flex-wrap: wrap; border-radius: var(--r-md); }
.seg.wrap button { flex: 1 1 40%; }
.seg button[aria-pressed="true"] {
  background: var(--card); color: var(--brand-700);
  box-shadow: var(--sh-1);
}

/* 开关 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); padding: 6px 0;
}
.switch-row label { font-size: var(--f-xs); color: var(--ink-2); }
.switch {
  position: relative; width: 54px; height: 30px; flex: 0 0 54px;
  border: none; border-radius: var(--r-pill);
  background: #DFD3C3; cursor: pointer;
  transition: background var(--t-base) var(--ease-soft);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(90, 70, 50, .3);
  transition: transform var(--t-base) var(--ease-bounce);
}
.switch[aria-pressed="true"] { background: var(--brand-500); }
.switch[aria-pressed="true"]::after { transform: translateX(24px); }

/* ---------- 7. 知识小窗 ---------- */
.note { background: var(--card-soft); }
.note p { font-size: var(--f-xs); color: var(--ink-2); }
.note p + p { margin-top: 10px; }
.note .highlight {
  background: linear-gradient(transparent 62%, #FAE7C4 62%);
  font-weight: 700; color: var(--ink);
}
.formula {
  display: block; text-align: center;
  margin: 12px 0; padding: 12px;
  background: var(--brand-50);
  border-radius: var(--r-md);
  font-size: var(--f-md); font-weight: 800; color: var(--brand-700);
  font-style: italic;
  border: 1px dashed var(--brand-300);
}
.tip {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: var(--s-3); padding: 10px 14px;
  background: #FDF1E3; border-radius: var(--r-md);
  font-size: var(--f-caption); color: var(--amber-600);
  border-left: 4px solid var(--sun);
}
.tip::before { content: '💡'; font-size: 15px; line-height: 1.5; }

/* ---------- 8. 小挑战 Quiz ---------- */
.quiz .q { font-size: var(--f-sm); font-weight: 700; margin-bottom: var(--s-3); }
.opts { display: grid; gap: 10px; }
.opt {
  text-align: left;
  min-height: 46px; padding: 10px 16px;
  border: 2px solid rgba(122, 86, 56, .16);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink); font-size: var(--f-xs); font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-bounce), border-color var(--t-fast), background var(--t-fast);
}
.opt:hover { transform: translateX(3px); border-color: var(--brand-300); background: var(--brand-50); }
.opt:active { transform: scale(.98); }
.opt.correct { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700); }
.opt.wrong   { background: #FBEAE4; border-color: var(--coral); color: var(--coral-600); }
.opt:disabled { cursor: default; }
.opt.correct:hover, .opt.wrong:hover { transform: none; }
.feedback {
  margin-top: var(--s-3); font-size: var(--f-xs);
  min-height: 22px; font-weight: 700;
}
.feedback.ok   { color: var(--ok); }
.feedback.no   { color: var(--err); }

/* 星级奖励 */
.stars { display: flex; gap: 4px; margin-top: 10px; }
.stars span {
  font-size: 20px; filter: grayscale(1) opacity(.35);
  transition: transform var(--t-base) var(--ease-bounce), filter var(--t-base);
}
.stars span.on { filter: none; transform: scale(1.18); }

/* ---------- 8.5 课时导航 ---------- */
.lesson-nav {
  display: flex; gap: var(--s-2);
  background: var(--card);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  box-shadow: var(--sh-1), var(--sh-in);
}
.lesson-nav a {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 12px;
  border-radius: var(--r-pill);
  background: var(--paper-deep);
  color: var(--ink-2);
  font-size: var(--f-xs); font-weight: 700; text-decoration: none;
  box-shadow: inset 0 0 0 2px rgba(122, 86, 56, .14);
  transition: transform var(--t-fast) var(--ease-bounce), background var(--t-fast), color var(--t-fast);
}
.lesson-nav a:hover { transform: translateY(-2px); background: var(--brand-50); color: var(--brand-700); }
.lesson-nav a:active { transform: scale(.97); }
.lesson-nav a.placeholder { opacity: .4; pointer-events: none; }

/* ---------- 8.6 关闭本页 ---------- */
/* 顶栏的紧凑关闭图标：浅珊瑚底 + 深珊瑚字形，6.4:1，不靠颜色单独传达语义 */
.icon-btn.close-btn { background: #FDEDE8; color: var(--coral-600); }
.icon-btn.close-btn:hover {
  background: #F9DAD1; color: #8E4325;
  transform: translateY(-2px); box-shadow: var(--sh-2);
}
.icon-btn.close-btn:active { transform: scale(.94); }
.icon-btn.close-btn svg { width: 19px; height: 19px; fill: currentColor; display: block; }

/* 关闭时的柔和淡出：整页缓缓隐去，给孩子一个明确的「回家」过渡（仅非 reduced-motion 时启用） */
body.closing { transition: opacity .34s ease; opacity: 0; }

/* 课时导航下方的全宽关闭按钮 */
.close-bar { margin-top: var(--s-3); }
.btn-close {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 16px;
  border: 2px solid #F2D3C7;
  border-radius: var(--r-pill);
  background: #FDEDE8;
  color: var(--coral-600);
  font-family: inherit; font-size: var(--f-xs); font-weight: 800;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-bounce),
              background var(--t-fast), box-shadow var(--t-fast);
}
.btn-close:hover { transform: translateY(-2px); background: #F9DAD1; box-shadow: var(--sh-1); }
.btn-close:active { transform: scale(.97); }
.btn-close svg { width: 18px; height: 18px; fill: currentColor; flex: 0 0 18px; }

/* ---------- 9. 反馈层：Toast / 徽章 ---------- */
#lab-toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 12px 22px; border-radius: var(--r-pill);
  background: rgba(74, 59, 47, .94); color: #FFF8EC;
  font-size: var(--f-xs); font-weight: 700;
  box-shadow: var(--sh-3);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease-soft), transform var(--t-base) var(--ease-bounce);
  z-index: 90; max-width: 86vw; text-align: center;
}
#lab-toast.show { opacity: 1; transform: translate(-50%, 0); }

#lab-confetti {
  position: fixed; inset: 0; pointer-events: none; z-index: 80;
}

/* ---------- 10. 响应式断点 ---------- */
/* ≥576px 大屏手机：正文与舞台放大 */
@media (min-width: 576px) {
  :root { --stage-h: 320px; --f-sm: 17px; }
  .topbar-title h1 { font-size: 28px; }
}

/* ≥768px 平板：舞台在上、控制在下的双列 */
@media (min-width: 768px) {
  :root { --stage-h: 380px; --f-base: 18px; }
  .app { padding: var(--s-4) var(--s-5) var(--s-7); }
  .layout { grid-template-columns: 1fr 1fr; gap: var(--s-5); align-items: start; }
  .stage-card { position: sticky; top: var(--s-4); }
}

/* ≥992px 笔记本：左舞台（宽）＋ 右控制（窄） */
@media (min-width: 992px) {
  :root { --stage-h: 460px; }
  .layout { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr); }
}

/* ≥1200px 桌面 */
@media (min-width: 1200px) {
  :root { --stage-h: 520px; --f-xl: 30px; }
  .app { padding: var(--s-5) var(--s-6) var(--s-7); }
  .layout { gap: var(--s-6); }
}

/* 横屏矮屏：压缩舞台，保证一屏可见 */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --stage-h: 200px; }
}

/* ---------- 10.5 首页目录 ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFFCF4 55%, #F3F8F1 100%);
  border-radius: var(--r-xl);
  padding: var(--s-4) var(--s-4);
  box-shadow: var(--sh-2), var(--sh-in);
  text-align: center;
  margin-bottom: var(--s-4);
}
.hero h1 { font-size: var(--f-xl); color: var(--ink); margin-bottom: 6px; }
.hero h1 .emoji-badge { width: 38px; height: 38px; flex: 0 0 38px; font-size: 22px; border-radius: 14px; }
.hero p { font-size: var(--f-xs); color: var(--ink-2); max-width: 46em; margin: 0 auto; }
.hero .stat-row {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--s-2); margin-top: var(--s-3);
}

/* 首页 hero 的温柔童话底景：暖阳光晕 + 缓缓飘动的云。纯装饰，不挡交互、不载语义 */
.hero > *:not(.scene) { position: relative; z-index: 1; }
.hero .scene {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.hero .sun {
  position: absolute; top: -34px; right: 22px;
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle, #FFE7A8 0%, #FFD27A 58%, rgba(255,210,122,0) 72%);
  filter: blur(2px);
}
.hero .cloud {
  position: absolute; background: #fff; border-radius: 40px;
  filter: blur(.5px); box-shadow: 0 10px 30px rgba(110,130,150,.10);
}
.hero .cloud::before, .hero .cloud::after {
  content: ''; position: absolute; background: #fff; border-radius: 50%;
}
.hero .cloud::before { width: 60px; height: 60px; top: -22px; left: 16px; }
.hero .cloud::after  { width: 44px; height: 44px; top: -14px; left: 60px; }
.hero .cloud-a { width: 120px; height: 40px; top: 16px;  left: 7%;  animation: drift 15s ease-in-out infinite alternate; }
.hero .cloud-b { width: 104px; height: 36px; top: 60px;  left: 60%; animation: drift 19s ease-in-out infinite alternate-reverse; }
.hero .cloud-c { width: 84px;  height: 30px; top: 8px;   left: 38%; opacity: .85; animation: drift 23s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(46px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero .cloud { animation: none; }
}

.filters {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  justify-content: center; margin-bottom: var(--s-5);
}
.filters .seg { width: 100%; max-width: 520px; }
.filters .seg button { min-height: 42px; font-size: var(--f-sm); }
.search-wrap { width: 100%; max-width: 520px; margin: var(--s-3) auto 0; }
.search-wrap input {
  width: 100%; min-height: 46px;
  padding: 10px 18px;
  border: 2px solid rgba(122, 86, 56, .16);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--ink);
  font-family: inherit; font-size: var(--f-sm);
  box-shadow: var(--sh-1);
}
.search-wrap input::placeholder { color: var(--ink-3); }

.group-title {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--f-lg); margin: var(--s-6) 0 var(--s-3);
}
.group-title .chip {
  font-size: var(--f-caption); font-weight: 700;
  padding: 3px 12px; border-radius: var(--r-pill);
  background: var(--brand-50); color: var(--brand-700);
}
.group-title::after {
  content: ''; flex: 1; height: 2px;
  background: linear-gradient(90deg, rgba(122, 86, 56, .16), transparent);
  border-radius: 2px;
}

.grid-lessons {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
@media (min-width: 768px) {
  .grid-lessons { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s-4); }
}

.lesson-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--s-4) var(--s-3);
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1), var(--sh-in);
  text-decoration: none; color: var(--ink);
  transition: transform var(--t-base) var(--ease-bounce), box-shadow var(--t-base) var(--ease-soft);
}
.lesson-card:hover { transform: translateY(-4px); box-shadow: var(--sh-3); }
.lesson-card:active { transform: scale(.98); }
.lesson-card .no {
  font-size: var(--f-caption); font-weight: 800; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.lesson-card .thumb {
  width: 46px; height: 46px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 2px;
  box-shadow: var(--sh-in);
}
.lesson-card .name { font-size: var(--f-sm); font-weight: 800; line-height: 1.4; }
.lesson-card .desc {
  font-size: var(--f-caption); color: var(--ink-3); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lesson-card[hidden] { display: none; }
.lesson-card.visited { box-shadow: var(--sh-1), var(--sh-in), inset 0 0 0 2px var(--brand-300); }
.done-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--brand-500); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px;
  box-shadow: var(--sh-1); pointer-events: none;
}
.progress-banner { margin: 10px 0 0; font-size: var(--f-caption); color: var(--ink-3); }
.link-btn {
  margin-top: 6px; padding: 5px 14px;
  background: transparent; border: 1px solid var(--brand-300);
  color: var(--brand-700); border-radius: 999px;
  font: inherit; font-size: var(--f-caption); font-weight: 700; cursor: pointer;
  transition: background var(--t-base) var(--ease-soft);
}
.link-btn:hover { background: var(--brand-50); }

/* ---------- 11. 无障碍与打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
@media (prefers-contrast: more) {
  :root { --ink-2: #4A3B2F; --ink-3: #4A3B2F; }
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
