/* =========================================================
   字母岛 · 样式
   面向 3–5 岁：大按钮、大图标、少文字、柔和底色 + 鲜艳图形、慢动画、防误触。
   纯 CSS，不引入任何外部字体或图片。
   ========================================================= */

/* =========================================================
   0. 全局设计系统（视觉升级 v9）
   ---------------------------------------------------------
   四个马卡龙主色 + 各自的"深一档 / 浅一档"：
     主色用来铺面（卡片、门、按钮）；
     深色用来压低边（按钮底边、描边、需要对比的文字）；
     浅色用来做柔光与内高光。
   阴影一律带颜色，不用黑色：儿童 App 里黑影子会让画面显脏。
   ========================================================= */
:root {
  /* ---------- 马卡龙主色 ---------- */
  --peach: #ffb6b9;          /* 蜜桃粉 */
  --mint: #8ee4af;           /* 薄荷绿 */
  --cream: #fff2a8;          /* 奶油黄 */
  --sky: #89cff0;            /* 天空蓝 */

  /* ---------- 同色系深浅 ---------- */
  --peach-deep: #ef8b90;
  --peach-mid: #ffd3d5;
  --peach-soft: #fff0f1;

  --mint-deep: #57c98a;
  --mint-mid: #c6f2d8;
  --mint-soft: #edfcf3;

  --cream-deep: #e8c85c;
  --cream-mid: #fff7cd;
  --cream-soft: #fffdf0;

  --sky-deep: #5cb0dd;
  --sky-mid: #cfe9f8;
  --sky-soft: #eef8fe;

  /* ---------- 文字与纸面 ---------- */
  --ink: #4a3b33;            /* 主文字：暖可可，不用纯黑 */
  --ink-soft: #8b7a6e;       /* 次级文字 */
  --ink-faint: #b6a79b;      /* 提示、占位 */
  --paper: #ffffff;
  --paper-warm: #fffdf8;

  /* ---------- 背景 ---------- */
  --bg-top: #fff8f2;
  --bg-mid: #fff3f7;
  --bg-bottom: #eef8ff;

  /* ---------- 圆角：卡片 28 / 按钮 24 / 胶囊 999 ---------- */
  --radius: 24px;
  --radius-lg: 32px;
  --radius-md: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --radius-pill: 999px;

  /* ---------- 阴影：彩色弥散，永不用 rgba(0,0,0,x) ---------- */
  --shadow-peach: 0 8px 24px rgba(255, 182, 185, 0.4);
  --shadow-peach-lg: 0 18px 42px -12px rgba(244, 145, 150, 0.46);
  --shadow-mint: 0 8px 24px rgba(142, 228, 175, 0.42);
  --shadow-mint-lg: 0 18px 42px -12px rgba(87, 201, 138, 0.4);
  --shadow-sky: 0 8px 24px rgba(137, 207, 240, 0.4);
  --shadow-sky-lg: 0 18px 42px -12px rgba(92, 176, 221, 0.4);
  --shadow-cream: 0 8px 24px rgba(255, 226, 130, 0.45);
  --shadow-card: 0 10px 28px -8px rgba(214, 168, 168, 0.32);
  --shadow-inset-top: inset 0 3px 0 rgba(255, 255, 255, 0.95);

  /* 旧的语义色：学习页/游戏页还在用，值统一往马卡龙方向挪一档 */
  --blue: #6fb8e8;
  --pink: #ff8fa9;
  --green: #6fd39b;
  --yellow: #ffe08a;
  --orange: #ffc08a;

  --shadow-soft: 0 10px 26px rgba(214, 168, 168, 0.18);
  --shadow-press: 0 4px 0 rgba(214, 168, 168, 0.35);

  /* ---------- 字体：粗一点、圆一点、字距 2px ---------- */
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --font-round: "Varela Round", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --tracking: 2px;
  --weight-text: 600;
  --weight-bold: 800;
  --weight-black: 900;

  /* 按压反馈要快，其它动画要慢 */
  --t-press: 0.16s;
  --t-soft: 0.45s;
  --t-float: 0.3s;
}

/* 阶段3/4 靠 hidden 属性切换关卡，必须保证它压得住 display */
[hidden] {
  display: none !important;
}

/* ---------- 1. 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: var(--weight-text);
  line-height: 1.55;
  /* 全站统一字距：中文 +2px 会明显"松"开，卡通感就是这么来的 */
  letter-spacing: var(--tracking);

  /* 三层柔和渐变：上暖、中粉、下蓝，从奶油色过渡到天空色 */
  background:
    radial-gradient(120% 70% at 12% 0%, rgba(255, 242, 168, 0.55) 0%, rgba(255, 242, 168, 0) 62%),
    radial-gradient(110% 60% at 92% 8%, rgba(255, 182, 185, 0.34) 0%, rgba(255, 182, 185, 0) 58%),
    linear-gradient(168deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;

  /* 防误触：禁掉双击缩放、长按选中、点击高亮 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}

/* 中文输入框仍要能选中文字 */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 4px;
  border-radius: 12px;
}

/* ---------- 2. 水印（三个页面共用，右下角） ---------- */
.watermark {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 99;

  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);

  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(74, 63, 53, 0.55);

  pointer-events: none;   /* 绝不吃掉孩子的点击 */
  -webkit-user-select: none;
  user-select: none;
}

/* =========================================================
   2.5 进度与星星条（大厅 / 学习区 / 学习页 / 游戏页共用）

   一条胶囊：左边"已学 8/26" + 中间进度槽 + 右边星星数。
   数字变化时整条轻轻弹一下，给孩子的反馈比数字本身更重要。
   ========================================================= */
.statbar {
  display: flex;
  align-items: center;
  gap: 10px;

  width: min(100%, 470px);
  margin: 0 auto 16px;
  padding: 8px 16px;

  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 4px 0 #eee4d2, 0 8px 16px rgba(122, 100, 70, 0.08);
}

/* 大厅里上下留白多一点；学习页/游戏页塞在标题下方，紧凑一点 */
.statbar--lobby {
  margin-top: -6px;
}

.statbar--tight {
  margin: 0 auto 12px;
}

.statbar__group {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex: 0 0 auto;
}

.statbar__group--stars {
  align-items: center;
}

.statbar__cap {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.statbar__num {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.statbar__of {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.statbar__track {
  flex: 1 1 auto;
  min-width: 40px;
  height: 12px;
  border-radius: 999px;
  background: #eee4d2;
  overflow: hidden;
}

.statbar__track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7fe0a8 0%, var(--green) 100%);
  transition: width 0.6s cubic-bezier(0.34, 0.9, 0.4, 1);
}

.statbar__icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

/* 数字变了：整条轻轻弹一下 */
.statbar.is-bump {
  animation: hudBump 0.6s ease-out;
}

/* 从按钮位置飘上去的 "+1" */
.star-pop {
  position: fixed;
  z-index: 200;
  transform: translate(-50%, -50%);
  pointer-events: none;

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #f2a52b;
  text-shadow: 0 2px 0 #ffffff, 0 4px 12px rgba(242, 165, 43, 0.45);

  animation: starPopUp 1.05s ease-out forwards;
}

/* =========================================================
   3. 封面 index.html —— 马卡龙天空 / 流云 / 星光 / 上升光点 / 草坡
   所有背景都是渐变 + 内联 SVG，不引任何图片。
   背景用 position:fixed 铺满视口，内容层 z-index:1 压在上面。
   ========================================================= */
body[data-page="index"] {
  /* .scene 会盖住这层，这里只做兜底色，防止渐变未绘制时露出白闪 */
  background: #dff1ff;
}

.gate {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.4vh, 30px);
  padding: 26px 20px calc(26px + env(safe-area-inset-bottom));
}

/* ---------- 背景舞台 ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 58% at 80% 2%, rgba(255, 242, 168, 0.85) 0%, rgba(255, 242, 168, 0) 56%),
    radial-gradient(90% 48% at 8% 10%, rgba(142, 228, 175, 0.36) 0%, rgba(142, 228, 175, 0) 62%),
    radial-gradient(120% 55% at 50% 106%, rgba(255, 182, 185, 0.4) 0%, rgba(255, 182, 185, 0) 64%),
    linear-gradient(
      180deg,
      #bde4ff 0%,
      #d6efff 30%,
      #eef9f4 56%,
      #fff9f0 78%,
      #fff3f2 100%
    );
}

/* 两团大范围柔光：慢慢呼吸，天空因此不会像一张静止的图 */
.scene__glow {
  position: absolute;
  border-radius: 50%;
  animation: glowBreath 14s ease-in-out infinite;
  will-change: transform, opacity;
}

.scene__glow--a {
  left: -22vmax;
  top: -24vmax;
  width: 58vmax;
  height: 58vmax;
  background: radial-gradient(circle, rgba(255, 244, 176, 0.72) 0%, rgba(255, 244, 176, 0) 68%);
}

.scene__glow--b {
  right: -20vmax;
  top: 6vmax;
  width: 50vmax;
  height: 50vmax;
  background: radial-gradient(circle, rgba(255, 182, 185, 0.5) 0%, rgba(255, 182, 185, 0) 70%);
  animation-delay: -6s;
}

@keyframes glowBreath {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50%      { transform: scale(1.09); opacity: 1; }
}

/* 太阳：只留一圈光晕，不画硬边圆盘，免得抢标题 */
.scene__sun {
  position: absolute;
  top: -10vmin;
  right: -8vmin;
  width: 48vmin;
  height: 48vmin;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    #fffdf0 0%,
    #fff5c4 22%,
    rgba(255, 236, 160, 0.46) 46%,
    rgba(255, 236, 160, 0) 72%
  );
}

/* 云：一条圆角胶囊 + 两个圆，拼起来就是一朵云。
   用 ::before/::after 而不是三颗 div，DOM 干净，动画也只动一层。 */
.scene__clouds {
  position: absolute;
  inset: 0;
}

.cloud {
  position: absolute;
  left: 0;
  display: block;
  height: 34px;
  border-radius: 999px;
  background: #ffffff;
  filter: drop-shadow(0 7px 13px rgba(118, 160, 196, 0.18));
  animation-name: cloudDrift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
}

.cloud::before {
  width: 58%;
  height: 196%;
  left: 9%;
  bottom: 26%;
}

.cloud::after {
  width: 41%;
  height: 148%;
  right: 13%;
  bottom: 22%;
}

/* 六朵云速度差得够大才不像"排队"：
   负延迟让第一眼看着就是散开的 */
.cloud--a { top: 13%; width: 118px; opacity: 0.96; animation-duration: 78s;  animation-delay: -8s; }
.cloud--b { top: 24%; width: 76px;  opacity: 0.78; animation-duration: 104s; animation-delay: -52s; }
.cloud--c { top: 7%;  width: 152px; opacity: 0.7;  animation-duration: 132s; animation-delay: -104s; }
.cloud--d { top: 33%; width: 60px;  opacity: 0.6;  animation-duration: 92s;  animation-delay: -74s; }
.cloud--e { top: 41%; width: 92px;  opacity: 0.52; animation-duration: 118s; animation-delay: -30s; }
.cloud--f { top: 17%; width: 54px;  opacity: 0.66; animation-duration: 66s;  animation-delay: -20s; }

@keyframes cloudDrift {
  from { transform: translateX(-45vw); }
  to   { transform: translateX(118vw); }
}

/* 闪光星：四角星用 clip-path 切，不用图片。
   忽大忽小 + 旋转 + 明暗，三样一起才有"闪"的感觉。 */
.scene__stars {
  position: absolute;
  inset: 0;
}

.tw {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: block;
  width: var(--s);
  height: var(--s);
  background: radial-gradient(
    circle at 50% 50%,
    #fffef4 0%,
    #ffeea8 46%,
    rgba(255, 214, 120, 0.55) 72%,
    rgba(255, 214, 120, 0) 100%
  );
  clip-path: polygon(
    50% 0%, 61% 39%, 100% 50%, 61% 61%,
    50% 100%, 39% 61%, 0% 50%, 39% 39%
  );
  animation: twinkle 4.8s ease-in-out infinite;
  animation-delay: var(--dl);
  will-change: transform, opacity;
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.55) rotate(0deg);  opacity: 0.4; }
  50%      { transform: scale(1.16) rotate(45deg); opacity: 1; }
}

/* 上升光点：从屏幕底慢慢飘到顶，一边飘一边轻微左右晃。
   比"只有云在横着走"更有生气，也不抢标题。 */
.scene__motes {
  position: absolute;
  inset: 0;
}

.mote {
  position: absolute;
  left: var(--x);
  bottom: -8vh;
  display: block;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #ffffff 0%, #fff6cc 48%, rgba(255, 236, 160, 0) 74%);
  box-shadow: 0 0 12px rgba(255, 236, 165, 0.85);
  animation: moteRise 13s linear infinite;
  animation-delay: var(--d);
  will-change: transform, opacity;
}

@keyframes moteRise {
  0%   { opacity: 0;    transform: translate3d(0, 0, 0) scale(0.5); }
  10%  { opacity: 0.95; }
  70%  { opacity: 0.8; }
  100% { opacity: 0;    transform: translate3d(var(--dx, 12px), -104vh, 0) scale(1.1); }
}

/* 草坡：贴底铺满，按底边对齐裁切，不会被拉扁变形 */
.scene__land {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: clamp(150px, 26vh, 260px);
}

/* ---------- 标题：糖果立体字（封面与大厅共用） ----------
   三层真实元素，DOM 顺序就是前后顺序：
     ① __deep —— 厚度。同一个字往下叠十层 text-shadow，色阶从亮压到深，
                  读作一块糖的侧面。偏移全部用 em，字号变了厚度自动跟着变；
     ② __edge —— 白色贴纸边。白色实心字 + 再外扩一圈白描边；
     ③ __face —— 正面。竖向渐变，像糖衣表面反光。
   为什么不用伪元素：正面渐变是 background-clip:text 画出来的，
   本质是"背景"，任何负 z-index 的子层都会把它整块盖住。
   三层必须是三个真实元素，前两层 aria-hidden。 */
.title3d {
  position: relative;
  display: inline-block;
  margin: 0;
  font-family: var(--font-round);
  font-weight: var(--weight-black);
  line-height: 1.14;
  letter-spacing: 0.06em;
  /* 给下坠的厚度让位，否则会压在下一行文字上 */
  padding-bottom: 0.3em;
}

.title3d__deep,
.title3d__edge {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  pointer-events: none;
}

/* 厚度：每层只差 0.03em，密到看不出台阶 */
.title3d__deep {
  color: #f2ac56;
  text-shadow:
    0 0.024em 0 #f7b96d,
    0 0.048em 0 #f1b268,
    0 0.072em 0 #ebac63,
    0 0.096em 0 #e6a55d,
    0 0.119em 0 #e09f58,
    0 0.143em 0 #da9853,
    0 0.167em 0 #d4924e,
    0 0.191em 0 #ce8b48,
    0 0.215em 0 #c88543,
    0 0.239em 0 #c37e3e,
    0 0.263em 0 #bd7839,
    0 0.287em 0 #b77133,
    0 0.311em 0 #b16b2e,
    0 0.334em 0 #ab6429,
    0 0.358em 0 #a55e24,
    0 0.382em 0 #a0571e,
    0 0.406em 0 #9a5119,
    0 0.430em 0 #944a14;
}

/* 白边：0.075em 的外扩量，字号大时白边也粗，比例才不变 */
.title3d__edge {
  color: #ffffff;
  -webkit-text-stroke: 0.15em #ffffff;
}

.title3d__face {
  position: relative;
  display: inline-block;
  color: #ffbe55;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .title3d__face {
    background: linear-gradient(180deg, #fff2bd 0%, #ffdd85 38%, #ffc25c 72%, #ff9f45 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.gate__cover {
  text-align: center;
  animation: riseIn var(--t-soft) ease-out both;
}

.gate__title {
  font-size: clamp(56px, 17.4vw, 104px);
  animation: titleBob 5.2s ease-in-out infinite;
  /* 整块字一起投影，不用每层单独投 */
  filter: drop-shadow(0 0.28em 0.3em rgba(197, 124, 58, 0.24));
}

@keyframes titleBob {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50%      { transform: translateY(-7px) rotate(0.4deg); }
}

/* 副标题：一枚小小的奶白药丸，把标题和木牌轻轻分开 */
.gate__sub {
  display: inline-block;
  margin: 18px 0 0;
  padding: 7px 20px 8px;

  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 6px 18px rgba(137, 207, 240, 0.28),
    inset 0 1px 0 #ffffff;

  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 700;
  letter-spacing: var(--tracking);
  color: #7d6a72;
}

/* ---------- 激活码卡片：一枚会浮的奶白气泡 ---------- */
.gate__form {
  position: relative;
  width: min(92vw, 470px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 22px 22px;

  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fffefb 0%, #fff7f5 100%);
  box-shadow:
    0 24px 48px -20px rgba(255, 150, 156, 0.6),
    0 10px 22px -14px rgba(137, 207, 240, 0.5),
    inset 0 3px 0 #ffffff,
    inset 0 0 0 2px rgba(255, 255, 255, 0.9);

  animation: riseIn var(--t-soft) ease-out 0.08s both;
}

/* 气泡的小尾巴，朝上指着标题 */
.gate__form::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 5px;
  background: #fffefb;
  box-shadow: inset 1px 1px 0 #ffffff;
  transform: rotate(45deg);
}

.gate__label {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: var(--tracking);
  color: #93806f;
  text-align: center;
}

/* ---------- 木牌：木板外框 + 两颗钉子 + 内嵌奶白输入区 ---------- */
.gate__board {
  position: relative;
  padding: 18px 16px;
  border: 4px solid #c98b4b;
  border-radius: 22px;

  /* 第一层是斜着的细木纹，第二层是木板的竖向明暗 */
  background:
    /* 两把疏密不同的横纹叠在一起，才像木头的年轮纹理，而不是规则条纹 */
    repeating-linear-gradient(
      2deg,
      rgba(255, 255, 255, 0.22) 0 1.5px,
      rgba(255, 255, 255, 0) 1.5px 7px
    ),
    repeating-linear-gradient(
      1deg,
      rgba(150, 95, 40, 0.07) 0 3px,
      rgba(150, 95, 40, 0) 3px 13px
    ),
    linear-gradient(180deg, #f9d6a1 0%, #f2c283 50%, #e6ac6c 100%);
  box-shadow:
    0 12px 24px -12px rgba(176, 118, 58, 0.62),
    inset 0 3px 0 rgba(255, 255, 255, 0.6),
    inset 0 -7px 12px rgba(160, 102, 44, 0.2);
}

/* 钉子：把木牌"钉"在气泡上 */
.gate__nail {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff6e2 0%, #dbaf78 46%, #a9762f 100%);
  box-shadow:
    inset 0 -1px 1px rgba(120, 70, 20, 0.5),
    0 1px 2px rgba(120, 70, 20, 0.35);
}

.gate__nail--l { left: 9px; }
.gate__nail--r { right: 9px; }

.gate__input {
  width: 100%;
  height: 84px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;

  /* 凹进去：上半暗、下半亮，像刻进木头里的白瓷片 */
  background: linear-gradient(180deg, #fffaf0 0%, #fffdf8 100%);
  box-shadow:
    inset 0 5px 11px rgba(176, 118, 58, 0.24),
    inset 0 -2px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.55);

  font-family: var(--font-round);
  font-size: clamp(21px, 5.8vw, 28px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  color: #6b4423;

  transition:
    box-shadow var(--t-soft) ease,
    background-color var(--t-soft) ease;
}

.gate__input::placeholder {
  color: rgba(140, 100, 60, 0.42);
  letter-spacing: 0.08em;
}

.gate__input:focus {
  outline: none;
  background: #ffffff;
  box-shadow:
    inset 0 2px 6px rgba(176, 118, 58, 0.14),
    0 0 0 4px rgba(255, 182, 185, 0.55),
    0 0 0 9px rgba(255, 182, 185, 0.22);
}

/* ---------- 糖果按钮 ----------
   糖体 = 粉色竖向渐变 + 顶部弧形反光（background 第一层）+ 下方实色"糖座"
   （box-shadow 的第二层），再叠一条斜着扫过的白光是 ::after。 */
.gate__btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 92px;
  padding: 0 18px;

  border-radius: var(--radius);
  background:
    radial-gradient(118% 74% at 50% -16%, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, #ffbcc8 0%, #ff98ad 46%, #ff7d9b 100%);
  box-shadow:
    0 10px 0 #e2647f,
    0 22px 34px -12px rgba(255, 125, 155, 0.62),
    inset 0 3px 0 rgba(255, 255, 255, 0.85),
    inset 0 -8px 14px rgba(206, 64, 104, 0.26);

  font-size: clamp(23px, 6.1vw, 30px);
  font-weight: var(--weight-black);
  letter-spacing: 0.14em;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(196, 62, 100, 0.45);

  transition: transform var(--t-float) cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow var(--t-float) ease;
}

/* 斜扫光：每 3.6 秒从左划到右，停大半时间，不吵 */
.gate__btn::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -46%;
  width: 34%;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.62) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(14deg);
  animation: candyShine 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes candyShine {
  0%, 58%   { left: -46%; }
  86%, 100% { left: 118%; }
}

@media (hover: hover) and (pointer: fine) {
  .gate__btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
      0 13px 0 #e2647f,
      0 26px 38px -12px rgba(255, 125, 155, 0.66),
      inset 0 3px 0 rgba(255, 255, 255, 0.9),
      inset 0 -8px 14px rgba(206, 64, 104, 0.24);
  }
}

.gate__btn:active:not(:disabled) {
  transform: translateY(7px) scale(0.995);
  box-shadow:
    0 2px 0 #d4576f,
    0 8px 16px -8px rgba(255, 125, 155, 0.5),
    inset 0 3px 0 rgba(255, 255, 255, 0.8),
    inset 0 -6px 12px rgba(206, 64, 104, 0.3);
}

.gate__msg {
  min-height: 46px;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--ink-soft);
}

.gate__msg.is-error {
  color: #d8435c;
  font-weight: 800;
}

/* 没消息时整块收掉：那 46px 的占位会在卡片底部留一大片空白 */
.gate__msg:empty {
  display: none;
}

/* 矮屏（667 及以下）：标题收一档，保证"标题 + 木牌 + 按钮"一屏看得见 */
@media (max-height: 720px) {
  .gate {
    gap: 12px;
    padding-top: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .gate__title {
    font-size: clamp(46px, 14vw, 62px);
  }

  .gate__sub {
    margin-top: 10px;
    padding: 5px 16px 6px;
    font-size: 14px;
  }

  .gate__form {
    gap: 11px;
    padding: 18px 16px 14px;
  }

  .gate__label { font-size: 15px; }

  .gate__board { padding: 13px 12px; }

  .gate__input { height: 62px; }

  .gate__btn {
    min-height: 70px;
    font-size: clamp(21px, 5.6vw, 26px);
    box-shadow:
      0 8px 0 #e2647f,
      0 16px 26px -12px rgba(255, 125, 155, 0.6),
      inset 0 3px 0 rgba(255, 255, 255, 0.85),
      inset 0 -8px 14px rgba(206, 64, 104, 0.26);
  }
}

/* 横屏手机：改成从顶部往下排，允许滚动，但先露出标题和木牌 */
@media (max-height: 470px) and (orientation: landscape) {
  .gate {
    justify-content: flex-start;
    gap: 8px;
    padding-top: 10px;
  }

  .gate__title {
    font-size: 42px;
  }

  .gate__sub { display: none; }

  .gate__form {
    padding: 12px 14px 10px;
    gap: 8px;
  }

  .gate__label { display: none; }

  .gate__board { padding: 10px 12px; }

  .gate__input {
    height: 52px;
    font-size: 20px;
  }

  .gate__btn {
    min-height: 54px;
    font-size: 20px;
    box-shadow:
      0 5px 0 #e2647f,
      0 10px 18px -10px rgba(255, 125, 155, 0.6),
      inset 0 2px 0 rgba(255, 255, 255, 0.85);
  }

  .gate__msg {
    min-height: 20px;
    font-size: 14px;
  }
}

/* 减少动效：云、星、光点、标题浮沉、按钮扫光全部停下；
   云要手动错开位置，否则六朵叠在左边 */
@media (prefers-reduced-motion: reduce) {
  .cloud {
    animation: none !important;
  }

  .cloud--a { left: 4%; }
  .cloud--b { left: 38%; }
  .cloud--c { left: 56%; }
  .cloud--d { left: 82%; }
  .cloud--e { left: 20%; }
  .cloud--f { left: 68%; }

  .tw {
    animation: none !important;
    opacity: 0.9;
  }

  .mote {
    animation: none !important;
    opacity: 0;
  }

  .scene__glow { animation: none !important; }

  .gate__title { animation: none !important; }

  .gate__btn::after { animation: none !important; opacity: 0; }
}

/* =========================================================
   4. 大厅 island.html —— 两座"传送门小岛"
   一屏只有两个入口，每个都要"一巴掌大"，不给第三个干扰项。
   造型：上半是拱门（传送门），底下压着一座小草丘（岛），
   草丘外还有一圈水波。学习区薄荷绿，游戏区蜜桃粉。
   ========================================================= */
body[data-page="island"] {
  /* 大厅专属底色：左上奶油、右上蜜桃、底部薄荷，全是马卡龙 */
  background:
    radial-gradient(52% 38% at 8% 2%, rgba(255, 242, 168, 0.55) 0%, rgba(255, 242, 168, 0) 68%),
    radial-gradient(48% 34% at 94% 4%, rgba(255, 182, 185, 0.46) 0%, rgba(255, 182, 185, 0) 70%),
    radial-gradient(70% 40% at 50% 104%, rgba(142, 228, 175, 0.3) 0%, rgba(142, 228, 175, 0) 72%),
    linear-gradient(168deg, #fff9f3 0%, #fff3f7 48%, #eef8ff 100%);
  background-attachment: fixed;
}

.lobby {
  min-height: 100vh;
  min-height: 100dvh;
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));

  display: flex;
  flex-direction: column;
  justify-content: center;
  /* 高度够的分开一点，667 那种矮屏全部收紧：
     两座岛 + 标题 + 进度条要在一屏里，孩子不用先滚动才看见游戏入口 */
  gap: clamp(12px, 2.6vh, 32px);
}

.lobby__header {
  text-align: center;
  animation: riseIn var(--t-soft) ease-out both;
}

/* 大厅标题：跟封面同一套糖果字，只是小一号、薄一点。
   多层 text-shadow 从白色高光压到天空蓝，最后一行是弥散投影。 */
.lobby__title {
  font-size: clamp(36px, 9.6vw, 56px);
  letter-spacing: 0.08em;
  /* 大厅的厚度比封面浅一点，别压住下面那句提示 */
  padding-bottom: 0.12em;
}

/* 天空蓝版本：面、厚度、白边都换一套色 */
.lobby__title .title3d__face { color: #6cc0ea; }

.lobby__title .title3d__deep {
  color: #8ecbe9;
  text-shadow:
    0 0.019em 0 #9ad4ef,
    0 0.039em 0 #93ceea,
    0 0.058em 0 #8cc8e5,
    0 0.077em 0 #85c2e0,
    0 0.096em 0 #7ebcdc,
    0 0.116em 0 #77b6d7,
    0 0.135em 0 #70b0d2,
    0 0.154em 0 #69aacd,
    0 0.174em 0 #62a4c8,
    0 0.193em 0 #5b9ec3,
    0 0.212em 0 #5498bf,
    0 0.231em 0 #4d92ba,
    0 0.251em 0 #468cb5,
    0 0.270em 0 #3f86b0;
}

.lobby__title .title3d__edge {
  color: #ffffff;
  -webkit-text-stroke: 0.13em #ffffff;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .lobby__title .title3d__face {
    background: linear-gradient(180deg, #eaf9ff 0%, #b6e4f8 42%, #7ec9ee 76%, #5cb6e6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.lobby__tip {
  margin-top: 12px;
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 700;
  color: #8d7b80;
  letter-spacing: var(--tracking);
}

.lobby__doors {
  display: grid;
  grid-template-columns: 1fr;
  /* 岛底座会伸出卡片下方 28px，间距必须比它大，否则两座岛会叠在一起 */
  gap: clamp(38px, 6.4vw, 52px);
}

/* 平板横放才并排；手机上下一排，每个都够高 */
@media (min-width: 640px) {
  .lobby__doors {
    grid-template-columns: 1fr 1fr;
  }

  /* 并排之后每张卡变宽，高度要跟上，否则像两块压扁的饼干。
     图标也放大一档，视觉重量才对得上。 */
  .door {
    min-height: clamp(268px, 35vh, 348px);
    padding: 30px 24px 40px;
  }

  .door__name {
    font-size: clamp(27px, 3vw, 35px);
  }
}

/* ---- 一座岛 ----
   ① 拱形卡身：上面两个角给到 132px，读作"传送门"；
   ② ::before 小草丘：椭圆，压在卡身下沿，卡片像从土里长出来；
   ③ ::after 水波：更下面一圈淡蓝，慢慢放大缩小；
   ④ 内圈 4px 白描边 + 底部内发光，让拱门有"发光口"的感觉。 */
.door {
  --door-a: #f4fdf8;
  --door-b: #cdf3de;
  --door-glow: rgba(87, 201, 138, 0.42);
  --island-grass: #a8e8c0;
  --island-grass-deep: #8fd6a9;
  --island-sand: #ffe7b5;
  --door-name: #37694f;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: clamp(188px, 24vh, 292px);
  padding: 20px 18px 30px;

  border: 0;
  border-radius: 132px 132px 40px 40px;
  background:
    radial-gradient(96% 58% at 50% -2%, #ffffff 0%, rgba(255, 255, 255, 0) 64%),
    linear-gradient(180deg, var(--door-a) 0%, var(--door-b) 100%);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.88),
    inset 0 -20px 32px -16px var(--door-glow),
    0 24px 44px -20px var(--door-glow),
    0 8px 18px -10px rgba(150, 190, 175, 0.32);

  transition:
    transform var(--t-float) cubic-bezier(0.3, 1.5, 0.5, 1),
    box-shadow var(--t-float) ease;
  animation: riseIn var(--t-soft) ease-out both;
  -webkit-tap-highlight-color: transparent;

  /* 建一个层叠上下文，底下的负 z-index 装饰才不会跑到卡片背后去 */
  isolation: isolate;
}

.door:nth-child(2) {
  animation-delay: 0.1s;
}

/* 小岛：一枚草丘。用 box-shadow 往下错 7px 压出一圈沙岸 ——
   比再叠一个渐变层老实得多，形状也一定跟草丘同一条曲线。 */
.door::before {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: -20px;
  height: 46px;
  z-index: -1;

  border-radius: 50%;
  background: radial-gradient(
    116% 100% at 50% 4%,
    var(--island-grass) 0%,
    var(--island-grass) 58%,
    var(--island-grass-deep) 100%
  );
  box-shadow:
    0 6px 0 var(--island-sand),
    0 18px 22px -12px rgba(140, 180, 160, 0.5);
}

/* 水波：比草丘再低一层，淡蓝的椭圆，慢慢一涨一落 */
.door::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -44px;
  height: 40px;
  z-index: -2;

  border-radius: 50%;
  background: radial-gradient(58% 100% at 50% 36%, rgba(137, 207, 240, 0.4) 0%, rgba(137, 207, 240, 0) 74%);
  animation: islandRipple 4.4s ease-in-out infinite;
}

.door:nth-child(2)::after {
  animation-delay: -2.2s;
}

@keyframes islandRipple {
  0%, 100% { transform: scale(0.93); opacity: 0.5; }
  50%      { transform: scale(1.05); opacity: 0.92; }
}

/* 真能悬停的设备才抬起来放大。手机上如果也写 hover，
   点完那一瞬间会停在"抬起"的状态，看起来像卡住了。 */
@media (hover: hover) and (pointer: fine) {
  .door:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
      inset 0 0 0 4px rgba(255, 255, 255, 0.92),
      inset 0 -22px 34px -16px var(--door-glow),
      0 30px 52px -20px var(--door-glow),
      0 10px 20px -10px rgba(150, 190, 175, 0.34);
  }

  .door:hover .door__art {
    box-shadow:
      0 0 0 7px rgba(255, 255, 255, 0.78),
      0 0 30px 8px var(--door-glow),
      inset 0 -8px 14px rgba(160, 200, 180, 0.16),
      inset 0 5px 9px rgba(255, 255, 255, 0.92);
  }
}

/* 按下去：整座岛往下沉一点，比"缩放"更像真的按到东西 */
.door:active {
  transform: translateY(3px) scale(0.985);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.88),
    inset 0 -14px 24px -14px var(--door-glow),
    0 10px 20px -12px var(--door-glow),
    0 4px 10px -6px rgba(150, 190, 175, 0.3);
}

/* 学习：薄荷绿；游戏：蜜桃粉。两个都往白里调，不用原色铺满。 */
.door--learn {
  --door-a: #f3fdf7;
  --door-b: #c9f2db;
  --door-glow: rgba(87, 201, 138, 0.44);
  --island-grass: #9fe3b9;
  --island-grass-deep: #85d5a1;
  --island-sand: #ffe8b6;
  --door-name: #2f6b54;
}

.door--play {
  --door-a: #fff6f6;
  --door-b: #ffd8dc;
  --door-glow: rgba(255, 150, 156, 0.46);
  --island-grass: #ffc9cb;
  --island-grass-deep: #f9b0b4;
  --island-sand: #ffe2b4;
  --door-name: #7a4045;
}

/* 图标：一枚奶白圆盘，外面套一圈会转的虚线光环（传送门） */
.door__art {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(80px, 19vw, 118px);
  height: clamp(80px, 19vw, 118px);
  margin-bottom: 2px;

  border-radius: 50%;
  background:
    radial-gradient(88% 88% at 34% 22%, #ffffff 0%, rgba(255, 255, 255, 0.94) 52%, rgba(255, 255, 255, 0.72) 100%);
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.7),
    0 0 26px 6px var(--door-glow),
    inset 0 -8px 14px rgba(160, 200, 180, 0.14),
    inset 0 5px 9px rgba(255, 255, 255, 0.92);

  transition: box-shadow var(--t-float) ease;
}

.door__art::before {
  content: "";
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.78);
  animation: ringSpin 22s linear infinite;
  pointer-events: none;
}

@keyframes ringSpin {
  to { transform: rotate(360deg); }
}

.door__art svg {
  display: block;
  width: 76%;
  height: 76%;
  overflow: visible;
  filter: drop-shadow(0 4px 8px rgba(122, 99, 87, 0.14));
  animation: artFloat 5.6s ease-in-out infinite;
}

.door:nth-child(2) .door__art svg {
  animation-delay: -2.8s;
}

@keyframes artFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.door__name {
  font-size: clamp(25px, 6.4vw, 33px);
  font-weight: var(--weight-black);
  letter-spacing: 0.06em;
  color: var(--door-name);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9);
}

.door__desc {
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 600;
  color: #8b7a6e;
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  .door__art::before,
  .door__art svg,
  .door::after {
    animation: none !important;
  }
}

/* =========================================================
   5. 学习区 island.html#learn
   ========================================================= */
.island {
  width: min(100%, 1120px);
  margin: 0 auto;
  /* 右边多留 4px 给水印那条竖排；底部 96px 是为了最后一排字母卡
     不被底部导航压住（56px 时实测最后一行会钻到导航底下，还滚不下去）。 */
  padding: 18px 22px calc(96px + env(safe-area-inset-bottom));
}

/* 返回按钮与标题同一行 */
.island__top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 14px;
}

/* 这一层的标题要跟返回按钮并排，所以比大厅小 */
.island__top .island__title {
  font-size: clamp(23px, 5.8vw, 32px);
  letter-spacing: 0.08em;
  text-shadow: none;
}

.island__title {
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #2f80ed;
  text-shadow: 0 3px 0 #ffffff, 0 8px 18px rgba(47, 128, 237, 0.18);
}

.island__tip {
  margin: 0 0 18px;
  font-size: clamp(16px, 4.2vw, 19px);
  text-align: center;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

.island__loading {
  padding: 40px 0;
  text-align: center;
  font-size: 20px;
  color: var(--ink-soft);
}

/* ---- 大小写难度开关 ---- */
.casebar {
  display: flex;
  justify-content: center;
  gap: 8px;

  margin: -8px 0 16px;
  padding: 0 4px;
}

.casebar__btn {
  /* 3 岁孩子手指落点比成人散，35px 高的胶囊实测常点空；撑到 40px 才稳 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 14px;
  border: 2px solid #e8ded2;
  border-radius: 999px;
  background: #fffdf9;

  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #8a7c6b;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.casebar__btn.is-on {
  border-color: #ffc98f;
  background: linear-gradient(180deg, #ffe9cf 0%, #ffd6a6 100%);
  color: #a4551a;
  box-shadow: 0 3px 0 rgba(214, 140, 68, 0.28);
}

.casebar__btn:active { transform: scale(0.94); }

.island__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(104px, 21vw, 152px), 1fr));
  gap: clamp(12px, 2.4vw, 20px);
}

/* ---- 字母卡片 ---- */
.letter-card {
  --card: #ffe1e6;
  --edge: #ffb3c1;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;

  min-height: clamp(128px, 26vw, 172px);
  padding: 14px 10px 12px;

  border: 4px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: 0 6px 0 var(--edge), 0 12px 20px rgba(122, 100, 70, 0.1);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

/* 手指按下去要有明显反馈 */
.letter-card:active {
  transform: translateY(5px) scale(0.98);
  box-shadow: 0 2px 0 var(--edge);
}

/* 学过的字母：右上角一个绿勾，不用读数字也知道学到哪了 */
.letter-card.is-learned::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;

  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 6px rgba(63, 191, 127, 0.4);

  font-size: 15px;
  font-weight: 800;
  line-height: 26px;
  text-align: center;
  color: #ffffff;
}

.letter-card__pair {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}

.letter-card__upper {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(38px, 9vw, 52px);
  font-weight: 800;
  color: var(--ink);
}

.letter-card__lower {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(26px, 6.2vw, 36px);
  font-weight: 700;
  color: var(--ink-soft);
}

.letter-card__thumb-wrap {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
}

.letter-card__thumb-wrap svg {
  width: clamp(46px, 11vw, 64px);
  height: clamp(46px, 11vw, 64px);
  display: block;
}

/* 取不到 SVG 时退回显示中文词，做成一个小药丸，别显得像坏了 */
.letter-card__thumb-wrap.is-fallback .letter-card__thumb-text {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.letter-card__thumb-text {
  font-size: clamp(15px, 3.6vw, 18px);
  font-weight: 700;
  color: var(--ink-soft);
}

/* 26 张卡片轮流换色，柔和不刺眼但彼此区分得开 */
.letter-card:nth-child(1)  { --card: #ffe1e6; --edge: #ffb3c1; }
.letter-card:nth-child(2)  { --card: #ffe9cf; --edge: #ffc785; }
.letter-card:nth-child(3)  { --card: #fff6c9; --edge: #ffdf6b; }
.letter-card:nth-child(4)  { --card: #e6f7cf; --edge: #bce07a; }
.letter-card:nth-child(5)  { --card: #d6f2e4; --edge: #8fdcc0; }
.letter-card:nth-child(6)  { --card: #d9f0fb; --edge: #8ed3f2; }
.letter-card:nth-child(7)  { --card: #e2e5fb; --edge: #a9b3f0; }
.letter-card:nth-child(8)  { --card: #f6e3fa; --edge: #d9a3e8; }
.letter-card:nth-child(9)  { --card: #ffe3d3; --edge: #ffb08a; }
.letter-card:nth-child(10) { --card: #e8f0d8; --edge: #c2d69a; }
.letter-card:nth-child(11) { --card: #d8f0f0; --edge: #96dbdb; }
.letter-card:nth-child(12) { --card: #fde7f3; --edge: #f5a9d0; }
.letter-card:nth-child(13) { --card: #f1eadd; --edge: #d8c6a9; }
.letter-card:nth-child(14) { --card: #fff0d6; --edge: #ffd08a; }
.letter-card:nth-child(15) { --card: #f0e8ff; --edge: #c5b3f5; }
.letter-card:nth-child(16) { --card: #dcf5e3; --edge: #9adcb4; }
.letter-card:nth-child(17) { --card: #ffdede; --edge: #ffaaaa; }
.letter-card:nth-child(18) { --card: #e0f3ff; --edge: #9ad4f5; }
.letter-card:nth-child(19) { --card: #fff8d9; --edge: #ffe98a; }
.letter-card:nth-child(20) { --card: #e9e4ff; --edge: #bdb0f0; }
.letter-card:nth-child(21) { --card: #ffe6f0; --edge: #ffb0ce; }
.letter-card:nth-child(22) { --card: #e4f4e8; --edge: #a9d9b8; }
.letter-card:nth-child(23) { --card: #fde9d9; --edge: #ffbe93; }
.letter-card:nth-child(24) { --card: #e7f0ff; --edge: #aac6f7; }
.letter-card:nth-child(25) { --card: #f5e9d8; --edge: #d9bd96; }
.letter-card:nth-child(26) { --card: #e8f7f0; --edge: #a3e0c6; }

/* 载入时轻轻浮上来，每 8 张错开一点，形成波浪感 */
.island__grid.is-ready .letter-card {
  animation: cardIn 0.5s ease-out both;
}

.island__grid.is-ready .letter-card:nth-child(8n + 1) { animation-delay: 0s; }
.island__grid.is-ready .letter-card:nth-child(8n + 2) { animation-delay: 0.04s; }
.island__grid.is-ready .letter-card:nth-child(8n + 3) { animation-delay: 0.08s; }
.island__grid.is-ready .letter-card:nth-child(8n + 4) { animation-delay: 0.12s; }
.island__grid.is-ready .letter-card:nth-child(8n + 5) { animation-delay: 0.16s; }
.island__grid.is-ready .letter-card:nth-child(8n + 6) { animation-delay: 0.2s; }
.island__grid.is-ready .letter-card:nth-child(8n + 7) { animation-delay: 0.24s; }
.island__grid.is-ready .letter-card:nth-child(8n + 8) { animation-delay: 0.28s; }

/* =========================================================
   5. 详情页 letter.html
   ========================================================= */
.letter {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 16px 16px calc(60px + env(safe-area-inset-bottom));
}

.letter__top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 14px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  min-height: 64px;
  padding: 0 22px 0 12px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 0 #e5dcc9;

  font-size: 19px;
  font-weight: 700;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.back-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #e5dcc9;
}

.back-btn__icon {
  width: 30px;
  height: 30px;
  color: #2f80ed;
}

/* 文字较长的返回按钮（"返回学习大厅"），保持高度不变只放宽 */
.back-btn--long {
  padding-right: 26px;
  font-size: clamp(16px, 4.2vw, 19px);
  white-space: nowrap;
}

.letter__crumb {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #b8a894;
}

.letter__hint {
  padding: 60px 0;
  text-align: center;
  font-size: 20px;
  color: var(--ink-soft);
}

.letter__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 页面底的返回出口：学完不用滚回顶部 */
.letter__foot {
  padding: 24px 0 8px;
  text-align: center;
}

.foot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 84px;
  padding: 0 40px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 6px 0 #e5dcc9;

  font-size: clamp(18px, 4.8vw, 22px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.foot-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #e5dcc9;
}

/* ---------- 6. 学习模块 ---------- */
.learn {
  padding: 22px 20px 24px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  animation: riseIn var(--t-soft) ease-out both;
}

.learn__hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.learn__letters {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.learn__upper {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(84px, 22vw, 140px);
  font-weight: 800;
  color: #2f80ed;
}

.learn__lower {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(56px, 15vw, 96px);
  font-weight: 800;
  color: var(--pink);
}

.learn__pic {
  flex: 0 0 auto;
  width: clamp(96px, 26vw, 150px);
  height: clamp(96px, 26vw, 150px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fffaf0;
}

.learn__pic svg {
  width: 84%;
  height: 84%;
  display: block;
}

.learn__word {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

.learn__word-en {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.learn__word-zh {
  font-size: clamp(18px, 4.8vw, 22px);
  color: var(--ink-soft);
}

.learn__tip {
  margin: 14px auto 0;
  max-width: 22em;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: #fff6e2;

  font-size: clamp(16px, 4.4vw, 19px);
  line-height: 1.5;
  text-align: center;
  color: #8a6d3b;
}

.learn__note {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fff0f0;
  font-size: 16px;
  text-align: center;
  color: #c04545;
}

/* ---- 三个发音按钮：颜色区分"字母名 / 字母音 / 单词" ---- */
.learn__says {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.say-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;

  min-height: 104px;
  padding: 12px 6px;

  border-radius: var(--radius-md);
  color: #ffffff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.say-btn:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);
}

.say-btn svg {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.say-btn__label {
  font-size: clamp(14px, 3.6vw, 17px);
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.95;
}

.say-btn__value {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(20px, 5.4vw, 27px);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.say-btn--name  { background: linear-gradient(180deg, #6ba7ec 0%, var(--blue) 100%); }
.say-btn--word  { background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%); }

/* 正在发音：轻轻呼吸一下 */
.say-btn.is-speaking {
  animation: breathe 0.9s ease-in-out;
}

/* ---------- 7. 加深模块 ---------- */
.games {
  padding: 18px 16px 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  animation: riseIn var(--t-soft) ease-out 0.1s both;
}

/* 学习页只剩一关，所以这块只有在 buildGames 里加了一个标题栏 */
.games--single {
  padding-top: 20px;
}

.games__head {
  margin-bottom: 14px;
  text-align: center;
}

.games__title {
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #2f80ed;
}

.games__sub {
  margin-top: 4px;
  font-size: clamp(15px, 3.9vw, 17px);
  color: var(--ink-soft);
}

.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 6px 0 2px;
}

.game__hint {
  font-size: clamp(16px, 4.4vw, 20px);
  font-weight: 700;
  text-align: center;
  color: var(--ink-soft);
}

.game__prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  width: 100%;
}

/* 大喇叭：随时能再听一次 */
.ear-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  min-height: 84px;
  padding: 0 30px;

  border-radius: 999px;
  background: linear-gradient(180deg, #6ba7ec 0%, var(--blue) 100%);
  box-shadow: 0 6px 0 #2d6cb5;
  color: #ffffff;

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.ear-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #2d6cb5;
}

.ear-btn svg {
  width: 34px;
  height: 34px;
}

.ear-btn__text {
  font-size: clamp(18px, 4.8vw, 22px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* 三个大选项 */
.game__options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.opt-btn {
  min-height: clamp(110px, 26vw, 148px);

  border: 4px solid #ffd9a0;
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 6px 0 #f0c98a;

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(46px, 13vw, 66px);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease,
    background-color var(--t-press) ease, border-color var(--t-press) ease;
}

.opt-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #f0c98a;
}

/* 答对：亮绿 + 轻轻一跳 */
.opt-btn.is-right {
  border-color: var(--green);
  background: #dcf7e8;
  color: #1b7a4b;
  box-shadow: 0 2px 0 var(--green);
  animation: pop 0.6s ease-in-out;
}

/* 答错：抖动，题目不变 */
.opt-btn.is-wrong {
  border-color: #ff8a8a;
  background: #ffeeee;
  animation: shake 0.6s ease-in-out;
}

.game__status {
  min-height: 32px;
  font-size: clamp(17px, 4.6vw, 21px);
  font-weight: 700;
  text-align: center;
  color: var(--green);
}

/* =========================================================
   8. 游戏挑战区 game.html（三步）
   ========================================================= */
.gamepage {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 16px 16px calc(60px + env(safe-area-inset-bottom));
}

.gamepage__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0 18px;
}

/* ---- 三步指示 ---- */
.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps__item {
  display: flex;
  align-items: center;
  gap: 5px;

  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);

  font-size: 13px;
  font-weight: 700;
  color: #b8a894;

  transition: background-color var(--t-soft) ease, color var(--t-soft) ease;
}

.steps__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ece3d2;
  font-size: 13px;
  font-weight: 800;
  color: #8a7a66;
}

.steps__item.is-active {
  background: #fff4d6;
  color: #8a6d3b;
}

.steps__item.is-active .steps__num {
  background: var(--yellow);
  color: #6b4c00;
}

.steps__item.is-done {
  color: #3f9d74;
}

.steps__item.is-done .steps__num {
  background: var(--green);
  color: #ffffff;
}

/* 手机上只留数字，把地方让给内容 */
@media (max-width: 520px) {
  .steps__text {
    display: none;
  }

  .steps__item {
    padding: 4px 5px;
  }
}

/* ---- 每一步的公共外壳 ---- */
.step {
  animation: riseIn var(--t-soft) ease-out both;
}

.step__title {
  font-size: clamp(23px, 6.2vw, 32px);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.step__tip {
  margin-top: 8px;
  font-size: clamp(15px, 4.1vw, 18px);
  text-align: center;
  color: var(--ink-soft);
}

.step__next {
  display: block;
  width: 100%;
  min-height: 92px;
  margin-top: 22px;

  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%);
  box-shadow: 0 8px 0 #2f9d66, 0 14px 22px rgba(63, 191, 127, 0.26);

  font-size: clamp(20px, 5.4vw, 26px);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffffff;

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease,
    background-color var(--t-press) ease;
}

.step__next:active:not(:disabled) {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #2f9d66;
}

/* 一个字母都没勾时：灰掉但文字仍要看得清，不用透明度 */
.step__next:disabled {
  background: #e9e1d2;
  box-shadow: 0 8px 0 #d8cdb9;
  color: #8f8271;
  opacity: 1;
}

.step__back {
  display: block;
  margin: 18px auto 0;
  min-height: 64px;
  padding: 0 28px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 0 #e5dcc9;

  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 700;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.step__back:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 #e5dcc9;
}

/* ---- 第一步：选字栏 ---- */
.pickbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
}

.pickbar__btn {
  min-height: 56px;
  padding: 0 20px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 0 #e5dcc9;

  font-size: 17px;
  font-weight: 700;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.pickbar__btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #e5dcc9;
}

.pickbar__count {
  margin-left: auto;
  font-size: 16px;
  font-weight: 700;
  color: #2f80ed;
}

/* ---- 26 个字母复选框 ---- */
/* 手机上固定 3 列：每格约 115px 宽，3–5 岁的手指也点得准 */
.pickgrid {
  /* 第一步的"下一步"改成悬浮在底部，别让它被最后一行字母挡住 */
  padding-bottom: 88px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 2.6vw, 16px);

  max-width: 660px;
  margin: 0 auto;
}

/* 平板和桌面才加列，否则宽屏上一排 3 个会大得离谱 */
@media (min-width: 640px) {
  .pickgrid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 980px) {
  .pickgrid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.pick {
  position: relative;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 原生复选框铺满整块：点字母、点中文、点边角都算点中 */
.pick__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pick__box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;

  min-height: clamp(88px, 22vw, 108px);
  padding: 10px 6px;

  border: 4px solid #e9dfcc;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 4px 0 #e9dfcc;

  transition: border-color var(--t-press) ease, background-color var(--t-press) ease,
    box-shadow var(--t-press) ease, transform var(--t-press) ease;
}

.pick__letter {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.pick__word {
  font-size: clamp(12px, 3.1vw, 13.5px);
  color: var(--ink-soft);
}

.pick:active .pick__box {
  transform: translateY(3px) scale(0.97);
}

/* 选中：整块变绿 + 右上角一个圆点，两种信号同时给 */
.pick__input:checked + .pick__box {
  border-color: var(--green);
  background: #dcf7e8;
  box-shadow: 0 4px 0 #79cc9f;
}

.pick__input:checked + .pick__box .pick__letter {
  color: #1b7a4b;
}

.pick__input:checked + .pick__box::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px #ffffff;
}

.pick__input:focus-visible + .pick__box {
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}

/* ---- 第二步：玩法大卡片 ----
   手机上一行两个：四个玩法必须一屏看全。
   排成一列时第四张正好掉在屏幕外面，孩子根本不知道还有这个玩法。 */
.modegrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .modegrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1000px) {
  .modegrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  min-height: clamp(150px, 38vw, 196px);
  padding: 14px 10px 16px;

  border: 4px solid #cfe7fb;
  border-radius: 26px;
  background: #f3fbff;
  box-shadow: 0 7px 0 #b7dcf5;

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.mode-card:nth-child(2) {
  border-color: #ffe0b8;
  background: #fff8ee;
  box-shadow: 0 8px 0 #f5c98e;
}

.mode-card:active:not(:disabled) {
  transform: translateY(7px);
  box-shadow: 0 1px 0 #b7dcf5;
}

.mode-card:nth-child(2):active:not(:disabled) {
  box-shadow: 0 1px 0 #f5c98e;
}

/* 勾的字母不够这个玩法的最低要求时，整块变灰 */
.mode-card:disabled,
.mode-card.is-locked {
  filter: grayscale(0.55);
  opacity: 0.6;
}

/* 点了一张还没解锁的卡：抖一下，比"毫无反应"清楚得多 */
.mode-card.is-bump {
  animation: modeBump 0.42s ease-in-out;
}

@keyframes modeBump {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px) rotate(-1deg); }
  60%      { transform: translateX(4px) rotate(1deg); }
}

.mode-card__art {
  display: block;
  width: clamp(56px, 15vw, 82px);
  height: clamp(56px, 15vw, 82px);
  margin-bottom: 2px;
}

.mode-card__art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mode-card__name {
  font-size: clamp(18px, 4.8vw, 28px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
}

.mode-card__desc {
  font-size: clamp(12px, 3.2vw, 16px);
  line-height: 1.3;
  text-align: center;
  color: var(--ink-soft);
}

/* ---- 第三步：游戏容器 ---- */
/* 这一屏会反复进出（换玩法、重开一局），不做入场动画，否则每次都闪一下 */
.step--play {
  animation: none;
}

.playbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0 0 16px;
}

.playbar__title {
  font-size: clamp(22px, 5.6vw, 28px);
  font-weight: 800;
  color: var(--ink);
}

.playbar__range {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.playbar__exit {
  margin-left: auto;
  min-height: 56px;
  padding: 0 20px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 0 #e5dcc9;

  font-size: 16px;
  font-weight: 700;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.playbar__exit:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #e5dcc9;
}

/* 玩法往这里画。最小高度给足，避免一上来画面忽大忽小 */
.playmount {
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: clamp(300px, 52vh, 460px);
  padding: 18px;

  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.playmount__wait {
  max-width: 20em;
  font-size: clamp(17px, 4.4vw, 20px);
  line-height: 1.6;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- 记忆翻牌（魔法宝箱） ----------
   包装逻辑：牌背不是牌背，是一个发光的上锁宝箱。
   翻开 = 开盖，配对 = 箱子炸开掉金币。
   尺寸全部用 clamp 跟着屏宽走，手机上 4 张牌也不会只剩芝麻大。 */
.memory {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.memory__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.memory__level {
  padding: 5px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff2c9 0%, #ffe08a 100%);
  box-shadow: 0 3px 0 #e0b64e;

  font-size: clamp(15px, 4vw, 18px);
  font-weight: 800;
  color: #7a4a08;
  letter-spacing: 0.02em;
}

.memory__goal {
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 700;
  text-align: center;
  color: var(--ink-soft);
}

.memory__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: clamp(10px, 2.8vw, 16px);

  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.memory__status {
  min-height: 30px;
  font-size: clamp(16px, 4.4vw, 19px);
  font-weight: 800;
  text-align: center;
  color: var(--green);
}

/* 按钮样式和戳泡泡共用一套，两个玩法的"再玩一次"长得一样 */
.memory__btn,
.bubble__btn {
  min-height: 64px;
  padding: 0 26px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 0 #e5dcc9;

  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 800;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.memory__btn:active,
.bubble__btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 #e5dcc9;
}

.memory__btn--again,
.bubble__btn--again {
  background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%);
  box-shadow: 0 5px 0 #2f9d66;
  color: #ffffff;
}

.memory__btn--again:active,
.bubble__btn--again:active {
  box-shadow: 0 1px 0 #2f9d66;
}

/* ---- 一个宝箱 ---- */
.mcard {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: none;
  background: none;

  perspective: 820px;   /* 3D 纵深，翻起来才像真的把箱子转过去 */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mcard__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34, 0.9, 0.4, 1) 0s;
}

/* 开盖先演一小段，再翻面：直接翻过去就看不见箱盖弹开了 */
.mcard.is-open .mcard__inner {
  transform: rotateY(180deg);
  transition-delay: 0.1s;
}

.mcard__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: clamp(14px, 3.4vw, 20px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 没翻开：夜色里发着光的宝箱 */
.mcard__face--front {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 238, 168, 0.42), rgba(255, 238, 168, 0) 58%),
    linear-gradient(160deg, #6b4bd8 0%, #3b2a80 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.28), 0 6px 0 #2b1f61;
}

.chest {
  display: block;
  width: 86%;
  height: 86%;
}

/* 箱盖绕左侧铰链转开。transform-box:fill-box 让百分比按箱盖自身
   的包围盒算，换屏幕尺寸也不会跑偏。 */
.chest__lid {
  transform-box: fill-box;
  transform-origin: 4% 96%;
  transition: transform 0.26s cubic-bezier(0.3, 1.4, 0.5, 1);
}

/* 开盖只掀一个小角度、往上抬一点。
   真按箱子铰链转 110°，箱盖会甩出卡片外面被 overflow 裁掉，
   看起来像卡片坏了，不像开箱。 */
.mcard.is-open .chest__lid {
  transform: translateY(-11px) rotate(-13deg);
}

/* 光柱和开盖同时出现，把"里面有东西"说清楚 */
.mcard.is-open .chest__beam {
  animation: chestBeam 0.5s ease-out forwards;
}

.mcard.is-open .chest__gap {
  opacity: 1;
  transition: opacity 0.12s ease;
}

@keyframes chestBeam {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0.7; }
}

.chest__glow {
  animation: chestGlow 2.2s ease-in-out infinite;
}

.chest__star {
  animation: chestTwinkle 1.6s ease-in-out infinite;
}

.chest__star--b { animation-delay: 0.5s; }
.chest__star--c { animation-delay: 0.95s; }

@keyframes chestGlow {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.8; }
}

@keyframes chestTwinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* 开盖那一下的白光圈，"啵" */
.mcard__puff {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 26%;
  height: 26%;
  margin: -13% 0 0 -13%;
  border-radius: 50%;
  border: 3px solid rgba(255, 244, 200, 0.9);
  opacity: 0;
}

.mcard.is-open .mcard__puff {
  animation: chestPuff 0.5s ease-out;
}

@keyframes chestPuff {
  0%   { transform: scale(0.3); opacity: 0; }
  30%  { opacity: 0.95; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* 翻开：白底金字，和夜色宝箱形成最大反差 */
.mcard__face--back {
  transform: rotateY(180deg);
  background: #ffffff;
  box-shadow: inset 0 0 0 4px #ffe0ae, 0 6px 0 #f0c98a;
}

.mcard__letter {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(38px, 11vw, 56px);
  font-weight: 800;
  line-height: 1;
  color: #2f80ed;
}

/* 小写用粉色，和大写一眼分得开 */
.mcard__letter--lower {
  font-size: clamp(32px, 9.4vw, 48px);
  color: var(--pink);
}

/* ---- 配对成功：原地炸开 ----
   不直接消失，而是先亮、再胀、最后炸没。
   560ms 之后 JS 才给 is-gone（只隐藏不塌陷），位置一直留着。 */
.mcard.is-boom {
  animation: cardBoom 0.56s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
  z-index: 5;
}

/* 只做 transform，不加 filter / opacity。
   这张牌里包着一个 3D 翻转层，父级一旦有 filter 或 opacity，
   整个 3D 上下文会被压平，牌面当场被投成一条竖带子。 */
@keyframes cardBoom {
  0%   { transform: scale(1) rotate(0deg); }
  32%  { transform: scale(1.15) rotate(-3deg); }
  62%  { transform: scale(1.02) rotate(3deg); }
  100% { transform: scale(0.22) rotate(0deg); }
}

/* 炸开瞬间的白光：独立一层，压在牌面上，不参与 3D */
.mcard__flash {
  position: absolute;
  inset: 0;
  border-radius: clamp(14px, 3.4vw, 20px);
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #ffeaa8 62%, #ffd05a 100%);
  opacity: 0;
  pointer-events: none;
}

.mcard.is-boom .mcard__flash {
  animation: cardFlash 0.34s ease-out;
}

@keyframes cardFlash {
  0%   { opacity: 0; }
  26%  { opacity: 0.95; }
  100% { opacity: 0; }
}

.mcard.is-gone {
  visibility: hidden;
  cursor: default;
}

/* 配错：红框 + 抖一下，1.05 秒后由 JS 一起盖回 */
.mcard.is-wrong .mcard__face--back {
  box-shadow: inset 0 0 0 4px #ff8a8a, 0 6px 0 #ff8a8a;
}

.mcard.is-wrong {
  animation: shake 0.5s ease-in-out;
}

/* ---- 全屏特效层：炸开的碎片会飞出网格，必须脱离网格 ----
   pointer-events:none，一秒钟掉几十个金币也不挡下一次点击。 */
.memory-fx {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
  pointer-events: none;
}

.fx-bit {
  position: absolute;
  width: var(--size, 14px);
  height: var(--size, 14px);
  margin: calc(var(--size, 14px) / -2) 0 0 calc(var(--size, 14px) / -2);
  will-change: transform, opacity;
}

.fx-bit--star {
  background: linear-gradient(180deg, #fff3a8 0%, #ffc531 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%,
                     79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 4px rgba(255, 214, 90, 0.75));
}

.fx-bit--coin {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff6c4 0%, #ffd045 42%, #e0a01c 100%);
  /* 金币要有"厚"的感觉：内圈亮边 + 下缘暗边。
     只给一个径向渐变的话，掉在米白背景上几乎看不见。 */
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 200, 0.95),
    inset 0 -3px 0 rgba(176, 118, 12, 0.5),
    0 2px 5px rgba(150, 100, 10, 0.35),
    0 0 7px rgba(255, 196, 50, 0.55);
}

/* 炸开：从牌心向四周飞，边飞边转，最后淡出 */
.fx-bit:not(.fx-bit--fall) {
  animation: fxBurst 0.9s cubic-bezier(0.16, 0.8, 0.3, 1) forwards;
}

@keyframes fxBurst {
  0% {
    transform: translate(0, 0) scale(0.4) rotate(0deg);
    opacity: 0;
  }
  18% { opacity: 1; }
  70% { opacity: 1; }
  100% {
    transform: translate(var(--dx, 0px), var(--dy, -80px)) scale(1.05) rotate(var(--spin, 180deg));
    opacity: 0;
  }
}

/* 掉落：从屏幕顶上往下掉，横向飘一点，像下金币雨 */
.fx-bit--fall {
  top: -40px;
  animation: fxFall var(--dur, 1.4s) cubic-bezier(0.35, 0.1, 0.7, 1) var(--delay, 0s) forwards;
}

@keyframes fxFall {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.7);
    opacity: 0;
  }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% {
    transform: translate(var(--drift, 0px), 106vh) rotate(var(--spin, 360deg)) scale(1);
    opacity: 0.9;
  }
}

/* 连对时整屏闪一下：一层白光压在页面上面，说完就没 */
.fx-flash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.86) 0%, rgba(255, 236, 158, 0.5) 30%, rgba(255, 236, 158, 0) 66%);
  animation: fxFlash 0.6s ease-out forwards;
}

/* 亮度只到 0.5：整屏刷白会把刚炸出来的金币一起盖掉，
   庆祝特效自己遮住庆祝对象，等于没做。 */
@keyframes fxFlash {
  0%   { opacity: 0; }
  18%  { opacity: 0.5; }
  55%  { opacity: 0.34; }
  100% { opacity: 0; }
}

/* ---- 过关弹窗 ---- */
.memory__over {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(48, 36, 84, 0.52);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: overFade 0.24s ease-out;
}

@keyframes overFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.memory__pop {
  width: min(360px, 88vw);
  padding: 26px 22px 24px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, #fff6d8 0%, rgba(255, 246, 216, 0) 60%),
    #fffdf6;
  box-shadow: 0 10px 0 #d9c9a4, 0 18px 40px rgba(40, 28, 70, 0.35);
  text-align: center;
  animation: popIn 0.42s cubic-bezier(0.34, 1.5, 0.5, 1);
}

@keyframes popIn {
  0%   { transform: scale(0.7) translateY(18px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.memory__pop-kicker {
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #e08a1e;
}

.memory__pop-title {
  margin-top: 6px;
  font-size: clamp(26px, 7.6vw, 34px);
  font-weight: 900;
  line-height: 1.2;
  color: #3a2a6b;
}

.memory__pop-sub {
  margin-top: 8px;
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 700;
  color: var(--ink-soft);
}

.memory__pop-btn {
  min-height: 66px;
  width: 100%;
  margin-top: 20px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%);
  box-shadow: 0 6px 0 #2f9d66;
  font-size: clamp(19px, 5vw, 22px);
  font-weight: 900;
  color: #ffffff;
  animation: btnBreathe 1.4s ease-in-out infinite;
}

.memory__pop-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 #2f9d66;
}

@keyframes btnBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

.memory__pop-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* ---------- 戳泡泡 ---------- */
.bubble {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.bubble__hint {
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 700;
  color: var(--ink-soft);
}

/* 小号喇叭：在头顶那一行，不能抢泡泡的视觉重量 */
.ear-btn--sm {
  min-height: 60px;
  padding: 0 20px;
  gap: 8px;
  box-shadow: 0 5px 0 #2d6cb5;
  flex: 0 0 auto;
}

.ear-btn--sm svg {
  width: 26px;
  height: 26px;
}

.ear-btn--sm .ear-btn__text {
  font-size: clamp(15px, 4vw, 18px);
}

/* 正在念题：喇叭轻轻跳两下。
   语音是听不见的（比如静音、系统没装英语声音），这道光至少告诉孩子
   "它说过了"，不会一直干等。 */
.ear-btn.is-saying {
  animation: earPulse 0.52s ease-in-out 2;
}

@keyframes earPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 5px 0 #2d6cb5; }
  45%      { transform: scale(1.05); box-shadow: 0 5px 0 #2d6cb5, 0 0 0 10px rgba(86, 167, 235, 0.22); }
}

/* 泡泡池：一整块浅蓝，overflow 裁掉飞出顶部的泡泡 */
.bubble-field {
  position: relative;
  overflow: hidden;

  height: clamp(300px, 46vh, 410px);
  border-radius: 30px;
  /* 几团柔光叠在水里。纯平色在泡泡退场那一瞬间就是一块白板，
     有深有浅才像"水"，空池也不显得断档。 */
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 44%),
    radial-gradient(circle at 84% 22%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 26% 76%, rgba(160, 214, 244, 0.55), rgba(160, 214, 244, 0) 34%),
    radial-gradient(circle at 76% 88%, rgba(186, 226, 248, 0.5), rgba(186, 226, 248, 0) 30%),
    linear-gradient(180deg, #eaf7ff 0%, #d3ecfb 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);

  touch-action: manipulation;
}

/* 一颗泡泡：外层负责上浮，内层负责爆开，两层动画互不干扰 */
.bub {
  position: absolute;
  left: var(--x, 50%);
  bottom: 0;

  width: var(--size, 80px);
  height: var(--size, 80px);
  margin-left: calc(var(--size, 80px) / -2);
  padding: 0;

  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  animation: floatUp var(--dur, 7s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

/* 中层：横向摆动 + 一点倾斜。
   周期和幅度由 JS 逐颗给（--sway-dur / --sway-amp），
   三颗用同一组参数会摇得像排练过，一眼看出是动画。 */
.bub__sway {
  display: block;
  width: 100%;
  height: 100%;
  animation: bubSway var(--sway-dur, 3.4s) ease-in-out infinite;
  animation-delay: var(--sway-delay, 0s);
  will-change: transform;
}

@keyframes bubSway {
  0%, 100% {
    transform: translateX(calc(-1 * var(--sway-amp, 9px))) rotate(-2.4deg);
  }
  50% {
    transform: translateX(var(--sway-amp, 9px)) rotate(2.4deg);
  }
}

.bub__ball {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.92);

  background: radial-gradient(circle at 34% 28%,
    #ffffff 0%,
    rgba(255, 255, 255, 0.84) 18%,
    rgba(150, 215, 245, 0.72) 58%,
    rgba(112, 190, 232, 0.55) 100%);
  box-shadow: inset 0 -8px 16px rgba(96, 160, 200, 0.22),
    0 8px 18px rgba(90, 150, 190, 0.16);

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: calc(var(--size, 80px) * 0.48);
  font-weight: 800;
  line-height: 1;
  /* 泡泡本身是浅蓝，字母再浅就糊在一起了 */
  color: #1d5f96;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);

  transition: transform var(--t-press) ease;
}

.bub:active .bub__ball {
  transform: scale(0.94);
}

/* 戳对：爆开 */
.bub.is-pop {
  pointer-events: none;
}

.bub.is-pop .bub__ball {
  animation: bubPop 0.45s ease-out forwards;
}

/* 戳错：只晃不破 */
.bub.is-wrong .bub__ball {
  animation: shake 0.5s ease-in-out;
}

.bubble__status {
  min-height: 30px;
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 800;
  text-align: center;
  color: var(--green);
}

.bubble__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* 行程（--rise）已经收在池子内部，所以这里可以放心走到 100%：
   泡泡在池顶折返，靠"末尾淡出 + 开头淡入"接缝，看不出是循环。 */
/* 淡出压到最后一小段。
   淡出区间一长，泡泡就有相当一段时间是半透明的——
   万一那正是要戳的那颗，孩子会站在那儿找不到它。 */
@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.94);
    opacity: 0;
  }
  7%   { opacity: 1; }
  87%  { opacity: 1; }
  97%  { opacity: 0; }
  100% {
    transform: translateY(calc(-1 * var(--rise, 400px))) scale(1.03);
    opacity: 0;
  }
}

@keyframes bubPop {
  0%   { transform: scale(1); opacity: 1; }
  45%  { transform: scale(1.3); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* 水花层：常驻，压在所有泡泡上面。
   水珠是从泡泡的破口往外溅，被泡泡挡住就只剩几颗边角。 */
.splash {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.splash__ring {
  position: absolute;
  width: calc(var(--r, 40px) * 2);
  height: calc(var(--r, 40px) * 2);
  margin-left: calc(var(--r, 40px) * -1);
  margin-top: calc(var(--r, 40px) * -1);
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(150, 220, 255, 0.75);
  animation: splashRing 0.58s ease-out forwards;
}

@keyframes splashRing {
  0%   { transform: scale(0.45); opacity: 0.9; }
  60%  { opacity: 0.4; }
  100% { transform: scale(1.6); opacity: 0; }
}

.splash__drop {
  position: absolute;
  width: var(--sz, 6px);
  height: var(--sz, 6px);
  margin-left: calc(var(--sz, 6px) / -2);
  margin-top: calc(var(--sz, 6px) / -2);
  border-radius: 50%;
  /* 水珠要能在浅蓝池子上看见：只靠浅蓝渐变会整个融进背景 */
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #9fdcf7 42%, #58b4e4 100%);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 1px 4px rgba(70, 150, 200, 0.4);
  animation: splashFly 0.6s cubic-bezier(0.18, 0.86, 0.42, 1) forwards;
  animation-delay: var(--dl, 0ms);
}

/* 末段整体再往下偏 20px：水珠飞出去之后是要掉的，
   一直直线飞会像烟花，不像水。 */
@keyframes splashFly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  55% {
    transform: translate(calc(var(--dx, 40px) * 0.86), calc(var(--dy, 40px) * 0.86)) scale(0.95);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 40px), calc(var(--dy, 40px) + 20px)) scale(0.32);
    opacity: 0;
  }
}

/* 结算画面：一颗大星星 + 一圈慢慢转的彩色小点 */
.bubble__done {
  position: absolute;
  inset: 0;
  z-index: 2;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;

  animation: doneIn 0.55s cubic-bezier(0.34, 1.4, 0.5, 1);
}

.bubble__done svg {
  width: clamp(104px, 27vw, 140px);
  height: auto;
  filter: drop-shadow(0 6px 10px rgba(224, 160, 28, 0.28));
  animation: starPop 0.7s cubic-bezier(0.34, 1.5, 0.5, 1);
}

.bubble__done p {
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: 900;
  color: #2b6ea8;
  letter-spacing: 0.02em;
}

.bubble__confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  opacity: 0;
  animation: confettiOrbit 2.4s ease-out forwards;
}

@keyframes doneIn {
  0%   { opacity: 0; transform: translateY(14px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes starPop {
  0%   { transform: scale(0.2) rotate(-24deg); }
  60%  { transform: scale(1.12) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* 小点从中心甩出去，再停在四周轻轻浮沉 */
@keyframes confettiOrbit {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4); }
  35%  { opacity: 1; transform: translate(var(--ax, 80px), var(--ay, 60px)) scale(1); }
  100% { opacity: 0.85; transform: translate(var(--ax, 80px), calc(var(--ay, 60px) * 0.96)) scale(0.92); }
}

/* 戳中之后，剩下的泡泡自己缩走。
   只动内层：外层还在跑上浮，改外层的 transform 会让它当场跳位。 */
.bub.is-out {
  pointer-events: none;
}

.bub.is-out .bub__ball {
  /* 晚 90ms 再走：三颗同时消失看着像画面被切断，
     稍微错开才有"自己飘走"的感觉 */
  animation: bubOut 0.46s ease-in 0.09s forwards;
}

@keyframes bubOut {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.22); opacity: 0; }
}

/* ---------- 小怪兽吃字母 ---------- */
.monster {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* 题目条：一张小图 + 单词，横着排省高度 */
.monster__q {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 14px 8px 8px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 0 #e9dfcc;
}

.monster__food {
  flex: 0 0 auto;
  width: clamp(54px, 14vw, 72px);
  height: clamp(54px, 14vw, 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff8e8;
  animation: riseIn var(--t-soft) ease-out both;
}

.monster__food svg {
  width: 86%;
  height: 86%;
  display: block;
}

.monster__food-text {
  font-size: clamp(14px, 3.6vw, 17px);
  font-weight: 800;
  color: var(--ink-soft);
}

.monster__qtext {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.monster__ask {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;

  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 800;
  color: var(--ink-soft);
}

/* 第几题：小字跟在问句后面。
   塞进问句里（"它开头是哪个字母？（1 / 5）"）在 390 宽的屏上会折行，
   折出来的半行正好把下面的单词顶下去，整块题面就散了 */
.monster__round {
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #b9a68a;
}

.monster__word {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(16px, 4.4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* 💡提示钮。放在题目条右端，而不是固定在屏幕角落——
   游戏页右下角有激活码水印，两块会叠在一起；而且水印是 pointer-events:none，
   真叠上了孩子点不动，会以为按钮坏了。 */
.monster__bulb {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: clamp(50px, 13.5vw, 60px);
  padding: 3px 0 5px;

  border: 3px solid #ffd9a0;
  border-radius: 16px;
  background: #fffdf6;
  box-shadow: 0 4px 0 #f0c98a;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s ease, box-shadow 0.14s ease,
    border-color 0.2s ease, background-color 0.2s ease;
}

.monster__bulb:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #f2c98c,
    0 4px 8px -4px rgba(138, 111, 84, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.95);
}

/* 已经用过提示：边框转绿，但**不置灰**——置灰等于告诉孩子"这条路封了"，
   而他很可能还想再听一遍单词 */
.monster__bulb.is-used {
  border-color: #cde6c2;
  background: #f3fbf0;
}

.monster__bulb-ico {
  font-size: clamp(17px, 4.6vw, 21px);
  line-height: 1.1;
}

.monster__bulb-text {
  font-size: clamp(10px, 2.9vw, 12px);
  font-weight: 800;
  line-height: 1.2;
  color: #a07a44;
}

/* ---------- 💡提示层：一张大图，一句慢读 ----------
   这一层里没有任何文字拼写：图是谜面，读音是谜面，
   答案是孩子自己从声音里听出来的那个开头字母。
   挂在 body 上（见 app.js），所以用 fixed 不会被祖宗的 transform 挪走。 */
.monster__peek {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  /* 靠上而不是居中：居中时卡片下沿正好压在字母卡上，
     孩子看不到自己要拖的那三个字母，还得先关掉提示才能拖。 */
  align-items: flex-start;
  justify-content: center;
  padding: clamp(52px, 9vh, 96px) 24px 24px;
}

.monster__peek-scrim {
  position: absolute;
  inset: 0;
  background: rgba(58, 44, 24, 0.5);
}

.monster__peek-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;

  width: min(78vw, 320px);
  padding: 30px 20px 18px;

  border: 5px solid #ffd9a0;
  border-radius: 30px;
  background: #fffdf7;
  box-shadow: 0 18px 40px rgba(58, 44, 24, 0.34);

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.monster__peek-card.is-in {
  animation: peekIn 0.34s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

@keyframes peekIn {
  0%   { opacity: 0; transform: scale(0.82) translateY(12px); }
  70%  { opacity: 1; transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.monster__peek-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(52vw, 210px);
  height: min(52vw, 210px);
  border-radius: 50%;
  background: #fff6e4;
}

.monster__peek-pic svg {
  width: 88%;
  height: 88%;
  display: block;
}

/* 点一下重播时图弹一下：让"我又念了一次"有个看得见的落点 */
.monster__peek-pic.is-ping {
  animation: peekPing 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes peekPing {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.1) rotate(-3deg); }
  72%  { transform: scale(0.97) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.monster__peek-text {
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 800;
  color: var(--ink-soft);
}

.monster__peek-say {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(12px, 3.4vw, 14px);
  font-weight: 800;
  color: #9c8869;
}

.monster__peek-say i {
  font-style: normal;
  font-size: 1.25em;
}

/* ✕ 要够大：这是孩子唯一不用认字就能懂的"关掉" */
.monster__peek-x {
  position: absolute;
  top: -15px;
  right: -15px;

  width: 46px;
  height: 46px;

  border: 4px solid #ffd9a0;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 4px 0 #f0c98a;

  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: #a07a44;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.monster__peek-x:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #f0c98a;
}

/* 横屏 / 矮窗口：图缩小一档，别让卡片顶出屏幕 */
@media (max-height: 520px) {
  .monster__peek-pic {
    width: min(38vh, 150px);
    height: min(38vh, 150px);
  }
}

/* 提示开着的时候，字母卡浮到遮罩上面：
   孩子看完大图不用先找 ✕，直接按住字母拖给怪兽就行
   （拖起来的一瞬间提示层会自己收掉，见 beginDrag）。 */
.monster.is-peeking .monster__tray {
  position: relative;
  z-index: 250;
}

/* 点提示时图跳一下：把"这个词就是这个东西"说到脸上 */
.monster__food.is-ping {
  animation: foodPing 0.56s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes foodPing {
  0%   { transform: scale(1) rotate(0deg); }
  35%  { transform: scale(1.18) rotate(-5deg); }
  68%  { transform: scale(0.96) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* 怪兽舞台：星星层叠在上面，不吃点击 */
.monster__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(146px, 38vw, 196px);
}

.monster__body {
  width: clamp(136px, 36vw, 184px);
  height: clamp(136px, 36vw, 184px);
  display: block;
  transform-origin: 50% 85%;   /* 缩放时脚不太跑，像蹲一下而不是浮起来 */
}

.monster__body svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 嘴（含舌头）和腮要能被 CSS 单独变形，必须以自身为坐标系 */
.monster__jaw,
.monster__cheek {
  transform-box: fill-box;
  transform-origin: center;
}

/* 卡片拖到嘴边时张嘴。用 transition 而不是 animation：
   手指可能来回进出判定区，transition 能从中途接上，不会从头重播。 */
.monster__jaw {
  transition: transform 0.16s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.monster__body.is-ready .monster__jaw {
  transform: scale(1.16, 1.5);
}

/* 等着吃的时候轻轻上下颠，像在咽口水 */
.monster__body.is-ready {
  animation: monsterYum 0.78s ease-in-out infinite;
}

@keyframes monsterYum {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.03, 0.98); }
}

.monster__spark {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 咬合 */
.monster__body.is-chomp {
  animation: chompBounce 0.9s ease-in-out;
}

.monster__body.is-chomp .monster__jaw {
  animation: chew 0.9s ease-in-out;
}

.monster__body.is-chomp .monster__cheek {
  animation: cheekPuff 0.9s ease-in-out;
}

/* 喂错：怪兽摇头 */
.monster__body.is-no {
  animation: monsterNo 0.72s ease-in-out;
}

/* 卡片已经送到嘴边、正在往里飞：嘴张到最大。
   比 is-ready 更大一档，"要吞下去了"和"张着嘴等"是两个程度。 */
.monster__body.is-mouth-open .monster__jaw {
  transform: scale(1.34, 2.05);
}

/* 打饱嗝：身子往上一顶，再落回来，像人被嗝顶了一下 */
.monster__body.is-burp {
  animation: monsterBurp 0.66s cubic-bezier(0.3, 1.3, 0.5, 1);
}

@keyframes monsterBurp {
  0%   { transform: translateY(0) scale(1); }
  26%  { transform: translateY(-9px) scale(1.05, 1.02); }
  52%  { transform: translateY(2px) scale(0.97, 1.03); }
  76%  { transform: translateY(-3px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}

/* "嗝～"的对话框：从嘴边冒出来，飘一下就散 */
.monster__burp {
  position: absolute;
  right: 4%;
  top: -2%;
  z-index: 4;

  padding: 7px 16px;
  border-radius: 18px 18px 18px 4px;
  background: #fff8e0;
  box-shadow: inset 0 0 0 2.5px #f0c98a, 0 4px 0 rgba(196, 164, 110, 0.5);

  font-size: clamp(17px, 4.6vw, 21px);
  font-weight: 900;
  color: #a05a12;
  white-space: nowrap;
  transform-origin: 10% 100%;

  opacity: 0;
  transform: scale(0.4) translateY(6px);
  pointer-events: none;
}

/* 气泡的小尾巴，指向怪兽的嘴 */
.monster__burp::after {
  content: '';
  position: absolute;
  left: 10px;
  bottom: -9px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 4px solid transparent;
  border-top: 9px solid #fff8e0;
  filter: drop-shadow(0 2.5px 0 rgba(196, 164, 110, 0.5));
}

.monster__burp.is-on {
  animation: burpBubble 1.34s cubic-bezier(0.34, 1.5, 0.5, 1) forwards;
}

/* 停在屏幕上足够久：3 岁孩子从"吃完"到"注意到有字"要花一两秒，
   快闪一下就没了等于没写。 */
@keyframes burpBubble {
  0%   { opacity: 0; transform: scale(0.4) translateY(10px) rotate(-8deg); }
  16%  { opacity: 1; transform: scale(1.06) translateY(0) rotate(-4deg); }
  30%  { transform: scale(1) translateY(-4px) rotate(-4deg); }
  70%  { opacity: 1; transform: scale(1) translateY(-8px) rotate(-3deg); }
  100% { opacity: 0; transform: scale(0.92) translateY(-30px) rotate(-2deg); }
}

/* 爱心层：不吃点击，跟着怪兽走 */
.monster__hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.monster__heart {
  position: absolute;
  font-style: normal;
  font-size: var(--size, 16px);
  line-height: 1;
  color: #ff5f8f;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);

  animation: heartFloat 1.7s ease-out forwards;
}

/* 爱心要"从嘴里升到头顶再消失"。
   用百分比位移会按字号算——一颗 18px 的爱心升 260% 只有 47px，
   全堆在脸上糊成一团。所以位移走 px（--rise 由 JS 给）。 */
@keyframes heartFloat {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  22% {
    transform: translate(calc(-50% + var(--dx, 0px) * 0.35),
                         calc(-50% - var(--rise, 120px) * 0.3)) scale(1.15);
    opacity: 1;
  }
  62% {
    transform: translate(calc(-50% + var(--dx, 0px) * 0.8),
                         calc(-50% - var(--rise, 120px) * 0.72)) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0px)),
                         calc(-50% - var(--rise, 120px))) scale(0.8);
    opacity: 0;
  }
}

/* 三个字母：手掌大，一格一指宽 */
.monster__tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.monster__tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: clamp(84px, 22vw, 106px);

  border: 4px solid #ffd9a0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 6px 0 #f0c98a;

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(38px, 10vw, 52px);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);

  /* 拖拽的三条前提，缺一条手机上就会出洋相：
     touch-action:none —— 按住卡片拖时页面不能跟着滚；
     user-select:none —— 长按不会选中文字、弹出复制菜单；
     -webkit-touch-callout —— iOS 长按不弹"存储图像"那类面板。 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease,
    background-color var(--t-press) ease, border-color var(--t-press) ease;
}

/* 按下不再做下沉位移：位移已经交给拖拽的 transform，
   两条规则抢同一个属性，卡片会在按下的瞬间先跳一下 */
.monster__tile:active {
  box-shadow: 0 3px 0 #f0c98a;
}

/* 卡片内容：只有一个字母，永远不印单词。
   印上 apple，孩子会拿"单词的形状"去对"字母的形状"，
   听音这一步被整个绕开，这一题就白做了。
   要提示就给图 + 读音，见下面的 .monster__peek。 */
.monster__tile-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transform-origin: 50% 55%;
}

.monster__tile-letter {
  display: block;
  font-size: clamp(38px, 10vw, 52px);
  line-height: 0.95;
}

/* 抖动挪到内层。外层此刻身上挂着拖拽的 translate3d，
   直接在外层放 animation 会把位移整个顶掉，卡片当场弹回原位。 */
.monster__tile.is-wrong {
  border-color: #ff8a8a;
  background: #ffeeee;
}

.monster__tile.is-wrong .monster__tile-in {
  animation: tileShake 0.62s ease-in-out;
}

@keyframes tileShake {
  0%, 100% { transform: rotate(0deg); }
  18%      { transform: rotate(-7deg); }
  40%      { transform: rotate(6deg); }
  62%      { transform: rotate(-4deg); }
  82%      { transform: rotate(2deg); }
}

/* 已经喂进嘴里的字母：留位置，别让整排重排 */
.monster__tile.is-gone {
  visibility: hidden;
}

/* ---- 拖拽中的状态 ---- */

/* 拖起来：抬起阴影 + 不要过渡。
   这里千万不能有 transition，否则卡片会慢半拍地追手指，手感立刻变"粘"。 */
.monster__tile.is-dragging {
  z-index: 60;
  transition: none;
  cursor: grabbing;
  border-color: #ffc978;
  opacity: 0.9;
  box-shadow: 0 16px 26px rgba(74, 58, 32, 0.26);
}

/* 卡片中心进了嘴的判定区 */
.monster__tile.is-over {
  border-color: #5cc45e;
  background: #effcf2;
  box-shadow: 0 12px 22px rgba(47, 157, 102, 0.26), 0 0 0 4px rgba(92, 196, 94, 0.3);
}

/* 松手回弹：带一点点过冲，像被橡皮筋拉回去 */
.monster__tile.is-settling {
  transition: transform 0.34s cubic-bezier(0.34, 1.4, 0.5, 1),
    border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

/* 喂对：缩进嘴里。这条要排在 is-dragging 后面，
   否则 is-dragging 的 transition:none 会把这段缩放进嘴的过渡吃掉 */
.monster__tile.is-eaten {
  z-index: 61;
  opacity: 0.28;
  transition: transform 0.3s cubic-bezier(0.45, 0, 0.9, 0.6), opacity 0.3s ease;
}

/* 第一题的暗示动作：告诉孩子"这张能拿起来" */
.monster__tile.is-hint .monster__tile-in {
  animation: tileLift 1.15s cubic-bezier(0.34, 1.5, 0.5, 1) 0.45s 2;
}

@keyframes tileLift {
  0%, 100% { transform: translateY(0); }
  42%      { transform: translateY(-10px); }
}

.monster__status {
  min-height: 30px;
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 800;
  text-align: center;
  color: var(--green);
}

/* 喂错了改用暖橙：绿色在这种语境里等于"对了"，会把孩子带偏 */
.monster__status.is-bad {
  color: #e0603f;
}

.monster__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.monster__btn {
  min-height: 64px;
  padding: 0 26px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 0 #e5dcc9;

  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 800;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.monster__btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 #e5dcc9;
}

.monster__btn--again {
  background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%);
  box-shadow: 0 5px 0 #2f9d66;
  color: #ffffff;
}

.monster__btn--again:active {
  box-shadow: 0 1px 0 #2f9d66;
}

@keyframes chew {
  0%   { transform: scaleY(1); }
  16%  { transform: scaleY(0.1); }
  34%  { transform: scaleY(1); }
  52%  { transform: scaleY(0.1); }
  70%  { transform: scaleY(0.92); }
  86%  { transform: scaleY(0.45); }
  100% { transform: scaleY(1); }
}

@keyframes cheekPuff {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.55); }
  62%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

@keyframes chompBounce {
  0%   { transform: scale(1); }
  16%  { transform: scale(1.1, 0.9); }
  36%  { transform: scale(0.96, 1.06); }
  56%  { transform: scale(1.05, 0.96); }
  76%  { transform: scale(1); }
  100% { transform: scale(1); }
}

@keyframes monsterNo {
  0%   { transform: translateX(0) rotate(0deg); }
  20%  { transform: translateX(-9px) rotate(-4deg); }
  45%  { transform: translateX(9px) rotate(4deg); }
  70%  { transform: translateX(-5px) rotate(-2deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

/* ---- 投喂口：拖动时才出现的虚线框 ---- */
.monster__target {
  position: absolute;
  box-sizing: border-box;

  border: 4px dashed #ffcf8a;
  border-radius: 28px;

  opacity: 0;
  transform: scale(0.84);
  pointer-events: none;

  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.monster.is-dragging .monster__target {
  opacity: 1;
  transform: scale(1);
}

/* 卡片中心一旦进框，框变实心绿——这是"现在松手就成"的唯一提示 */
.monster.is-over .monster__target {
  border-style: solid;
  border-color: #5cc45e;
  transform: scale(1.05);
}

.monster__hint {
  min-height: 20px;
  margin-top: -2px;

  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 700;
  text-align: center;
  color: #9b9078;
}

/* ---------- 连击特效 ---------- */
/* 一整层 fixed 覆盖，pointer-events:none —— 撒星星的时候孩子还能继续点 */
.combo-layer {
  position: fixed;
  inset: 0;
  z-index: 95;

  overflow: hidden;
  pointer-events: none;
}

.combo-pop {
  position: absolute;
  left: 50%;
  top: 48%;        /* 落在屏幕中线偏下：避开顶部两行标题，又能压住整个画面 */

  display: flex;
  align-items: baseline;
  gap: 12px;

  padding: 8px 30px 14px;

  border: 3px solid #ffd75e;
  border-radius: 30px;
  /* 深紫底板 + 亮金字。
     一开始试的是"白字 + 橙描边"，压在米色底上几乎看不见；
     后来换成"金黄字 + 深棕描边"还是糊。浅色页面上，
     唯一稳的办法是把字放进一块深色板里——对比度直接拉满，
     顺便有了"成就弹窗"的分量。 */
  background: linear-gradient(165deg, #4b2f8f 0%, #2a1b57 100%);
  box-shadow: 0 10px 0 rgba(42, 27, 87, 0.32),
    0 20px 36px rgba(42, 27, 87, 0.34);

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;

  color: #ffd75e;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);

  animation: comboPop 1.18s cubic-bezier(0.2, 1.55, 0.4, 1) both;
}

/* 连到 5 次换暖红、8 次换蓝紫。换色比字号变大更能让孩子觉得"我升级了" */
.combo-pop.is-hot {
  background: linear-gradient(165deg, #c2410c 0%, #7c2d12 100%);
  border-color: #ffd75e;
  color: #ffe9a3;
}

.combo-pop.is-fire {
  background: linear-gradient(165deg, #1e3a8a 0%, #111c4e 100%);
  border-color: #7dd3fc;
  color: #a5f3fc;
}

.combo-pop__num {
  font-size: clamp(19px, 5.8vw, 28px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.combo-pop__x {
  font-size: clamp(46px, 14.5vw, 86px);
  color: #fff8c9;
}

.combo-pop.is-fire .combo-pop__x {
  color: #e8fbff;
}

@keyframes comboPop {
  0%   { transform: translate(-50%, -50%) scale(0.22) rotate(-11deg); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1.3) rotate(4deg); opacity: 1; }
  46%  { transform: translate(-50%, -50%) scale(0.92) rotate(-2deg); }
  60%  { transform: translate(-50%, -50%) scale(1.08) rotate(1.5deg); }
  72%  { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { transform: translate(-50%, -74%) scale(0.84); opacity: 0; }
}

/* 落下来的星星和金币。--size / --drift / --spin / --dur / --delay 由 JS 随机填 */
.combo-bit {
  position: absolute;
  top: -34px;

  width: var(--size, 18px);
  height: var(--size, 18px);

  background: #ffd84d;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
    50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);

  animation: comboFall var(--dur, 1.3s) linear var(--delay, 0s) both;
  will-change: transform;
}

.combo-bit--coin {
  clip-path: none;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff6bf 0%, #ffd53f 46%, #e0a013 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

@keyframes comboFall {
  0%   { transform: translate3d(0, -34px, 0) rotate(0deg) scale(0.7); opacity: 0; }
  9%   { opacity: 1; }
  100% { transform: translate3d(var(--drift, 0px), 104vh, 0) rotate(var(--spin, 180deg)) scale(1); }
}

/* ---------- 字母打地鼠 ---------- */
.whack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whack__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.whack__hint {
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 700;
  color: var(--ink-soft);
}

/* 计时条。宽度由 rAF 每帧直接写，别加 transition——
   加了就会慢半拍，看上去时间比实际走得慢。 */
.whack__meter {
  height: 14px;
  border-radius: 999px;
  background: #e8dfcb;
  box-shadow: inset 0 2px 4px rgba(90, 70, 30, 0.14);
  overflow: hidden;
}

.whack__bar {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #86dd6f 0%, #52c05a 100%);
}

.whack__bar.is-mid {
  background: linear-gradient(90deg, #ffd75e 0%, #f5b23c 100%);
}

.whack__bar.is-low {
  background: linear-gradient(90deg, #ff9d8a 0%, #ef6b5b 100%);
}

/* 草地 + 四个洞 */
.whack__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.whack-hole {
  position: relative;
  overflow: hidden;            /* 地鼠靠它藏到地面以下 */
  aspect-ratio: 1 / 0.86;

  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 116%, #a2da8d 0%, #b8e5a4 48%, #cdeec0 100%);
  box-shadow: inset 0 -7px 14px rgba(84, 134, 66, 0.16);
}

/* 洞口。z-index 压在地鼠上，地鼠下半身就"陷"进洞里，
   而不是浮在洞上面——这一层是"从地里钻出来"和"贴纸片"的分界。 */
.whack-hole__pit {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 3%;
  z-index: 3;

  height: 16%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 24%, #2a231b 0%, #3f362a 58%, #5c5041 100%);
  /* 最外那圈是翻出来的土：没有它，黑椭圆像贴在草地上的一个洞贴纸；
     有了这一圈土，洞才是"从地里挖出来的"。 */
  box-shadow: inset 0 5px 9px rgba(0, 0, 0, 0.5), 0 -2px 0 rgba(255, 255, 255, 0.16),
    0 0 0 4px #c8a074, 0 2px 7px rgba(84, 134, 66, 0.24);
}

/* 地鼠：默认蹲在洞下，冒头 / 缩回各有一段 keyframes。
   不用 transition 的原因：transition 只会"平移到某个位置"，做不出
   "窜出来时冲过头一点再稳住""缩回去先压一下"这两下；
   而这两下正是"活的"和"贴纸"的区别。 */
.whack-mole {
  position: absolute;
  left: 50%;
  bottom: 8%;
  z-index: 2;
  /* 62% → 68%：一波最多两只，洞里空得多，地鼠可以做大一点。
     3 岁的手指按 108px 宽的东西本来就偏小，这个尺寸才是"看得见也敲得中"。
     再大就会顶到洞口上沿被裁掉（0.68 × 1.12 ≈ 洞高的 88%，加 8% 底边刚好） */
  width: 68%;

  transform: translate(-50%, 108%);
  transition: none;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* both：动画结束后停在最后一帧。冒头停在 translateY(0)，
   缩回停在地下——这样摘掉类的一瞬间不会先跳回起点再动一下。 */
.whack-mole.is-up {
  animation: moleUp 0.36s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.whack-mole.is-down {
  animation: moleDown 0.28s ease-in both;
}

@keyframes moleUp {
  0%   { transform: translate(-50%, 108%) scale(0.92, 1.08); }
  62%  { transform: translate(-50%, -7%) scale(1.03, 0.97); }
  100% { transform: translate(-50%, 0) scale(1, 1); }
}

@keyframes moleDown {
  0%   { transform: translate(-50%, 0) scale(1, 1); }
  28%  { transform: translate(-50%, -4%) scale(0.98, 1.03); }
  100% { transform: translate(-50%, 108%) scale(0.92, 1.08); }
}

.whack-mole__in {
  position: relative;
  display: block;
  transform-origin: 50% 92%;   /* 被打中时从底部往下压，像被锤子砸了一下 */
  will-change: transform;
}

.whack-mole__in svg {
  display: block;
  width: 100%;
  height: auto;
}

/* 地鼠举的字母牌 */
.whack-mole__card {
  position: absolute;
  left: 50%;
  bottom: 14%;

  width: 58%;
  padding: 3% 0 4.5%;

  transform: translateX(-50%);

  border: 3px solid #e2c79a;
  border-radius: 12px;
  background: #fffdf6;
  box-shadow: 0 3px 0 #dcc08c;

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(20px, 6.4vw, 28px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  color: #3f5f55;
}

/* ---- 表情：两套眼睛，打中换 × ---- */
.whack-mole__xeyes {
  display: none;
}

.whack-mole.is-hit .whack-mole__eyes {
  display: none;
}

.whack-mole.is-hit .whack-mole__xeyes {
  display: block;
}

/* 打中：压扁再弹回 */
.whack-mole.is-hit .whack-mole__in {
  animation: moleSquash 0.44s cubic-bezier(0.3, 1.4, 0.5, 1);
}

@keyframes moleSquash {
  0%   { transform: translateY(0) scale(1, 1); }
  28%  { transform: translateY(8%) scale(1.16, 0.82); }
  58%  { transform: translateY(-3%) scale(0.95, 1.07); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* 打中：头顶转圈的小星星 */
.whack-mole__dizzy {
  position: absolute;
  left: 50%;
  top: 21%;      /* 整圈都得留在洞口以内，太靠上会被 overflow 裁掉一半 */

  width: 0;
  height: 0;
  opacity: 0;
}

.whack-mole__dizzy i {
  position: absolute;

  width: 13px;
  height: 13px;
  margin: -6.5px;

  background: #ffd54f;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
    50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 1px 1px rgba(90, 60, 0, 0.24));
}

.whack-mole__dizzy i:nth-child(1) { transform: rotate(0deg) translate(23px); }
.whack-mole__dizzy i:nth-child(2) { transform: rotate(120deg) translate(23px); }
.whack-mole__dizzy i:nth-child(3) { transform: rotate(240deg) translate(23px); }

.whack-mole.is-hit .whack-mole__dizzy {
  opacity: 1;
  animation: dizzySpin 1.05s linear infinite;
}

@keyframes dizzySpin {
  to { transform: rotate(360deg); }
}

/* 敲错：缩回去之前先原地晃，告诉孩子"这个不对" */
.whack-mole.is-miss .whack-mole__in {
  animation: moleFlail 0.36s ease-in-out;
}

@keyframes moleFlail {
  0%, 100% { transform: rotate(0deg); }
  26%      { transform: rotate(-8deg); }
  64%      { transform: rotate(7deg); }
}

/* 时间到：把正确答案那只拎出来晃两下，牌面变绿 */
.whack-mole.is-reveal {
  z-index: 4;
}

.whack-mole.is-reveal .whack-mole__in {
  animation: moleReveal 0.62s ease-in-out 2;
}

@keyframes moleReveal {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-13%) scale(1.08); }
}

.whack-mole.is-reveal .whack-mole__card {
  border-color: #5cc45e;
  color: #2f9d66;
  box-shadow: 0 0 0 5px rgba(92, 196, 94, 0.32), 0 3px 0 #dcc08c;
}

/* ---- 底部提示与结算 ---- */
.whack__status {
  min-height: 22px;
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 800;
  text-align: center;
  color: var(--green);
}

.whack__result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  padding: 34px 16px 16px;
  text-align: center;
}

/* 结算了就别再留着"再听一次"和那条空时间条——
   它们会让孩子以为还能继续打，也会把结算卡挤到下半屏 */
.whack.is-done .whack__head,
.whack.is-done .whack__meter {
  display: none;
}

/* 结算卡在容器里居中：不然内容全顶着上沿，底下空一大块 */
.whack.is-done {
  justify-content: center;
  min-height: 360px;
}

.whack__medal {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 2px;
}

/* 三颗星按打中数点亮：7 只以上满星，5 只两星，其余一星。
   和全站星星经济同一套符号，孩子一眼知道自己这局打得怎么样。 */
.whack__star {
  width: clamp(34px, 9.6vw, 44px);
  height: auto;
  color: #e8dfcb;
}

.whack__star.is-on {
  color: #ffc531;
  filter: drop-shadow(0 3px 0 rgba(198, 140, 0, 0.22));
}

.whack__score {
  font-size: clamp(22px, 6.6vw, 30px);
  font-weight: 900;
  line-height: 1.35;
  color: var(--ink);
}

.whack__sub {
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 700;
  color: var(--ink-soft);
}

.whack__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.whack__btn {
  min-height: 60px;
  padding: 0 24px;

  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 0 #e5dcc9;

  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 800;
  color: var(--ink-soft);

  transition: transform var(--t-press) ease, box-shadow var(--t-press) ease;
}

.whack__btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 #e5dcc9;
}

.whack__btn--again {
  background: linear-gradient(180deg, #5cd39a 0%, var(--green) 100%);
  box-shadow: 0 5px 0 #2f9d66;
  color: #ffffff;
}

.whack__btn--again:active {
  box-shadow: 0 1px 0 #2f9d66;
}

/* 平板/横屏：四个洞摆成一排，更像打地鼠台 */
@media (min-width: 560px) {
  .whack__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .whack-hole {
    aspect-ratio: 1 / 1.02;
  }
}

/* =========================================================
   9. 动画（都偏慢，孩子看得清）
   ========================================================= */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes breathe {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.08); }
  70%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-10px) rotate(-2deg); }
  30%  { transform: translateX(10px) rotate(2deg); }
  45%  { transform: translateX(-8px) rotate(-1.5deg); }
  60%  { transform: translateX(8px) rotate(1.5deg); }
  80%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* 统计条：数字变了轻轻弹一下 */
@keyframes hudBump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}

/* "+1" 从按钮位置往上飘 */
@keyframes starPopUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -90%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -240%) scale(1);
  }
}

/* =========================================================
   10. 屏幕适配
   ========================================================= */
/* 平板横屏 / 桌面：详情页左右两栏，减少滚动 */
@media (min-width: 780px) {
  .letter {
    width: min(100%, 1080px);
  }

  .letter__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
  }
}

/* 小屏手机：按钮保持一行但缩小间距 */
@media (max-width: 380px) {
  .learn {
    padding: 18px 14px 20px;
  }

  .learn__says,
  .game__options {
    gap: 8px;
  }
}

/* 系统开了"减少动态效果"：全部关掉，不做任何位移 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  /* 泡泡的显示全靠 floatUp 里的 opacity，动画一关就停在第一帧，
     整屏泡泡会变成隐形的。这里直接把三颗摆成固定位置。 */
  .bub {
    animation: none !important;
    opacity: 1 !important;
  }

  .bub:nth-of-type(1) { bottom: 26%; }
  .bub:nth-of-type(2) { bottom: 48%; }
  .bub:nth-of-type(3) { bottom: 68%; }

  .bub__sway,
  .bubble__confetti {
    animation: none !important;
  }

  .bubble__confetti { opacity: 0.85; transform: translate(var(--ax, 80px), var(--ay, 60px)); }
}

/* =======================================================
   九、星星商城（入口 + 面板 + 三种特效）
   ======================================================= */

/* ---- 大厅右上角的入口 ---- */
/* .lobby 本身是 flex 容器，加定位只是给这个按钮当参照，
   z-index 1 是为了压住太空主题的星点层（见文件末尾）。 */
.lobby {
  position: relative;
  z-index: 1;
}

.shop-btn {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 6;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 13px 6px 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf8 0%, #ffeed4 100%);
  box-shadow:
    0 4px 0 #f2c98c,
    0 9px 15px -5px rgba(138, 111, 84, 0.36),
    inset 0 2px 0 rgba(255, 255, 255, 0.95);

  font-size: 14px;
  font-weight: 800;
  color: #a0702c;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.shop-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #f2c98c,
    0 4px 8px -4px rgba(138, 111, 84, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.95);
}

.shop-btn__ico {
  display: block;
  width: 25px;
  height: 25px;
}

.shop-btn__ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shop-btn__label {
  letter-spacing: 0.04em;
}

.shop-btn__wallet {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: 7px;
  border-left: 2px dashed #f0dfc2;
  font-size: 15px;
}

.shop-btn__star {
  display: block;
  width: 16px;
  height: 16px;
}

/* ---- 面板 ---- */
.shop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.shop__veil {
  position: absolute;
  inset: 0;
  background: rgba(58, 44, 24, 0.5);
  animation: shopFade 0.2s ease both;
}

.shop__panel {
  position: relative;
  display: flex;
  flex-direction: column;

  width: min(100%, 560px);
  /* 固定高度，不跟着商品数量变：切 Tab 时面板一伸一缩，
     看起来像"整块界面跳了一下"。内容多就在里面滚。 */
  height: min(84dvh, 690px);
  max-height: 92dvh;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));

  border-radius: 28px 28px 0 0;
  background: #fffdf7;
  box-shadow: 0 -14px 42px rgba(58, 44, 24, 0.3);

  animation: shopUp 0.34s cubic-bezier(0.22, 1.2, 0.4, 1) both;
}

@keyframes shopFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shopUp {
  from { transform: translateY(30px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}

.shop__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop__title {
  margin: 0;
  font-size: clamp(20px, 5.4vw, 24px);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.shop__wallet {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff6e4;

  font-size: 17px;
  font-weight: 800;
  color: #a0702c;
}

.shop__wallet svg {
  display: block;
  width: 19px;
  height: 19px;
}

.shop__close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;

  border: 3px solid #efe3cd;
  border-radius: 50%;
  background: #ffffff;

  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  color: #a08e74;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---- 三个大 Tab ---- */
.shop__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.shop__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;

  min-height: 60px;
  padding: 6px 4px;

  border: 3px solid #efe3cd;
  border-radius: 18px;
  background: #ffffff;

  font-size: clamp(14px, 4vw, 16px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #9c8a73;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s ease, border-color 0.18s ease,
    background-color 0.18s ease, box-shadow 0.18s ease;
}

.shop__tab:active {
  transform: translateY(2px);
}

.shop__tab.is-on {
  border-color: #ffc978;
  background: #fff6e4;
  color: #a06012;
  box-shadow: 0 4px 0 #f0c98a;
}

.shop__tab-ico {
  font-size: 18px;
  line-height: 1.15;
}

/* ---- 商品网格 ---- */
.shop__grid {
  flex: 1 1 auto;
  min-height: 0;              /* 没有它，flex 子项不会收缩，列表滚不动 */

  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;

  margin-top: 14px;
  padding: 2px 2px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* 关键：不加 align-content，只有一行时 grid 会把这一行拉满整个高度，
     卡片变成一根竖长的白条（宠物 Tab 只有两条商品，最明显）。 */
  align-content: start;
}

/* 面板底部那句话：贴着底边，顺便把"商品少时下面一片白"撑住 */
.shop__foot {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: #b6a58c;
}

.shop__empty {
  grid-column: 1 / -1;
  margin: 30px 0;
  font-size: 15px;
  text-align: center;
  color: #a08e74;
}

.shopcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;

  padding: 12px 10px 10px;
  border: 3px solid #efe3cd;
  border-radius: 22px;
  background: #ffffff;
  text-align: center;

  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.shopcard.is-on {
  border-color: #cde6c2;
  background: #f8fdf5;
}

.shopcard.is-soon {
  border-style: dashed;
  background: #fdfbf5;
}

.shopcard__ico {
  display: block;
  width: 52px;
  height: 52px;
}

.shopcard__ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shopcard__name {
  margin: 0;
  font-size: clamp(14px, 3.9vw, 16px);
  font-weight: 800;
  color: var(--ink);
}

.shopcard__desc {
  margin: 0;
  min-height: 2.5em;          /* 描述两行、三行都不让卡片高度跳 */
  font-size: 12px;
  line-height: 1.55;
  color: #9c8a73;
}

.shopcard__price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 15px;
  font-weight: 800;
  color: #a0702c;
}

.shopcard__price svg {
  display: block;
  width: 15px;
  height: 15px;
}

.shopcard__btn {
  width: 100%;
  min-height: 40px;

  border: 0;
  border-radius: 14px;
  background: #ffc531;
  box-shadow: 0 4px 0 #e0a800;

  font-size: 14px;
  font-weight: 800;
  color: #6b4a05;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.shopcard__btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #e0a800;
}

.shopcard__btn.is-owned {
  background: #d7f0cc;
  box-shadow: 0 4px 0 #a8d69a;
  color: #2f6b3a;
  font-size: 12.5px;
}

.shopcard__btn.is-poor {
  background: #efe9dd;
  box-shadow: 0 4px 0 #ded5c4;
  color: #a3977f;
  cursor: default;
}

.shopcard__btn.is-soon {
  background: #f4efe5;
  box-shadow: 0 4px 0 #e5dccb;
  color: #b0a48e;
  cursor: default;
}

/* 刚买到：卡片亮一下；钱不够：卡片摇一下 */
.shopcard.is-fresh {
  animation: shopFresh 0.85s ease both;
}

@keyframes shopFresh {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 197, 49, 0); }
  35%  { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(255, 197, 49, 0.35); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 197, 49, 0); }
}

.shopcard.is-deny {
  animation: shopDeny 0.42s ease both;
}

@keyframes shopDeny {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  60%      { transform: translateX(5px); }
  85%      { transform: translateX(-3px); }
}

/* 桌面宽屏：面板改成居中的浮层，不再贴底 */
@media (min-width: 620px) {
  .shop { align-items: center; padding: 24px; }
  .shop__panel { border-radius: 28px; height: min(80vh, 690px); max-height: 86vh; }
}

/* 商城开着的时候别让背后的页面跟着滚 */
body.shop-locked {
  overflow: hidden;
}

/* ---- 特效一：手指魔法拖尾 ---- */
.trail {
  position: fixed;
  inset: 0;
  z-index: 130;          /* 在水印（99）之上、商城面板（300）之下 */
  pointer-events: none;  /* 绝不能挡住孩子的点击 */
  overflow: hidden;
}

.trail__spark {
  position: absolute;
  display: block;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;

  animation-name: trailPop;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

.trail__spark svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 星星自己带一点同色光晕，暗背景（太空主题）上也好看 */
.trail__spark svg {
  filter: drop-shadow(0 0 4px currentColor);
}

@keyframes trailPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25) rotate(0deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.14) rotate(16deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--rise, -28px))) scale(0.45)
      rotate(var(--spin, 60deg));
  }
}

/* ---- 特效二：彩虹流星雨 ---- */
.rain {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  overflow: hidden;
}

.rain__drop {
  position: absolute;
  top: -150px;

  display: block;
  border-radius: 999px;
  background: linear-gradient(to bottom,
    rgba(255, 255, 255, 0), var(--c, #ff7aa2) 42%, #ffffff);
  box-shadow: 0 0 8px var(--c, #ff7aa2);

  transform: rotate(16deg);
  animation-name: rainFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes rainFall {
  0%   { transform: translate3d(0, 0, 0) rotate(16deg); opacity: 0; }
  8%   { opacity: 0.95; }
  86%  { opacity: 0.9; }
  100% { transform: translate3d(-15vh, 118vh, 0) rotate(16deg); opacity: 0; }
}

/* ---- 特效三：太空主题（只作用于大厅） ---- */
body[data-page="island"].theme-space {
  --bg-top: #18224f;
  --bg-bottom: #070b1f;
}

/* 星野：四层小圆点平铺 + 两团星云。
   用 ::before 而不是再插一层 DOM，省一个节点也省一次 JS。 */
body[data-page="island"].theme-space::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background-image:
    radial-gradient(38% 30% at 18% 10%, rgba(139, 123, 247, 0.34), transparent 70%),
    radial-gradient(42% 32% at 84% 74%, rgba(74, 144, 226, 0.28), transparent 72%),
    radial-gradient(1.9px 1.9px at 18px 28px, #ffffff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 82px 104px, #cfe0ff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 136px 52px, #ffffff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 54px 148px, #ffe9a8 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 112px 128px, #ffffff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 152px 160px, #dfe8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 96px 12px, #ffffff 50%, transparent 51%);
  background-size: 100% 100%, 100% 100%, 168px 168px, 168px 168px, 168px 168px,
    168px 168px, 168px 168px, 168px 168px, 168px 168px;
}

body[data-page="island"].theme-space .lobby__title {
  color: #ffe9a8;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28), 0 8px 22px rgba(255, 214, 102, 0.4);
}

body[data-page="island"].theme-space .lobby__tip {
  color: #c9d6ff;
}

/* 门卡片还是奶白底：深色背景下更像"发光的小屋子"。
   只换配色变量，阴影结构照旧，糖果厚度在深色里也成立。 */
body[data-page="island"].theme-space .door {
  --door-a: #fffdf7;
  --door-b: #ece2ff;
  --door-edge: #6a76b4;
  --door-disc: #fffdf9;
  box-shadow:
    0 11px 0 var(--door-edge),
    0 22px 40px -8px rgba(0, 0, 0, 0.46),
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    inset 0 -10px 18px rgba(255, 255, 255, 0.45);
}

/* ---- 减少动效 ----
   上面那条全局规则会把所有动画压成 0.001ms，等于"买了特效却看不见"。
   这两处是花钱买来的效果，单独给一个更短但仍然看得见的时长。 */
@media (prefers-reduced-motion: reduce) {
  .trail__spark {
    animation-duration: 0.4s !important;
  }

  .rain__drop {
    animation-duration: 3.2s !important;
  }
}

/* =======================================================
   十、宠物养成

   小精灵是 document.body 的直接子节点（见 app.js）：
   .lobby 上挂着入场动画的 transform，元素落在里面，
   position:fixed 就会以它当参照，坐标全乱。
   ======================================================= */

/* ---- 小精灵：右下角，压在水印上方 ---- */
.pet {
  position: fixed;
  right: max(6px, env(safe-area-inset-right));
  /* 水印在 bottom:10px、高约 26px，宠物站在它上面，不压字 */
  bottom: calc(52px + env(safe-area-inset-bottom));
  z-index: 150;

  width: 84px;
  pointer-events: none;      /* 只有精灵本体吃点击，周围留白不吃 */
}

/* 去了学习区就收起：网格里每张卡都要能点到 */
.pet.is-hidden { display: none; }

.pet__artwrap { display: block; }

.pet__tap {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;

  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

  /* 整个身体慢慢上下浮：幅度小、周期长，才像"飘着"，快了就成抖 */
  animation: petFloat 3.6s ease-in-out infinite;
}

.pet__art {
  display: block;
  width: 100%;
  height: auto;
  /* 暖棕色的影子，跟着绘本描边走；用绿色会显得宠物在发光 */
  filter: drop-shadow(0 7px 11px rgba(122, 99, 87, 0.26));
}

@keyframes petFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-9px) rotate(-2deg); }
}

/* 眨眼睛：绝大多数时间睁着，只在最后几帧合一下 */
.pet__eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: petBlink 5.2s ease-in-out infinite;
}

@keyframes petBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.12); }
}

/* 被点：原地蹦一下。作用在画上而不是按钮上，
   否则会跟 petFloat 抢同一个 transform，浮空动作会断掉。 */
.pet.is-talk .pet__art {
  animation: petHop 0.62s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes petHop {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-13px) scale(1.07, 0.95); }
  60%  { transform: translateY(2px) scale(0.96, 1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* ---- 吃东西：身体一耸一耸，嘴一开一合 ---- */
/* 先停止整只飘：食物和爱心是 .pet 的绝对定位子节点，
   身体还在上下浮的话，饼干会对不准嘴。 */
.pet.is-eating .pet__tap {
  animation: none;
}

.pet.is-eating .pet__art {
  animation: petEat 0.34s ease-in-out 4;
}

@keyframes petEat {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45%      { transform: translateY(3px) scale(1.06, 0.93); }
}

.pet__mouth {
  transform-box: fill-box;
  transform-origin: 50% 30%;
}

.pet.is-eating .pet__mouth {
  animation: petMouth 0.26s ease-in-out 6;
}

@keyframes petMouth {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.3); }
}

/* 递到嘴边的食物：从上方落下来，一口口变小。
   bottom 是按 .pet 高度算的百分比：新精灵的嘴在 112 坐标系的 70 处，
   也就是整只高度的 62% 偏下，所以 18% 才落在嘴边（30% 会飘到鼻子上）。 */
/* ---- 爱心：从胸口往上飘，边飘边淡 ---- */
.pet__hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.pet__heart {
  position: absolute;
  bottom: 44%;
  width: 19px;
  opacity: 0;
  animation: petHeart 1.45s ease-out forwards;
}

.pet__heart svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 3px rgba(220, 90, 120, 0.3));
}

@keyframes petHeart {
  0%   { opacity: 0; transform: translateY(4px) scale(0.4); }
  25%  { opacity: 1; transform: translateY(-10px) scale(1.05); }
  70%  { opacity: 1; transform: translateY(-40px) scale(0.95); }
  100% { opacity: 0; transform: translateY(-62px) scale(0.6); }
}

/* ---- 升级提示：从宠物头顶升起来的一张金色小条 ---- */
.pet__levelup {
  position: absolute;
  right: -4px;
  bottom: 72%;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;

  width: max-content;
  padding: 7px 12px 8px;
  border: 3px solid #ffd98a;
  border-radius: 15px;
  background: linear-gradient(180deg, #fffdf3 0%, #fff4d6 100%);
  box-shadow: 0 8px 18px rgba(150, 110, 20, 0.26);

  pointer-events: none;
  white-space: nowrap;
  animation: petLevelUp 3s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.pet__levelup b {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #d9861a;
}

.pet__levelup span {
  font-size: 11px;
  font-weight: 800;
  color: #8a6a35;
}

@keyframes petLevelUp {
  0%   { opacity: 0; transform: translateY(16px) scale(0.7); }
  10%  { opacity: 1; transform: translateY(0) scale(1.04); }
  16%  { transform: translateY(0) scale(1); }
  78%  { opacity: 1; transform: translateY(-8px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

/* ---- 对话气泡 ---- */
.pet__bubble {
  position: absolute;
  right: 4px;
  bottom: calc(100% - 10px);

  width: max-content;
  max-width: min(60vw, 214px);
  padding: 9px 14px 8px;

  border: 3px solid #cdeee0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(58, 96, 80, 0.22);

  text-align: center;
}

/* 小尖尾巴指着精灵的头 */
.pet__bubble::after {
  content: "";
  position: absolute;
  right: 25px;
  bottom: -11px;

  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 11px solid #ffffff;
  filter: drop-shadow(0 3px 0 #cdeee0);
}

.pet__bubble b {
  display: block;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(16px, 4.4vw, 19px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: #2f6b58;
}

.pet__bubble i {
  display: block;
  margin-top: 1px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: #a3b3aa;
}

.pet__bubble.is-in {
  animation: petBubble 0.32s cubic-bezier(0.3, 1.45, 0.5, 1) both;
}

@keyframes petBubble {
  0%   { opacity: 0; transform: scale(0.7) translateY(8px); }
  70%  { opacity: 1; transform: scale(1.04) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* =======================================================
   小精灵的小屋（点宠物弹出）
   ======================================================= */
.petmenu {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(158px + env(safe-area-inset-bottom));
  z-index: 290;

  width: min(304px, calc(100vw - 20px));
  max-height: min(64dvh, 460px);
  padding: 11px 13px 12px;

  border: 3px solid #bfe9d7;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f2fdf8 100%);
  box-shadow: 0 16px 34px rgba(40, 90, 72, 0.28);

  transform-origin: 100% 100%;
  animation: petMenuIn 0.2s cubic-bezier(0.3, 1.4, 0.5, 1) both;

  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #3d5a4e;
}

.petmenu[hidden] { display: none; }

/* 尾巴指向宠物，孩子一眼知道"这是它的小屋" */
.petmenu__caret {
  position: absolute;
  right: 30px;
  bottom: -12px;

  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid #bfe9d7;
}

@keyframes petMenuIn {
  0%   { opacity: 0; transform: scale(0.82) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.petmenu__head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.petmenu__ava {
  display: block;
  width: 18px;
  flex: 0 0 auto;
}

.petmenu__ava svg { display: block; width: 100%; height: auto; }

.petmenu__name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2f6b58;
}

.petmenu__lv {
  padding: 2px 8px;
  border-radius: 999px;
  background: #e4f7ef;

  font-size: 10.5px;
  font-weight: 800;
  color: #3d8f70;
  white-space: nowrap;
}

.petmenu__x {
  margin-left: auto;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;

  border: 2px solid #e2f0e9;
  border-radius: 50%;
  background: #ffffff;

  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: #96b0a4;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 亲密度进度条 */
.petmenu__love {
  height: 9px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e4f4ec;
  overflow: hidden;
}

.petmenu__love i {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8be0bd 0%, #ffb3c7 100%);
  transition: width 0.4s cubic-bezier(0.3, 1.2, 0.5, 1);
}

.petmenu__hint {
  margin: 5px 0 9px;
  font-size: 11px;
  line-height: 1.4;
  color: #93a89d;
}

.petmenu__acts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.petact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;

  padding: 8px 2px 7px;
  border: 2px solid #e2f2ea;
  border-radius: 15px;
  background: #ffffff;

  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  color: #3d6b5a;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.petact:active {
  transform: translateY(2px);
  border-color: #ffd28a;
  background: #fff9ee;
}

.petact__ico {
  font-size: 19px;
  line-height: 1.1;
}

.petmenu__day {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: #a0b3a8;
}

/* ---- 声音：女声 / 男声 ---- */
.petmenu__voice {
  display: flex;
  align-items: center;
  gap: 6px;

  margin: 9px 0 0;
  padding: 6px 8px;
  border-radius: 14px;
  background: #f4faf7;
}

.petmenu__voice span {
  flex: 1;
  font-size: 11.5px;
  font-weight: 800;
  color: #7d9a8c;
}

/* 语音说明：一行小字，解释"为什么听起来像机器" */
.petmenu__voicenote {
  margin: 6px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #a2937f;
}

.voicebtn {
  padding: 5px 11px;
  border: 2px solid #dcefe6;
  border-radius: 999px;
  background: #ffffff;

  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #4a7a68;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.voicebtn.is-on {
  border-color: #7fd3b0;
  background: linear-gradient(180deg, #d9f7ea 0%, #b6ecd6 100%);
  color: #1f6d52;
}

.voicebtn:active { transform: scale(0.94); }

/* ---- 喂食 / 换装列表 ---- */
.petmenu__back {
  display: inline-flex;
  align-items: center;
  gap: 2px;

  margin: 0 0 4px -2px;
  padding: 2px 6px 2px 3px;
  border: 0;
  border-radius: 9px;
  background: none;

  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  color: #6f9183;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.petmenu__back:active { background: #eafaf2; }

.petmenu__lead {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #7d9588;
}

.petmenu__none {
  margin: 4px 0 8px;
  padding: 10px 8px;
  border-radius: 13px;
  background: #f4fbf7;

  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: #93a89d;
}

.petmenu__foods {
  display: flex;
  flex-direction: column;
  gap: 6px;

  max-height: 176px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1px;
}

.petfood {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;

  border: 2px solid #e6f3ec;
  border-radius: 14px;
  background: #ffffff;

  font-family: inherit;
  text-align: left;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.petfood:active { background: #f6fdf9; }

.petfood__ico {
  display: block;
  width: 32px;
  flex: 0 0 auto;
}

.petfood__ico svg {
  display: block;
  width: 100%;
  height: auto;
}

.petfood__txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.petfood__txt b {
  font-size: 13px;
  font-weight: 800;
  color: #375646;
}

.petfood__txt i {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  color: #9aada2;
}

.petmenu__wide {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;

  border: 2px solid #ffd28a;
  border-radius: 13px;
  background: #fff6e4;

  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  color: #a06012;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.petmenu__wide:active { transform: translateY(1px); }

/* 商城里"冰箱还有几份" */
.shopcard__own {
  display: block;
  margin: -1px 0 2px;
  font-size: 11px;
  font-weight: 700;
  color: #8ba396;
}

.shopcard__own b {
  font-size: 13px;
  color: #2f8f5b;
}

/* =======================================================
   每日签到气球
   ======================================================= */
.checkin {
  position: fixed;
  inset: 0;
  z-index: 330;

  display: grid;
  place-items: center;
  padding: 16px;

  /* 只负责"看"，不负责"挡"：
     以前它是全屏模态，手机上一张卡片正好压在"游戏挑战区"那扇门上，
     孩子点门其实是点在卡片上，什么都不会发生 —— 看起来就是"点了没反应"。
     现在整层不吃事件，只有"收下星星"按钮可点，点门会直接穿过去开门。 */
  pointer-events: none;

  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.checkin[hidden] { display: none; }

.checkin__veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(46, 96, 82, 0.34), rgba(16, 30, 38, 0.66));
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.checkin__stage {
  position: relative;
  width: min(92vw, 372px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.checkin__balloons {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  height: 128px;
}

.checkin__one {
  display: block;
  width: 74px;
  animation: balloonRise 0.7s cubic-bezier(0.2, 1.3, 0.4, 1) both,
    balloonFloat 3.4s ease-in-out 0.7s infinite;
}

.checkin__one:nth-child(2) {
  width: 64px;
  margin-bottom: 14px;
  animation-delay: 0.12s, 0.82s;
}

.checkin__one svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.2));
}

@keyframes balloonRise {
  0%   { opacity: 0; transform: translateY(46px) scale(0.6); }
  70%  { opacity: 1; transform: translateY(-6px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes balloonFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-8px) rotate(2deg); }
}

.checkin__pet {
  width: 148px;
  margin: -4px 0 2px;
  animation: petJumpIn 0.85s cubic-bezier(0.2, 1.4, 0.4, 1) 0.1s both;
}

.checkin__pet .pet__art {
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.26));
}

@keyframes petJumpIn {
  0%   { opacity: 0; transform: translateY(90px) scale(0.7); }
  65%  { opacity: 1; transform: translateY(-10px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.checkin__card {
  width: 100%;
  padding: 13px 18px 16px;

  border: 4px solid #ffd98a;
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);

  text-align: center;
  animation: checkCardIn 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) 0.25s both;

  /* 卡片自己接事件：点它会先关掉签到，再把这一下"补"给底下的门 */
  pointer-events: auto;
}

@keyframes checkCardIn {
  0%   { opacity: 0; transform: translateY(24px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.checkin__kicker {
  display: inline-block;
  margin: 0 0 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff1d6;

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #b07a1c;
}

.checkin__title {
  margin: 0;
  font-size: clamp(19px, 5.4vw, 23px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #3a2f1c;
}

.checkin__desc {
  margin: 6px 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #8a7860;
}

.checkin__desc b {
  font-size: 15px;
  color: #d9861a;
}

.checkin__ok {
  width: 100%;
  padding: 12px 10px;

  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffd45f 0%, #ffb62e 100%);
  box-shadow: 0 5px 0 #dd9410;

  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7a4a06;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

  /* 整层都不吃事件，只有这个按钮要能点 */
  pointer-events: auto;
}

.checkin__ok:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #dd9410;
}

/* 签到打开时别让远处那只小精灵重复出现。
   注意：不要再给 body 加 overflow:hidden —— 那一层已经不挡路了，
   锁滚动反而会在全屏/大视口下把布局顶偏，孩子点门时坐标对不上。 */
body.checkin-open .pet { visibility: hidden; }

/* ---- 矮屏 / 横屏 ----
   签到是竖着排的（气球 → 宠物 → 卡片），横屏只有 390 高，
   直接照搬会把卡片顶出屏幕。改成左气球、中宠物、右卡片。 */
@media (max-height: 560px) and (orientation: landscape) {
  .checkin { padding: 10px; }

  .checkin__stage {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: min(96vw, 660px);
  }

  .checkin__balloons {
    height: auto;
    gap: 8px;
    transform: scale(0.72);
  }

  .checkin__pet { width: 112px; margin: 0; }

  .checkin__card {
    width: min(58vw, 330px);
    padding: 10px 14px 13px;
  }

  .checkin__title { font-size: 19px; }
  .checkin__desc { margin: 4px 0 9px; font-size: 12.5px; }
  .checkin__ok { padding: 9px 8px; font-size: 15px; }

  /* 小屋在横屏里不能再往上顶，直接贴到右上角 */
  .petmenu {
    top: max(8px, env(safe-area-inset-top));
    bottom: auto;
    max-height: calc(100dvh - 16px);
  }

  .petmenu__caret { display: none; }
}


/* ---- 减少动效 ----
   浮空、眨眼、蹦跳、咀嚼、爱心都是装饰，全停；
   但气泡和签到卡必须还看得见（它们带文字）。 */
@media (prefers-reduced-motion: reduce) {
  .pet__tap,
  .pet.is-talk .pet__art,
  .pet.is-eating .pet__art,
  .pet.is-eating .pet__mouth,
  .pet__eyes,
  .checkin__one,
  .checkin__pet,
  .checkin__card,
  .pet__levelup,
  .petmenu {
    animation: none !important;
  }

  .pet__heart {
    animation-duration: 0.001ms !important;
    opacity: 0 !important;
  }

  .pet__bubble.is-in {
    animation-duration: 0.001ms !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 320 这类极窄屏：商城按钮会顶到标题右端，
   把按钮收一档，给"字母岛"留出入口。 */
@media (max-width: 340px) {
  .shop-btn {
    padding: 4px 9px 4px 6px;
    font-size: 12px;
    gap: 4px;
  }

  .shop-btn__ico {
    width: 21px;
    height: 21px;
  }

  .shop-btn__wallet {
    font-size: 13px;
    padding-left: 6px;
  }

  .shop-btn__star {
    width: 14px;
    height: 14px;
  }
}

/* =========================================================
   20. v4 · 现代 App 化：底部悬浮导航 + 3D 宠物展示台 + 盲盒商城
   ---------------------------------------------------------
   这一版换掉两样东西：
     ① 右上角的糖果"商城"按钮 → 玻璃星星胶囊（导航栏里已有商城入口）；
     ② 代码画的矢量小精灵 → 3D 图片（#current-pet），
        旧的 .pet 结构不再创建，但喂食/换装/签到那套逻辑照旧，
        只是挂到了新的 .stage 上（见 js/app.js 的 App.pet.mount）。
   ========================================================= */

/* ---------- 20.1 星星胶囊 ---------- */
.wallet {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 6;

  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 13px 0 10px;

  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    0 8px 18px -10px rgba(120, 88, 56, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);

  font-size: 15px;
  font-weight: 800;
  color: #a0702c;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease;
}

/* 视觉上还是 34px 的小胶囊（再高会破坏顶部留白），
   但把可点区域向下、向外各放 6px——实际命中 46px，孩子点得到。
   伪元素挂在按钮内部，点击仍然落在 button 上，不影响无障碍语义。 */
.wallet::after {
  content: '';
  position: absolute;
  inset: -6px -4px;
  border-radius: inherit;
}

.wallet:active { transform: scale(0.94); }

.wallet__star {
  display: block;
  width: 17px;
  height: 17px;
}

.wallet__num { font-variant-numeric: tabular-nums; }

/* ---------- 20.2 底部悬浮导航 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 260;

  width: min(calc(100% - 26px), 400px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px;

  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 252, 247, 0.55);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  backdrop-filter: blur(26px) saturate(190%);
  box-shadow:
    0 18px 38px -14px rgba(94, 70, 52, 0.5),
    0 4px 12px -6px rgba(94, 70, 52, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);

  animation: tabbarIn 0.5s cubic-bezier(0.22, 1.1, 0.4, 1) both;
}

@keyframes tabbarIn {
  from { transform: translate(-50%, 26px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

.tabbar__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;

  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 21px;
  background: transparent;

  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #a4907c;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.24s ease, box-shadow 0.24s ease,
    color 0.24s ease, transform 0.16s ease;
}

.tabbar__btn:active { transform: scale(0.96); }

.tabbar__ico {
  font-size: 20px;
  line-height: 1.05;
  /* 没选中时压成灰的：一眼就知道现在在哪一页 */
  filter: grayscale(1) opacity(0.55);
  transition: filter 0.24s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tabbar__txt { line-height: 1.1; }

.tabbar__btn.is-on {
  color: #d1567f;
  background: linear-gradient(180deg, #ffffff 0%, #fff6f9 100%);
  box-shadow:
    0 8px 16px -8px rgba(209, 86, 127, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.95),
    inset 0 -2px 0 rgba(255, 214, 228, 0.55);
}

.tabbar__btn.is-on .tabbar__ico {
  filter: none;
  transform: translateY(-1px) scale(1.1);
}

/* 商城/小屋打开时把导航收起来：不然它压在面板底下，半截露出来很脏 */
body.shop-locked .tabbar,
body.checkin-open .tabbar {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity 0.2s ease, transform 0.24s ease;
}

@media (prefers-reduced-motion: reduce) {
  .tabbar { animation: none; }
}

/* ---------- 20.3 3D 宠物展示台 ---------- */
.stage {
  position: absolute;
  /* 原来贴到 6px；但身后那圈 .stage__halo 是 116% 宽、居中铺开的，
     它比展台本身宽出约 9px，贴太近会把页面横向撑出 5px（375 宽下实测 380）。
     留到 18px，柔光完整落在屏内，也不会贴边裁掉。 */
  right: max(18px, env(safe-area-inset-right));
  /* 站在导航栏上面；水印在最底，不打架 */
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 150;

  width: clamp(108px, 29vw, 146px);
  display: flex;
  align-items: flex-end;
  justify-content: center;

  pointer-events: none;        /* 只有宠物本体吃点击 */
}

.stage.is-hidden { display: none; }

.stage__tap {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;

  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

  /* 上下浮：幅度小、周期长，才像"飘着" */
  animation: stageFloat 4.6s ease-in-out infinite;
  will-change: transform;
}

@keyframes stageFloat {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-10px) rotate(1.4deg); }
}

/* 背后的光晕：让宠物"发光"而不是贴一张图上去 */
.stage__halo {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 0;
  width: 116%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 210, 228, 0.9) 0%,
    rgba(255, 236, 244, 0.55) 42%,
    rgba(255, 245, 250, 0) 68%);
  filter: blur(7px);
  animation: stageHalo 5.4s ease-in-out infinite;
}

@keyframes stageHalo {
  0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.06); }
}

.stage__pet {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;

  /* 不加投影。
     图已经裁到脚底，下沿是一条平边；drop-shadow 会照着这条平边
     在脚下描出一块带直角的光斑（看着像块板子）。
     立体感交给身后那圈 .stage__halo 柔光就够了。 */
  filter: none;
  transform-origin: 50% 90%;
  transition: opacity 0.3s ease;
}

/* 脚下的软影：宠物浮起来时它缩小、变淡，落下去时反过来 */
/* 脚底那条地面影：删掉。
   原来这里是一个 62% 宽、11px 高的棕色椭圆，铺在图片最下沿。
   宠物图本身裁到脚底以后，这条椭圆正好压在脚下面，
   看上去就是一条平直的灰线（用户说的"淡淡的水平线"）。
   现在立体感全靠 .stage__pet 上那两层 drop-shadow —— 它顺着轮廓走，
   不会变成一根横杠。 */
.stage__ground { display: none; }

@keyframes stageGround {
  0%, 100% { transform: translateX(-50%) scale(1);    opacity: 0.85; }
  50%      { transform: translateX(-50%) scale(0.86); opacity: 0.5; }
}

/* 没有图的时候：虚线圈占位，不露出破图标 */
.stage.is-empty .stage__pet,
.stage.is-empty .stage__halo,
.stage.is-empty .stage__ground { display: none; }

.stage.is-empty .stage__tap { animation: none; }

.stage__empty {
  display: none;
  width: 88px;
  height: 88px;
  border: 2px dashed rgba(180, 155, 138, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #b5a08c;
  align-items: center;
  justify-content: center;
}

.stage.is-empty .stage__empty { display: flex; }

/* 吃 / 被点：改成图片的弹跳。原来作用在 SVG 上，现在作用在 img 上 */
.stage.is-eating .stage__tap { animation: none; }

.stage.is-eating .stage__pet {
  animation: stageEat 0.36s ease-in-out 4;
}

@keyframes stageEat {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45%      { transform: translateY(4px) scale(1.05, 0.94); }
}

.stage.is-talk .stage__pet {
  animation: stageHop 0.66s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes stageHop {
  0%   { transform: translateY(0) scale(1); }
  28%  { transform: translateY(-16px) scale(1.05, 0.96); }
  58%  { transform: translateY(2px) scale(0.96, 1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* 旧矢量身体留着给签到弹层用，展台上不再出现 */
.stage .pet__art,
.stage .pet__artwrap { display: none; }

/* 气泡：贴在头顶，尾巴朝下 */
.stage__bubble {
  position: absolute;
  /* 展台贴着屏幕右边，气泡就以它的右沿为准往左长，
     否则居中一撑就顶出屏幕，"Yummy!" 只剩半个。 */
  right: 0;
  left: auto;
  bottom: calc(100% - 2px);
  z-index: 5;

  width: max-content;
  max-width: min(58vw, 212px);
  padding: 9px 14px 8px;

  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 22px -10px rgba(120, 90, 80, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);

  text-align: center;
  pointer-events: none;
}

.stage__bubble::after {
  content: "";
  position: absolute;
  /* 尾巴对准宠物脑袋（展台正中偏右一点） */
  left: auto;
  right: 40px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 3px 3px 5px -3px rgba(120, 90, 80, 0.3);
}

.stage__bubble b {
  display: block;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 800;
  line-height: 1.25;
  color: #7c5c66;
}

.stage__bubble i {
  display: block;
  margin-top: 1px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: #b3a2a8;
}

.stage__bubble.is-in {
  animation: petBubble 0.32s cubic-bezier(0.3, 1.45, 0.5, 1) both;
}

/* 喂食时的爱心 / 升级条：定位基准从 84px 的小精灵换成展台 */
.stage .pet__heart { width: auto; }

/* ---------- 20.4 商城：改成"盲盒"面板 ---------- */
.shop { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }

.shop__panel {
  height: min(87dvh, 736px);
  max-height: calc(100dvh - 20px);
  padding: 16px 16px 14px;
  border-radius: 32px;
  background: linear-gradient(180deg, #fffdfb 0%, #fff7f5 100%);
  box-shadow:
    0 -4px 0 rgba(255, 255, 255, 0.55) inset,
    0 -20px 56px -16px rgba(74, 50, 38, 0.45),
    0 2px 6px rgba(74, 50, 38, 0.12);
}

.shop__head { gap: 8px; align-items: flex-start; }

.shop__headtxt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.shop__sub {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #b09a86;
}

.shop__wallet {
  margin-top: 2px;
  padding: 5px 12px;
  background: rgba(255, 246, 228, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 226, 178, 0.9);
}

.shop__close {
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 6px 14px -8px rgba(120, 90, 70, 0.6),
    inset 0 0 0 1px rgba(238, 228, 214, 0.9);
  font-size: 14px;
  color: #a8977f;
  transition: transform 0.16s ease;
}

.shop__close:active { transform: scale(0.9); }

/* Tab：三格分段控件（宠物 / 特效 / 零食） */
.shop__tabs {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(246, 238, 231, 0.72);
}

.shop__tab {
  flex-direction: row;
  gap: 4px;
  min-height: 40px;
  padding: 4px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: clamp(11.5px, 3.3vw, 13.5px);
  font-weight: 800;
  letter-spacing: 0;
  color: #a08c78;
  transition: background-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.shop__tab.is-on {
  background: #ffffff;
  color: #cf5b83;
  box-shadow:
    0 6px 12px -8px rgba(150, 100, 90, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  border-color: transparent;
}

.shop__tab-ico {
  font-size: 15px;
  line-height: 1;
}

.shop__tab.is-on .shop__tab-ico { filter: none; }

/* ---- 大展示台 ---- */
.showcase {
  position: relative;
  flex: 0 0 auto;
  height: clamp(172px, 27dvh, 226px);
  margin-top: 12px;
  border-radius: 26px;
  overflow: hidden;

  display: flex;
  align-items: flex-end;
  justify-content: center;

  background:
    radial-gradient(72% 62% at 50% 8%, #ffffff 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(168deg, #fff4f7 0%, #ffe8f1 46%, #ffe0ea 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.85),
    inset 0 -26px 40px -28px rgba(208, 120, 150, 0.5),
    0 14px 26px -20px rgba(170, 90, 120, 0.55);
}

/* 展示台背后的一圈光台 */
.showcase::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 58%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.35) 46%,
    rgba(255, 255, 255, 0) 68%);
}

.showcase__pet {
  position: relative;
  z-index: 2;
  height: 72%;
  margin-bottom: 52px;
  width: auto;
  max-width: 88%;
  object-fit: contain;
  filter:
    drop-shadow(0 2px 2px rgba(150, 100, 110, 0.14))
    drop-shadow(0 16px 20px rgba(150, 90, 110, 0.28));
  animation: showcaseFloat 5s ease-in-out infinite;
}

@keyframes showcaseFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* 小羊这张新图是瘦长构图（比例 0.889，熊/猪也是 0.889，但羊身上留白多），
   展示台按高度排下来会比另外两只小一圈。按 id 单独补 6% 高度，
   让它和熊/猪看起来一样分量；上限仍在容器内，不会顶到名字条。 */
.showcase__pet[data-pet="sheep"] { height: 76%; }

/* 宠物卡同理，补 4% */
.petcard[data-card="sheep"] .petcard__pic img { height: 96%; }

.showcase__shadow {
  position: absolute;
  left: 50%;
  bottom: 50px;
  z-index: 1;
  width: 132px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(170, 110, 125, 0.34) 0%, rgba(170, 110, 125, 0) 72%);
  filter: blur(4px);
  animation: showcaseGround 5s ease-in-out infinite;
}

@keyframes showcaseGround {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.9; }
  50%      { transform: translateX(-50%) scale(0.9); opacity: 0.6; }
}

.showcase__cap {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 3;
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 24px);
  padding: 6px 8px 6px 14px;

  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow:
    0 8px 18px -10px rgba(150, 90, 110, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.showcase__cap b {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #8c5568;
  white-space: nowrap;
}

.showcase__tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd0e0 0%, #ffb6cd 100%);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #8f2f4e;
  white-space: nowrap;
}

/* 其它 Tab 里不占地方：展示台只属于"宠物" */
.shop__panel:not(.is-pets) .showcase { display: none; }

/* ---- 宠物卡片 ---- */
.shop__grid.is-pets {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.petcard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;

  padding: 9px 9px 11px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow:
    0 10px 22px -14px rgba(120, 90, 80, 0.5),
    inset 0 0 0 1px rgba(240, 232, 224, 0.9);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.petcard:active { transform: scale(0.985); }

/* 图片格子：每只宠物一个自己的底色，图上还是白底也不会脏 */
.petcard__pic {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;

  display: flex;
  align-items: flex-end;
  justify-content: center;

  background:
    radial-gradient(86% 62% at 50% 6%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(170deg, var(--tint-a, #fff3f7) 0%, var(--tint-b, #ffe4ee) 100%);
}

.petcard__pic img {
  position: relative;
  z-index: 1;
  /* 按高度约束、宽度自适应：原来写死 width 84% + max-height 92%，
     竖长图（964×1080）会先被限高、再被 flex 底对齐，顶上那撮卷毛就被卡边削掉。
     换成 height 定值 + width:auto，整只宠物完整落在格子里，比例也不变。 */
  width: auto;
  height: 92%;
  max-width: 84%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(140, 96, 96, 0.22));
}

/* 透明图还没有的时候，格子里放一个大大的问号，像盲盒 */
.petcard__mystery {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 3px 8px rgba(160, 120, 140, 0.35);
}

.petcard__name {
  margin: 1px 0 0;
  padding-left: 2px;
  font-size: clamp(13.5px, 3.7vw, 15.5px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #5b4a41;
}

.petcard__price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding-left: 2px;
  font-size: 12.5px;
  font-weight: 800;
  color: #b08a52;
}

.petcard__price svg {
  display: block;
  width: 14px;
  height: 14px;
}

.petcard__price.is-free { color: #6fae7f; }

.petcard__btn {
  width: 100%;
  min-height: 38px;
  margin-top: 2px;

  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffa9c6 0%, #ff86ae 100%);
  box-shadow:
    0 8px 16px -10px rgba(240, 110, 155, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);

  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.16s ease,
    background-color 0.2s ease, color 0.2s ease;
}

.petcard__btn:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 3px 8px -6px rgba(240, 110, 155, 0.9);
}

/* 已拥有：不是主按钮了，白底粉字 */
.petcard__btn.is-owned {
  background: #fff6f9;
  box-shadow:
    inset 0 0 0 1.6px #ffd2e0,
    0 6px 12px -10px rgba(220, 130, 160, 0.8);
  color: #d1567f;
}

/* 正在穿戴：按下没反应，颜色退到最淡 */
.petcard__btn.is-current {
  background: #f7f2ee;
  box-shadow: inset 0 0 0 1.6px #ece2d9;
  color: #b0a191;
  cursor: default;
}

.petcard__btn.is-poor {
  background: #f7f3ee;
  box-shadow: inset 0 0 0 1.6px #ece2d9;
  color: #b0a191;
  cursor: default;
}

.petcard__btn.is-soon {
  background: #faf7f3;
  box-shadow: inset 0 0 0 1.6px #eee5da;
  color: #bcae9f;
  cursor: default;
}

/* 已拥有的小角标 */
.petcard__flag {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 2;

  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 10px -6px rgba(140, 100, 90, 0.7);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #cc5f86;
}

.petcard__flag.is-new {
  background: linear-gradient(180deg, #ffe08a 0%, #ffc93c 100%);
  color: #7a4c05;
}

.petcard.is-current {
  box-shadow:
    0 12px 26px -14px rgba(209, 86, 127, 0.55),
    inset 0 0 0 2px #ffc2d7;
}

.petcard.is-locked { box-shadow: inset 0 0 0 1.6px rgba(240, 232, 224, 0.9); }

/* 买下 / 穿上之后：卡片弹一下，和展示台呼应 */
.petcard.is-fresh { animation: petFresh 0.7s cubic-bezier(0.3, 1.3, 0.5, 1) both; }

@keyframes petFresh {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.045); box-shadow: 0 18px 30px -16px rgba(255, 140, 175, 0.9); }
  100% { transform: scale(1); }
}

.showcase.is-pop .showcase__pet {
  animation: showcasePop 0.62s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes showcasePop {
  0%   { transform: scale(0.86); opacity: 0.4; }
  55%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

/* 宠物卡一律两列。原来这里有条「宽屏铺三列」的规则，
   但一共就三只，两列看得更清楚，也省得同一页出现两种排法。 */

@media (max-width: 340px) {
  .tabbar { width: calc(100% - 18px); padding: 6px; }
  .tabbar__btn { height: 48px; }
  .tabbar__ico { font-size: 18px; }
  .tabbar__txt { font-size: 10.5px; }
  .stage { width: 104px; }
}

/* 极矮的横屏（844×390 这种）：一行标题 + 两扇并排 + 底部导航，
   进度条在这一档收起来，否则一屏放不下，孩子得先滚一下。 */
@media (max-height: 560px) and (orientation: landscape) {
  .tabbar { bottom: 8px; padding: 5px; }
  .tabbar__btn { height: 44px; flex-direction: row; gap: 6px; }
  .tabbar__txt { font-size: 11px; letter-spacing: 0.04em; }

  .lobby {
    padding: 8px 18px calc(146px + env(safe-area-inset-bottom));
    gap: 8px;
    justify-content: flex-start;
  }

  .lobby__header {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
  }

  .lobby__title { font-size: 26px; letter-spacing: 0.08em; }
  .lobby__tip { margin: 0; font-size: 13px; }

  .statbar--lobby { display: none; }

  .lobby__doors { gap: 22px; }

  .door {
    min-height: 168px;
    padding: 10px 12px 20px;
    gap: 2px;
    border-radius: 84px 84px 26px 26px;
  }

  .door::before { bottom: -12px; height: 30px; }
  .door::after { bottom: -22px; height: 22px; }
  .door__art::before { inset: -10px; border-width: 2px; }

  .door__art { width: 62px; height: 62px; }
  .door__name { font-size: 18px; }
  .door__desc { display: none; }

  .stage { width: 84px; bottom: calc(58px + env(safe-area-inset-bottom)); }

  /* 横屏整体缩小一档，零食按钮别比宠物还抢眼 */
  .stage__foods { gap: 5px; bottom: 10%; }
  .foodbtn { width: 34px; height: 34px; }
  .foodbtn__ico { width: 22px; height: 22px; }
  .foodbtn__n { min-width: 15px; height: 15px; line-height: 15px; font-size: 9.5px; }
}

/* ---------- 20.5 大厅：给展台和导航让出地方 ---------- */
/* 底部要留两层：导航（约 78px）+ 宠物站的位置（约 130px）。
   不留够的话，宠物会压住"游戏挑战区"右下角，孩子点不到。
   176 是量出来的：再大一点，390×844 这种屏一屏就装不下两座岛了。 */
.lobby {
  padding-bottom: calc(172px + env(safe-area-inset-bottom));
}

/* 横屏只有 390 高，188px 的底部留白会把大厅顶出 20 多像素。
   上面那条媒体查询写在前面、被这里覆盖了，所以在它后面补回来。 */
@media (max-height: 560px) and (orientation: landscape) {
  .lobby { padding-bottom: calc(146px + env(safe-area-inset-bottom)); }
}

/* 矮屏（iPhone SE 一类，667 高）：导航 + 展台要占掉 180px，
   剩下的高度不够放两张大卡，所以标题、进度条、卡片一起收一档，
   保证一屏能看见两个入口，不用滚动。 */
@media (max-height: 720px) and (min-height: 561px) {
  .lobby {
    padding: 12px 16px calc(180px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .lobby__title { font-size: clamp(30px, 9vw, 38px); }
  .lobby__tip { margin-top: 4px; font-size: 14px; }

  .statbar { padding: 6px 14px; }
  .statbar--lobby { margin-top: 0; margin-bottom: 6px; }

  .lobby__doors { gap: 34px; }

  .door {
    min-height: 142px;
    padding: 10px 14px 22px;
    gap: 2px;
    border-radius: 96px 96px 30px 30px;
  }

  .door::before { bottom: -14px; height: 34px; }
  .door::after { bottom: -26px; height: 26px; }
  .door__art::before { inset: -11px; border-width: 2px; }

  .door__art { width: clamp(56px, 16vw, 76px); height: clamp(56px, 16vw, 76px); }
  .door__name { font-size: clamp(20px, 5.6vw, 26px); }
  .door__desc { font-size: 12.5px; }

  .stage { width: clamp(96px, 26vw, 118px); bottom: calc(82px + env(safe-area-inset-bottom)); }
}

/* 水印让开：右下角是宠物、底下是导航，挪到左上角，
   做得像"版本号"那样轻，不去抢标题的注意力。 */
body[data-page="island"] .watermark {
  left: max(14px, env(safe-area-inset-left));
  right: auto;
  top: max(14px, env(safe-area-inset-top));
  bottom: auto;

  padding: 0;
  background: none;
  border-radius: 0;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(74, 63, 53, 0.34);
}

/* ---------- 20.6 宠物光环 + 零食按钮 ----------
   这两样都不碰宠物本体，所以不存在锚点：
     光环 = 一串绝对定位的小图标，只在左右两条边上飘；
     零食 = 展台左边一列圆按钮。
   宠物站在正中，脸始终是干净的。 */

/* 光环层：只比展台大一点点。展台贴着屏幕右边，
   层做得太宽，右半边粒子会被屏幕裁掉、看不见。 */
.stage__aura {
  position: absolute;
  inset: -14% -4% -4%;
  z-index: 4;

  pointer-events: none;
  overflow: hidden;
}

.aura__p {
  position: absolute;
  display: block;
  opacity: 0;

  animation-name: auraRise;
  animation-timing-function: cubic-bezier(0.24, 0.7, 0.35, 1);
  animation-fill-mode: forwards;
  will-change: transform, opacity;

  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.95))
    drop-shadow(0 2px 4px rgba(170, 90, 120, 0.28));
}

.aura__p svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes auraRise {
  0%   { opacity: 0;    transform: translate3d(0, 10px, 0) scale(0.4) rotate(0deg); }
  22%  { opacity: 1; }
  68%  { opacity: 0.95; }
  100% { opacity: 0;    transform: translate3d(var(--dx, 0px), -72px, 0) scale(1.06)
                        rotate(var(--rot, 14deg)); }
}

/* 减少动效：光环不再上升，改成静静挂在两边（数量有上限，不会越积越多） */
@media (prefers-reduced-motion: reduce) {
  .aura__p {
    animation: none;
    opacity: 0.9;
  }
}

/* 零食按钮：展台左侧一列，买过才出现 */
.stage__foods {
  position: absolute;
  right: calc(100% + 2px);
  bottom: 16%;
  z-index: 6;

  display: flex;
  flex-direction: column;
  gap: 7px;

  pointer-events: auto;
}

.stage__foods[hidden] { display: none; }

.foodbtn {
  position: relative;
  display: grid;
  place-items: center;

  width: 42px;
  height: 42px;
  padding: 0;

  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(255, 252, 248, 0.9);
  -webkit-backdrop-filter: blur(10px) saturate(170%);
  backdrop-filter: blur(10px) saturate(170%);
  box-shadow:
    0 8px 18px -9px rgba(120, 90, 80, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

  animation: foodPop 0.34s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  transition: transform 0.16s ease;
}

.foodbtn:active { transform: scale(0.9); }

.foodbtn__ico {
  display: block;
  width: 27px;
  height: 27px;
}

.foodbtn__ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.foodbtn__n {
  position: absolute;
  right: -2px;
  top: -3px;

  min-width: 17px;
  height: 17px;
  padding: 0 4px;

  border-radius: 9px;
  background: #ff7d9c;
  color: #ffffff;

  font-size: 10.5px;
  font-weight: 900;
  line-height: 17px;
  text-align: center;

  box-shadow: 0 2px 5px rgba(200, 60, 90, 0.35);
}

@keyframes foodPop {
  0%   { opacity: 0; transform: scale(0.4) translateY(6px); }
  100% { opacity: 1; transform: none; }
}

/* 喂零食：先跳一下，落地之后再吧唧嘴（见 app.js 的 feed） */
.stage.is-hop .stage__tap { animation: none; }

.stage.is-hop .stage__pet {
  animation: stageHop 0.54s cubic-bezier(0.3, 1.4, 0.5, 1);
}

/* 签到弹层里的宠物：也换成 3D 图 */
.checkin__pet img {
  display: block;
  width: 100%;
  height: auto;
  filter:
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.14))
    drop-shadow(0 14px 18px rgba(40, 20, 30, 0.34));
}

/* ---------- 20.7 老卡片（特效 / 零食）换成同一套语言 ----------
   宠物卡是新做的，其它两栏还是糖果那版（黄按钮 + 3px 米色描边）。
   不换成一样的，切 Tab 会像换了两个 App。 */
.shopcard {
  border: 0;
  border-radius: 22px;
  padding: 12px 10px 11px;
  background: #ffffff;
  box-shadow:
    0 10px 22px -14px rgba(120, 90, 80, 0.45),
    inset 0 0 0 1px rgba(240, 232, 224, 0.9);
}

.shopcard.is-on {
  background: #fff9fb;
  box-shadow:
    0 12px 24px -14px rgba(209, 86, 127, 0.5),
    inset 0 0 0 2px #ffd2e0;
}

.shopcard.is-soon {
  border: 0;
  box-shadow: inset 0 0 0 1.6px rgba(236, 226, 217, 0.9);
}

.shopcard__ico {
  width: 58px;
  height: 58px;
  padding: 9px;
  border-radius: 19px;
  background: linear-gradient(170deg, #fff8f3 0%, #ffe9de 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.shopcard__name { font-size: clamp(14px, 3.8vw, 15.5px); }

.shopcard__desc {
  font-size: 11.5px;
  color: #a8978a;
}

.shopcard__price {
  font-size: 13.5px;
  color: #bb8b48;
}

.shopcard__price svg { width: 14px; height: 14px; }

.shopcard__btn {
  min-height: 38px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffa9c6 0%, #ff86ae 100%);
  box-shadow:
    0 8px 16px -10px rgba(240, 110, 155, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  font-size: 13px;
  color: #ffffff;
}

.shopcard__btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 8px -6px rgba(240, 110, 155, 0.9);
}

.shopcard__btn.is-owned {
  background: #fff6f9;
  box-shadow:
    inset 0 0 0 1.6px #ffd2e0,
    0 6px 12px -10px rgba(220, 130, 160, 0.8);
  font-size: 12.5px;
  color: #d1567f;
}

.shopcard__btn.is-poor,
.shopcard__btn.is-soon {
  background: #f7f3ee;
  box-shadow: inset 0 0 0 1.6px #ece2d9;
  color: #b0a191;
}

.shopcard__own {
  font-size: 11.5px;
  color: #b08a52;
}

.shopcard__own b { font-size: 13px; }

/* ---------- 20.8 小屋：从"飘在宠物旁边的卡片"改成底部抽屉 ----------
   展台上是 3D 图，旁边已经没有一块空地放 300px 宽的卡了：
   手机上它会横着压住第二扇门。改成和商城同一套的底部抽屉，
   圆角、阴影、标题层级全部对齐。 */
.petmenu {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 310;

  width: auto;
  max-width: 452px;
  margin: 0 auto;
  max-height: min(74dvh, 540px);
  padding: 15px 16px calc(16px + env(safe-area-inset-bottom));

  border: 0;
  border-radius: 30px;
  background: linear-gradient(180deg, #fffdfb 0%, #fff7f5 100%);
  box-shadow:
    0 -20px 52px -18px rgba(74, 50, 38, 0.45),
    0 2px 6px rgba(74, 50, 38, 0.1);

  color: #5b4a41;
  animation: shopUp 0.3s cubic-bezier(0.22, 1.2, 0.4, 1) both;
}

/* 抽屉没有"尾巴"可指 */
.petmenu__caret { display: none; }

.petmenu__name {
  font-size: 16px;
  color: #4a3a32;
}

.petmenu__lv {
  background: #ffe9f1;
  color: #cf5b83;
}

.petmenu__x {
  border: 0;
  background: #f7f1ec;
  color: #a8978a;
}

.petmenu__love { background: #f7ece7; }

.petmenu__love i {
  background: linear-gradient(90deg, #ffb3c7 0%, #ff86ae 100%);
}

.petmenu__hint,
.petmenu__day,
.petmenu__lead,
.petmenu__none {
  color: #a8978a;
}

.petact {
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1.5px #f2e9e1,
    0 8px 16px -12px rgba(120, 90, 80, 0.6);
  color: #5b4a41;
}

.petact:active {
  border-color: transparent;
  background: #fff6f9;
  box-shadow: inset 0 0 0 1.5px #ffd2e0;
}

.petact__ico { font-size: 20px; }

.petmenu__wide {
  border: 0;
  background: linear-gradient(180deg, #ffa9c6 0%, #ff86ae 100%);
  box-shadow: 0 8px 16px -10px rgba(240, 110, 155, 0.95);
  border-radius: 14px;
  color: #ffffff;
}

.petmenu__back {
  color: #b09280;
}

.petfood {
  border-color: #f2e9e1;
  border-radius: 15px;
}

/* 非宠物 Tab 没有大展示台，内容少的时候别留一大片空：
   高度跟着内容走，但给个下限，别缩成一条。 */
.shop__panel:not(.is-pets) {
  height: auto;
  min-height: min(46dvh, 420px);
}

/* =========================================================
   9. 全站图形同步：游戏区的字母也用手绘字形
   ---------------------------------------------------------
   app.js 现在把 App.art.letter() 的 <svg> 塞进这些容器里。
   字形本身已经带白包边和渐变，容器只负责"给多大地方"。
   ========================================================= */
.pick__letter svg {
  display: block;
  height: clamp(38px, 10.4vw, 46px);
  width: auto;
  margin: 0 auto;
  /* 白包边在纯白卡片上会"化"掉，垫一层粉影把贴纸边缘托出来 */
  filter: drop-shadow(0 3px 0 rgba(214, 122, 150, 0.28))
    drop-shadow(0 6px 10px rgba(239, 111, 142, 0.18));
}

/* 泡泡里的字：跟着泡泡尺寸走（--size 是 JS 按屏幕算的） */
.bub__ball svg {
  display: block;
  width: 58%;
  height: auto;
  filter: drop-shadow(0 3px 4px rgba(40, 100, 150, 0.26));
}

/* 地鼠举的牌：牌面只有 58% 宽，字要留出边距 */
.whack-mole__card svg {
  display: block;
  width: auto;                 /* 宽高都由高度决定，字形才不会被拉长 */
  height: clamp(24px, 7.6vw, 34px);
  margin: 3% auto 0;
}

/* 怪兽手里的字母卡 */
.monster__tile-letter svg {
  display: block;
  width: clamp(34px, 9.6vw, 50px);
  height: auto;
  margin: 0 auto;
}

/* 宝箱翻开后的字母 */
.mcard__letter svg {
  display: block;
  width: clamp(40px, 11.5vw, 58px);
  height: auto;
  margin: 0 auto;
}

/* 学习页顶栏的"大写 + 小写"标识 */
.lesson__id {
  align-items: center;
}

.lesson__up svg {
  display: block;
  height: clamp(28px, 7.4vw, 36px);
  width: auto;
}

.lesson__low svg {
  display: block;
  height: clamp(24px, 6.4vw, 31px);
  width: auto;
}

/* =========================================================
   10. 结算气泡（半透明遮罩 + 波浪边框 + 星星掉落）
   ========================================================= */
.result {
  position: fixed;
  inset: 0;
  z-index: 1200;          /* 压过底部导航与商城 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.result__veil {
  position: absolute;
  inset: 0;
  background: rgba(72, 50, 64, 0.4);
  -webkit-backdrop-filter: blur(5px) saturate(1.05);
  backdrop-filter: blur(5px) saturate(1.05);
}

.result__bubble {
  position: relative;
  width: min(342px, 87vw);
  padding: 46px 30px 30px;
  transform-origin: 50% 62%;
}

.result__bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 26px rgba(150, 96, 96, 0.26))
    drop-shadow(0 4px 0 rgba(236, 206, 176, 0.6));
}

/* 星星只在气泡内部掉，掉出边就裁掉，不要飘到遮罩上 */
.result__rain {
  position: absolute;
  inset: 6px;
  overflow: hidden;
  border-radius: 22px;
  pointer-events: none;
}

.result__fall {
  position: absolute;
  top: -26px;
  left: var(--x);
  width: var(--sz);
  height: var(--sz);
  background: #ffd25e;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
    50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0;
  animation: resultFall var(--dur) linear var(--dl) infinite;
}

@keyframes resultFall {
  0%   { transform: translate3d(0, -24px, 0) rotate(0deg); opacity: 0; }
  14%  { opacity: 0.95; }
  100% { transform: translate3d(var(--drift), 430px, 0) rotate(440deg); opacity: 0; }
}

.result__body {
  position: relative;
  z-index: 2;
  text-align: center;
}

.result__kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #e39a45;
}

.result__medal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 6px 0 2px;
}

.result__medal-star {
  width: 30px;
  height: 30px;
  color: #efe4cf;         /* 没拿到的那颗：纸一样的淡色 */
}

.result__medal-star.is-on {
  color: #ffc531;
  filter: drop-shadow(0 3px 6px rgba(255, 175, 40, 0.45));
  animation: resultStarPop 0.5s cubic-bezier(0.34, 1.6, 0.5, 1) both;
}

.result__medal-star.is-on:nth-child(2) { animation-delay: 0.09s; }
.result__medal-star.is-on:nth-child(3) { animation-delay: 0.18s; }

@keyframes resultStarPop {
  0%   { transform: scale(0.2) rotate(-40deg); opacity: 0; }
  70%  { transform: scale(1.18) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result__title {
  margin: 2px 0 0;
  font-family: var(--font-round);
  font-size: clamp(27px, 7.6vw, 34px);
  font-weight: 900;
  line-height: 1.22;
  color: #5b3f63;
  letter-spacing: var(--tracking);
}

.result__gain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 10px 0 0;
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 800;
  color: #c9872c;
}

.result__gain b {
  font-size: 1.55em;
  font-weight: 900;
  color: #e8961f;
  line-height: 1;
}

.result__gain-icon {
  width: 21px;
  height: 21px;
  color: #ffc531;
  filter: drop-shadow(0 2px 3px rgba(255, 175, 40, 0.4));
}

.result__sub {
  margin: 8px 0 0;
  font-size: clamp(14px, 3.9vw, 16px);
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink-soft);
}

.result__row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.result__btn {
  flex: 1 1 0;
  min-height: 62px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: #ffffff;
  box-shadow: 0 5px 0 #ecdcbf;
  color: #8a6f5c;
  font-family: inherit;
  font-size: clamp(17px, 4.4vw, 19px);
  font-weight: 900;
  letter-spacing: var(--tracking);
  cursor: pointer;
}

.result__btn--main {
  background: linear-gradient(180deg, #ffd977 0%, #ffbb35 100%);
  box-shadow: 0 6px 0 #e09a17;
  color: #7a4a00;
}

.result__btn:active {
  transform: translateY(4px) scale(0.97);
  box-shadow: 0 1px 0 #e09a17;
  filter: brightness(0.97);
}

/* 出场 / 退场 */
.result.is-in .result__veil { animation: resultVeilIn 0.3s ease both; }
.result.is-in .result__bubble { animation: resultPop 0.52s cubic-bezier(0.34, 1.46, 0.5, 1) both; }

.result.is-out .result__veil { animation: resultVeilOut 0.2s ease both; }
.result.is-out .result__bubble { animation: resultShrink 0.2s ease both; }

@keyframes resultVeilIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes resultVeilOut { from { opacity: 1; } to { opacity: 0; } }

@keyframes resultPop {
  0%   { transform: scale(0.62) translateY(26px); opacity: 0; }
  62%  { transform: scale(1.04) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes resultShrink {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(0.92); opacity: 0; }
}

/* =========================================================
   11. 页面转场：圆圈放大 → 抵达后淡出
   ========================================================= */
.transit {
  position: fixed;
  left: 0;
  top: 0;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transform-origin: 50% 50%;
  transition: transform 0.46s cubic-bezier(0.55, 0.02, 0.62, 1);
  z-index: 3000;
  pointer-events: none;
  will-change: transform;
}

.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.44s ease 0.04s;
}

.page-curtain.is-out {
  opacity: 0;
}

/* 大厅 ↔ 学习区：换视图时淡入 */
.is-swap {
  animation: viewSwap 0.46s ease both;
}

@keyframes viewSwap {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* =========================================================
   12. 按压反馈：能点的东西按下去要缩一下、暗一点
   ---------------------------------------------------------
   不写在各个组件里，是因为漏一处就会"有的按钮有手感、有的没有"。
   用 :where() 把自身权重降到 0，组件里写过的 :active
   （门、导航、选择格、结算按钮）仍然按各自的写法走，不被这条盖掉。
   ========================================================= */
:where(button:not(:disabled), a[href], [role="button"]):active {
  transform: scale(0.95);
  filter: brightness(0.96);
}

/* SVG 里的可点区域不跟着缩放：SVG 的 transform-origin 是视框原点，
   scale 会让热点"跳"到别处去。给它们只做变暗。 */
svg :where([role="button"]):active {
  transform: none;
  filter: brightness(0.9);
}

/* 白包边压在米白/纯白的卡面上会"化"掉，给这几处字形垫一层粉影，
   让贴纸边缘重新长出来（学习区的大字母另有一层更强的投影，不受影响）。 */
.whack-mole__card svg,
.monster__tile-letter svg,
.mcard__letter svg {
  filter: drop-shadow(0 2px 0 rgba(206, 116, 146, 0.26))
    drop-shadow(0 3px 7px rgba(239, 111, 142, 0.16));
}

/* 第一步要滚过 26 个字母才看得到"下一步"——手机上要滑 500 多像素，
   孩子选完字母就停在那儿不知道怎么办。这里把它做成悬浮，
   一进这一步就在拇指够得着的位置；其他步骤的按钮仍留在原位。 */
#stepPick .step__next {
  /* 用 sticky 而不是 fixed：.step 上有 riseIn 动画，动画结束后仍保留
     transform（fill-mode: both），fixed 会以 .step 为包含块，
     结果按钮仍然留在文档流末尾——实测 top=1228，等于没做。
     sticky 相对滚动视口，不受 transform 影响。 */
  position: sticky;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 44;

  width: 100%;
  min-height: 74px;
  margin-top: 10px;

  box-shadow: 0 7px 0 #2f9d66, 0 18px 34px -10px rgba(46, 122, 84, 0.5);
}

#stepPick .step__next:disabled {
  box-shadow: 0 7px 0 #d8cdb9;
}

/* =========================================================
   21. 大厅三入口（学习 / 游戏 / 复习）
   =========================================================
   为什么要改形态：原来只有两扇门，竖着摆两座拱门正好占满一屏。
   加上"每日复习"之后，三座竖拱门在 390×844 上要 700 多像素，
   再加上标题和进度条就必然要滚——而"每天要复习"这件事，
   恰恰最不能藏在需要滑一下才能看见的地方。

   所以手机上换成三张横卡：图标在左、两行字在右，每张 90px 高，
   三个入口一屏全露。平板（≥640）空间够，回到三座拱门并排。
   --------------------------------------------------------- */

.lobby__doors {
  display: grid;
  grid-template-columns: 1fr;
  /* 横卡之间不需要给草丘留位置（草丘已关掉），间距收到 13px */
  gap: 13px;
}

.door {
  display: grid;
  grid-template-columns: 58px 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  justify-items: start;
  column-gap: 15px;
  row-gap: 1px;

  min-height: 90px;
  padding: 13px 46px 13px 17px;
  border-radius: 26px;
  text-align: left;
}

/* 草丘与水波是"拱门"的配套装饰，横卡上一律关掉 */
.door::before,
.door::after { display: none; }

/* 依次入场，第三张别再跟第二张同时出现 */
.door:nth-child(2) { animation-delay: 0.08s; }
.door:nth-child(3) { animation-delay: 0.16s; }

.door__art {
  grid-row: 1 / 3;
  grid-column: 1;
  width: 58px;
  height: 58px;
  margin: 0;
}

.door__art::before {
  inset: -9px;
  border-width: 2.5px;
}

.door__name {
  grid-column: 2;
  font-size: 21px;
  line-height: 1.24;
}

.door__desc {
  grid-column: 2;
  font-size: 12.5px;
  line-height: 1.36;
  /* 复习卡的说明会动态换字（"今天已复习"），给两行余量不跳版 */
  min-height: 17px;
}

/* ---- 第三扇门：橙黄 ----
   比另外两扇暖一档，在一列里第一眼就看见它。 */
.door--review {
  /* 底色调到"杏橙"而不是"沙黄"：三张卡并排时，
     绿色和粉色都是往白里调的，橙色如果也调淡就发灰，
     在一列里反而不如另外两张跳。这一档是量出来的——
     再浓一档就变成警告条，再淡一档就认不出是橙色。 */
  --door-a: #fffaef;
  --door-b: #ffd88c;
  --door-glow: rgba(255, 170, 56, 0.52);
  --island-grass: #ffd894;
  --island-grass-deep: #f7c266;
  --island-sand: #ffe8b6;
  --door-name: #7d4a0e;

  /* 平板上三扇门并排时，复习在最右；给它一点"今天要做"的呼吸感 */
  background:
    radial-gradient(96% 58% at 50% -2%, #ffffff 0%, rgba(255, 255, 255, 0) 64%),
    linear-gradient(180deg, var(--door-a) 0%, var(--door-b) 100%);
}

.door--review .door__desc { color: #9a7332; }

/* 右上角小角标：今天还有几个字母要复习 */
.door__badge {
  position: absolute;
  top: 12px;
  right: 13px;

  min-width: 26px;
  height: 26px;
  padding: 0 8px;

  display: grid;
  place-items: center;

  border-radius: 999px;
  background: linear-gradient(180deg, #ffa64f 0%, #f0741e 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: var(--weight-black);
  letter-spacing: 0.02em;
  line-height: 1;

  box-shadow:
    0 0 0 2.5px rgba(255, 255, 255, 0.92),
    0 3px 0 rgba(190, 84, 16, 0.5),
    0 7px 14px -5px rgba(190, 84, 16, 0.6);

  animation: badgePop 0.46s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  pointer-events: none;
}

.door__badge[hidden] { display: none; }

@keyframes badgePop {
  from { transform: scale(0.3); opacity: 0; }
  70%  { transform: scale(1.12); opacity: 1; }
  to   { transform: scale(1); opacity: 1; }
}

/* 今天复习完了：角标换成一个绿勾 */
.door__badge.is-done {
  background: linear-gradient(180deg, #6ed6a0 0%, #35a86f 100%);
  box-shadow:
    0 0 0 2.5px rgba(255, 255, 255, 0.92),
    0 3px 0 rgba(28, 118, 76, 0.5),
    0 7px 14px -5px rgba(28, 118, 76, 0.55);
}

/* ---- 平板：回到三座拱门 ----
   640px 以上一屏横着放得下三个，竖拱门比横卡更有"传送门"的仪式感。 */
@media (min-width: 640px) {
  .lobby__doors {
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(14px, 2.2vw, 26px);
  }

  .door {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 7px;

    min-height: clamp(232px, 31vh, 306px);
    padding: 24px 16px 32px;
    border-radius: 132px 132px 40px 40px;
  }

  .door::before,
  .door::after { display: block; }

  .door__art {
    width: clamp(66px, 11vw, 98px);
    height: clamp(66px, 11vw, 98px);
    margin-bottom: 2px;
  }

  .door__art::before {
    inset: -13px;
    border-width: 3px;
  }

  .door__name { font-size: clamp(19px, 2.6vw, 28px); }
  .door__desc { font-size: clamp(12px, 1.5vw, 14.5px); }

  .door__badge {
    top: 20px;
    right: 22px;
  }
}

/* 平板三列并排之后，右下角那只小羊正好站在"每日复习"的裙边上。
   往下挪 30px、缩到 132，两不相犯；这个宽度下它也压不到底部导航。 */
@media (min-width: 640px) {
  .stage {
    bottom: calc(54px + env(safe-area-inset-bottom));
    width: 132px;
  }
}

/* ---- 横屏矮屏（≤560 高）：三张竖着排会把页面顶穿，改三列小卡 ---- */
@media (max-height: 560px) and (orientation: landscape) {
  .lobby__doors {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .door {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 3px;

    min-height: 116px;
    padding: 10px 10px 14px;
    border-radius: 84px 84px 24px 24px;
  }

  .door::before,
  .door::after { display: block; }

  .door__art { width: 50px; height: 50px; }
  .door__art::before { inset: -8px; border-width: 2px; }
  .door__name { font-size: 17px; }
  .door__desc { display: none; }

  .door__badge {
    top: 8px;
    right: 9px;
    min-width: 22px;
    height: 22px;
    font-size: 11.5px;
  }
}

/* =========================================================
   21.1 大厅：手机上内容靠上，把下半屏让出来
   =========================================================
   三个入口排下来只有 270 多像素，原来的 justify-content:center
   会把它们放在屏幕正中——而每日签到是弹出来的浮层，
   两者必然撞在"每日复习"那一张上。
   靠上排之后，标题、进度、三扇门、签到、宠物各占一段，谁也不压谁。
   平板上三列并排本来就矮，保持居中更好看。
   --------------------------------------------------------- */
@media (max-width: 639px) {
  body[data-page="island"] .lobby {
    justify-content: flex-start;
    padding-top: max(22px, env(safe-area-inset-top));
  }

  .lobby__title { font-size: clamp(32px, 8.6vw, 46px); }
  .lobby__tip { margin-top: 8px; }

  /* 90 → 82：三张省下 24px，正好给底下的签到腾出位置。
     82px 对拇指来说仍然是一整块大目标。 */
  .door { min-height: 82px; padding: 11px 46px 11px 16px; }
  .door__art { width: 54px; height: 54px; }
  .door__name { font-size: 20px; }
}

/* =========================================================
   21.2 每日签到：从居中模态改成贴底通知
   =========================================================
   原来它是"气球 128 + 宠物 148 + 卡片 200 = 476px"竖着堆，
   在 844 高的屏上无论居中还是贴底，都会盖住至少一张门。
   孩子第一眼看到的是一张盖住入口的卡片，家长会以为没有那个功能。

   改法：
     ① 宠物从竖排里拿出来，缩成卡片右上角的小头像——
        大厅右下角本来就站着一只，弹窗里再放一只等于同一只出现两次；
     ② 气球挂到卡片上方（绝对定位），不占布局高度；
     ③ 整层贴到底部导航上方。
   这样占位高度只剩卡片本身，门全部露出来。
   --------------------------------------------------------- */
.checkin {
  place-items: end center;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom));
}

/* 遮罩只压底部：签到是"今天也来啦"，不是"打断你"。 */
.checkin__veil {
  background: linear-gradient(
    to top,
    rgba(20, 38, 34, 0.46) 0%,
    rgba(20, 38, 34, 0.20) 42%,
    rgba(20, 38, 34, 0) 70%
  );
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.checkin__balloons {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;

  height: auto;
  margin-bottom: -8px;
  gap: 150px;
  pointer-events: none;
  z-index: 1;
}

.checkin__one { width: 54px; }
.checkin__one:nth-child(2) { width: 46px; margin-bottom: 8px; }

.checkin__pet {
  position: absolute;
  right: -12px;
  top: -34px;

  width: 78px;
  margin: 0;
  z-index: 2;

  pointer-events: none;
}

/* 卡片再收一点内边距，整块落到 190px 以内 */
.checkin__card { padding: 11px 16px 14px; }
.checkin__desc { margin: 5px 0 10px; }
.checkin__ok { padding: 11px 10px; }

/* 横屏（≤560 高）维持原来的左右排法，贴底会让卡片顶出屏幕 */
@media (max-height: 560px) and (orientation: landscape) {
  .checkin {
    place-items: center;
    padding: 10px;
  }

  .checkin__balloons {
    position: static;
    height: auto;
    margin-bottom: 0;
    gap: 8px;
  }

  .checkin__pet {
    position: static;
    width: 112px;
    margin: 0;
  }

  .checkin__veil {
    background: radial-gradient(circle at 50% 42%, rgba(46, 96, 82, 0.30), rgba(16, 30, 38, 0.60));
  }
}

/* =========================================================
   22. 字母分组筛选 + 已学/未学状态
   =========================================================
   26 张卡在手机上要滑好几屏才找得到 S。分组不是"锦上添花"，
   是让 3 岁孩子能在两屏内点到目标字母。

   已学/未学用"压暗"而不是"变灰框"：灰框看起来像禁用，
   孩子会以为点不了；降饱和 + 降透明仍然能点、能看清字。
   --------------------------------------------------------- */

.letter-card[hidden] { display: none; }

.island__grid.has-learned .letter-card:not(.is-learned) {
  /* 注意：入场动画 cardIn 是 fill-mode: both，结束后仍把 opacity 钉在 1，
     直接写 opacity 会被动画盖掉（实测算出来还是 1）。
     放在 filter 里的 opacity() 不参与那个动画，才真的暗得下来。 */
  /* 0.56 在 390 宽上已经把字压到几乎看不见，孩子会当成"坏了"。
     0.7 + 0.72 饱和度，一眼能分出亮/暗，又能看清字形。 */
  filter: saturate(0.72) opacity(0.7);
}

/* 手指按下去的瞬间要恢复，不然会怀疑这张卡坏了 */
.island__grid.has-learned .letter-card:not(.is-learned):active {
  filter: none;
}

.gridtabs {
  display: flex;
  flex-direction: column;
  gap: 6px;

  margin: 0 0 14px;
  padding: 0 2px;
}

/* 五个字母段一行等分，两颗状态另一行等分：
   390 宽下七个胶囊排一行会有一半跑到屏幕外（实测"已学/未学"整颗点不到）。 */
.gridtabs__row {
  display: grid;
  gap: 6px;
}

.gridtabs__row--range { grid-template-columns: repeat(5, 1fr); }
.gridtabs__row--state { grid-template-columns: repeat(2, 1fr); }

.gridtab {
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;

  border: 2px solid #ecdfcd;
  border-radius: 999px;
  background: #fffdf8;

  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #a4907c;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.gridtab:active { transform: scale(0.96); }

.gridtab.is-on {
  background: linear-gradient(180deg, #ffd98e 0%, #ffc35f 100%);
  border-color: #f0b95b;
  color: #7d4a0e;
  box-shadow: 0 3px 0 #e3a63f;
}

/* 已学 / 未学两颗用薄荷绿，和"学习"这件事对应 */
.gridtab--state.is-on {
  background: linear-gradient(180deg, #b9ecd5 0%, #87dcb8 100%);
  border-color: #7fd0aa;
  color: #226249;
  box-shadow: 0 3px 0 #6ec09b;
}

/* 胶囊里的数量：比正文轻一档，不抢"已学"两个字 */
.gridtab b {
  margin-left: 1px;
  font-size: 11.5px;
  font-weight: 800;
  opacity: 0.62;
}

.grid-empty {
  margin: 6px 0 0;
  padding: 28px 18px;

  border: 2px dashed #e8dcc8;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);

  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  color: #a4907c;
}

.grid-empty[hidden] { display: none; }

/* =========================================================
   23. 家长看板
   =========================================================
   入口必须"孩子按不开、家长两下就会"：
   按住 3 秒，环形进度在指头底下走完才开；手一松就归零。
   --------------------------------------------------------- */

.parentkey {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 6;

  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 5px;

  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
  box-shadow:
    0 8px 18px -12px rgba(120, 88, 56, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);

  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #a08e7a;

  cursor: pointer;
  /* 长按期间别让页面跟着滚 */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.parentkey__ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

/* 第一只 svg 是进度环，绝对定位套在锁外面 */
.parentkey__ring > svg:first-of-type {
  position: absolute;
  inset: -3px;
  width: 30px;
  height: 30px;
  transform: rotate(-90deg);
}

.parentkey__ring circle {
  fill: none;
  stroke-width: 3;
}

.parentkey__track { stroke: rgba(122, 100, 70, 0.14); }

.parentkey__fill {
  stroke: #f2a03f;
  stroke-linecap: round;
  stroke-dasharray: 97.4;      /* r=15.5 的周长 */
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset 0.18s ease;
}

.parentkey.is-holding .parentkey__fill {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 3s linear;
}

.parentkey__lock {
  position: relative;
  width: 16px;
  height: 16px;
}

.parentkey__pop {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;

  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(46, 79, 68, 0.92);
  color: #ffffff;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;

  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.parentkey.is-hint .parentkey__pop {
  opacity: 1;
  transform: none;
}

/* ---- 面板 ---- */
.parent {
  position: fixed;
  inset: 0;
  z-index: 420;

  display: grid;
  place-items: end center;
}

.parent[hidden] { display: none; }

.parent__veil {
  position: absolute;
  inset: 0;
  background: rgba(24, 38, 33, 0.46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.parent__card {
  position: relative;
  display: flex;
  flex-direction: column;

  width: min(100%, 560px);
  max-height: 88vh;
  max-height: 88dvh;

  border-radius: 28px 28px 0 0;
  background: #fffdf8;
  box-shadow: 0 -20px 48px -14px rgba(60, 44, 30, 0.5);

  padding-bottom: env(safe-area-inset-bottom);
  animation: parentUp 0.34s cubic-bezier(0.22, 1.1, 0.4, 1) both;
}

@keyframes parentUp {
  from { transform: translateY(44px); opacity: 0.5; }
  to   { transform: translateY(0); opacity: 1; }
}

.parent__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 13px;
  border-bottom: 1px solid #f2e8d8;
}

.parent__headtxt { flex: 1; }

.parent__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #2e4f44;
}

.parent__sub {
  margin: 3px 0 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #a4907c;
}

.parent__close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f4ece0;
  color: #8a7a68;

  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.parent__close:active { transform: scale(0.94); }

.parent__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 18px 22px;
}

body.parent-locked { overflow: hidden; }

/* 四格数字 */
.pstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pstat {
  padding: 9px 4px 8px;
  border: 1px solid #f2e6d2;
  border-radius: 15px;
  background: #fff8ec;
  text-align: center;
}

.pstat__n {
  display: block;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.08;
  color: #2e4f44;
}

.pstat__c {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #9a8a76;
}

.pstat__x {
  display: block;
  margin-top: 1px;
  font-size: 9.5px;
  font-style: normal;
  color: #b6a692;
}

.pstat__u {
  margin-left: 2px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  color: #b58a5a;
}

.pstat.is-gold .pstat__n { color: #d99a1f; }
.pstat.is-warm .pstat__n { color: #e06a8c; }

/* 上周复习 */
.pweek {
  margin-top: 12px;
  padding: 12px 14px 13px;
  border: 1px solid #f2e4cc;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8ec 0%, #fff1de 100%);
}

.pweek__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pweek__cap {
  font-size: 12px;
  font-weight: 700;
  color: #9a8a76;
}

.pweek__val {
  font-size: 15px;
  font-weight: 800;
  color: #7c4f12;
}

.pweek__dots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.pweek__d {
  flex: 1 1 0;
  height: 27px;

  display: grid;
  place-items: center;

  border: 1px solid #efe3d1;
  border-radius: 9px;
  background: #fffdf8;

  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  color: #c7b7a3;
}

.pweek__d.is-on {
  background: linear-gradient(180deg, #ffd98e 0%, #ffc35f 100%);
  border-color: #f0c274;
  color: #8a5417;
}

.pweek__d.is-today {
  box-shadow: 0 0 0 2px rgba(255, 157, 84, 0.24);
}

/* 分区 */
.pblock { margin-top: 17px; }

.pblock__h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 9px;

  font-size: 14px;
  font-weight: 800;
  color: #3e5f52;
}

.pblock__h span {
  font-size: 11.5px;
  font-weight: 700;
  color: #a4907c;
}

.pblock__tip {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.65;
  color: #a8957f;
}

.pblock__empty {
  margin: 0;
  padding: 15px 14px;

  border: 1px dashed #e6d8c2;
  border-radius: 14px;
  background: #fbf6ec;

  font-size: 12.5px;
  line-height: 1.7;
  color: #9a8a76;
}

/* 已掌握字母 */
.pchips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pchip {
  position: relative;
  width: 52px;
  padding: 7px 0 6px;

  border: 1.5px solid #bfe8d5;
  border-radius: 12px;
  background: #eafaf2;
  text-align: center;
}

.pchip b {
  display: block;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  color: #2f7d5d;
}

.pchip i {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-style: normal;
  color: #8cb8a4;
}

.pchip.is-done::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;

  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5cc98f;
  box-shadow: 0 0 0 2px #fffdf8;

  font-size: 10px;
  line-height: 16px;
  text-align: center;
  color: #ffffff;
}

/* 错题本 */
.pweak {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pweak__row {
  display: grid;
  grid-template-columns: 32px 72px 1fr;
  align-items: center;
  gap: 9px;
}

.pweak__l {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;

  border: 1.5px solid #ffc6d6;
  border-radius: 9px;
  background: #ffe9ef;

  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: #c2517a;
}

.pweak__n {
  font-size: 11.5px;
  font-weight: 700;
  color: #9a8a76;
}

.pweak__track {
  height: 8px;
  border-radius: 999px;
  background: #f4ead9;
  overflow: hidden;
}

.pweak__track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb3c8 0%, #ff7fa6 100%);
}

.pnote {
  margin: 18px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: #b6a692;
  text-align: center;
}

/* 平板 / 桌面：改成居中卡片，别贴着屏幕底 */
@media (min-width: 720px) {
  .parent { place-items: center; padding: 24px; }

  .parent__card {
    border-radius: 26px;
    max-height: 82vh;
  }

  .parent__head { padding-top: 20px; }
}

/* =========================================================
   24. 水印避让
   =========================================================
   原来写死 bottom: 10px，正好落在底部导航那条带子上：
   在大厅被 tabbar 盖住，在学习页则反过来压在"下一步"按钮上。
   现在每个页面给一个抬升量，把水印送到悬浮栏上方；
   z-index 也压到 40，即使算错也只会被按钮盖住，不会挡点击。
   --------------------------------------------------------- */

.watermark {
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(8px + env(safe-area-inset-bottom) + var(--wm-lift, 0px));
  z-index: 40;
  padding: 3px 9px;
  font-size: 11.5px;

  transition: opacity 0.18s ease;
}

/* 签到卡片弹出时会把水印压掉一半，露出个小尾巴反而更显眼，
   干脆整块淡出，卡片收起来再回来。 */
body.checkin-open .watermark { opacity: 0; }

/* 大厅：底部导航 + 右侧宠物台，两个都占着右下角。
   所以只把它抬到导航上方，并且换到左边——小羊在右边站着。 */
body[data-page="island"] { --wm-lift: 84px; }
body[data-page="island"] .watermark {
  /* 上面 20.5 有一条把岛页水印放到左上角的旧规则（当时是当版本号用的）。
     现在左上角站着"家长"按钮，必须显式把 top 撤掉，
     否则 top 和 bottom 同时存在时浏览器只认 top，水印又会回到家长按钮上。 */
  left: max(10px, env(safe-area-inset-left));
  right: auto;
  top: auto;
  bottom: calc(8px + env(safe-area-inset-bottom) + var(--wm-lift, 0px));

  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(74, 63, 53, 0.5);
}

/* 字母学习区：右下角是导航、右边是宠物，左下角又压着字母卡。
   直接把水印改成竖排贴在右边缘，和 letter.html 完全一致：
   那里是 .island 的 18px 留白，刚好放得下一条竖条。 */
body[data-page="island"].is-learning .watermark {
  left: auto;
  right: 1px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);

  padding: 9px 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.34);

  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: 0.16em;
  opacity: 0.62;
}

/* 学习页：底部是整条"上一步 / 下一步"，抬到它上面 */
body[data-page="letter"] { --wm-lift: 106px; }

/* 游戏页：第一步的"下一步"是贴底悬浮的，抬到它上面 */
body[data-page="game"] { --wm-lift: 96px; }

/* 复习页 / 激活页没有固定底栏，留在右下角 */
body[data-page="review"] { --wm-lift: 6px; }
body[data-page="index"]  { --wm-lift: 6px; }

/* =========================================================
   25. 360×640 极窄屏
   =========================================================
   这批机器（老安卓、小屏 SE）宽度只有 360，高度只有 640。
   统一收一档：标题、间距、卡片高度各让一点，
   目标是"大厅一屏看全三个入口，学习区一屏看到 6 张卡"，
   不用先滑一下才知道下面还有什么。
   --------------------------------------------------------- */

@media (max-width: 360px) {
  .lobby {
    padding: 12px 12px calc(150px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  .lobby__title { font-size: 30px; }
  .lobby__tip { margin-top: 2px; font-size: 13px; }

  .statbar {
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 13px;
  }
  .statbar--lobby { margin-top: -2px; }

  .door {
    min-height: 74px;
    padding: 8px 38px 8px 13px;
    border-radius: 22px;
    column-gap: 12px;
  }
  .door__art { width: 46px; height: 46px; }
  .door__art::before { inset: -7px; border-width: 2px; }
  .door__name { font-size: 18px; }
  .door__desc { font-size: 11.5px; }
  .door__badge { top: 9px; right: 10px; min-width: 22px; height: 22px; font-size: 11.5px; }

  .wallet { height: 30px; padding: 0 10px 0 8px; }
  .wallet__num { font-size: 13px; }

  .parentkey { height: 30px; padding: 0 10px 0 4px; font-size: 10.5px; }
  .parentkey__ring { width: 21px; height: 21px; }
  .parentkey__ring > svg:first-of-type { width: 26px; height: 26px; }
  .parentkey__lock { width: 14px; height: 14px; }

  .stage { width: 98px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }

  .tabbar {
    width: calc(100% - 16px);
    padding: 5px;
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .tabbar__btn { min-height: 46px; }
  .tabbar__txt { font-size: 11px; }

  /* 学习区 */
  .island { padding: 12px 22px calc(92px + env(safe-area-inset-bottom)); }
  .island__title { font-size: 21px; }
  /* 360 上每一条都得算着用：提示语和下面的胶囊说的是同一件事，先让它让位 */
  .island__tip { display: none; }

  .casebar { gap: 6px; margin: -2px 0 10px; }
  .casebar__btn { padding: 6px 10px; font-size: 12.5px; }

  .gridtabs { gap: 6px; margin-bottom: 10px; }
  .gridtab { min-height: 34px; padding: 0 12px; font-size: 12px; }

  .island__grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 9px;
  }

  .letter-card {
    min-height: 112px;
    padding: 10px 8px 9px;
    border-width: 3px;
    border-radius: 16px;
  }
  .letter-card__upper { font-size: 34px; }
  .letter-card__lower { font-size: 23px; }
  .letter-card__thumb-wrap { min-height: 38px; }
  .letter-card__thumb-wrap svg { width: 40px; height: 40px; }
  .letter-card.is-learned::after { width: 22px; height: 22px; line-height: 22px; font-size: 13px; }

  /* 签到卡片：高度再收一档，别把三扇门压住 */
  .checkin__card { padding: 9px 14px 12px; }
  .checkin__title { font-size: 19px; }
  .checkin__desc { margin: 4px 0 8px; font-size: 12px; }
  .checkin__ok { min-height: 46px; }

  /* 家长面板：小屏上四格改两行，字才不会挤成一条线 */
  .pstats { grid-template-columns: repeat(2, 1fr); }
  .parent__body { padding: 12px 14px 18px; }
  .parent__title { font-size: 18px; }
  .pweak__row { grid-template-columns: 30px 66px 1fr; gap: 7px; }
}

/* 360 且很矮（640 及以下）：再把大厅缩短一点 */
@media (max-width: 360px) and (max-height: 660px) {
  .lobby { padding-top: 10px; gap: 7px; }
  .door { min-height: 70px; }
  .lobby__tip { display: none; }
}
