:root {
  --cream: #FBF8F1;
  --cream-deep: #F5EFE3;
  --blue-soft: #DDEFD6;
  --blue-mid: #8DBF73;
  --blue-deep: #4E8F42;
  --blue-text: #2F6B37;
  --mint: #C8E6D5;
  --peach: #F8D7C9;
  --yellow: #FCE8A8;
  --lavender: #E0D4F0;
  --pink-soft: #F5D5D5;
  --text-dark: #4A4A4A;
  --text-mid: #7A7A7A;
  --text-light: #A0A0A0;
  --star: #F5B84B;
  --star-deep: #E89B2F;
  --done: #7FCB9A;
  --shadow: 0 4px 14px rgba(78, 143, 66, 0.16);
  --shadow-hover: 0 8px 24px rgba(78, 143, 66, 0.26);
  --radius: 18px;
  --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #FBF8F1 0%, #E6F4DF 50%, #F5EFE3 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* 顶部云朵装饰 */
.cloud-deco {
  position: fixed;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}
.cloud-1 { top: 40px; left: -30px; font-size: 60px; animation: float 8s ease-in-out infinite; }
.cloud-2 { top: 120px; right: -20px; font-size: 50px; animation: float 10s ease-in-out infinite reverse; }
.cloud-3 { bottom: 80px; left: 10%; font-size: 45px; animation: float 12s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-15px) translateX(10px); }
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  position: relative;
  z-index: 1;
}

/* ============ 顶部欢迎栏 ============ */
.header {
  background: linear-gradient(135deg, #ffffff 0%, #F2FAEE 100%);
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  border: 2px solid #DCEED5;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: "🚀";
  position: absolute;
  top: -10px;
  right: 30px;
  font-size: 70px;
  opacity: 0.12;
  transform: rotate(-15deg);
}
.header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 4px 12px rgba(111, 161, 87, 0.4);
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.9);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.avatar:active {
  transform: scale(0.92);
}
.avatar:hover {
  box-shadow: 0 4px 16px rgba(111, 161, 87, 0.6);
}
.avatar-camera {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  pointer-events: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 头像裁剪编辑器 */
.avatar-crop-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.ace-title {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  text-align: center;
}
.ace-stage {
  position: relative;
  width: 260px; height: 260px;
  overflow: hidden;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.7);
  background: #1a1a1a;
  flex-shrink: 0;
}
.ace-img {
  position: absolute;
  cursor: grab;
  -webkit-user-drag: none;
  will-change: transform;
}
.ace-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
  pointer-events: none;
}
.ace-zoom {
  display: flex; align-items: center; gap: 14px;
  color: #fff; font-size: 14px;
}
.ace-zbtn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff; font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  min-height: 38px;
}
.ace-zbtn:active { background: rgba(255,255,255,0.32); }
.ace-zlabel { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.ace-actions {
  display: flex; gap: 12px;
  margin-top: 6px;
}
.ace-btn {
  padding: 10px 26px;
  border-radius: 22px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s;
  min-height: 42px;
}
.ace-btn:active { transform: scale(0.94); }
.ace-cancel { background: rgba(255,255,255,0.16); color: #fff; }
.ace-reset  { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.75); }
.ace-change { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.85); }
.ace-confirm { background: linear-gradient(135deg, #6fa8dc, #4a90d9); color: #fff; }

.header-title h1 {
  font-size: 22px;
  color: var(--blue-text);
  font-weight: 700;
}
.header-title p {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 2px;
}
.header-stats {
  margin-left: auto;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat-pill {
  background: linear-gradient(135deg, #fff, #FBF8F1);
  padding: 8px 16px;
  border-radius: 16px;
  text-align: center;
  border: 1.5px solid #F0E8D8;
  min-width: 80px;
}
.stat-pill .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--star-deep);
  line-height: 1;
}
.stat-pill .lbl {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}
.stat-pill.badge .num { color: var(--blue-deep); font-size: 16px; font-weight: 800; }

/* 进度总条 */
.progress-bar-wrap {
  margin-top: 18px;
  background: #F0E8D8;
  height: 14px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-deep), var(--star));
  border-radius: 10px;
  transition: width 0.6s ease;
  position: relative;
}
.progress-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shine 2s linear infinite;
}
@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-mid);
  margin-top: 8px;
}

/* ============ 导航 Tab ============ */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  background: #fff;
  padding: 6px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.nav-tab {
  flex: 1;
  min-width: 90px;
  padding: 12px 8px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-mid);
  font-weight: 600;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.nav-tab .icon { font-size: 20px; }
.nav-tab:hover { background: var(--blue-soft); }
.nav-tab.active {
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-deep));
  color: #fff;
  box-shadow: 0 4px 12px rgba(111, 161, 87, 0.4);
}

/* ============ 页面容器 ============ */
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 卡片通用 ============ */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1.5px solid #E4F0DC;
  transition: box-shadow 0.3s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--blue-text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .emoji { font-size: 22px; }
.card-title .count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  background: var(--cream-deep);
  padding: 3px 10px;
  border-radius: 10px;
}

/* ============ 首页看板 ============ */
.welcome-banner {
  background: linear-gradient(135deg, #DCEAF7 0%, #FCE8A8 100%);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.welcome-banner h2 {
  font-size: 20px;
  color: var(--blue-text);
}
.welcome-banner p {
  font-size: 14px;
  color: var(--text-mid);
  margin-top: 6px;
}
.welcome-banner .deco-emoji {
  position: absolute;
  font-size: 40px;
  opacity: 0.7;
}
.welcome-banner .d1 { top: 10px; left: 20px; transform: rotate(-10deg); }
.welcome-banner .d2 { bottom: 10px; right: 20px; transform: rotate(10deg); }

.today-tasks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.task-mini {
  background: linear-gradient(135deg, #fff, #FBF8F1);
  border: 2px solid #F0E8D8;
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.task-mini:hover { transform: translateY(-2px); border-color: var(--blue-mid); }
.task-mini.today-played { border-color: #FFB74D; background: linear-gradient(135deg, #FFF8E1, #FFECB3); }
.task-mini .tm-icon {
  font-size: 28px;
  width: 44px; height: 44px;
  background: var(--blue-soft);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.task-mini .tm-info { flex: 1; }
.task-mini .tm-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.task-mini .tm-sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.task-mini .tm-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--blue-mid);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.task-mini.done { background: linear-gradient(135deg, #E8F5E9, #C8E6C9); border-color: var(--done); }
.task-mini.done .tm-check { background: var(--done); border-color: var(--done); color: #fff; }
.task-mini.done .tm-name { color: var(--text-light); text-decoration: line-through; }

/* 段位卡片 */
.rank-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.rank-card-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.rank-card-badge .rcb-icon { font-size: 28px; line-height: 1; }
.rank-card-badge .rcb-name { font-size: 11px; font-weight: 800; margin-top: 2px; }
.rank-card-info .rci-title { font-size: 13px; color: var(--text-light); font-weight: 600; }
.rank-card-info .rci-desc { font-size: 15px; font-weight: 700; color: var(--text-dark); margin-top: 2px; }
.rank-card-info .rci-coins { font-size: 12px; color: var(--text-light); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.rank-progress-bar-wrap {
  height: 10px;
  background: #F0E8D8;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}
.rank-progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}
.rank-progress-text {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 16px;
}
.rank-tier-list {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.rank-tier {
  flex: 1;
  text-align: center;
  padding: 8px 2px;
  border-radius: 10px;
  transition: all 0.3s;
}
.rank-tier.locked {
  opacity: 0.35;
  filter: grayscale(0.7);
}
.rank-tier.current {
  background: rgba(107,159,212,0.1);
  box-shadow: 0 0 0 2px rgba(107,159,212,0.3);
  transform: scale(1.08);
}
.rank-tier-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid #E0D8C8;
  background: #F8F4EC;
}
.rank-tier.unlocked .rank-tier-icon {
  border-width: 2.5px;
}
.rank-tier-name {
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-dark);
}
.rank-tier.locked .rank-tier-name {
  color: var(--text-light);
}
.rank-tier-threshold {
  font-size: 9px;
  color: var(--text-light);
  margin-top: 1px;
}

/* 段位升级弹窗 */
.rankup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 0.4s;
  pointer-events: none;
}
.rankup-overlay.show {
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
}
.rankup-modal {
  background: #fff;
  border-radius: 24px;
  padding: 36px 28px 28px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.3) translateY(60px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rankup-overlay.show .rankup-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.rankup-badge-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.rankup-badge {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  animation: rankup-pulse 1.5s ease-in-out infinite;
}
@keyframes rankup-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
  50% { transform: scale(1.08); box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
}
.rankup-badge-icon { font-size: 40px; line-height: 1; }
.rankup-badge-name { font-size: 14px; font-weight: 800; margin-top: 2px; }
.rankup-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.rankup-rank-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.rankup-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.rankup-coins {
  font-size: 13px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
}
.rankup-next {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.rankup-close-btn {
  background: linear-gradient(135deg, var(--accent), var(--star));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(107,159,212,0.3);
  transition: transform 0.2s;
}
.rankup-close-btn:active { transform: scale(0.95); }

/* ============ 任务卡片 ============ */
.task-item {
  background: linear-gradient(135deg, #fff, #FCFAF5);
  border: 1.5px solid #F0E8D8;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.25s;
}
.task-item:hover { border-color: var(--blue-mid); transform: translateX(2px); }
.task-item.done {
  background: linear-gradient(135deg, #F1F8F4, #E8F5E9);
  border-color: var(--done);
}
.task-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.task-head .ti-icon {
  font-size: 24px;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--blue-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.task-head .ti-title { flex: 1; }
.task-head .ti-title h4 { font-size: 15px; color: var(--text-dark); }
.task-head .ti-title .ti-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.task-head .ti-stars {
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.check-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--blue-mid);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.check-btn:hover { background: var(--blue-soft); }
.task-item.done .check-btn { background: var(--done); border-color: var(--done); color: #fff; }

.task-content {
  background: var(--cream);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.8;
}
.task-content .tc-label {
  font-size: 12px;
  color: var(--blue-text);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-content .tc-block { margin-bottom: 10px; }
.task-content .tc-block:last-child { margin-bottom: 0; }
.word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.word-chip {
  background: #fff;
  border: 1.5px solid var(--blue-soft);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text-dark);
}
.word-chip .pinyin { font-size: 11px; color: var(--blue-text); display: block; }
.word-chip .meaning { font-size: 10px; color: var(--text-light); display: block; }

/* 数学题 */
.math-q {
  background: #fff;
  border: 1.5px solid var(--blue-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.math-q .q-num { color: var(--blue-text); font-weight: 600; min-width: 24px; }
.math-q .q-text { flex: 1; }
.math-q .q-ans {
  width: 60px;
  border: 1.5px solid var(--blue-mid);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 15px;
  text-align: center;
  background: #fff;
  color: var(--text-dark);
}
.math-q.correct { background: #E8F5E9; border-color: var(--done); }
.math-q.correct .q-ans { border-color: var(--done); color: var(--done); font-weight: 700; }
.math-q.wrong { background: #FFEBEE; border-color: #E87B7B; }

/* 英语字母卡 */
.letter-card {
  background: linear-gradient(135deg, #DCEAF7, #E0D4F0);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
}
.letter-big {
  font-size: 64px;
  font-weight: 800;
  color: var(--blue-deep);
  line-height: 1;
  font-family: "Georgia", serif;
}
.letter-small {
  font-size: 28px;
  color: var(--blue-text);
  margin-top: 4px;
  font-family: "Georgia", serif;
}
.letter-sound {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 10px;
}
/* 发音按钮 */
.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-deep));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(111, 161, 87, 0.3);
}
.speak-btn:hover { transform: scale(1.05); box-shadow: 0 4px 10px rgba(111, 161, 87, 0.4); }
.speak-btn:active { transform: scale(0.95); }
.speak-btn.speaking { background: linear-gradient(135deg, var(--star), var(--star-deep)); animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(245, 184, 75, 0.4); }
  50% { box-shadow: 0 4px 14px rgba(245, 184, 75, 0.7); }
}
.word-chip-with-sound {
  background: #fff;
  border: 1.5px solid var(--blue-soft);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mini-speak {
  background: var(--blue-soft);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.mini-speak:hover { background: var(--blue-mid); transform: scale(1.1); }

/* ============ 金币百宝箱 ============ */
.treasure-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--blue-soft);
  padding-bottom: 0;
}
.treasure-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-bottom: 3px solid transparent;
  border-radius: 10px 10px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.treasure-tab:hover { background: var(--blue-soft); }
.treasure-tab.active {
  color: var(--blue-text);
  border-bottom-color: var(--star-deep);
  background: var(--blue-soft);
}
.treasure-panel { display: none; }
.treasure-panel.active { display: block; }

/* ============ 金币商城 ============ */
.shop-section { margin-bottom: 24px; }
.shop-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 4px solid var(--star-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.shop-item {
  background: linear-gradient(135deg, #fff, #FBF8F1);
  border: 2px solid #F0E8D8;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: all 0.25s;
  position: relative;
}
.shop-item:hover { transform: translateY(-3px); border-color: var(--star); box-shadow: 0 6px 16px rgba(245, 184, 75, 0.2); }
.shop-item .si-icon { font-size: 36px; }
.shop-item .si-name { font-size: 14px; font-weight: 600; color: var(--text-dark); margin-top: 8px; }
.shop-item .si-cost {
  display: inline-block;
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 10px;
}
.shop-item .si-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: var(--blue-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.shop-item .si-btn:hover { background: var(--blue-text); }
.shop-item .si-btn:disabled { background: #ccc; cursor: not-allowed; }
.shop-item.redeemed { opacity: 0.6; }
.shop-item.redeemed .si-btn { background: var(--done); }
.award-mask {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(74, 74, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.award-card {
  width: min(380px, 100%);
  background: linear-gradient(180deg, #FFFDF6 0%, #FFF5D8 100%);
  border: 5px solid #F5B84B;
  border-radius: 24px;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: 0 14px 34px rgba(94, 69, 22, 0.22);
  position: relative;
  overflow: hidden;
}
.award-card::before,
.award-card::after {
  content: "★";
  position: absolute;
  top: 14px;
  color: #E89B2F;
  font-size: 24px;
}
.award-card::before { left: 18px; }
.award-card::after { right: 18px; }
.award-ribbon {
  display: inline-block;
  background: linear-gradient(135deg, #E89B2F, #F5B84B);
  color: #fff;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
}
.award-icon { font-size: 52px; margin: 4px 0; }
.award-title { font-size: 24px; font-weight: 900; color: #9A6A13; letter-spacing: 2px; margin: 6px 0; }
.award-name {
  background: #fff;
  border: 2px dashed #F5B84B;
  border-radius: 16px;
  padding: 12px 10px;
  color: var(--blue-text);
  font-size: 18px;
  font-weight: 800;
  margin: 12px 0;
}
.award-text { font-size: 14px; color: var(--text-mid); line-height: 1.7; margin-bottom: 14px; }
.award-actions { display: flex; gap: 10px; }
.award-actions .btn { flex: 1; min-height: 44px; font-size: 15px; }

/* ============ 我的背包 ============ */
.prize-summary {
  background: linear-gradient(135deg, #FFF8E7, #F2FAEE);
  border: 2px solid #F3DEAA;
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1.7;
}
.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.prize-card {
  background: linear-gradient(135deg, #fff, #FFF9E8);
  border: 2px solid #F0E8D8;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.prize-card:hover { transform: translateY(-2px); border-color: var(--star); }
.prize-card .pc-icon { font-size: 38px; }
.prize-card .pc-name { font-size: 14px; font-weight: 800; color: var(--text-dark); margin-top: 8px; }
.prize-card .pc-meta { font-size: 12px; color: var(--text-light); margin-top: 6px; line-height: 1.5; }
.prize-empty {
  background: #fff;
  border: 2px dashed #E8DCC8;
  border-radius: 18px;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-mid);
}
.prize-empty .pe-icon { font-size: 44px; margin-bottom: 8px; }
.prize-use-mask {
  position: fixed;
  inset: 0;
  z-index: 1320;
  background: rgba(74, 74, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.prize-use-box {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(74, 74, 74, 0.22);
}
.prize-use-icon { font-size: 48px; margin-bottom: 8px; }
.prize-use-title { font-size: 20px; font-weight: 900; color: var(--text-dark); margin-bottom: 8px; }
.prize-use-desc { font-size: 14px; color: var(--text-mid); line-height: 1.7; margin-bottom: 16px; }
.prize-use-actions { display: flex; gap: 10px; }
.prize-use-actions .btn { flex: 1; min-height: 46px; font-size: 15px; }

/* ============ 商城自定义管理弹窗 ============ */
.shop-manage-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.shop-manage-panel {
  background: #fff;
  border-radius: var(--radius-lg, 16px);
  width: 100%; max-width: 520px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.shop-manage-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--blue-soft, #E8F0FE);
}
.shop-manage-title { font-size: 16px; font-weight: 800; color: var(--text-dark); }
.shop-manage-close {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--text-light); padding: 4px 8px; border-radius: 8px;
}
.shop-manage-close:hover { background: var(--blue-soft, #E8F0FE); }
.shop-manage-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
}
.shop-manage-foot {
  display: flex; gap: 10px;
  padding: 14px 20px;
  border-top: 1.5px solid var(--blue-soft, #E8F0FE);
}
.shop-manage-foot .btn { flex: 1; min-height: 44px; font-size: 15px; }
.shop-edit-section { margin-bottom: 18px; }
.shop-edit-section:last-child { margin-bottom: 0; }
.shop-edit-title {
  font-size: 13px; font-weight: 700; color: var(--text-light);
  margin-bottom: 8px; letter-spacing: 0.5px;
}
.shop-edit-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #F5F0E5;
}
.shop-edit-row:last-child { border-bottom: none; }
.ser-icon { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; }
.ser-name {
  flex: 1; min-width: 0;
  padding: 6px 10px; font-size: 13px;
  border: 1.5px solid #E8E0D0; border-radius: 8px;
  background: #FFFEF8; color: var(--text-dark);
  outline: none;
}
.ser-name:focus { border-color: var(--blue-mid, #7EC8E3); background: #fff; }
.ser-cost {
  width: 72px; flex-shrink: 0;
  padding: 6px 8px; font-size: 13px;
  border: 1.5px solid #E8E0D0; border-radius: 8px;
  background: #FFFEF8; color: var(--text-dark);
  text-align: center; outline: none;
  -moz-appearance: textfield;
}
.ser-cost::-webkit-inner-spin-button,
.ser-cost::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ser-cost:focus { border-color: var(--blue-mid, #7EC8E3); background: #fff; }
.ser-reset {
  flex-shrink: 0;
  padding: 4px 8px !important;
  font-size: 13px !important;
  min-height: 0 !important;
  border-radius: 8px !important;
}

/* ============ 学习档案 ============ */
.archive-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.archive-stat {
  background: linear-gradient(135deg, #fff, #FBF8F1);
  border: 2px solid #F0E8D8;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.archive-stat.clickable {
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.archive-stat.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--blue-mid);
  box-shadow: var(--shadow-hover);
}
.archive-stat .as-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--blue-deep);
  line-height: 1;
}
.archive-stat .as-lbl { font-size: 12px; color: var(--text-mid); margin-top: 6px; }
.archive-stat .as-icon { font-size: 24px; margin-bottom: 6px; }

.history-list {
  max-height: 400px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #F0E8D8;
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }
.history-item .hi-date { color: var(--blue-text); font-weight: 600; min-width: 100px; }
.history-item .hi-tasks { flex: 1; color: var(--text-mid); }
.history-item .hi-stars { color: var(--star-deep); font-weight: 600; }

.char-test-mask {
  position: fixed;
  inset: 0;
  z-index: 1350;
  background: rgba(74, 74, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.char-test-panel {
  width: min(430px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fff 0%, #FBF8F1 100%);
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 14px 36px rgba(74, 74, 74, 0.22);
  text-align: center;
}
.char-test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.char-test-title { font-size: 18px; font-weight: 900; color: var(--blue-text); }
.char-test-close {
  border: none;
  background: var(--cream-deep);
  color: var(--text-mid);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-weight: 900;
  cursor: pointer;
}
.char-test-progress { font-size: 13px; color: var(--text-mid); margin-bottom: 10px; }
.tianzi-card {
  width: min(240px, 72vw);
  height: min(240px, 72vw);
  margin: 0 auto 12px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), #E8B9A8 calc(50% - 1px), #E8B9A8 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent calc(50% - 1px), #E8B9A8 calc(50% - 1px), #E8B9A8 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(45deg, transparent calc(50% - 1px), #F0D0C4 calc(50% - 1px), #F0D0C4 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(-45deg, transparent calc(50% - 1px), #F0D0C4 calc(50% - 1px), #F0D0C4 calc(50% + 1px), transparent calc(50% + 1px)),
    #FFFDF8;
  border: 4px solid #E8B9A8;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7), var(--shadow);
}
.tianzi-char {
  font-size: clamp(104px, 34vw, 158px);
  font-weight: 900;
  color: #3F3A35;
  line-height: 1;
  font-family: "KaiTi", "STKaiti", "Songti SC", serif;
}
.english-test-card {
  width: min(300px, 82vw);
  min-height: 170px;
  margin: 0 auto 12px;
  background: linear-gradient(180deg, #F7FBFF 0%, #FFFFFF 100%);
  border: 4px solid var(--blue-mid);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7), var(--shadow);
}
.english-test-main {
  font-size: clamp(34px, 12vw, 58px);
  font-weight: 900;
  color: var(--blue-text);
  line-height: 1.12;
  word-break: break-word;
}
.english-test-main.phrase {
  font-size: clamp(26px, 8vw, 42px);
}
.english-test-sub {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.5;
}
.char-test-tip { font-size: 13px; color: var(--text-light); line-height: 1.6; margin-bottom: 12px; }
.char-test-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.char-test-btn {
  border: none;
  border-radius: 16px;
  min-height: 54px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}
.char-test-btn.known { background: linear-gradient(135deg, #A8E6BF, #70C98F); color: #1F6E3A; }
.char-test-btn.unknown { background: linear-gradient(135deg, #FFD0D0, #F29A9A); color: #9A3838; }
.char-test-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.char-test-pill {
  background: #fff;
  border: 1.5px solid #F0E8D8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-mid);
  font-weight: 700;
}
.char-test-pill.clickable {
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.char-test-pill.clickable:hover { border-color: var(--gold, #E8C46B); background: #FFFBF0; }
.char-test-pill.clickable:active { transform: scale(0.95); }

/* 已认识/待复习 卡片列表 */
.card-list-empty {
  text-align: center;
  padding: 28px 0;
  color: var(--text-light);
  font-size: 14px;
}
.char-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.char-list-item {
  background: #fff;
  border: 1.5px solid #F0E8D8;
  border-radius: 12px;
  padding: 10px 4px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.char-list-item:hover { border-color: #E8C46B; background: #FFFBF0; }
.char-list-item:active { transform: scale(0.92); background: #FFF3D6; }
.en-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.en-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #F0E8D8;
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.en-list-item:hover { border-color: #E8C46B; background: #FFFBF0; }
.en-list-item:active { transform: scale(0.98); background: #FFF3D6; }
.en-list-item .eli-main { flex: 1; min-width: 0; }
.en-list-item .eli-en { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.en-list-item .eli-zh { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.en-list-item .eli-speak {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

/* ============ 设置 ============ */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #F0E8D8;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-label { font-size: 14px; color: var(--text-dark); }
.setting-row .sr-desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--blue-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { background: var(--blue-text); }
.btn.danger { background: #E87B7B; }
.btn.danger:hover { background: #D85F5F; }
.btn.outline { background: transparent; border: 1.5px solid var(--blue-mid); color: var(--blue-text); }
.btn.outline:hover { background: var(--blue-soft); }
.btn.big-touch {
  min-height: 44px;
  min-width: 72px;
  padding: 10px 18px;
}
.reset-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(74, 74, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.reset-confirm-box {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: 0 12px 32px rgba(74, 74, 74, 0.22);
  text-align: center;
}
.reset-confirm-icon { font-size: 42px; margin-bottom: 8px; }
.reset-confirm-title { font-size: 19px; font-weight: 800; color: var(--text-dark); margin-bottom: 8px; }
.reset-confirm-desc { font-size: 14px; color: var(--text-mid); line-height: 1.7; margin-bottom: 16px; }
.reset-confirm-actions { display: flex; gap: 10px; }
.reset-confirm-actions .btn { flex: 1; min-height: 46px; font-size: 15px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 123, 168, 0.3);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-mask.show { display: flex; animation: fadeIn 0.3s; }
.modal {
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal .m-emoji { font-size: 56px; }
.modal .m-title { font-size: 20px; font-weight: 700; color: var(--blue-text); margin-top: 12px; }
.modal .m-text { font-size: 14px; color: var(--text-mid); margin-top: 8px; line-height: 1.7; }
.modal .m-btn {
  margin-top: 20px;
  padding: 10px 32px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* 金色金币图案 */
.gold-coin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.48em;
  height: 1.48em;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #FFF8C6 0%, #FFD95A 36%, #F2A51A 72%, #B86A00 100%);
  border: 1px solid #D89316;
  color: #8A4D00;
  font-size: 1.02em;
  font-weight: 900;
  line-height: 1;
  vertical-align: -0.16em;
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.65), inset 0 -2px 3px rgba(139,82,0,0.2), 0 1px 3px rgba(120,80,0,0.22);
}
.gold-coin-icon::before {
  content: "¥";
}

/* 金币飘落 */
.star-fall {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #FFF8C6 0%, #FFD95A 36%, #F2A51A 72%, #B86A00 100%);
  border: 2px solid #D89316;
  color: #8A4D00;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 3px 5px rgba(255,255,255,0.65), inset 0 -3px 5px rgba(139,82,0,0.22), 0 4px 10px rgba(150,105,0,0.28);
  animation: fall 1s ease-in forwards;
}
.star-fall::before {
  content: "¥";
}
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(200px) rotate(360deg); opacity: 0; }
}

/* 星星飘落 */
.star-particle {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(255,200,0,0.5));
  animation: star-drift 1.2s ease-out forwards;
}
@keyframes star-drift {
  0%   { transform: translateY(-30px) rotate(0deg) scale(0.5); opacity: 0; }
  15%  { opacity: 1; transform: translateY(-10px) rotate(30deg) scale(1.1); }
  40%  { transform: translateY(40px) rotate(-15deg) scale(1); opacity: 1; }
  100% { transform: translateY(180px) rotate(25deg) scale(0.6); opacity: 0; }
}

/* ============ 庆祝烟花 ============ */
.firework-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}
.celebration-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 501;
  pointer-events: none;
  animation: none;
}
.celebration-text {
  text-align: center;
  animation: celebratePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.celebration-text .ct-emoji { font-size: 72px; }
.celebration-text .ct-title { font-size: 28px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.3); margin-top: 12px; }
.celebration-text .ct-msg { font-size: 18px; font-weight: 600; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.3); margin-top: 8px; }
@keyframes celebratePop {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-text));
  color: #fff;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(111, 161, 87, 0.4);
  z-index: 200;
  animation: slideDown 0.3s, slideUp 0.3s 2s forwards;
}
@keyframes slideDown {
  from { transform: translate(-50%, -60px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes slideUp {
  to { transform: translate(-50%, -60px); opacity: 0; }
}

/* 响应式 */
@media (max-width: 600px) {
  .header-stats { width: 100%; justify-content: space-between; }
  .stat-pill { min-width: 70px; padding: 6px 10px; }
  .stat-pill .num { font-size: 18px; }
  .nav-tab { min-width: 70px; font-size: 12px; padding: 10px 4px; }
  .nav-tab .icon { font-size: 18px; }
  .letter-big { font-size: 48px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--blue-mid); border-radius: 4px; }

/* ============ 游戏页 ============ */
.game-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.game-card {
  background: linear-gradient(135deg, #fff, #FBF8F1);
  border: 2px solid #F0E8D8;
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--blue-mid); }
.game-card .gc-icon { font-size: 40px; }
.game-card .gc-name { font-size: 15px; font-weight: 700; color: var(--text-dark); margin-top: 10px; }
.game-card .gc-desc { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.game-card .gc-best { font-size: 11px; color: var(--star-deep); margin-top: 8px; font-weight: 600; }
.game-card .gc-cat { position: absolute; top: 8px; right: 8px; font-size: 10px; padding: 2px 8px; border-radius: 8px; font-weight: 600; }
.gc-cat-cn { background: var(--peach); color: #C97B5F; }
.gc-cat-math { background: var(--blue-soft); color: var(--blue-text); }
.gc-cat-en { background: var(--lavender); color: #7B5FA8; }

/* ============ 游戏面板（全屏弹层）============ */
.game-mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 123, 168, 0.35);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}
.game-mask.show { display: flex; animation: fadeIn 0.3s; }
/* 浮动退出按钮 - 固定在右上角，不受滚动影响 */
.game-float-close {
  display: none;
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(107, 159, 212, 0.92);
  border: 2px solid rgba(255,255,255,0.6);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.game-mask.show ~ .game-float-close,
.game-float-close.show {
  display: flex;
}
.game-float-close:active {
  background: rgba(74, 123, 168, 1);
  transform: scale(0.92);
}
.game-panel {
  background: linear-gradient(135deg, #fff 0%, #FBF8F1 100%);
  border-radius: 22px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}
.game-panel-header {
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-deep));
  color: #fff;
  padding: 18px 22px;
  border-radius: 22px 22px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.game-panel-header .gph-icon { font-size: 28px; }
.game-panel-header .gph-title { font-size: 17px; font-weight: 700; flex: 1; }
.game-panel-header .gph-close {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 21;
  flex-shrink: 0;
  touch-action: manipulation;
}
.game-panel-header .gph-close:hover { background: rgba(255,255,255,0.4); }

.game-body { padding: 22px; flex: 1; overflow-y: auto; }

/* 游戏进度条 */
.game-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-mid);
}
.game-progress-info .score-badge {
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  padding: 3px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}
.game-prev-btn {
  border: none;
  background: var(--cream-deep);
  color: var(--text-mid);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
}
.game-prev-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.game-progress-bar {
  background: var(--cream-deep);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
}
.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-deep));
  border-radius: 6px;
  transition: width 0.4s;
}

/* 题目区 */
.game-question {
  background: #fff;
  border: 2px solid var(--blue-soft);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}
.game-question .gq-label { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.game-question .gq-text { font-size: 20px; font-weight: 700; color: var(--text-dark); line-height: 1.6; }
.game-question .gq-sub { font-size: 14px; color: var(--text-mid); margin-top: 6px; }
/* 看图选拼音：上方大 emoji 配图 */
.game-question .gq-pic { display: block; font-size: 64px; line-height: 1; margin: 2px 0 6px; text-align: center; }

/* 选项 */
.game-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.game-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: stretch;
}
.game-option-row .game-option {
  width: 100%;
}
.game-option-speak {
  width: 42px;
  min-width: 42px;
  min-height: 56px;
  border-radius: 14px;
  border: 2px solid var(--blue-soft);
  background: var(--blue-soft);
  color: var(--blue-text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.game-option-speak:active {
  transform: scale(0.96);
  background: var(--blue-mid);
}
.game-option {
  background: #fff;
  border: 2px solid var(--blue-soft);
  border-radius: 14px;
  padding: 16px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) {
  .game-option:hover { border-color: var(--blue-deep); background: var(--blue-soft); transform: translateY(-1px); }
}
.game-option:focus, .game-option:focus-visible { outline: none; box-shadow: none; }
.game-option.correct { border-color: var(--done); background: #E8F5E9; color: #2D8C5C; }
.game-option.wrong { border-color: #E87B7B; background: #FFEBEE; color: #C75F5F; }
.game-option.disabled { pointer-events: none; opacity: 0.7; }

/* 单词填字游戏 */
.crossword-wrap {
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  color: #111;
}
.crossword-top {
  margin-bottom: 12px;
}
.crossword-theme {
  font-size: 15px;
  font-weight: 800;
  color: #111;
  margin-bottom: 8px;
  text-align: center;
}
.crossword-word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.crossword-word-chip {
  border: 1px solid #111;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  background: #fff;
  text-transform: lowercase;
}
.crossword-word-chip.solved {
  color: #7a7a7a;
  border-color: #b8c7d8;
  background: #eef7ff;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.crossword-theme-picker {
  margin: 12px 0 14px;
  padding: 12px;
  background: #f7fbff;
  border: 1.5px solid #d7e8f8;
  border-radius: 14px;
}
.crossword-theme-picker-title {
  font-size: 14px;
  font-weight: 800;
  color: #24415f;
  margin-bottom: 8px;
}
.crossword-theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.crossword-theme-btn {
  border: 1.5px solid #b9d8ef;
  background: #fff;
  color: #24415f;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.crossword-theme-btn.active {
  background: #dff1ff;
  border-color: #54a9e6;
  color: #1268a8;
  box-shadow: 0 3px 8px rgba(84,169,230,0.25);
}
.crossword-theme-note {
  margin-top: 8px;
  font-size: 12px;
  color: #5d7893;
  text-align: center;
}
.crossword-grid {
  display: grid;
  justify-content: center;
  gap: 0;
  margin: 0 auto 12px;
  max-width: 100%;
  overflow-x: auto;
}
.crossword-cell {
  width: var(--cw-cell, clamp(30px, 8.8vw, 56px));
  height: var(--cw-cell, clamp(30px, 8.8vw, 56px));
  position: relative;
  box-sizing: border-box;
}
.crossword-cell.empty {
  background: transparent;
}
.crossword-input {
  width: 100%;
  height: 100%;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  text-align: center;
  font-size: calc(var(--cw-cell, 44px) * 0.52);
  font-weight: 800;
  text-transform: lowercase;
  outline: none;
  padding: calc(var(--cw-cell, 44px) * 0.26) 1px 1px;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}
.crossword-input.filled {
  color: #1268d6;
}
.crossword-input:focus {
  box-shadow: inset 0 0 0 2px #f2c94c;
}
.crossword-input.hint {
  color: #111;
  font-weight: 900;
  cursor: default;
}
.crossword-input.solved {
  background: #dff1ff !important;
}
.crossword-input.correct {
  background: #dff1ff !important;
}
.crossword-input.wrong {
  background: #fff0f0 !important;
}
.crossword-num {
  position: absolute;
  top: 1px;
  left: 2px;
  color: #d00000;
  font-size: max(8px, calc(var(--cw-cell, 44px) * 0.22));
  font-weight: 900;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}
/* iPad/大屏：填字游戏弹窗加宽，格子随屏幕自适应放大 */
@media (min-width: 720px) {
  .game-panel.crossword-wide {
    max-width: min(94vw, 860px);
  }
}
.crossword-status {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}
.crossword-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 比大小天平题 */
.compare-balance-wrap {
  background: linear-gradient(180deg, #F8FBFF 0%, #FFF8EA 100%);
  border: 2px solid var(--blue-soft);
  border-radius: 18px;
  padding: 18px 14px 16px;
  margin-bottom: 16px;
  text-align: center;
  overflow: hidden;
}
.compare-balance {
  position: relative;
  width: min(420px, 100%);
  height: 190px;
  margin: 0 auto 10px;
}
.compare-beam {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 70px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #D9A64A, #F8D37B, #D9A64A);
  transform-origin: center;
  transition: transform 0.55s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 5px 10px rgba(130,90,25,0.18);
}
.compare-balance.tilt-left .compare-beam { transform: rotate(-8deg); }
.compare-balance.tilt-right .compare-beam { transform: rotate(8deg); }
.compare-balance.equal .compare-beam { transform: rotate(0deg); }
.compare-stand {
  position: absolute;
  left: 50%;
  top: 76px;
  width: 12px;
  height: 78px;
  transform: translateX(-50%);
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #C28A35, #8A6127);
}
.compare-base {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 130px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #B67B2D, #E9B85A, #B67B2D);
}
.compare-pan {
  position: absolute;
  top: 92px;
  width: 134px;
  min-height: 62px;
  border-radius: 18px;
  background: #fff;
  border: 3px solid #F0C76E;
  box-shadow: 0 8px 16px rgba(120,80,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  font-weight: 900;
  color: var(--blue-text);
  font-size: 24px;
  transition: transform 0.55s cubic-bezier(.34,1.56,.64,1);
}
.compare-pan.left { left: 2%; }
.compare-pan.right { right: 2%; }
.compare-balance.tilt-left .compare-pan.left { transform: translateY(18px); }
.compare-balance.tilt-left .compare-pan.right { transform: translateY(-14px); }
.compare-balance.tilt-right .compare-pan.left { transform: translateY(-14px); }
.compare-balance.tilt-right .compare-pan.right { transform: translateY(18px); }
.compare-balance.equal .compare-pan.left,
.compare-balance.equal .compare-pan.right { transform: translateY(0); }
.compare-symbol-slot {
  position: absolute;
  left: 50%;
  top: 24px;
  width: 68px;
  height: 54px;
  transform: translateX(-50%);
  border-radius: 18px;
  border: 3px dashed var(--blue-mid);
  background: rgba(255,255,255,0.92);
  color: var(--star-deep);
  font-size: 36px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-options {
  grid-template-columns: repeat(3, 1fr);
}
.compare-options .game-option {
  font-size: 30px;
  font-weight: 900;
}
.compare-hint {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 4px;
}

/* 叠词寻宝消消乐 */
.redup-scene {
  background: linear-gradient(180deg, #FFF9E8 0%, #F4FBFF 100%);
  border: 2px solid var(--blue-soft);
  border-radius: 18px;
  padding: 14px 10px;
  margin-bottom: 14px;
  text-align: center;
}
.redup-train {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  margin-bottom: 12px;
  justify-content: flex-start;
}
.redup-train-engine {
  font-size: 32px;
  flex-shrink: 0;
  margin-right: 4px;
}
.redup-train-car {
  min-width: 56px;
  height: 62px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
  border: 2.5px solid var(--blue-soft);
  background: #fff;
  color: var(--text-light);
  transition: all 0.3s;
  line-height: 1.2;
  text-align: center;
  padding: 4px 3px;
  gap: 2px;
}
.redup-train-car.active {
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  border-color: var(--star-deep);
  transform: translateY(-5px) scale(1.12);
  box-shadow: 0 6px 14px rgba(245,184,75,0.35);
}
.redup-train-car.passed {
  background: var(--done);
  border-color: var(--done);
  color: #fff;
}
.redup-train-car.passed .rtc-check {
  font-size: 16px;
  line-height: 1;
}
.redup-train-car.passed .rtc-word {
  font-size: 10px;
  line-height: 1.1;
  opacity: 0.9;
}
.redup-train-car .rtc-kind {
  font-size: 13px;
  font-weight: 900;
  color: var(--text-mid);
}
.redup-current-type {
  font-size: 18px;
  font-weight: 900;
  color: var(--star-deep);
  margin-bottom: 8px;
}
/* 模板类型固定字提示 */
.redup-template-hint {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 10px;
  font-weight: 700;
}
.rth-tpl {
  display: inline-block;
  font-size: 18px;
  font-weight: 900;
  color: var(--star-deep);
  margin-left: 4px;
  letter-spacing: 2px;
}
.rth-blank {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  color: var(--blue-soft);
  font-weight: 900;
}
.rth-hint {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  margin-left: 6px;
}
.rth-tpl-inline {
  font-size: 20px;
  font-weight: 900;
  color: var(--star-deep);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.rth-tpl-inline .redup-picked-char {
  background: #FFF3D0;
}
.redup-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 0 auto 12px;
}
.redup-cell {
  aspect-ratio: 1;
  min-height: 42px;
  border: 2px solid var(--blue-soft);
  border-radius: 12px;
  background: #fff;
  color: var(--text-dark);
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(70,100,130,0.08);
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s, background 0.18s, opacity 0.25s;
}
.redup-cell.selected {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.redup-cell.removed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.redup-cell.wrong {
  background: #FFEBEE;
  border-color: #E87B7B;
  color: #C75F5F;
  animation: shake 0.32s;
}
.redup-selected-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text-mid);
  font-weight: 700;
  font-size: 15px;
}
.redup-picked-char {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--blue-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 900;
}
.redup-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.redup-small-btn {
  border: none;
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 800;
  color: var(--text-dark);
  background: var(--cream-deep);
  cursor: pointer;
}

/* 叠词类型选择器 */
.redup-type-picker {
  margin: 12px 0;
  text-align: center;
}
.redup-type-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.redup-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.redup-type-btn {
  border: 2.5px solid var(--blue-soft);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  min-width: 90px;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
}
.redup-type-btn.active {
  border-color: var(--star-deep);
  background: linear-gradient(135deg, #FFF9E8, #FFF3D0);
  box-shadow: 0 4px 12px rgba(245,184,75,0.25);
  transform: translateY(-2px);
}
.redup-type-emoji {
  font-size: 22px;
  margin-bottom: 2px;
}
.redup-type-label {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 2px;
}
.redup-type-example {
  font-size: 11px;
  color: var(--text-mid);
  font-weight: 600;
}
.redup-type-note {
  font-size: 13px;
  color: var(--star-deep);
  font-weight: 700;
}

/* 古诗寻宝年级选择器（仿叠词选择器） */
.poem-grade-picker {
  margin: 12px 0;
  text-align: center;
}
.poem-grade-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.poem-grade-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.poem-grade-btn {
  border: 2.5px solid var(--blue-soft);
  border-radius: 14px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
  min-width: 72px;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
}
.poem-grade-btn.active {
  border-color: var(--star-deep);
  background: linear-gradient(135deg, #FFF9E8, #FFF3D0);
  box-shadow: 0 4px 12px rgba(245,184,75,0.25);
  transform: translateY(-2px);
}
.poem-grade-emoji {
  font-size: 22px;
  margin-bottom: 2px;
}
.poem-grade-label {
  font-size: 14px;
  font-weight: 900;
  color: var(--text-dark);
}
.poem-grade-note {
  font-size: 13px;
  color: var(--star-deep);
  font-weight: 700;
}

/* 排序题词语区 */
.game-order-source { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; min-height: 48px; }
.game-order-target {
  background: var(--cream);
  border: 2px dashed var(--blue-mid);
  border-radius: 14px;
  padding: 12px;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.order-word {
  background: #fff;
  border: 1.5px solid var(--blue-mid);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
}
.order-word:hover { background: var(--blue-soft); }
.order-word.used { opacity: 0.3; pointer-events: none; }

/* 输入题 */
.game-input-row { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 16px; }
.game-input {
  width: 100px;
  border: 2px solid var(--blue-mid);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dark);
  background: #fff;
}
.game-input:focus { outline: none; border-color: var(--blue-deep); box-shadow: 0 0 0 3px rgba(107,159,212,0.2); }
.game-input.correct { border-color: var(--done); background: #E8F5E9; color: #2D8C5C; }
.game-input.wrong { border-color: #E87B7B; background: #FFEBEE; color: #C75F5F; }

/* 确认按钮 */
.game-confirm-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-text));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.game-confirm-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(107,159,212,0.4); }
.game-confirm-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

/* 即时反馈 */
.game-feedback {
  text-align: center;
  padding: 14px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 700;
  display: none;
  animation: feedbackPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-feedback.show { display: block; }
.game-feedback.correct { background: #E8F5E9; color: #2D8C5C; border: 2px solid var(--done); }
.game-feedback.wrong { background: #FFEBEE; color: #C75F5F; border: 2px solid #E87B7B; }
.game-feedback .gf-explain { font-size: 13px; font-weight: 400; color: var(--text-mid); margin-top: 6px; }
@keyframes feedbackPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 开始页 */
.game-start {
  text-align: center;
  padding: 30px 20px;
}
.game-start .gs-icon { font-size: 64px; }
.game-start .gs-title { font-size: 22px; font-weight: 700; color: var(--blue-text); margin-top: 12px; }
.game-start .gs-desc { font-size: 14px; color: var(--text-mid); margin-top: 8px; line-height: 1.7; }
.game-start .gs-rules {
  background: var(--cream);
  border-radius: 14px;
  padding: 14px;
  margin: 16px 0;
  text-align: left;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.8;
}
.game-start .gs-best { font-size: 14px; color: var(--star-deep); font-weight: 600; margin-bottom: 16px; }
.game-start .gs-btn {
  padding: 14px 40px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(245, 184, 75, 0.4);
  animation: pulseBtn 1.5s infinite;
}
@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* 结果页 */
.game-result { text-align: center; padding: 20px; }
.game-result .gr-emoji { font-size: 56px; animation: feedbackPop 0.5s; }
.game-result .gr-title { font-size: 22px; font-weight: 700; color: var(--blue-text); margin-top: 10px; }
.game-result .gr-stars { font-size: 32px; margin: 12px 0; letter-spacing: 4px; }
.game-result .gr-score {
  display: inline-block;
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  padding: 8px 28px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0;
}
.game-result .gr-reward { font-size: 15px; color: var(--star-deep); font-weight: 600; margin: 10px 0; }
.game-result .gr-best { font-size: 13px; color: var(--text-light); margin-top: 6px; }
.game-result .gr-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.game-result .gr-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.gr-btn.primary { background: linear-gradient(135deg, var(--blue-deep), var(--blue-text)); color: #fff; }
.gr-btn.secondary { background: var(--cream-deep); color: var(--text-dark); }

/* ============ 口算闪电战关卡系统 ============ */
.math-level-start .mls-avatar {
  font-size: 56px;
  animation: bounceAvatar 1.5s ease-in-out infinite;
}
@keyframes bounceAvatar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.math-level-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--blue-soft), var(--blue-mid));
  border-radius: 14px;
  padding: 10px 14px;
}
.math-level-bar .mlb-avatar {
  font-size: 28px;
  flex-shrink: 0;
  animation: bounceAvatar 1.5s ease-in-out infinite;
}
.math-level-bar .mlb-dots {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
}
.math-level-bar .level-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.5);
  color: var(--text-mid);
  transition: all 0.3s;
}
.math-level-bar .level-dot.passed {
  background: var(--done);
  color: #fff;
}
.math-level-bar .level-dot.current {
  background: linear-gradient(135deg, var(--star), var(--star-deep));
  color: #fff;
  box-shadow: 0 0 0 3px rgba(245,184,75,0.3);
  animation: pulseDot 1.2s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.math-level-bar .mlb-info {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-text);
  white-space: nowrap;
  flex-shrink: 0;
}
.math-stair-scene {
  background: linear-gradient(180deg, #F2FAEE 0%, #FFF8E8 100%);
  border: 2px solid var(--blue-soft);
  border-radius: 16px;
  padding: 10px 10px 8px;
  margin-bottom: 10px;
}
.math-stairs {
  height: 118px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  position: relative;
}
.math-step {
  width: 28px;
  min-height: 18px;
  border-radius: 8px 8px 2px 2px;
  background: #E6EEF7;
  border: 1.5px solid #CFE0F2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 3px;
  font-size: 10px;
  font-weight: 900;
  color: var(--blue-text);
  position: relative;
}
.math-step.done {
  background: linear-gradient(180deg, #FFF4BC, #F5B84B);
  border-color: var(--star-deep);
  color: #8A5A00;
}
.math-step.current {
  background: linear-gradient(180deg, #DCEAF7, #9FCAE8);
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(107,159,212,0.22);
}
.math-step.top {
  background: linear-gradient(180deg, #FFECC4, #F0A83A);
}
.math-step-person {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  filter: drop-shadow(0 4px 5px rgba(80,50,0,0.22));
  animation: bounceAvatar 1.2s ease-in-out infinite;
}
.math-stair-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-mid);
  font-weight: 700;
  margin-top: 4px;
}

/* 口算题目区 */
.game-question.math-q {
  background: linear-gradient(135deg, #fff, #F2FAEE);
  border-color: var(--blue-mid);
  position: relative;
  overflow: hidden;
}
.game-question.math-q .gq-text {
  font-family: "Courier New", monospace;
  letter-spacing: 3px;
}
.math-question-answer {
  display: inline-flex;
  min-width: 56px;
  min-height: 48px;
  padding: 0 8px;
  margin: 0 4px;
  align-items: center;
  justify-content: center;
  border-bottom: 4px solid var(--blue-mid);
  color: var(--blue-deep);
  font-weight: 900;
  vertical-align: baseline;
}
.math-question-answer.filled {
  color: var(--blue-deep);
  border-color: var(--blue-mid);
}
.math-question-answer.wrong {
  color: #E53935;
  border-color: #E53935;
  animation: wrongShake 0.28s ease-in-out;
}
.math-answer-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 76px;
  line-height: 1;
  font-weight: 900;
  color: #E53935;
  text-shadow: 0 4px 12px rgba(229,57,53,0.25);
  pointer-events: none;
  animation: letterCheckPop 0.45s ease-out both;
}
.math-level-prompt {
  width: min(92vw, 430px);
  padding: 28px 20px;
  pointer-events: auto;
  background: rgba(255,255,255,0.96);
  border-radius: 26px;
  box-shadow: 0 18px 45px rgba(47,111,163,0.32);
}
.math-level-prompt .ct-title { color: var(--blue-deep); text-shadow: none; }
.math-level-prompt .ct-msg { color: var(--text-dark); text-shadow: none; }
.math-level-prompt .gr-btns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}
.math-level-prompt .gr-btn {
  min-height: 58px;
  font-size: 18px;
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(107,159,212,0.28);
}
.math-level-prompt .gr-btn.secondary {
  background: #FFF1D6;
  color: #8A5A00;
  border: 2px solid #F5B84B;
}

/* 答案输入显示 */
.math-input-display {
  font-size: 48px;
  font-weight: 800;
  color: var(--blue-deep);
  text-align: center;
  min-height: 60px;
  border-bottom: 4px solid var(--blue-mid);
  margin: 16px auto;
  max-width: 200px;
  letter-spacing: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 屏幕数字键盘 */
.math-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto 16px;
}
.math-keypad .mk-btn {
  padding: 18px 8px;
  font-size: 26px;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff, var(--blue-soft));
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 3px 8px rgba(107,159,212,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
}
.math-keypad .mk-btn:active {
  transform: scale(0.92);
  background: var(--blue-mid);
}
.math-keypad .mk-btn.mk-clear {
  background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
  color: #C75F5F;
  font-size: 16px;
}
.math-keypad .mk-btn.mk-back {
  background: linear-gradient(135deg, var(--cream-deep), #F0E8D8);
  color: var(--text-mid);
  font-size: 22px;
}

/* 口算答题页紧凑模式：控制在一屏内，减少下拉 */
.game-body.math-compact {
  padding: 10px 14px 12px;
  overflow-y: auto;
}
.game-body.math-compact .math-level-bar {
  padding: 6px 10px;
  margin-bottom: 6px;
  gap: 6px;
  border-radius: 12px;
}
.game-body.math-compact .math-level-bar .mlb-avatar {
  font-size: 22px;
}
.game-body.math-compact .math-level-bar .level-dot {
  width: 18px;
  height: 18px;
  font-size: 9px;
}
.game-body.math-compact .math-level-bar .mlb-info {
  font-size: 11px;
}
.game-body.math-compact .game-progress-info {
  margin-bottom: 4px;
  font-size: 12px;
}
.game-body.math-compact .game-progress-bar {
  height: 8px;
  margin-bottom: 8px;
}
.game-body.math-compact .game-question.math-q {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 13px;
}
.game-body.math-compact .game-question.math-q .gq-label {
  margin-bottom: 2px;
  font-size: 11px;
}
.game-body.math-compact .game-question.math-q .gq-text {
  font-size: 32px !important;
  line-height: 1.25;
}
.game-body.math-compact .math-input-display {
  font-size: 34px;
  min-height: 42px;
  margin: 6px auto 8px;
  max-width: 160px;
  border-bottom-width: 3px;
  letter-spacing: 4px;
}
.game-body.math-compact .math-keypad {
  max-width: 330px;
  gap: 10px;
  margin: 0 auto 10px;
}
.game-body.math-compact .math-keypad .mk-btn {
  min-height: 58px;
  padding: 12px 6px;
  font-size: 28px;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(107,159,212,0.18);
}
.game-body.math-compact .math-keypad .mk-btn.mk-clear {
  font-size: 18px;
}
.game-body.math-compact .math-keypad .mk-btn.mk-back {
  font-size: 26px;
}
.game-body.math-compact .game-confirm-btn {
  max-width: 330px;
  display: block;
  margin: 0 auto;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 14px;
}
.game-body.math-compact .game-feedback {
  max-width: 260px;
  margin: 8px auto 0;
  padding: 8px;
  font-size: 14px;
  border-radius: 12px;
}

@media (max-height: 720px), (max-width: 480px) {
  .game-body.math-compact {
    padding: 8px 10px 10px;
  }
  .game-body.math-compact .math-level-bar {
    padding: 5px 8px;
  }
  .game-body.math-compact .math-level-bar .level-dot {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
  .game-body.math-compact .math-level-bar .mlb-info {
    font-size: 10px;
  }
  .game-body.math-compact .game-question.math-q .gq-text {
    font-size: 28px !important;
  }
  .game-body.math-compact .math-input-display {
    font-size: 30px;
    min-height: 36px;
    margin: 4px auto 6px;
  }
  .game-body.math-compact .math-keypad {
    max-width: 315px;
    gap: 8px;
    margin-bottom: 8px;
  }
  .game-body.math-compact .math-keypad .mk-btn {
    min-height: 52px;
    padding: 9px 4px;
    font-size: 25px;
  }
  .game-body.math-compact .game-confirm-btn {
    max-width: 315px;
    padding: 8px 10px;
  }
}

/* 答对/答错动画 */
@keyframes correctShake {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.05); }
  75% { transform: scale(1.05); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.game-question.correct { animation: correctShake 0.4s; border-color: var(--done); }
.game-question.wrong { animation: wrongShake 0.4s; border-color: #E87B7B; }

/* ============ 青蛙过河场景 ============ */
.frog-scene {
  background: linear-gradient(180deg, #D6F0E8 0%, #B8E0F0 100%);
  border-radius: 16px;
  padding: 12px 10px 10px;
  margin-bottom: 8px;
  position: relative;
  min-height: 136px;
}
.frog-river {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  padding: 0 4px;
}
.lily-pad {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #8BC34A 60%, #689F38 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  flex-shrink: 0;
  transition: all 0.4s;
  position: relative;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.lily-pad.reached { background: radial-gradient(circle, var(--done) 60%, #5BAE7E 100%); }
.lily-pad.current { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(127,203,154,0.4); }
.frog-avatar {
  display: block;
  font-size: 28px;
  line-height: 1;
  transform: translateY(-1px);
  animation: frogBounce 0.5s;
}
@keyframes frogBounce {
  0% { transform: translateY(-30px) scale(0.5); }
  60% { transform: translateY(5px) scale(1.2); }
  100% { transform: translateY(0) scale(1); }
}
.frog-char-display {
  text-align: center;
  margin-bottom: 8px;
}
.frog-char-display .fcd-char {
  font-size: 52px;
  font-weight: 700;
  color: var(--blue-text);
  line-height: 1;
}
.frog-char-display .fcd-pinyin-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}
.frog-progress-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 6px;
}
.frog-question-compact {
  padding: 10px 12px;
  margin-bottom: 8px;
}
.frog-question-compact .gq-label { margin-bottom: 3px; }
.frog-question-compact .gq-text { font-size: 26px !important; line-height: 1.2; }
.frog-question-compact .gq-sub { font-size: 12px; margin-top: 2px; }
.frog-game-options {
  gap: 6px;
  margin-bottom: 8px;
}
.frog-game-options .game-option {
  min-height: 42px;
  padding: 8px 8px;
  font-size: 15px;
  border-radius: 12px;
}

/* ============ 寻宝场景 ============ */
.treasure-scene {
  background: linear-gradient(180deg, #F5E6C8 0%, #E8D5A8 100%);
  border-radius: 16px;
  padding: 20px 12px;
  margin-bottom: 16px;
  position: relative;
  min-height: 120px;
}
.treasure-chests {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.treasure-chest {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all 0.4s;
}
.treasure-chest.opened { background: linear-gradient(135deg, #FFD700, #FFA500); animation: treasurePop 0.5s; }
.treasure-chest.closed { background: #D4A76A; opacity: 0.6; }
.treasure-chest.current {
  width: 70px;
  height: 70px;
  font-size: 42px;
  background: linear-gradient(135deg, #B97934, #F3C06A);
  opacity: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(139, 92, 32, 0.3), 0 0 0 5px rgba(255, 215, 100, 0.28);
  animation: treasureInvite 1.2s ease-in-out infinite;
}
.treasure-chest.current:hover { transform: translateY(-4px) scale(1.04); }
.treasure-chest.opening {
  background: linear-gradient(135deg, #FFD95A, #F2A51A);
  animation: treasureOpenBurst 0.75s ease-out forwards;
}
.treasure-start-hint {
  text-align: center;
  color: #8B6914;
  font-weight: 800;
  font-size: 15px;
  margin-top: 12px;
}
.treasure-question-hidden {
  text-align: center;
  background: rgba(255,255,255,0.78);
  border: 2px dashed #C99A54;
  border-radius: 16px;
  padding: 18px 12px;
  color: #8B6914;
  font-weight: 700;
  margin-top: 12px;
}
.treasure-reward-pop {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 502;
  pointer-events: none;
  text-align: center;
  animation: treasureRewardFloat 1.55s ease-out forwards;
}
.treasure-reward-pop .treasure-box-open {
  font-size: 76px;
  filter: drop-shadow(0 8px 12px rgba(80,50,0,0.28));
}
.treasure-reward-pop .treasure-gem {
  font-size: 64px;
  margin-top: -18px;
  animation: treasureGemJump 1.1s ease-out forwards;
}
@keyframes treasurePop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
@keyframes treasureInvite {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.06); }
}
@keyframes treasureOpenBurst {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.18) rotate(-5deg); }
  70% { transform: scale(1.05) rotate(5deg); }
  100% { transform: scale(1.1) rotate(0); }
}
@keyframes treasureRewardFloat {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(0.55); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  72% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -75%) scale(0.92); }
}
@keyframes treasureGemJump {
  0% { transform: translateY(28px) scale(0.35) rotate(-18deg); opacity: 0; }
  35% { transform: translateY(-18px) scale(1.18) rotate(8deg); opacity: 1; }
  70% { transform: translateY(-8px) scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: translateY(-20px) scale(1.05) rotate(0); opacity: 1; }
}
.treasure-progress {
  text-align: center;
  font-size: 13px;
  color: #8B6914;
  margin-top: 10px;
  font-weight: 600;
}

/* ============ 送小动物回家场景 ============ */
.rescue-home-scene {
  background: linear-gradient(180deg, #D6E8F5 0%, #B8D8E8 100%);
  border-radius: 16px;
  padding: 20px 12px;
  margin-bottom: 16px;
  position: relative;
  min-height: 120px;
}
/* 英语句子排排乐场景：中文释义提示 */
.en-sentence-scene {
  background: linear-gradient(180deg, #E3F6E1 0%, #C7EED0 100%);
  border-radius: 16px;
  padding: 14px 12px;
  margin-bottom: 16px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.en-sentence-hint {
  color: #3a7d44;
  font-size: 15px;
  font-weight: 600;
}
.animal-homes {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.animal-home {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all 0.4s;
}
.animal-home.arrived { background: linear-gradient(135deg, #8BC34A, #689F38); animation: homePop 0.5s; }
.animal-home.waiting { background: #A8C8E8; opacity: 0.6; }
@keyframes homePop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.rescue-progress {
  text-align: center;
  font-size: 13px;
  color: var(--blue-text);
  margin-top: 10px;
  font-weight: 600;
}

/* 麦克风按钮 */
.mic-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #FF8A65, #FF6E40);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin: 12px auto;
  box-shadow: 0 4px 12px rgba(255,110,64,0.4);
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.recording { background: linear-gradient(135deg, #E91E63, #C2185B); animation: micPulse 1s infinite; }
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,30,99,0.5); }
  50% { box-shadow: 0 0 0 12px rgba(233,30,99,0); }
}
.mic-status {
  text-align: center;
  font-size: 14px;
  color: var(--text-mid);
  margin-top: 8px;
  min-height: 20px;
}

/* ============ 动物解救场景 ============ */
.rescue-scene {
  background: linear-gradient(180deg, #FFF3E0 0%, #FFE0B2 100%);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.rescue-cages {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.rescue-cages.single {
  margin: 4px auto 12px;
}
.cage {
  width: 48px;
  height: 56px;
  background: #fff;
  border: 2px solid #BCAAA4;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  position: relative;
  transition: all 0.4s;
}
.rescue-cages.single .cage {
  width: 138px;
  height: 138px;
  border-radius: 24px;
  font-size: 78px;
  margin: 0 auto;
}
.cage.locked::after {
  content: "🔒";
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 16px;
}
.cage.sealed {
  background: linear-gradient(180deg, #FFFDF7, #FFF1D8);
  border: 4px solid var(--star-deep);
  box-shadow: 0 10px 22px rgba(150,105,0,0.22), 0 0 0 6px rgba(245,184,75,0.22);
}
.cage.sealed::after {
  content: "🔒";
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 26px;
}
.cage .seal {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 18px;
  border-radius: 10px;
  background: repeating-linear-gradient(90deg, #E74C3C 0 18px, #FFF1E8 18px 30px);
  border: 2px solid rgba(150,40,30,0.22);
  box-shadow: 0 3px 8px rgba(120,40,20,0.18);
  transform-origin: center;
}
.cage .seal-a { transform: translateY(-50%) rotate(36deg); }
.cage .seal-b { transform: translateY(-50%) rotate(-36deg); }
.cage.freed { background: #E8F5E9; border-color: var(--done); animation: cageOpen 0.6s; }
.cage.freed::after { content: ""; }
.cage.current {
  width: 68px;
  height: 76px;
  font-size: 38px;
  background: linear-gradient(180deg, #FFFDF7, #FFF1D8);
  border-color: var(--star-deep);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(150,105,0,0.22), 0 0 0 5px rgba(245,184,75,0.22);
  animation: rescueInvite 1.15s ease-in-out infinite;
}
.cage.current::after {
  content: "🔒";
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 20px;
}
.cage.unlocking {
  animation: animalUnlock 0.9s ease-out forwards;
}
.rescue-start-hint {
  font-size: 15px;
  color: #9A6A2B;
  font-weight: 800;
  margin-top: 10px;
}
.rescue-question-hidden {
  background: rgba(255,255,255,0.82);
  border: 2px dashed #D8A45F;
  border-radius: 16px;
  padding: 16px 12px;
  color: #9A6A2B;
  font-weight: 700;
  margin-top: 12px;
}
.animal-reward-pop {
  position: fixed;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  z-index: 502;
  pointer-events: none;
  text-align: center;
  animation: animalRewardFloat 1.55s ease-out forwards;
}
.animal-reward-pop .animal-lock-open {
  font-size: 66px;
}
.animal-reward-pop .animal-free {
  font-size: 92px;
  margin-top: -10px;
  filter: drop-shadow(0 7px 10px rgba(0,0,0,0.2));
  animation: animalJumpOut 1.15s ease-out forwards;
}
.spell-keyboard {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 7px;
  max-width: 430px;
  margin: 0 auto 12px;
}
.spell-key {
  min-height: 48px;
  padding: 8px 4px;
  font-size: 24px;
  font-weight: 900;
  background: var(--blue-soft);
  color: var(--text-dark);
  justify-content: center;
  border-radius: 12px;
}
.spell-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
}
.spell-native-wrap {
  max-width: 420px;
  margin: 10px auto 10px;
}
.spell-native-input {
  width: 100%;
  min-height: 58px;
  border: 3px solid var(--blue-mid);
  border-radius: 16px;
  background: #fff;
  color: var(--blue-text);
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 1px;
  outline: none;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(78, 143, 66, 0.12);
}
.spell-native-input:focus {
  border-color: var(--blue-deep);
  box-shadow: 0 0 0 4px rgba(141,191,115,0.25);
}
.spell-native-input.correct {
  border-color: var(--done);
  background: #E8F5E9;
  color: #2D8C5C;
}
.spell-native-input.wrong {
  border-color: #E87B7B;
  background: #FFEBEE;
  color: #C75F5F;
}
.spell-native-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
  text-align: center;
}
@keyframes cageOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes rescueInvite {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.06); }
}
@keyframes animalUnlock {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.15) rotate(-6deg); }
  70% { transform: scale(1.05) rotate(6deg); }
  100% { transform: scale(1.1) rotate(0); background:#E8F5E9; border-color:var(--done); }
}
@keyframes animalRewardFloat {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(0.55); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  75% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -78%) scale(0.9); }
}
@keyframes animalJumpOut {
  0% { transform: translateY(30px) scale(0.35); opacity: 0; }
  35% { transform: translateY(-20px) scale(1.15); opacity: 1; }
  70% { transform: translateY(-8px) scale(1); opacity: 1; }
  100% { transform: translateY(-18px) scale(1.05); opacity: 1; }
}
.rescue-progress {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 6px;
}

/* 单词拼写输入框 */
.spell-display {
  text-align: center;
  margin-bottom: 16px;
}
.spell-zh {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue-text);
}
.spell-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}
.spell-question-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.spell-answer-hint {
  display: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: #FFEBEE;
  border: 2px solid #E87B7B;
  color: #C75F5F;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}
.spell-answer-hint.show {
  display: inline-flex;
  align-items: center;
}
.spell-letter-blanks {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.spell-blank-word {
  display: inline-flex;
  gap: 6px;
  align-items: flex-end;
}
.spell-letter-blank {
  width: 22px;
  height: 20px;
  border-bottom: 4px solid var(--blue-mid);
  border-radius: 0 0 4px 4px;
}
.spell-boxes {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.spell-box {
  width: 44px;
  height: 52px;
  border: 3px solid var(--blue-mid);
  border-radius: 10px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--blue-deep);
  background: #fff;
  text-transform: lowercase;
  transition: all 0.2s;
}
.spell-box:focus { outline: none; border-color: var(--blue-deep); box-shadow: 0 0 0 3px rgba(107,159,212,0.2); }
.spell-box.correct { border-color: var(--done); background: #E8F5E9; color: #2D8C5C; }
.spell-box.wrong { border-color: #E87B7B; background: #FFEBEE; color: #C75F5F; }

@media (max-width: 600px) {
  .game-options { grid-template-columns: 1fr; }
  .game-panel { max-width: 100%; }
  .lily-pad { width: 36px; height: 36px; font-size: 22px; }
  .spell-box { width: 36px; height: 44px; font-size: 22px; }
  .spell-question-line { gap: 8px; }
  .spell-answer-hint { font-size: 16px; padding: 7px 10px; white-space: normal; }
  .cage { width: 40px; height: 48px; font-size: 24px; }
}

/* ============ 手写画板 ============ */
.handwrite-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0;
}
.handwrite-canvas-wrap {
  position: relative;
  border: 3px dashed var(--blue-mid);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.handwrite-canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
  background: repeating-linear-gradient(0deg, transparent, transparent 39px, #F0E8D8 40px);
}
.hw-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.hw-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hw-btn.clear { background: #FFEBEE; color: #C75F5F; }
.hw-btn.confirm.recognizing, #confirmBtn.recognizing { opacity: .75; cursor: wait; }
.hw-btn .mini-spinner, #confirmBtn .mini-spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 4px;
  animation: hwspin .8s linear infinite;
}
@keyframes hwspin { to { transform: rotate(360deg); } }
.hw-btn.confirm { background: linear-gradient(135deg, var(--blue-deep), var(--blue-text)); color: #fff; }
.hw-recognized {
  font-size: 32px;
  font-weight: 700;
  color: var(--blue-deep);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 4px;
}
.hw-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* 看拼音写词：田字格与小人进度条 */
.pinyin-road-scene {
  background: linear-gradient(180deg, #F2FAEE 0%, #FFF8E8 100%);
  border: 2px solid var(--blue-soft);
  border-radius: 18px;
  padding: 12px 12px 10px;
  margin: 8px 0 14px;
}
.pinyin-road {
  position: relative;
  height: 54px;
  margin: 2px 8px 4px;
}
.pinyin-road::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 28px;
  height: 10px;
  border-radius: 10px;
  background: repeating-linear-gradient(90deg, #C99A54 0 18px, #E7C889 18px 28px);
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.45);
}
.pinyin-road-fill {
  position: absolute;
  left: 8px;
  top: 28px;
  height: 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-deep));
  transition: width 0.4s ease;
}
.pinyin-runner {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 34px;
  transition: left 0.4s ease;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.18));
}
.pinyin-destination {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 32px;
}
.pinyin-road-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-mid);
  font-weight: 600;
}
.pinyin-write-card {
  background: #fff;
  border: 2px solid #E4F0DC;
  border-radius: 18px;
  padding: 14px 12px;
  text-align: center;
}
.pinyin-prompt {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 14px;
  background: #F2FAEE;
  border: 1.5px solid var(--blue-soft);
  color: var(--blue-text);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 8px 0 12px;
}
.pinyin-prompt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pinyin-correct-hint {
  display: none;
  padding: 7px 10px;
  border-radius: 12px;
  background: #FFEBEE;
  border: 2px solid #E87B7B;
  color: #C75F5F;
  font-size: 18px;
  font-weight: 900;
}
.pinyin-correct-hint.show {
  display: inline-flex;
}
.pinyin-answer-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 86px;
  line-height: 1;
  font-weight: 900;
  pointer-events: none;
  z-index: 3;
  animation: letterCheckPop 0.42s ease-out both;
}
.pinyin-answer-mark.correct {
  color: #E53935;
  text-shadow: 0 4px 12px rgba(229,57,53,0.25);
}
.pinyin-answer-mark.wrong {
  color: #E53935;
  animation: wrongShake 0.28s ease-in-out;
}
.tianzige-canvas-wrap {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  border: 3px solid var(--blue-mid);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 12px rgba(78, 143, 66, 0.12);
}
.tianzige-canvas-wrap.correct {
  border-color: var(--done);
  box-shadow: 0 4px 14px rgba(45, 140, 92, 0.25);
}
.tianzige-canvas-wrap.wrong {
  border-color: #E87B7B;
  animation: wrongShake 0.28s ease-in-out;
}
.tianzige-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  background: #fff;
}

/* 拼写手写格 */
.spell-handwrite-box {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
  flex-wrap: wrap;
  align-items: center;
}
.spell-slot-word {
  display: inline-flex;
  gap: 8px;
}
.shw-slot {
  width: 60px;
  height: 70px;
  border: 3px solid var(--blue-mid);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--blue-deep);
  position: relative;
}
.shw-slot.active { border-color: var(--star); box-shadow: 0 0 0 3px rgba(245,184,75,0.3); }
.shw-slot.filled { background: #FFF8E8; }
.shw-slot.correct { border-color: var(--done); background: #E8F5E9; color: #2D8C5C; }
.shw-slot.wrong { border-color: #E87B7B; background: #FFEBEE; color: #C75F5F; }

/* 字母听写乐园 */
.letter-park {
  background: linear-gradient(180deg, #F2F8FF 0%, #FFF8E8 100%);
  border: 2px solid var(--blue-soft);
  border-radius: 18px;
  padding: 8px;
  text-align: center;
  margin-bottom: 6px;
}
.letter-train {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.letter-car {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: #fff;
  border: 1.5px solid #D8EAF8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--blue-text);
}
.letter-car.done { background: #E8F5E9; color: #2D8C5C; border-color: #8DD8AA; }
.letter-car.wrong { background: #FFEBEE; color: #C75F5F; border-color: #E87B7B; }
.letter-car.current { background: var(--star); color: #fff; border-color: var(--star-deep); transform: scale(1.12); }
.letter-dictation-card {
  background: #fff;
  border: 2px dashed var(--blue-mid);
  border-radius: 18px;
  padding: 8px;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}
.letter-hidden {
  font-size: 34px;
  font-weight: 900;
  color: var(--blue-text);
  letter-spacing: 4px;
  margin: 0;
}
.letter-hidden.revealed {
  color: #C75F5F;
}
.letter-answer-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  line-height: 1;
  font-weight: 900;
  color: #E53935;
  text-shadow: 0 4px 12px rgba(229, 57, 53, 0.25);
  pointer-events: none;
  animation: letterCheckPop 0.45s ease-out both;
}
@keyframes letterCheckPop {
  0% { opacity: 0; transform: scale(0.35) rotate(-12deg); }
  65% { opacity: 1; transform: scale(1.18) rotate(0deg); }
  100% { opacity: 1; transform: scale(1); }
}
.four-line-wrap {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 6px auto;
  max-width: 340px;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}
.four-line-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
  margin-bottom: 2px;
}
.four-line-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-text, #4A7FB5);
  letter-spacing: 1px;
}
.four-line-label.left { color: #E07070; }
.four-line-label.right { color: #5A9BD6; }
.four-line-canvas {
  width: 100%;
  height: 132px;
  display: block;
  background:
    /* 中间竖向分割虚线 */
    linear-gradient(to bottom,
      transparent 0%, transparent 100%),
    repeating-linear-gradient(to bottom,
      transparent 0px, transparent 6px,
      #C8D8E8 6px, #C8D8E8 8px),
    /* 四线格背景 */
    linear-gradient(to bottom,
      transparent 14%,
      #E98D8D 14%, #E98D8D calc(14% + 2px),
      transparent calc(14% + 2px), transparent 38%,
      #E98D8D 38%, #E98D8D calc(38% + 2px),
      transparent calc(38% + 2px), transparent 62%,
      #6BA7D6 62%, #6BA7D6 calc(62% + 2px),
      transparent calc(62% + 2px), transparent 86%,
      #E98D8D 86%, #E98D8D calc(86% + 2px),
      transparent calc(86% + 2px)),
    #FFFDF8;
  background-size:
    2px 100%,
    2px 100%,
    100% 100%,
    100% 100%;
  background-position:
    50% 0,
    50% 0,
    0 0,
    0 0;
  background-repeat: no-repeat;
  border-radius: 0;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.letter-writing-lock {
  overflow: hidden;
  overscroll-behavior: none;
}
.letter-submit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 6px 0 4px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(251,248,241,0.25), #FBF8F1 45%);
  padding-top: 6px;
}
.letter-score-big {
  font-size: 42px;
  font-weight: 900;
  color: var(--star-deep);
  margin: 10px 0;
}

/* 时钟样式 */
.clock-display {
  text-align: center;
  margin: 16px 0;
}
.clock-svg {
  filter: drop-shadow(0 4px 10px rgba(107,159,212,0.25));
}

/* 人民币样式 */
.money-display {
  text-align: center;
  margin: 16px 0;
}
.money-coins {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.coin {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #7A4300;
  background: radial-gradient(circle at 30% 25%, #FFF8C6 0%, #FFD95A 36%, #F2A51A 72%, #B86A00 100%);
  border: 2px solid #D89316;
  box-shadow: inset 0 4px 8px rgba(255,255,255,0.6), inset 0 -4px 8px rgba(139,82,0,0.22), 0 3px 8px rgba(120,80,0,0.18);
}
.coin.c1, .coin.c5, .coin.c10, .coin.c50 {
  background: radial-gradient(circle at 30% 25%, #FFF8C6 0%, #FFD95A 36%, #F2A51A 72%, #B86A00 100%);
}
.coin.y1, .coin.y5, .coin.y10 {
  width: 56px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFF1A8 0%, #FFD95A 42%, #E7A21A 100%);
  border-color: #D89316;
  color: #7A4300;
}


/* ============ iPhone 手机版强化适配 ============ */
@media (max-width: 480px) {
  body { font-size: 16px; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
  .app { max-width: 100%; padding: max(12px, env(safe-area-inset-top)) 10px max(72px, env(safe-area-inset-bottom)); }
  .header { padding: 16px 14px; border-radius: 18px; margin-bottom: 12px; }
  .header-title, .card-title, .gs-title { font-size: 20px !important; line-height: 1.35; }
  .nav-tabs { gap: 6px; padding: 8px 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-tab { min-width: 78px; padding: 10px 8px; font-size: 14px; border-radius: 14px; }
  .card, .game-card, .tc-block, .game-start, .game-question { border-radius: 16px; padding: 14px 12px; }
  .game-grid { gap: 10px; }
  .word-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .game-mask, .modal-mask { align-items: stretch; padding: 0; }
  .game-panel, .modal { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .game-body { padding: 10px; overflow-x: hidden; }
  .gq-text { font-size: 22px !important; line-height: 1.45; word-break: break-word; }
  .game-question .gq-pic { font-size: 56px; }
  .game-options { gap: 9px; }
  .game-option { min-height: 52px; padding: 12px 10px; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 6px; }
  .frog-scene { min-height: 118px; padding: 8px 8px 7px; margin-bottom: 6px; }
  .frog-char-display .fcd-char { font-size: 42px; }
  .frog-char-display .fcd-pinyin-hint { font-size: 12px; margin-top: 2px; }
  .lily-pad { width: 31px; height: 31px; font-size: 18px; }
  .frog-avatar { font-size: 22px; }
  .frog-progress-text { font-size: 11px; margin-top: 4px; }
  .frog-question-compact { padding: 7px 10px !important; margin-bottom: 6px; }
  .frog-question-compact .gq-text { font-size: 22px !important; line-height: 1.15; }
  .frog-question-compact .gq-sub { font-size: 11px; margin-top: 1px; }
  .frog-game-options { gap: 6px; margin-bottom: 6px; }
  .frog-game-options .game-option { min-height: 38px; padding: 6px 6px; font-size: 15px; }
  .speak-btn, .game-confirm-btn, .gs-btn, .gr-btn { min-height: 48px; font-size: 16px; }
  .mini-speak { width: 34px; height: 34px; min-width: 34px; font-size: 16px; }
  .math-keypad { max-width: 100%; gap: 7px; }
  .mk-btn, .hw-btn { min-height: 46px; font-size: 17px; }
  .spell-native-wrap { max-width: 100%; margin: 8px auto; }
  .spell-native-input { min-height: 54px; font-size: 25px; padding: 7px 10px; }
  .spell-letter-blanks { gap: 10px; margin-top: 10px; }
  .spell-blank-word { gap: 4px; }
  .spell-letter-blank { width: 18px; height: 18px; border-bottom-width: 3px; }
  .spell-handwrite-box { gap: 5px; flex-wrap: wrap; }
  .spell-slot-word { gap: 5px; }
  .shw-slot { width: 34px; height: 42px; font-size: 20px; }
  .frog-river, .treasure-chests, .animal-homes, .rescue-cages { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .celebration-text { width: calc(100vw - 28px); padding: 22px 16px; }
  /* 裁剪编辑器移动端适配 */
  .ace-stage { width: 220px; height: 220px; }
  .ace-title { font-size: 12px; padding: 0 20px; }
  .ace-actions { flex-wrap: wrap; justify-content: center; }
  .ace-btn { padding: 9px 20px; font-size: 14px; }
}

/* ============ iPad/平板适配（≥720px）：布局铺开 + 元素放大 ============ */
@media (min-width: 720px) {
  body { font-size: 16.5px; }
  .app { padding: 28px 24px 70px; }

  /* 头部与导航 */
  .header { padding: 30px 34px; border-radius: 28px; }
  .avatar { width: 80px; height: 80px; font-size: 40px; }
  .avatar-camera { width: 26px; height: 26px; font-size: 14px; }
  .header-title h1 { font-size: 26px; }
  .header-title p { font-size: 15px; }
  .stat-pill { min-width: 96px; padding: 10px 20px; border-radius: 18px; }
  .stat-pill .num { font-size: 26px; }
  .stat-pill .lbl { font-size: 12.5px; }
  .nav-tabs { gap: 10px; padding: 8px; }
  .nav-tab { min-width: 110px; padding: 14px 10px; font-size: 16px; }
  .nav-tab .icon { font-size: 24px; }

  /* 页面卡片与网格 */
  .card { padding: 26px; }
  .card-title { font-size: 20px; }
  .card-title .emoji { font-size: 26px; }
  .welcome-banner h2 { font-size: 24px; }
  .welcome-banner p { font-size: 16px; }
  .today-tasks { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
  .task-mini { padding: 18px; }
  .task-mini .tm-icon { font-size: 34px; }
  .task-mini .tm-name { font-size: 16px; }
  .task-mini .tm-sub { font-size: 12.5px; }
  .task-mini .tm-check { width: 28px; height: 28px; }
  .rank-tier-icon { width: 44px; height: 44px; font-size: 22px; }
  .rank-tier-name { font-size: 13px; }
  .rank-tier-threshold { font-size: 10px; }
  .rank-card-badge { width: 84px; height: 84px; }
  .rank-card-badge .rcb-icon { font-size: 34px; }
  .rankup-modal { max-width: 400px; padding: 44px 32px 32px; }
  .rankup-badge { width: 120px; height: 120px; }
  .rankup-badge-icon { font-size: 48px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .shop-item .si-icon { font-size: 44px; }
  .shop-item .si-name { font-size: 16px; }
  .prize-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .prize-card .pc-icon { font-size: 46px; }
  .prize-card .pc-name { font-size: 16px; }
  .prize-card .pc-meta { font-size: 13px; }
  .archive-stats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .game-grid { gap: 12px; }
  .game-card { padding: 26px 18px; }
  .game-card .gc-icon { font-size: 52px; }
  .game-card .gc-name { font-size: 18px; }
  .game-card .gc-desc { font-size: 14px; }
  .game-card .gc-best { font-size: 13px; }

  /* 游戏弹窗 */
  .game-panel { max-width: min(92vw, 780px); }
  .game-panel-header { padding: 22px 28px; }
  .game-panel-header .gph-icon { font-size: 34px; }
  .game-panel-header .gph-title { font-size: 20px; }
  .game-panel-header .gph-close { width: 42px; height: 42px; font-size: 20px; }
  .game-body { padding: 28px 32px; }
  .game-prev-btn { font-size: 14px; min-height: 38px; }
  .game-progress-bar { height: 12px; }
  .game-question { padding: 26px; }
  .game-question .gq-label { font-size: 13px; }
  .game-question .gq-text { font-size: 25px; }
  .game-question .gq-sub { font-size: 16px; }
  .game-options { gap: 14px; }
  .game-option { font-size: 19px; min-height: 68px; padding: 20px 16px; border-radius: 16px; }
  .game-option-speak { width: 52px; min-width: 52px; min-height: 68px; font-size: 22px; }
  .game-confirm-btn { padding: 18px; font-size: 17px; }
  .game-start .gs-icon { font-size: 80px; }
  .game-start .gs-title { font-size: 26px; }
  .game-start .gs-desc { font-size: 16px; }
  .gs-btn { font-size: 18px; min-height: 56px; }
  .speak-btn { font-size: 14px; padding: 8px 16px; }
  .mini-speak { width: 30px; height: 30px; font-size: 15px; }

  /* 各游戏内部 */
  .math-q { font-size: 18px; padding: 14px 18px; }
  .math-q .q-ans { width: 76px; font-size: 18px; }
  .math-stairs { height: 150px; }
  .letter-big { font-size: 84px; }
  .letter-small { font-size: 36px; }
  .compare-balance { width: min(560px, 100%); height: 240px; }
  .compare-options .game-option { font-size: 40px; }
  .clock-svg { width: 260px; height: 260px; }
  .coin { width: 80px; height: 80px; font-size: 16px; }
  .coin.y1, .coin.y5, .coin.y10 { width: 70px; height: 80px; }
  .redup-grid { max-width: 560px; gap: 8px; }
  .redup-cell { min-height: 56px; font-size: 30px; border-radius: 14px; }
  .redup-train-car { min-width: 54px; height: 58px; font-size: 13px; }
  .redup-train-car.passed { font-size: 22px; }
  .redup-current-type { font-size: 22px; }
  .redup-small-btn { padding: 12px 20px; font-size: 15px; }
  .order-word { font-size: 17px; padding: 12px 20px; }
  .frog-char-display .fcd-char { font-size: 68px; }
  .frog-avatar { font-size: 38px; }
  .lily-pad { width: 52px; height: 52px; font-size: 28px; }
  .spell-letter-blank { width: 30px; height: 26px; }
  .shw-slot { width: 76px; height: 88px; font-size: 40px; }
  .hw-btn { padding: 12px 22px; font-size: 15px; }
  .hw-recognized { font-size: 40px; }
  .mk-btn { min-height: 60px; font-size: 22px; }
  /* 手写画板按内部坐标系等比放大（280×120 / 320×160 内部分辨率不变，坐标自动映射） */
  .handwrite-canvas-wrap { width: min(480px, 100%); }
  .handwrite-canvas { width: 100%; height: 205px; }
  .four-line-wrap { max-width: 420px; }
  .four-line-canvas { height: 210px; }
  .crossword-theme { font-size: 17px; }
  .crossword-word-chip { font-size: 15px; padding: 6px 12px; }
  .crossword-status { font-size: 15px; }
}

/* ============ 游乐园首页卡片 ============ */
.amusement-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid #F8D7C9;
  background: linear-gradient(135deg, #FFF5EE 0%, #FFF0E8 50%, #FFE8D6 100%);
  position: relative;
  overflow: hidden;
}
.amusement-card::before {
  content: "🎪";
  position: absolute;
  top: -8px;
  right: 16px;
  font-size: 56px;
  opacity: 0.1;
  transform: rotate(10deg);
}
.amusement-card:active { transform: scale(0.98); }
.amusement-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.aci-left { flex-shrink: 0; }
.aci-icon {
  font-size: 40px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFE0C4, #FFCBA4);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(255, 160, 80, 0.25);
}
.aci-content { flex: 1; min-width: 0; }
.aci-title {
  font-size: 18px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 2px;
}
.aci-desc {
  font-size: 13px;
  color: #A06830;
  margin-bottom: 4px;
}
.aci-games {
  font-size: 12px;
  color: #C87840;
  font-weight: 600;
}
.aci-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: #C87840;
  opacity: 0.6;
}

/* ============ 游乐园全屏弹层 ============ */
.amusement-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
  padding: 16px;
}
.amusement-panel {
  background: linear-gradient(135deg, #fff 0%, #FFF8F2 100%);
  border-radius: 22px;
  width: min(440px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 游乐园首页 */
#page-amusement {
  max-width: 480px;
  margin: 0 auto;
}
.amusement-home { padding: 24px 20px; }
.amusement-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px dashed #F0D8C4;
}
.ah-title {
  font-size: 22px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 4px;
}
.ah-subtitle {
  font-size: 14px;
  color: #A06830;
  margin-bottom: 8px;
}
.ah-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFF0E0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: #C87840;
}
.amusement-games {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.amusement-game-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  border: 2px solid #F0D8C4;
  box-shadow: 0 2px 8px rgba(200, 120, 64, 0.08);
}
.agc-icon { font-size: 42px; margin-bottom: 8px; }
.agc-name {
  font-size: 18px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 4px;
}
.agc-desc {
  font-size: 13px;
  color: #A06830;
  margin-bottom: 10px;
}
.agc-status {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}
.agc-btn {
  display: inline-block;
  padding: 10px 32px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #FFB060, #FF8830);
  color: #fff;
  box-shadow: 0 3px 12px rgba(255, 136, 48, 0.35);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.agc-btn:active { transform: scale(0.96); }
.agc-btn.disabled {
  background: #ddd;
  color: #999;
  box-shadow: none;
  cursor: not-allowed;
}

/* 游玩规则 */
.amusement-rules {
  background: #FFF8F0;
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #F0D8C4;
}
.ar-title {
  font-size: 14px;
  font-weight: 700;
  color: #C05E20;
  margin-bottom: 6px;
}
.ar-text {
  font-size: 13px;
  color: #A06830;
  line-height: 1.8;
}

/* 模式选择 */
.amusement-mode-select {
  padding: 24px 20px;
  text-align: center;
}
.ams-back {
  display: inline-block;
  background: none;
  border: none;
  font-size: 14px;
  color: #C05E20;
  cursor: pointer;
  margin-bottom: 12px;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}
.ams-title {
  font-size: 22px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 4px;
}
.ams-subtitle {
  font-size: 14px;
  color: #A06830;
  margin-bottom: 20px;
}
.ams-modes {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.ams-mode {
  flex: 1;
  max-width: 170px;
  background: #fff;
  border: 2.5px solid #F0D8C4;
  border-radius: 18px;
  padding: 20px 14px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ams-mode:active {
  transform: scale(0.96);
  border-color: #FF8830;
}
.ams-mode-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.ams-mode-name {
  font-size: 17px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 4px;
}
.ams-mode-desc {
  font-size: 12px;
  color: #A06830;
}
.ams-cost {
  font-size: 13px;
  color: #888;
  margin-top: 6px;
}

/* ============ 金币消费确认弹窗 ============ */
.cc-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  animation: fadeIn 0.25s;
  padding: 16px;
}
.cc-dialog {
  background: linear-gradient(135deg, #FFFEF8 0%, #FFF5E8 100%);
  border-radius: 24px;
  width: min(320px, 90vw);
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25), 0 0 0 3px #FFD95A;
  animation: ccDialogPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ccDialogPop {
  0% { transform: scale(0.6) translateY(30px); opacity: 0; }
  70% { transform: scale(1.04) translateY(-4px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.cc-title {
  font-size: 20px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 8px;
}
.cc-desc {
  font-size: 14px;
  color: #A06830;
  line-height: 1.6;
  margin-bottom: 16px;
}
.cc-coins {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 52px;
  align-items: center;
}
.cc-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #FFF8C6 0%, #FFD95A 36%, #F2A51A 72%, #B86A00 100%);
  border: 2.5px solid #D89316;
  color: #8A4D00;
  font-size: 22px;
  font-weight: 900;
  box-shadow: inset 0 3px 5px rgba(255,255,255,0.65), inset 0 -3px 5px rgba(139,82,0,0.2), 0 3px 10px rgba(120,80,0,0.3);
  animation: ccCoinPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.cc-coin::before { content: "¥"; }
@keyframes ccCoinPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.cc-cost-text {
  font-size: 15px;
  font-weight: 700;
  color: #C05E20;
  margin-bottom: 20px;
}
.cc-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.cc-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.cc-btn:active { transform: scale(0.94); }
.cc-cancel {
  background: #F0EDE8;
  color: #888;
}
.cc-confirm {
  background: linear-gradient(135deg, #FFB060, #FF8830);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 136, 48, 0.4);
}

/* ============ 数独游戏 ============ */
.sudoku-game {
  padding: 16px 12px;
}
.sudoku-top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.stb-back {
  background: none;
  border: none;
  font-size: 13px;
  color: #C05E20;
  cursor: pointer;
  padding: 4px 6px;
  -webkit-tap-highlight-color: transparent;
}
.stb-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #666;
}
.stb-size {
  background: #FFF0E0;
  padding: 2px 10px;
  border-radius: 10px;
  color: #C05E20;
  font-size: 12px;
}
.stb-progress {
  color: #4E8F42;
}
.stb-timer {
  font-variant-numeric: tabular-nums;
  color: #888;
}

/* 数独网格 */
.sudoku-grid {
  display: grid;
  gap: 0;
  margin: 0 auto 16px;
  border: 2.5px solid #333;
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.sudoku-grid-4 {
  grid-template-columns: repeat(4, 1fr);
  max-width: min(300px, 85vw);
}
.sudoku-grid-9 {
  grid-template-columns: repeat(9, 1fr);
  max-width: min(380px, 92vw);
}

/* 单元格 */
.sudoku-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  border: 0.5px solid #ccc;
  transition: background-color 0.25s, color 0.15s;
  aspect-ratio: 1;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.sudoku-cell-4 {
  font-size: clamp(22px, 6vw, 32px);
}
.sudoku-cell-9 {
  font-size: clamp(15px, 4vw, 22px);
}

/* 粗边框 - 宫格分隔 */
.sudoku-cell.box-left {
  border-left: 2.5px solid #333;
}
.sudoku-cell.box-top {
  border-top: 2.5px solid #333;
}

/* 预设数字 */
.sudoku-cell.given {
  background: #F5F0E8;
  color: #333;
  cursor: default;
  font-weight: 800;
}

/* 用户填入 */
.sudoku-cell.filled {
  color: #2563EB;
  background: #fff;
}

/* 选中 */
.sudoku-cell.selected {
  background: #FFF3CD !important;
  box-shadow: inset 0 0 0 2px #FF8830;
  z-index: 2;
}

/* 行/宫完成蓝色高亮 */
.sudoku-cell.unit-blue {
  background: #DBEAFE !important;
  color: #1D4ED8 !important;
  transition: background-color 0.5s;
}
.sudoku-cell.given.unit-blue {
  background: #C4DAF7 !important;
}

/* 错误红色标记 */
.sudoku-cell.unit-red,
.sudoku-cell.error-shake {
  background: #FEE2E2 !important;
  color: #DC2626 !important;
  animation: sudokuShake 0.4s ease-in-out;
}

@keyframes sudokuShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* 数字输入面板 */
.sudoku-num-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.sudoku-num-pad-4 {
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}
.sudoku-num-pad-9 {
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}
.sudoku-num-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #E0D4C4;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 4px 0;
}
.sudoku-num-pad-4 .sudoku-num-btn {
  width: 54px;
  height: 60px;
}
.sudoku-num-pad-9 .sudoku-num-btn {
  width: 38px;
  height: 52px;
}
.sudoku-num-btn:active {
  transform: scale(0.93);
  background: #FFF0E0;
}
.sudoku-num-btn.all-placed {
  opacity: 0.35;
  cursor: not-allowed;
}
.snb-num {
  font-size: 20px;
  font-weight: 800;
  color: #C05E20;
  line-height: 1.1;
}
.snb-count {
  font-size: 10px;
  color: #aaa;
  line-height: 1;
}

/* 操作按钮 */
.sudoku-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.sa-btn {
  padding: 10px 24px;
  border: 2px solid #E0D4C4;
  border-radius: 24px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.sa-btn:active {
  transform: scale(0.96);
  background: #FFF0E0;
}

/* 结果展示 */
.sudoku-result {
  text-align: center;
  padding: 20px;
  border-radius: 16px;
  margin-top: 8px;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.result-success {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  border: 2px solid #81C784;
}
.sr-icon { font-size: 48px; margin-bottom: 8px; }
.sr-title {
  font-size: 20px;
  font-weight: 800;
  color: #2E7D32;
  margin-bottom: 6px;
}
.sr-desc {
  font-size: 14px;
  color: #388E3C;
  margin-bottom: 14px;
}
.sr-btn {
  display: inline-block;
  padding: 10px 32px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #66BB6A, #43A047);
  color: #fff;
  box-shadow: 0 3px 12px rgba(67, 160, 71, 0.35);
  -webkit-tap-highlight-color: transparent;
}
.sr-btn:active { transform: scale(0.96); }

/* ============ 成语释义对对碰 ============ */
.im-board {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: flex-start;
}
.im-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.im-col-title {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--blue-text);
  padding: 4px 0;
  border-bottom: 2px solid var(--blue-mid);
  margin-bottom: 4px;
}
.im-card {
  padding: 9px 8px;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.25s ease;
  border: 2.5px solid transparent;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.im-left {
  background: linear-gradient(135deg, #FFF9E6, #FFF3CC);
  color: #8B5A00;
  border-color: #F5D76E;
  font-size: 16px;
  letter-spacing: 2px;
}
.im-right {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  color: var(--blue-text);
  border-color: #A5D6A7;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1.4;
  text-align: left;
  padding: 8px 10px;
}
.im-card:active:not(.im-matched) {
  transform: scale(0.96);
}
.im-selected {
  border-color: var(--star) !important;
  box-shadow: 0 0 0 3px rgba(245, 184, 75, 0.4), 0 2px 8px rgba(245, 184, 75, 0.3);
  transform: scale(1.03);
  z-index: 2;
}
.im-matched {
  opacity: 0.45;
  transform: scale(0.95);
  pointer-events: none;
  border-color: var(--done) !important;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9) !important;
  color: var(--done) !important;
  transition: all 0.6s ease;
  text-decoration: line-through;
  text-decoration-color: var(--done);
}
.im-matched .im-check {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--done);
  font-size: 16px;
  font-weight: 700;
}
.im-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 10px;
  padding: 6px 12px;
  background: var(--cream-deep);
  border-radius: 10px;
}
/* 配对成功闪光动画 */
@keyframes im-flash {
  0% { background: linear-gradient(135deg, #FFF9C4, #FFF176); border-color: #FFD54F; opacity: 1; transform: scale(1.05); }
  50% { background: linear-gradient(135deg, #C8E6C9, #81C784); border-color: #66BB6A; opacity: 1; transform: scale(1); }
  100% { opacity: 0.45; transform: scale(0.95); background: linear-gradient(135deg, #E8F5E9, #C8E6C9); border-color: var(--done); }
}
.im-card.im-flash-anim {
  animation: im-flash 0.7s ease forwards;
}
/* 答错抖动 */
@keyframes im-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.im-card.im-shake-anim {
  animation: im-shake 0.45s ease;
  border-color: #EF5350 !important;
}
/* 移动端适配 */
@media (max-width: 380px) {
  .im-left { font-size: 14px; letter-spacing: 1px; }
  .im-right { font-size: 11.5px; }
  .im-card { padding: 7px 5px; min-height: 36px; }
  .im-col { gap: 5px; }
}

/* ===== 词语连连看模块 ===== */
.wm-wrap {
  position: relative;
  margin-top: 8px;
}
.wm-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}
/* 用 grid 确保左右行严格等高，中间留足连线空间 */
.wm-board.im-board {
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  gap: 0 0;
  align-items: stretch;
  margin-top: 0;
}
.wm-board .wm-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wm-board .wm-gap {
  /* 中间连线通道 */
}
.wm-board .im-col-title {
  font-size: 12px;
  padding: 3px 0;
  margin-bottom: 2px;
}
/* 左右卡片统一尺寸，等高对齐 */
.wm-board .im-card {
  padding: 5px 6px;
  min-height: 34px;
  font-size: 14px;
  letter-spacing: 1px;
  border-radius: 10px;
}
.wm-board .im-left {
  font-size: 14px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #FFFDE7, #FFF8C4);
  border-color: #FFD54F;
}
.wm-board .im-right {
  font-size: 14px;
  letter-spacing: 1px;
  text-align: center;
  padding: 5px 6px;
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  color: #1565C0;
  border-color: #90CAF9;
  font-weight: 600;
}
@media (max-width: 380px) {
  .wm-board.im-board { grid-template-columns: 1fr 36px 1fr; }
  .wm-board .im-card { font-size: 12.5px; padding: 4px 4px; min-height: 30px; }
}

/* ===== 每日小成就模块 ===== */
#page-achievement {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
}

.ach-header {
  text-align: center;
  margin-bottom: 16px;
}
.ach-title {
  font-size: 20px;
  font-weight: 800;
  color: #2E7D32;
  margin-bottom: 4px;
}
.ach-date {
  font-size: 13px;
  color: #888;
}

.ach-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  padding: 14px 0;
  background: linear-gradient(135deg, #E8F5E9 0%, #F1F8E9 100%);
  border-radius: 16px;
}
.ach-stat {
  text-align: center;
}
.ach-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #2E7D32;
}
.ach-stat-lbl {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

.ach-week-bar {
  background: #FFFDE7;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ach-week-label {
  font-size: 12px;
  color: #8D6E00;
  font-weight: 600;
}
.ach-week-dots {
  display: flex;
  gap: 5px;
}
.ach-week-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #999;
  font-weight: 600;
}
.ach-week-dot.checked {
  background: #66BB6A;
  color: #fff;
}
.ach-week-dot.today {
  border: 2px solid #FFB300;
}

.ach-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.ach-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid #E0E0E0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.ach-task:active {
  transform: scale(0.98);
}
.ach-task.done {
  background: #E8F5E9;
  border-color: #66BB6A;
}

.ach-checkbox {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.25s ease;
}
.ach-checkbox.checked {
  background: #43A047;
  border-color: #43A047;
  color: #fff;
  animation: ach-check-pop 0.3s ease;
}

@keyframes ach-check-pop {
  0% { transform: scale(0.6); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.ach-task-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.ach-task-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  flex: 1;
}
.ach-task.done .ach-task-name {
  color: #2E7D32;
  text-decoration: line-through;
  text-decoration-color: #A5D6A7;
}

.ach-exchange {
  text-align: center;
  padding: 18px 12px;
  margin-top: 12px;
  background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
  border-radius: 14px;
  border: 1.5px solid #F0D98C;
}
.ach-exchange-balances {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 15px;
  color: #5a3a00;
}
.ach-eb-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ach-eb-item b {
  font-size: 18px;
  color: #B8860B;
}
.ach-eb-arrow {
  font-size: 18px;
  color: #DAA520;
  font-weight: 700;
}
.ach-exchange-rate {
  font-size: 11px;
  color: #99803a;
  margin-bottom: 12px;
}
.ach-exchange-btn {
  min-width: 180px;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #5a3a00;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 8px rgba(255,165,0,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.ach-exchange-btn:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(255,165,0,0.3);
}
.ach-exchange .btn.disabled {
  opacity: 0.4;
  pointer-events: none;
  background: #e0e0e0;
  color: #999;
  box-shadow: none;
}

/* 好习惯任务管理面板 */
.smp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1.5px solid #e8f0fe;
}
.smp-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #333;
}
.smp-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  font-size: 15px;
  font-weight: bold;
  color: #777;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.smp-close:hover,
.smp-close:active {
  background: #e8e8e8;
  color: #333;
}
.smp-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 18px;
  max-height: 55vh;
}

/* 任务管理面板内条目 */
.ach-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
/* 拖拽手柄 */
.ach-mi-drag {
  color: #bbb;
  font-size: 16px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  padding: 4px 2px;
  line-height: 1;
  flex-shrink: 0;
}
.ach-mi-drag:active {
  cursor: grabbing;
}
/* 拖拽占位符 */
.ach-manage-placeholder {
  border: 1.5px dashed #ccc;
  border-radius: 8px;
  background: #fafafa;
  margin: 4px 0;
}
/* 正在被拖拽的项 */
.ach-dragging {
  opacity: 0.88;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.16);
}
.ach-manage-item .ach-mi-icon {
  width: 40px;
  text-align: center;
  font-size: 18px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 6px 2px;
}
.ach-manage-item .ach-mi-name {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
.ach-mi-del {
  padding: 4px 10px !important;
  color: #e55 !important;
  font-size: 16px !important;
}

/* 平板适配 */
@media (min-width: 720px) {
  #page-achievement { max-width: 540px; }
  .ach-task { padding: 14px 18px; gap: 12px; }
  .ach-task-name { font-size: 16px; }
  .ach-checkbox { width: 32px; height: 32px; font-size: 18px; }
  .ach-stats { gap: 28px; padding: 18px 0; }
  .ach-stat-num { font-size: 26px; }
}

/* ============ 记忆翻翻乐 ============ */

/* 主题选择网格 */
.mf-themes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 340px;
  margin: 0 auto 16px;
}
.mf-theme {
  background: #fff;
  border: 2.5px solid #F0D8C4;
  border-radius: 16px;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mf-theme:active {
  transform: scale(0.96);
  border-color: #FF8830;
}
.mf-theme-icon { font-size: 36px; margin-bottom: 6px; }
.mf-theme-name {
  font-size: 15px;
  font-weight: 700;
  color: #C05E20;
  margin-bottom: 2px;
}
.mf-theme-desc {
  font-size: 12px;
  color: #A06830;
}

/* 游戏容器 */
.mf-game {
  padding: 16px 12px;
}
.mf-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.mf-back-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: #C05E20;
  cursor: pointer;
  padding: 4px 6px;
  -webkit-tap-highlight-color: transparent;
}
.mf-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.mf-theme-label {
  background: #FFF0E0;
  padding: 2px 10px;
  border-radius: 10px;
  color: #C05E20;
  font-size: 12px;
}
.mf-pairs { color: #4E8F42; }
.mf-restart-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

/* 卡片网格 */
.mf-grid {
  display: grid;
  grid-template-columns: repeat(4, clamp(62px, 19vw, 86px));
  gap: clamp(6px, 1.5vw, 10px);
  justify-content: center;
  margin: 0 auto 16px;
  perspective: 1000px;
}
.mf-grid-text .mf-card-front {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 800;
  font-size: clamp(22px, 6vw, 32px);
}

/* 卡片 */
.mf-card {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mf-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.mf-card.mf-show .mf-card-inner {
  transform: rotateY(180deg);
}
.mf-card-front, .mf-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: clamp(10px, 2.5vw, 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}
.mf-card-front {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #FFFEF8, #FFF5E8);
  border: 2.5px solid #F0D8C4;
  font-size: clamp(26px, 7vw, 38px);
  box-shadow: 0 2px 8px rgba(200, 120, 64, 0.1);
}
.mf-card-back {
  background: linear-gradient(135deg, #FF8830, #FFB060);
  border: 2.5px solid #E07020;
  box-shadow: 0 2px 10px rgba(255, 136, 48, 0.25);
}
.mf-card-back::after {
  content: "❓";
  font-size: clamp(20px, 5vw, 30px);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

/* 配对成功 */
.mf-card.mf-matched .mf-card-front {
  border-color: #43A047;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  box-shadow: 0 0 12px rgba(67, 160, 71, 0.3);
}
.mf-card.mf-matched {
  cursor: default;
}

/* 配对成功弹跳动画 */
@keyframes mfMatchPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.12); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}
.mf-card.mf-match-pop {
  animation: mfMatchPop 0.45s ease;
}

/* 配对失败抖动动画 */
@keyframes mfShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.mf-card.mf-shake .mf-card-inner {
  animation: mfShake 0.4s ease;
}

/* 底部开始按钮 */
.mf-bottom {
  text-align: center;
  margin-top: 8px;
}
.mf-start-btn {
  display: inline-block;
  padding: 12px 32px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #FFB060, #FF8830);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 136, 48, 0.4);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mf-start-btn:active { transform: scale(0.96); }

/* 通关结果 */
.mf-win {
  padding: 40px 24px;
  text-align: center;
}
.mf-win-icon {
  font-size: 60px;
  margin-bottom: 12px;
  animation: mfMatchPop 0.6s ease;
}
.mf-win-title {
  font-size: 22px;
  font-weight: 800;
  color: #C05E20;
  margin-bottom: 8px;
}
.mf-win-desc {
  font-size: 14px;
  color: #A06830;
  margin-bottom: 24px;
}
.mf-win-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.mf-win-btn {
  padding: 12px 32px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-width: 180px;
}
.mf-win-btn:active { transform: scale(0.96); }
.mf-win-btn.primary {
  background: linear-gradient(135deg, #FFB060, #FF8830);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 136, 48, 0.4);
}
.mf-win-btn.secondary {
  background: #F0EDE8;
  color: #888;
}

/* ===== 登录门禁（未登录强制先登录，盖住整个应用） ===== */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(160deg, #FFF6E5 0%, #FFE9F0 55%, #E8F3FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-gate-panel {
  width: min(360px, 92vw);
  background: linear-gradient(180deg, #fff 0%, #FBF8F1 100%);
  border-radius: 26px;
  padding: 28px 22px 24px;
  box-shadow: 0 18px 44px rgba(74, 74, 74, 0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-gate-title { font-size: 20px; font-weight: 900; color: var(--blue-text); }
.login-gate-desc { font-size: 13px; color: var(--text-mid); }
#gateUsername,
#gatePassword {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #ffd88a;
  border-radius: 12px;
  font-size: 16px;
  box-sizing: border-box;
  text-align: center;
}
#gateUsername:focus,
#gatePassword:focus { outline: none; border-color: #ffb44a; }
.login-gate-btn { width: 100%; min-width: 0; font-size: 16px; }
.login-gate-tip { min-height: 18px; font-size: 13px; color: #d9534f; font-weight: 600; }

/* 识字/英语测试：认识时红色大勾淡入淡出动画 */
@keyframes knownCheckFade {
  0%   { opacity: 0; transform: scale(0.45); }
  18%  { opacity: 1; transform: scale(1.12); }
  35%  { opacity: 1; transform: scale(1); }
  78%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}
