/**
 * styles.css - 幼儿园10以内加减法互动练习
 *
 * 设计规范：
 * - 卡通手绘风格，马卡龙柔和配色
 * - 圆润造型设计
 * - 禁用高饱和红色
 * - 元素尺寸偏大，适配幼儿手指（最小触控目标 48px）
 * - 平板横屏优先，兼容鼠标操作
 */

/* ======================== CSS变量 ======================== */
:root {
  /* 马卡龙配色方案 */
  --color-bg: #FFF8F0;               /* 温暖米白背景 */
  --color-primary: #A8D8EA;           /* 柔和蓝 */
  --color-secondary: #FFD3B6;         /* 柔和橙 */
  --color-accent: #DCEDC1;            /* 柔和绿 */
  --color-pink: #FFB7B2;              /* 柔和粉 */
  --color-purple: #D5C4F7;            /* 柔和紫 */
  --color-yellow: #FFEAA7;            /* 柔和黄 */
  --color-card-bg: #FFFFFF;           /* 卡片白色 */
  --color-text: #5D5D5D;              /* 主文字深灰 */
  --color-text-light: #9B9B9B;        /* 辅助文字浅灰 */
  --color-border: #E8E0D8;            /* 边框暖灰 */

  /* 星星颜色 */
  --color-star: #FFD700;              /* 金黄色 */
  --color-star-glow: rgba(255, 215, 0, 0.3); /* 星星光晕 */
  --color-super-star: #FFB347;        /* 超级星金色 */

  /* 进度条 */
  --color-progress-bg: #FFF3CD;       /* 浅黄背景 */
  --color-progress-fill: linear-gradient(90deg, #FFD700, #FFA500); /* 金色渐变 */

  /* 角标 */
  --color-badge-bg: #FFFFFF;          /* 白底 */
  --color-badge-text: #E8875D;        /* 金字（柔和橙） */

  /* 锁定状态 */
  --color-locked: #D0D0D0;            /* 灰色 */

  /* 尺寸 */
  --nav-height: 64px;                 /* 导航栏高度 */
  --footer-height: 80px;              /* 底部栏高度 */
  --border-radius: 16px;              /* 通用圆角 */
  --border-radius-lg: 24px;           /* 大圆角 */
  --min-touch-size: 48px;             /* 最小触控目标 */

  /* 字体 */
  --font-main: -apple-system, "PingFang SC", "Microsoft YaHei",
               "Noto Sans SC", sans-serif;
  --font-size-sm: 14px;
  --font-size-md: 18px;
  --font-size-lg: 24px;
  --font-size-xl: 32px;
  --font-size-xxl: 48px;
}

/* ======================== 全局重置 ======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent; /* 去除iOS点击高亮 */
  touch-action: manipulation;               /* 禁用双击缩放 */
  user-select: none;                        /* 禁用文字选择 */
}

/* 禁用长按菜单（移动端） */
body * {
  -webkit-touch-callout: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

/* ======================== 顶部导航栏 ======================== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: var(--font-size-md);
  font-weight: 600;
  min-height: var(--min-touch-size);
  transition: background 0.2s, transform 0.15s;
}

.nav-tab:active {
  transform: scale(0.95);
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-text);
}

.tab-emoji {
  font-size: var(--font-size-lg);
}

.tab-label {
  font-size: var(--font-size-md);
}

/* 语音控制区 */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--min-touch-size);
  height: var(--min-touch-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  font-size: var(--font-size-lg);
  transition: background 0.2s, transform 0.15s;
}

.control-btn:active {
  transform: scale(0.9);
}

.icon-speaker {
  font-size: 24px;
}

/* 音量滑条 */
.volume-slider {
  width: 80px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

/* 语速按钮 */
.speed-btn {
  width: auto;
  padding: 0 12px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #fff;
}

/* ======================== 主内容区域 ======================== */
.main-content {
  padding-top: var(--nav-height);
  padding-bottom: var(--footer-height);
  min-height: 100vh;
}

/* 页面容器 */
.page-container {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.page-container.active {
  display: flex;
}

/* ======================== 订单卡片 ======================== */
.order-card {
  width: 100%;
  background: var(--color-card-bg);
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 16px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  cursor: pointer; /* 点击可重播题目 */
  transition: transform 0.15s;
}

.order-card:active {
  transform: scale(0.98);
}

.order-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-text);
}

.order-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--font-size-xl);
  min-height: 48px;
  align-items: center;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--color-yellow);
  padding: 6px 12px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-lg);
}

/* ======================== 题目 & 算式区 ======================== */
.equation-area {
  width: 100%;
  text-align: center;
  padding: 12px 0;
}

.equation-text {
  font-size: var(--font-size-xxl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 4px;
}

/* ======================== 果蔬素材区 ======================== */
.items-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 12px;
  min-height: 100px;
  width: 100%;
}

/* ======================== 减法互动区域 ======================== */
.subtraction-interactive-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 500px;
}

.basket-zone,
.removed-zone {
  background: var(--color-card-bg);
  border-radius: 12px;
  border: 3px solid var(--color-border);
  padding: 20px;
  min-height: 180px;
  transition: border-color 0.3s, background 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.basket-zone {
  border-color: #8BC34A;
  background: linear-gradient(135deg, #F1F8E9, #DCEDC8);
  border-width: 4px;
}

.removed-zone {
  border-color: #FF9800;
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  border-width: 4px;
}

.basket-zone.drag-over,
.removed-zone.drag-over {
  border-color: var(--color-star);
  background: var(--color-yellow);
  transform: scale(1.02);
}

.zone-label {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  text-align: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
}

.zone-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
}

.zone-item {
  font-size: 56px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-card-bg);
  border-radius: var(--border-radius-lg);
  border: 3px solid var(--color-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: none;
  animation: popIn 0.3s ease;
}

.zone-item:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 4px 16px var(--color-star-glow);
}

.zone-item.removed {
  opacity: 0.7;
  cursor: default;
  animation: removedPop 0.4s ease;
}

@keyframes removedPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
}

.removed-count-badge {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--font-size-xxl);
  font-weight: 700;
  padding: 16px 32px;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: countBadgePop 0.6s ease;
  pointer-events: none;
}

@keyframes countBadgePop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.item-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.item-icon {
  font-size: var(--font-size-xxl);
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-card-bg);
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: none; /* 关键：允许拖拽 */
}

.item-icon:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 4px 16px var(--color-star-glow);
}

/* 静态元素不设 will-change，避免过多 GPU 合成层消耗平板内存 */
.item-icon,
.number-btn,
.encourage-overlay,
.helper-popup,
.basket-area,
.progress-fill {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 锁定状态 */
.item-icon.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

/* 数量角标 */
.item-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  font-size: var(--font-size-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-badge-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ======================== 购物篮（加法页专用） ======================== */
.basket-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--color-accent);
  border-radius: var(--border-radius-lg);
  min-height: 64px;
  width: 100%;
  max-width: 400px;
  justify-content: center;
  flex-wrap: wrap;
  border: 2px dashed #B8D4A3;
}

.basket-icon {
  font-size: var(--font-size-xxl);
  display: none; /* 隐藏篮子图标 */
}

.basket-count {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  display: none; /* 隐藏默认数字显示 */
}

/* ======================== 计算进度按钮 ======================== */
.calc-progress-btn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.2s, box-shadow 0.2s;
}

.calc-progress-btn:active {
  transform: scale(0.9);
}

.calc-icon {
  font-size: 24px;
}

.calc-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--color-badge-text);
  border-radius: 10px;
  padding: 1px 6px;
  margin-top: 2px;
  min-width: 30px;
  text-align: center;
}

/* 计算进度弹窗 */
.calc-popup {
  position: fixed;
  bottom: 170px;
  right: 20px;
  background: #fff;
  border-radius: var(--border-radius-lg);
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 51;
  min-width: 120px;
  text-align: center;
  animation: popIn 0.3s ease;
}

.calc-popup-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}

.calc-popup-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-top: 4px;
}

/* ======================== 数字选择区 ======================== */
.number-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  padding: 8px 0;
}

.number-btn {
  width: 100%;
  aspect-ratio: 1;
  min-height: var(--min-touch-size);
  border-radius: var(--border-radius);
  background: var(--color-card-bg);
  border: 2px solid var(--color-border);
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.number-btn:active {
  transform: scale(0.92);
  background: var(--color-yellow);
  border-color: var(--color-star);
}

.number-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.number-btn.selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ======================== 底部星星栏和进度条 ======================== */
.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: linear-gradient(135deg, #FFF9F0, #FFF3E0);
  border-top: 2px solid var(--color-border);
  z-index: 100;
}

/* 进度条区域 */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  max-width: 320px;
}

.progress-label {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  font-weight: 700;
  background: rgba(255, 234, 167, 0.6);
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-block;
}

.progress-bar {
  width: 100%;
  height: 18px;
  background: var(--color-progress-bg);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
  background-size: 200% 100%;
  border-radius: 9px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 0;
  position: relative;
}

/* 进度条满时闪光效果 */
.progress-fill.full {
  animation: progressGlow 1.2s ease infinite;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

@keyframes progressGlow {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.9), 0 0 48px rgba(255, 165, 0, 0.4);
  }
}

/* 星星区域 */
.stars-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.star-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.star-icon {
  font-size: 32px;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

.star-icon.super-star {
  font-size: 56px;
  position: relative;
  z-index: 1;
}

/* 超级星星彩虹渐变外圈光晕 */
.star-group.super {
  position: relative;
}

.star-group.super::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(#FF6B6B, #FFD93D, #6BCB77, #4D96FF, #9B59B6, #FF6B6B);
  opacity: 0.35;
  animation: superStarBreath 2s ease infinite;
  z-index: 0;
}

@keyframes superStarBreath {
  0%, 100% {
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.8), 0 0 30px rgba(100, 200, 255, 0.4);
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.star-count {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  min-width: 24px;
  text-align: center;
}

/* ======================== 响应式设计 ======================== */

/* 平板横屏优先（768px - 1024px） */
@media (min-width: 768px) {
  .main-content {
    padding-left: 40px;
    padding-right: 40px;
  }

  .page-container {
    gap: 20px;
    padding: 24px;
  }

  .order-card {
    padding: 20px 28px;
  }

  .equation-text {
    font-size: 56px;
  }

  .item-icon {
    width: 88px;
    height: 88px;
    font-size: 52px;
  }

  .number-pad {
    max-width: 480px;
    gap: 14px;
  }

  .number-btn {
    font-size: var(--font-size-xxl);
  }

  .basket-area {
    max-width: 460px;
    padding: 20px 32px;
  }
}

/* 桌面端（> 1024px） */
@media (min-width: 1024px) {
  .nav-bar {
    padding: 0 40px;
  }

  .main-content {
    padding-left: 80px;
    padding-right: 80px;
  }

  .page-container {
    max-width: 900px;
  }

  .footer-bar {
    padding: 8px 40px;
  }
}

/* 小屏竖屏适配（< 600px，如手机竖屏） */
@media (max-width: 599px) {
  :root {
    --nav-height: 56px;
    --footer-height: 72px;
    --font-size-xxl: 40px;
  }

  .nav-tab {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
  }

  .tab-label {
    display: none; /* 小屏只显示emoji */
  }

  .volume-slider {
    width: 60px;
  }

  .page-container {
    padding: 12px;
    gap: 12px;
  }

  .item-icon {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }

  .number-pad {
    gap: 8px;
  }

  .equation-text {
    font-size: var(--font-size-xxl);
  }

  /* 竖屏时计算进度按钮上移，避免遮挡数字按钮 */
  .calc-progress-btn {
    bottom: 170px;
    width: 48px;
    height: 48px;
  }

  .calc-icon {
    font-size: 20px;
  }

  .calc-badge {
    font-size: 10px;
  }

  .calc-popup {
    bottom: 230px;
    right: 12px;
    padding: 12px 16px;
    min-width: 100px;
  }
}

/* ======================== 工具类 ======================== */
.hidden {
  display: none !important;
}

/* 拖拽时的幽灵样式 */
.dragging {
  opacity: 0.6;
  transform: scale(1.2);
  box-shadow: 0 8px 24px var(--color-star-glow);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 拖拽幽灵元素（跟随手指/鼠标的素材副本） */
.drag-ghost {
  position: fixed;
  font-size: 48px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%) scale(1.2);
  filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.5));
  transition: none;
  will-change: left, top;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 拖拽幽灵飞入购物篮动画 */
.drag-ghost.fly-to-basket {
  transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.4s ease;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0.6;
}

/* 购物篮内素材图标容器 */
.basket-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  min-height: 0;
  max-width: 180px;
}

/* 购物篮内单个素材图标 */
.basket-item-icon {
  font-size: 36px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: basketItemPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: scale(0);
  opacity: 0;
}

@keyframes basketItemPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* 闪烁动画 */
@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.flash {
  animation: flash 0.3s ease 3;
}

/* 弹入动画 */
@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.pop-in {
  animation: popIn 0.3s ease forwards;
}

/* 淡出动画 */
@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.9); }
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

/* ======================== 鼓励弹窗 ======================== */
.encourage-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.encourage-card {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius-lg);
  padding: 24px 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 3px solid var(--color-yellow);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 300px;
}

.encourage-face {
  font-size: 56px;
  margin-bottom: 8px;
  animation: animSway 0.8s ease 3;
}

.encourage-text {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
}

/* ======================== 小助手弹出（连续第3次答错） ======================== */
.helper-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5) translateY(30px);
  z-index: 1002;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 360px;
  width: 90%;
  pointer-events: none;
  opacity: 0;
}

.helper-popup.show {
  animation: animHelperSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.helper-popup.hide {
  animation: animHelperSlideOut 0.4s ease-in forwards;
}

/* 小助手人物 */
.helper-character {
  flex-shrink: 0;
}

.helper-avatar {
  font-size: 64px;
  animation: animHelperWave 0.8s ease infinite;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 小助手气泡 */
.helper-bubble {
  background: rgba(255, 255, 255, 0.97);
  border-radius: var(--border-radius-lg);
  padding: 16px 20px;
  border: 3px solid var(--color-primary);
  box-shadow: 0 8px 32px rgba(168, 216, 234, 0.4);
  animation: animBubblePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.helper-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.helper-text {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.helper-guide {
  font-size: var(--font-size-md);
  color: #E8875D;
  font-weight: 600;
  padding: 8px 12px;
  background: var(--color-yellow);
  border-radius: var(--border-radius);
  line-height: 1.5;
}

/* 算式区高亮提示 */
.helper-highlight {
  animation: animHelperHighlight 1s ease infinite;
  border-radius: var(--border-radius);
}

/* ======================== 重置菜单 ======================== */
.icon-reset {
  font-size: 20px;
}

.reset-menu {
  position: fixed;
  top: calc(var(--nav-height) + 4px);
  right: 16px;
  background: var(--color-card-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--color-border);
  padding: 8px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  animation: popIn 0.2s ease;
}

.reset-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text);
  transition: background 0.15s, transform 0.1s;
  min-height: var(--min-touch-size);
}

.reset-menu-item:active {
  transform: scale(0.96);
}

.reset-menu-item:hover {
  background: var(--color-progress-bg);
}

.reset-menu-item.danger {
  color: #E8875D;
}

.reset-menu-item.danger:hover {
  background: #FFF0E6;
}

.reset-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.reset-label {
  white-space: nowrap;
}

/* ======================== 二次确认弹窗 ======================== */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.confirm-dialog {
  background: var(--color-card-bg);
  border-radius: var(--border-radius-lg);
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 3px solid var(--color-secondary);
  max-width: 340px;
  width: 90%;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-face {
  font-size: 56px;
  margin-bottom: 8px;
}

.confirm-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.confirm-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-md);
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  border: 2px solid var(--color-border);
  min-height: var(--min-touch-size);
  min-width: 100px;
  transition: transform 0.12s, background 0.15s;
}

.confirm-btn:active {
  transform: scale(0.95);
}

.confirm-btn.cancel {
  background: var(--color-card-bg);
  color: var(--color-text);
}

.confirm-btn.cancel:hover {
  background: var(--color-progress-bg);
}

.confirm-btn.ok {
  background: #E8875D;
  color: #fff;
  border-color: #E8875D;
}

.confirm-btn.ok:hover {
  background: #D4764E;
}
