/* ============================================
   幼小衔接工作台 - 设计系统
   配色来自 Ardot 设计稿
   ============================================ */

:root {
  /* 背景 */
  --bg-canvas: #FFFAF0;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;

  /* 主题色 */
  --c-yellow: #FFC857;
  --c-coral: #FF8C7A;
  --c-blue: #5BB8E8;
  --c-green: #5FCF9E;
  --c-orange: #FF9F5A;
  --c-purple: #B08BF8;

  /* 浅色背景 */
  --c-yellow-light: #FFF4D6;
  --c-coral-light: #FFE4DF;
  --c-blue-light: #E0F1FB;
  --c-green-light: #DCF6EC;
  --c-orange-light: #FFEBD9;
  --c-purple-light: #F0E8FF;

  /* 文字 */
  --text-primary: #2D2A4A;
  --text-secondary: #9A96AE;
  --text-tertiary: #6B6B8A;
  --text-white: #FFFFFF;

  /* 功能色 */
  --shadow: rgba(45, 42, 74, 0.08);
  --shadow-strong: rgba(45, 42, 74, 0.15);

  /* 尺寸 */
  --sidebar-w: 72px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-canvas);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============================================
   布局
   ============================================ */
#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* 左侧导航 */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  box-shadow: 2px 0 12px var(--shadow);
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  font-size: 28px;
  margin-bottom: 8px;
  padding: 4px;
}

.nav-btn {
  width: 60px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.nav-btn:hover { background: var(--bg-canvas); }
.nav-btn.active {
  background: var(--c-yellow-light);
  color: var(--c-orange);
}
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 700; }

/* 主内容区 */
.content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-canvas);
  padding: 0;
  scrollbar-width: thin;
}

/* 页面容器 */
.page {
  min-height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   通用组件
   ============================================ */

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 4px 16px var(--shadow);
}

/* 顶部标题栏 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.page-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 每日标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
}
.tag-daily { background: var(--c-yellow-light); color: var(--c-orange); }

/* 任务卡 */
.task-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px var(--shadow);
  transition: transform 0.15s ease;
}
.task-card:active { transform: scale(0.98); }

.task-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.task-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 胶囊按钮 */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.15s;
}
.pill-btn:active { transform: scale(0.95); }

/* 大按钮 */
.btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  transition: transform 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--c-yellow); color: var(--text-white); }
.btn-blue { background: var(--c-blue); color: var(--text-white); }
.btn-green { background: var(--c-green); color: var(--text-white); }
.btn-coral { background: var(--c-coral); color: var(--text-white); }
.btn-purple { background: var(--c-purple); color: var(--text-white); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--c-yellow);
  color: var(--c-orange);
}

/* 进度环 */
.progress-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-ring-svg { transform: rotate(-90deg); }
.progress-ring-bg { stroke: #F0ECF5; }
.progress-ring-fg { transition: stroke-dashoffset 0.5s ease; stroke-linecap: round; }
.progress-ring-text {
  position: absolute;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 10px;
  background: #F0ECF5;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* 勾选框 */
.checkbox {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2.5px solid #D8D4E0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  cursor: pointer;
}
.checkbox.checked {
  background: var(--c-green);
  border-color: var(--c-green);
}
.checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 16px;
  font-weight: 900;
}

/* ============================================
   首页
   ============================================ */
.home-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.greeting-text h2 {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
}
.greeting-text p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.home-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--c-yellow-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.home-progress {
  display: flex;
  align-items: center;
  gap: 16px;
}
.home-progress-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-progress-info h3 {
  font-size: 16px;
  font-weight: 700;
}
.home-progress-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 学科四宫格 */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.subject-card {
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s;
  min-height: 110px;
}
.subject-card:active { transform: scale(0.97); }
.subject-card .subj-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.subject-card .subj-name {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-primary);
}
.subject-card .subj-desc {
  font-size: 11px;
  color: var(--text-tertiary);
}
.subject-card .subj-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  margin-top: auto;
}

/* 奖励预览 */
.reward-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.reward-preview::-webkit-scrollbar { display: none; }
.reward-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--shadow);
}
.reward-chip .coin { font-size: 16px; }

/* ============================================
   学科详情页
   ============================================ */
.detail-banner {
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
}
.detail-banner .banner-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.detail-banner h2 { font-size: 20px; font-weight: 900; }
.detail-banner p { font-size: 12px; opacity: 0.9; margin-top: 2px; }

/* 古诗卡 */
.poem-card {
  background: var(--c-purple-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.poem-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--c-purple);
  margin-bottom: 12px;
}
.poem-author {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.poem-text {
  font-size: 16px;
  line-height: 2;
  color: var(--text-primary);
  font-weight: 500;
}

/* 单词卡 */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.word-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}
.word-emoji { font-size: 28px; }
.word-en {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-blue);
}
.word-cn {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 英语短句 */
.phrase-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 8px var(--shadow);
  border-left: 4px solid var(--c-blue);
}
.phrase-en {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.phrase-cn {
  font-size: 13px;
  color: var(--text-secondary);
}
.phrase-speak {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--c-blue-light);
  font-size: 12px;
  font-weight: 700;
  color: var(--c-blue);
}

/* ============================================
   数学 - 计算题
   ============================================ */
.math-problem {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow);
}
.math-question {
  font-size: 36px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.math-input {
  width: 100px;
  height: 60px;
  border: 3px solid var(--c-blue-light);
  border-radius: var(--radius-md);
  font-size: 32px;
  font-weight: 900;
  text-align: center;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  background: var(--c-blue-light);
  -webkit-appearance: none;
  appearance: none;
}
.math-input:focus { border-color: var(--c-blue); }
.math-options {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.math-option {
  min-width: 56px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--c-blue-light);
  font-size: 24px;
  font-weight: 900;
  color: var(--c-blue);
  transition: all 0.2s;
}
.math-option:active { transform: scale(0.95); }
.math-option.correct { background: var(--c-green); color: white; }
.math-option.wrong { background: var(--c-coral); color: white; }

.math-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.math-stat {
  text-align: center;
}
.math-stat-num {
  font-size: 24px;
  font-weight: 900;
}
.math-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* 方法提示 */
.method-hint {
  background: var(--c-yellow-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--c-orange);
  line-height: 1.6;
}

/* ============================================
   锻炼页
   ============================================ */
.exercise-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 16px var(--shadow);
}
.exercise-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.exercise-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.exercise-name { font-size: 17px; font-weight: 700; }
.exercise-target { font-size: 12px; color: var(--text-secondary); }

.plank-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 16px 0;
}
.plank-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #E8E4F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.3s;
}
.plank-dot.active {
  border-color: var(--c-orange);
  background: var(--c-orange-light);
  color: var(--c-orange);
}
.plank-dot.done {
  background: var(--c-green);
  border-color: var(--c-green);
  color: white;
}

.timer-display {
  text-align: center;
  font-size: 48px;
  font-weight: 900;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin: 12px 0;
}
.timer-display.running { color: var(--c-coral); }

.situp-counter {
  text-align: center;
  margin: 16px 0;
}
.situp-count {
  font-size: 56px;
  font-weight: 900;
  color: var(--c-green);
  font-variant-numeric: tabular-nums;
}
.situp-total { font-size: 16px; color: var(--text-secondary); }

.counter-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.counter-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  transition: transform 0.15s;
}
.counter-btn:active { transform: scale(0.9); }

/* ============================================
   游戏页
   ============================================ */
.game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 16px var(--shadow);
}
.game-banner {
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  color: white;
  margin-bottom: 16px;
}
.game-title { font-size: 20px; font-weight: 900; }
.game-desc { font-size: 12px; opacity: 0.9; margin-top: 4px; }

.pinyin-hint {
  background: var(--c-green-light);
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  color: var(--c-green);
  margin: 16px 0;
}
.game-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.game-choice {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.game-choice:active { transform: scale(0.97); }
.game-choice.correct { background: var(--c-green); color: white; border-color: var(--c-green); }
.game-choice.wrong { background: var(--c-coral); color: white; border-color: var(--c-coral); }

.game-goose {
  font-size: 60px;
  text-align: center;
  margin: 12px 0;
  animation: bounce 1s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.game-score {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 12px;
}

/* ============================================
   打卡积分页
   ============================================ */
.points-hero {
  background: linear-gradient(135deg, var(--c-yellow), var(--c-orange));
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  color: white;
}
.points-number {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
}
.points-label { font-size: 14px; opacity: 0.9; margin-top: 4px; }
.points-progress {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.points-progress .progress-bar-fill { background: white; }
.points-next {
  font-size: 12px;
  opacity: 0.9;
}

.reward-tier {
  display: flex;
  gap: 10px;
}
.reward-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
  position: relative;
}
.reward-card.unlocked { border: 2px solid var(--c-green); }
.reward-emoji { font-size: 32px; }
.reward-name { font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--text-primary); }
.reward-cost { font-size: 11px; color: var(--c-orange); margin-top: 2px; }
.reward-lock { font-size: 20px; position: absolute; top: 4px; right: 6px; }

.checkin-task {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}
.checkin-task.completed { opacity: 0.6; }
.checkin-task.completed .task-title { text-decoration: line-through; }

.task-delete {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.task-delete:active { background: var(--c-coral-light); }

/* 添加任务输入 */
.add-task-row {
  display: flex;
  gap: 8px;
}
.add-task-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E8E4F0;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
}
.add-task-input:focus { border-color: var(--c-yellow); }

/* ============================================
   Toast 提示
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   庆祝弹窗
   ============================================ */
.celebrate {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 74, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.celebrate.show { opacity: 1; pointer-events: auto; }
.celebrate-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  max-width: 280px;
  animation: popIn 0.4s ease;
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.celebrate-emoji { font-size: 56px; }
.celebrate-title { font-size: 22px; font-weight: 900; margin-top: 12px; }
.celebrate-text { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }

/* ============================================
   弹窗 Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 74, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  animation: popIn 0.3s ease;
  box-shadow: 0 8px 32px var(--shadow-strong);
}
.modal-icon { font-size: 48px; margin-bottom: 8px; }
.modal-title { font-size: 20px; font-weight: 900; color: var(--text-primary); }
.modal-desc { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }
.modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #E8E4F0;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  text-align: center;
  background: var(--bg-canvas);
  color: var(--text-primary);
  margin-top: 12px;
}
.modal-input:focus { border-color: var(--c-yellow); }

/* ============================================
   侧边栏底部
   ============================================ */
.sidebar-spacer { flex: 1; }
.nav-settings {
  margin-top: 4px;
  border-top: 1px solid #F0ECF5;
  padding-top: 12px;
  border-radius: 0;
}

/* ============================================
   宠物页
   ============================================ */
.pet-adopt-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 4px 16px var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s;
}
.pet-adopt-card:active { transform: scale(0.97); }
.pet-adopt-card.selected { border: 3px solid var(--c-yellow); }

.pet-display {
  text-align: center;
  padding: 20px;
}
.pet-emoji {
  font-size: 80px;
  transition: transform 0.3s;
  display: inline-block;
}
.pet-emoji.happy { animation: petBounce 0.6s ease; }
@keyframes petBounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.15) translateY(-8px); }
  60% { transform: scale(0.95) translateY(2px); }
}

.pet-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pet-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pet-stat-emoji { font-size: 16px; width: 24px; text-align: center; }
.pet-stat-bar {
  flex: 1;
  height: 8px;
  background: #F0ECF5;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.pet-stat-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.pet-stat-value { font-size: 12px; font-weight: 700; width: 32px; text-align: right; }
.pet-action-btns {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.pet-action-btns .btn { flex: 1; font-size: 14px; }

.pet-stage {
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

/* 3D 宠物容器 */
#pet3dContainer {
  cursor: grab;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: transparent;
}
#pet3dContainer canvas {
  display: block !important;
  margin: 0 auto !important;
}

/* ============================================
   主题设置
   ============================================ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.theme-option {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.15s;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.theme-option:active { transform: scale(0.95); }
.theme-option.selected { border-color: var(--c-yellow); box-shadow: 0 0 0 2px var(--c-yellow-light); }
.theme-option .theme-emoji { font-size: 28px; }

/* 淡色主题背景图案（角色SVG插图） */
/* 公共：所有主题背景都使用 ::after 伪元素 + fixed 定位 + 极低透明度 */
body[data-theme="melody"] #app::after,
body[data-theme="ultraman"] #app::after,
body[data-theme="kuromi"] #app::after,
body[data-theme="cinnamoroll"] #app::after,
body[data-theme="kitty"] #app::after,
body[data-theme="pompompurin"] #app::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: auto 60%;
  opacity: 0.08;
}

/* 美乐蒂 - 粉色兔子 */
body[data-theme="melody"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Cellipse cx='150' cy='170' rx='100' ry='90' fill='%23FF7EB3'/%3E%3Cellipse cx='110' cy='120' rx='55' ry='70' fill='%23FF7EB3'/%3E%3Cellipse cx='190' cy='120' rx='55' ry='70' fill='%23FF7EB3'/%3E%3Cellipse cx='110' cy='100' rx='20' ry='28' fill='%23FFDBED'/%3E%3Cellipse cx='190' cy='100' rx='20' ry='28' fill='%23FFDBED'/%3E%3Ccircle cx='110' cy='108' r='5' fill='%23333'/%3E%3Ccircle cx='190' cy='108' r='5' fill='%23333'/%3E%3Cellipse cx='150' cy='160' rx='10' ry='8' fill='%23FFD700'/%3E%3Cpath d='M150 168 Q140 185 150 190 Q160 185 150 168' fill='%23FF6B9D'/%3E%3Ccircle cx='100' cy='250' r='8' fill='%23FFDBED'/%3E%3Ccircle cx='200' cy='250' r='8' fill='%23FFDBED'/%3E%3Cpath d='M80 280 Q150 350 220 280' stroke='%23FF7EB3' stroke-width='4' fill='none'/%3E%3C/svg%3E");
}

/* 奥特曼 - 蓝色英雄 */
body[data-theme="ultraman"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Cellipse cx='150' cy='100' rx='55' ry='50' fill='%234A90D9'/%3E%3Cpolygon points='100,60 150,10 200,60' fill='%234A90D9'/%3E%3Cellipse cx='130' cy='85' rx='15' ry='18' fill='%23FFC857'/%3E%3Cellipse cx='170' cy='85' rx='15' ry='18' fill='%23FFC857'/%3E%3Ccircle cx='130' cy='85' r='4' fill='%23333'/%3E%3Ccircle cx='170' cy='85' r='4' fill='%23333'/%3E%3Crect x='120' y='150' width='60' height='100' rx='10' fill='%234A90D9'/%3E%3Crect x='60' y='170' width='25' height='80' rx='12' fill='%234A90D9'/%3E%3Crect x='215' y='170' width='25' height='80' rx='12' fill='%234A90D9'/%3E%3Crect x='180' y='260' width='20' height='90' rx='10' fill='%234A90D9'/%3E%3Crect x='100' y='260' width='20' height='90' rx='10' fill='%234A90D9'/%3E%3Ccircle cx='150' cy='130' r='10' fill='%23FFC857'/%3E%3C/svg%3E");
}

/* 库洛米 - 紫色小恶魔 */
body[data-theme="kuromi"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Ccircle cx='150' cy='170' r='90' fill='%23F5F0FA'/%3E%3Ccircle cx='150' cy='170' r='80' fill='%239B59B6'/%3E%3Cpolygon points='80,100 110,50 140,100' fill='%23333'/%3E%3Cpolygon points='160,100 190,50 220,100' fill='%23333'/%3E%3Cellipse cx='130' cy='145' rx='14' ry='16' fill='white'/%3E%3Cellipse cx='170' cy='145' rx='14' ry='16' fill='white'/%3E%3Ccircle cx='133' cy='145' r='5' fill='%23333'/%3E%3Ccircle cx='173' cy='145' r='5' fill='%23333'/%3E%3Cpath d='M140 165 Q150 175 160 165' stroke='%23333' stroke-width='3' fill='none'/%3E%3Ccircle cx='100' cy='250' r='8' fill='%23FF7EB3'/%3E%3Ccircle cx='200' cy='250' r='8' fill='%23FF7EB3'/%3E%3Cpath d='M85 295 Q150 355 215 295' stroke='%239B59B6' stroke-width='4' fill='none'/%3E%3C/svg%3E");
}

/* 玉桂狗 - 浅蓝天蓝色狗 */
body[data-theme="cinnamoroll"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Ccircle cx='150' cy='160' r='85' fill='%2387CEEB'/%3E%3Cellipse cx='120' cy='120' rx='45' ry='55' fill='%2387CEEB'/%3E%3Cellipse cx='180' cy='120' rx='45' ry='55' fill='%2387CEEB'/%3E%3Cellipse cx='130' cy='100' rx='14' ry='18' fill='white'/%3E%3Cellipse cx='170' cy='100' rx='14' ry='18' fill='white'/%3E%3Ccircle cx='132' cy='105' r='4' fill='%23333'/%3E%3Ccircle cx='172' cy='105' r='4' fill='%23333'/%3E%3Cellipse cx='150' cy='150' rx='8' ry='6' fill='%23FFB6C1'/%3E%3Ccircle cx='105' cy='240' r='7' fill='white'/%3E%3Ccircle cx='195' cy='240' r='7' fill='white'/%3E%3Cpath d='M95 280 Q150 340 205 280' stroke='%2387CEEB' stroke-width='3' fill='none'/%3E%3C/svg%3E");
}

/* Hello Kitty - 粉色猫咪 */
body[data-theme="kitty"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Cellipse cx='150' cy='170' rx='85' ry='80' fill='%23FF6B9D'/%3E%3Cpolygon points='100,110 80,50 120,100' fill='%23FF6B9D'/%3E%3Cpolygon points='200,110 220,50 180,100' fill='%23FF6B9D'/%3E%3Crect x='75' y='55' width='15' height='15' rx='5' fill='%23FFDBED'/%3E%3Crect x='210' y='55' width='15' height='15' rx='5' fill='%23FFDBED'/%3E%3Cellipse cx='130' cy='145' rx='10' ry='12' fill='white'/%3E%3Cellipse cx='170' cy='145' rx='10' ry='12' fill='white'/%3E%3Ccircle cx='132' cy='145' r='4' fill='%23333'/%3E%3Ccircle cx='172' cy='145' r='4' fill='%23333'/%3E%3Cellipse cx='150' cy='180' rx='6' ry='5' fill='%23FFD700'/%3E%3Cline x1='115' y1='200' x2='95' y2='195' stroke='%23333' stroke-width='2'/%3E%3Cline x1='115' y1='195' x2='95' y2='200' stroke='%23333' stroke-width='2'/%3E%3Cline x1='185' y1='200' x2='205' y2='195' stroke='%23333' stroke-width='2'/%3E%3Cline x1='185' y1='195' x2='205' y2='200' stroke='%23333' stroke-width='2'/%3E%3Ccircle cx='100' cy='260' r='7' fill='%23FFDBED'/%3E%3Ccircle cx='200' cy='260' r='7' fill='%23FFDBED'/%3E%3C/svg%3E");
}

/* 布丁狗 - 奶油黄狗 */
body[data-theme="pompompurin"] #app::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Ccircle cx='150' cy='160' r='90' fill='%23F4C430'/%3E%3Cellipse cx='120' cy='115' rx='45' ry='50' fill='%23F4C430'/%3E%3Cellipse cx='180' cy='115' rx='45' ry='50' fill='%23F4C430'/%3E%3Cellipse cx='130' cy='100' rx='12' ry='14' fill='white'/%3E%3Cellipse cx='170' cy='100' rx='12' ry='14' fill='white'/%3E%3Ccircle cx='132' cy='102' r='4' fill='%23333'/%3E%3Ccircle cx='172' cy='102' r='4' fill='%23333'/%3E%3Cellipse cx='150' cy='145' rx='10' ry='7' fill='%23333'/%3E%3Ccircle cx='100' cy='250' r='7' fill='%23FFFDF0'/%3E%3Ccircle cx='200' cy='250' r='7' fill='%23FFFDF0'/%3E%3Cpath d='M90 290 Q150 350 210 290' stroke='%23F4C430' stroke-width='4' fill='none'/%3E%3C/svg%3E");
}

/* ============================================
   拼音声调精准定位
   拼音整行横排，声调悬浮在元音字母正上方
   ============================================ */
.pinyin-vowel {
  display: inline-block;
  vertical-align: baseline;
  line-height: 1;
}
.pinyin-base {
  display: inline-block;
  font-size: inherit;
  line-height: 1;
  position: relative;
}
.pinyin-tone {
  position: absolute;
  bottom: 95%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5em;
  font-weight: 500;
  line-height: 1;
  color: var(--c-coral);
  text-shadow: none;
  white-space: nowrap;
  pointer-events: none;
}

/* 游戏中拼音声调颜色跟主题色匹配 */
.pinyin-hint .pinyin-tone {
  color: var(--c-green);
  bottom: 80%;
}

/* ============================================
   拼音强化训练
   ============================================ */
.pinyin-confuse-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 4px 16px var(--shadow);
}
.pinyin-confuse-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px dashed #F0ECF5;
}
.pinyin-pair-tag {
  font-size: 28px;
  font-weight: 900;
  color: var(--c-coral);
  letter-spacing: 4px;
}
.pinyin-tip-box {
  background: var(--c-yellow-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--c-orange);
  line-height: 1.7;
  margin-bottom: 12px;
}
.pinyin-rule-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 8px var(--shadow);
  border-left: 4px solid var(--c-purple);
}
.pinyin-rule-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.pinyin-rule-content {
  font-size: 14px;
  color: var(--c-purple);
  font-weight: 500;
  margin-top: 6px;
  line-height: 1.8;
}
.pinyin-rule-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.6;
}

/* 大确认按钮 */
.btn-confirm {
  width: 100%;
  padding: 20px;
  border-radius: var(--radius-lg);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  transition: all 0.2s;
}
.btn-confirm:active { transform: scale(0.97); }
.btn-confirm.done {
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================
   拼音标注 (ruby)
   ============================================ */
.poem-text-ruby {
  font-size: 16px;
  line-height: 2.8;
  color: var(--text-primary);
  font-weight: 500;
}
.poem-text-ruby ruby,
.idiom-name-ruby ruby {
  ruby-position: over;
}
.poem-text-ruby rt,
.idiom-name-ruby rt {
  font-size: 10px;
  color: var(--c-purple);
  font-weight: 500;
  font-family: 'Noto Sans SC', sans-serif;
  line-height: 1.2;
}
.idiom-name-ruby {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.idiom-name-ruby rt {
  font-size: 9px;
}

/* ============================================
   汉字详情卡
   ============================================ */
.char-detail-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 4px 16px var(--shadow);
}
.char-memory-tip {
  background: var(--c-yellow-light);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--c-orange);
  line-height: 1.5;
  margin-top: 10px;
}

/* ============================================
   绘本阅读
   ============================================ */
.book-page-card {
  background: var(--c-coral-light);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  box-shadow: 0 4px 16px var(--shadow);
}
.book-text {
  font-size: 16px;
  line-height: 2;
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
}

/* ============================================
   控笔训练
   ============================================ */
.pen-control-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 16px var(--shadow);
}
.pen-desc {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.pen-svg-area {
  background: var(--c-blue-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.pen-svg-area svg {
  display: block;
  margin: 0 auto;
}
.pen-strokes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pen-stroke-btn {
  background: var(--c-blue-light);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s;
}
.pen-stroke-btn:active { transform: scale(0.95); }

/* ============================================
   响应式 - 手机竖屏优化
   ============================================ */
@media (max-width: 380px) {
  :root { --sidebar-w: 60px; }
  .nav-btn { width: 52px; }
  .nav-icon { font-size: 18px; }
  .page { padding: 12px; gap: 12px; }
  .page-title { font-size: 20px; }
  .subject-grid { gap: 8px; }
}

/* 横屏时侧边栏可收起 */
@media (orientation: landscape) and (max-height: 500px) {
  .sidebar { width: 56px; min-width: 56px; }
  .nav-label { display: none; }
  .nav-btn { width: 48px; padding: 8px 4px; }
}
