/* ===== 全局变量 ===== */
:root {
  --primary: #6c5ce7;
  --primary-light: #a29bfe;
  --primary-dark: #5649e0;
  --accent: #fd79a8;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --info: #0984e3;
  --bg: #f0f0f5;
  --card-bg: #ffffff;
  --text: #2d3436;
  --text-light: #636e72;
  --text-muted: #b2bec3;
  --border: #dfe6e9;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 导航栏 ===== */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(108, 92, 231, 0.3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.navbar-brand .logo { font-size: 28px; }

.navbar-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-item {
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-item:hover { background: rgba(255,255,255,0.2); }
.nav-item.active { background: rgba(255,255,255,0.3); font-weight: 600; }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-badge {
  background: linear-gradient(135deg, var(--warning), #f39c12);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(252, 203, 110, 0.4);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,0.25); }
.user-chip .avatar { font-size: 24px; }
.user-chip .name { font-size: 14px; font-weight: 500; }
.user-chip .unbind-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
}
.user-chip .unbind-btn:hover {
  opacity: 1;
  background: rgba(255,80,80,0.25);
}

/* ===== 页面容器 ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 18px; font-weight: 600; }

/* ===== 网格布局 ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ===== 打卡日历格子 ===== */
.checkin-day {
  width: min(48px, 10vw);
  height: min(48px, 10vw);
  border-radius: 50%;
  margin: 8px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  /* --- 导航栏：两行布局，第一行品牌+用户，第二行导航横向滚动 --- */
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px 0;
  }
  .navbar-brand {
    font-size: 17px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .navbar-brand .logo { font-size: 22px; }
  .navbar-right {
    gap: 8px;
    margin-left: auto;
  }
  .points-badge { padding: 4px 10px; font-size: 13px; }
  .user-chip { padding: 3px 10px 3px 4px; }
  .user-chip .avatar { font-size: 20px; }
  .user-chip .name { font-size: 13px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .navbar-nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0 8px;
    margin-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.18);
    scrollbar-width: none;
  }
  .navbar-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    padding: 6px 12px;
    font-size: 13px;
    flex: 0 0 auto;
  }

  /* --- 页面容器与标题 --- */
  .page-container { padding: 16px 14px 24px; }
  .page-title { font-size: 20px; margin-bottom: 14px; }

  /* --- 卡片 --- */
  .card { padding: 16px; }
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* --- 网格：3/4列 → 2列，避免单列卡片过长 --- */
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }

  /* --- 统计卡紧凑化 --- */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }
  .stat-info .value { font-size: 22px; }

  /* --- 表格：整行横向滚动，表头不再竖排折行 --- */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* --- 任务卡片 --- */
  .task-card { flex-wrap: wrap; }
  .task-meta { flex-wrap: wrap; }

  /* --- 学习页 --- */
  .learn-header { flex-wrap: wrap; }
  .learn-info-bar { flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
  .math-question-card { padding: 28px 18px; }
  .math-question-text { font-size: 34px; }
  .math-option { font-size: 18px; padding: 14px; }
  .result-actions { flex-wrap: wrap; }
  .result-score { font-size: 56px; }

  /* --- 宠物 --- */
  .pet-container { padding: 24px 14px; }
  .pet-avatar { font-size: 80px; }
  .pet-speech-bubble { max-width: 230px; font-size: 13px; }

  /* --- Toast 避开双行导航 --- */
  .toast-container { top: 112px; right: 12px; }
}

@media (max-width: 400px) {
  .grid-2 { grid-template-columns: 1fr; }
  .math-question-text { font-size: 30px; }
}

/* ===== 统计卡片 ===== */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

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

.stat-info .label { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.stat-info .value { font-size: 28px; font-weight: 700; }
.stat-info .sub { font-size: 12px; color: var(--text-muted); }

/* ===== 按钮 ===== */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(108,92,231,0.3); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }

.btn-warning { background: var(--warning); color: white; }

.btn-danger { background: var(--danger); color: white; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 进度条 ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.tag-math { background: #ffeaa7; color: #d4a017; }
.tag-chinese { background: #fab1a0; color: #c0392b; }
.tag-english { background: #a29bfe; color: white; }
.tag-science { background: #55efc4; color: #00896b; }
.tag-easy { background: #dfe6e9; color: #636e72; }
.tag-medium { background: #ffeaa7; color: #d4a017; }
.tag-hard { background: #fab1a0; color: #c0392b; }
.tag-default { background: var(--bg); color: var(--text-light); }

/* ===== 任务卡片 ===== */
.task-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}
.task-card:hover { transform: translateX(4px); box-shadow: var(--shadow-lg); }
.task-card.completed { opacity: 0.6; border-left-color: var(--success); }
.task-card.completed .task-title { text-decoration: line-through; }

.task-title { font-weight: 600; font-size: 15px; }
.task-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

/* ===== 宠物展示 ===== */
.pet-container {
  background: linear-gradient(135deg, #a8e6cf, #dcedc1);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pet-avatar {
  font-size: 100px;
  display: inline-block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

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

.pet-name {
  font-size: 24px;
  font-weight: 700;
  margin-top: 12px;
}

.pet-level-badge {
  background: var(--warning);
  color: white;
  padding: 4px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  display: inline-block;
  margin-top: 8px;
}

.pet-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pet-stat {
  text-align: center;
  min-width: 80px;
}
.pet-stat .stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.pet-stat .stat-bar {
  width: 80px;
  height: 8px;
  background: rgba(255,255,255,0.5);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px auto;
}
.pet-stat .stat-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.pet-stat .stat-value { font-size: 16px; font-weight: 700; }

/* ===== 商店道具卡片 ===== */
.item-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.item-icon { font-size: 48px; margin-bottom: 8px; }
.item-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.item-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; min-height: 32px; }
.item-price {
  background: var(--warning);
  color: white;
  padding: 4px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
}

/* ===== 成就卡片 ===== */
.achievement-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 2px solid transparent;
}
.achievement-card.unlocked {
  border-color: var(--warning);
  background: linear-gradient(135deg, #fffaef, #fff);
}
.achievement-card.locked { opacity: 0.6; }
.ach-icon { font-size: 48px; margin-bottom: 8px; }
.ach-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.ach-desc { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text-light); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.form-textarea { min-height: 120px; resize: vertical; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  font-size: 56px;
  margin-bottom: 8px;
}

.login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  color: var(--text-light);
}
.login-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow);
}

.quick-login {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}
.quick-login-title { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; text-align: center; }
.quick-login-btns { display: flex; gap: 12px; }
.quick-login-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.quick-login-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 图表 ===== */
.chart-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
  position: relative;
}
.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 70%;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
  position: relative;
}
.bar-value {
  position: absolute;
  top: -20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  left: 50%;
  transform: translateX(-50%);
}
.bar-label { font-size: 11px; color: var(--text-muted); }

/* 环形图 */
.donut-chart {
  display: flex;
  align-items: center;
  gap: 24px;
}
.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-center {
  width: 100px;
  height: 100px;
  background: white;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

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

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 350px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ===== 撒花动画 ===== */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall 3s ease-out forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== 列表 ===== */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg); }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 64px; margin-bottom: 12px; }
.empty-state .text { font-size: 16px; }

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table tr:hover { background: var(--bg); }

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== btn-info ===== */
.btn-info { background: var(--info); color: white; }
.btn-info:hover { filter: brightness(1.1); }

/* ===== 宠物互动增强 ===== */
.pet-avatar-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s ease;
}
.pet-avatar-wrap:hover { transform: scale(1.05); }
.pet-avatar-wrap:active { transform: scale(0.95); }

.pet-click-hint {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  pointer-events: none;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.pet-mood-face {
  position: absolute;
  top: 10px;
  right: -10px;
  font-size: 36px;
  background: white;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
}

.pet-mood-text {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
}

.pet-decorations {
  position: absolute;
  top: 0;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.pet-stage-sad { background: linear-gradient(135deg, #ddd, #eee) !important; }
.pet-stage-lonely { background: linear-gradient(135deg, #c7c7d0, #e0e0e8) !important; }
.pet-stage-excited { background: linear-gradient(135deg, #ffd3a5, #fd9858) !important; }
.pet-stage-happy { background: linear-gradient(135deg, #a8e6cf, #dcedc1) !important; }

/* 宠物信息行 */
.pet-info-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pet-personality-badge {
  background: var(--info);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== 对话气泡 ===== */
.pet-speech-bubble {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 10px 18px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 20;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pet-speech-bubble .speech-text { position: relative; z-index: 1; }
.pet-speech-bubble .speech-tail {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid white;
}
.speech-pop-in { animation: speechPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.speech-fade-out { animation: speechFade 0.5s ease forwards; }
@keyframes speechPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.8); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes speechFade {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ===== 需求提示 ===== */
.pet-wants {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 15;
}
.want-badge {
  background: rgba(255,255,255,0.92);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: wantBounce 2s ease-in-out infinite;
}
.want-hungry { color: #e17055; }
.want-lonely { color: #6c5ce7; }
.want-sick { color: #d63031; }
.want-bored { color: #0984e3; }
@keyframes wantBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ===== 情绪粒子 ===== */
.pet-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}
.emotion-particle {
  position: absolute;
  animation: particleFloat var(--duration, 2s) ease-out var(--delay, 0s) forwards;
}
@keyframes particleFloat {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-30px) translateX(var(--drift, 0)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) translateX(var(--drift, 0)) scale(0.8);
  }
}

/* ===== 闲置动画 ===== */
.pet-idle { animation: idleBreathe 3s ease-in-out infinite; }
@keyframes idleBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}

.idle-look { animation: idleLook 2s ease-in-out !important; }
@keyframes idleLook {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-8px) rotate(-5deg); }
  75% { transform: translateX(8px) rotate(5deg); }
}

.idle-stretch { animation: idleStretch 2s ease !important; }
@keyframes idleStretch {
  0%, 100% { transform: scale(1, 1); }
  30% { transform: scale(1.15, 0.85); }
  60% { transform: scale(0.95, 1.1); }
}

/* ===== 互动动画 ===== */
.anim-bounce { animation: petBounce 0.6s ease !important; }
.anim-wiggle { animation: petWiggle 0.5s ease !important; }
.anim-spin { animation: petSpin 0.8s ease !important; }
.anim-glow { animation: petGlow 0.8s ease !important; }
.anim-shake { animation: petShake 0.5s ease !important; }
@keyframes petBounce { 0%,100%{transform:translateY(0);} 30%{transform:translateY(-30px);} 60%{transform:translateY(-10px);} }
@keyframes petWiggle { 0%,100%{transform:rotate(0);} 25%{transform:rotate(-10deg);} 75%{transform:rotate(10deg);} }
@keyframes petSpin { 0%{transform:rotate(0);} 100%{transform:rotate(360deg);} }
@keyframes petGlow { 0%,100%{filter:brightness(1);} 50%{filter:brightness(1.5) drop-shadow(0 0 20px gold);} }
@keyframes petShake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-8px);} 75%{transform:translateX(8px);} }

/* ===== 升级动画 ===== */
.levelup-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); animation: fadeIn 0.3s;
}
.levelup-overlay.fade-out { animation: fadeOut 0.5s forwards; }
.levelup-content { text-align: center; animation: popIn 0.5s; }
.levelup-emoji { font-size: 80px; margin-bottom: 16px; }
.levelup-title {
  font-size: 36px; font-weight: 900; color: #fdcb6e;
  text-shadow: 0 0 20px rgba(252,203,110,0.5);
}
.levelup-level { font-size: 24px; color: white; margin-top: 8px; }
.levelup-subtitle { color: #b2bec3; margin-top: 8px; }
@keyframes popIn { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes floatUp { 0% { transform: translateY(0); opacity:1; } 100% { transform: translateY(-80px); opacity:0; } }

/* 道具背包卡片 */
.item-section { margin-bottom: 16px; }
.item-section-title { font-size: 14px; font-weight: 600; color: var(--text-light); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px dashed var(--border); }

.inv-item-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  transition: var(--transition);
}
.inv-item-card:hover { background: #e8e8f0; transform: translateY(-2px); }
.inv-icon { font-size: 32px; margin-bottom: 4px; }
.inv-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.inv-qty { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }

/* 任务类型徽章 */
.task-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}
.task-type-badge.type-math { background: #74b9ff; color: white; }
.task-type-badge.type-reading { background: #a29bfe; color: white; }

/* ===== 学习页面通用 ===== */
.learn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.learn-timer {
  background: var(--card-bg);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  box-shadow: var(--shadow);
}

.learn-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.learn-progress-info { font-size: 15px; font-weight: 600; }
.learn-current-num, .learn-correct-num { color: var(--primary); font-size: 20px; font-weight: 700; }

.learn-progress-bar { margin-bottom: 20px; }
.learn-progress-bar .progress-bar { height: 12px; }
.learn-progress-bar .progress-fill { transition: width 0.4s ease; }

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

/* ===== 口算答题页 ===== */
.math-quiz-container {
  max-width: 600px;
  margin: 0 auto;
}

.math-question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.math-question-card.flash-correct {
  animation: flashGreen 0.5s;
}
.math-question-card.flash-wrong {
  animation: flashRed 0.5s;
}
@keyframes flashGreen { 0%,100%{background:white;} 50%{background:#c8f7dc;} }
@keyframes flashRed { 0%,100%{background:white;} 50%{background:#fab1a0;} }

.math-question-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.math-question-text {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 32px;
  font-family: 'Georgia', serif;
}

.math-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.math-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.math-option:hover {
  border-color: var(--primary);
  background: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.math-option.correct {
  background: #c8f7dc;
  border-color: var(--success);
  color: var(--success);
}

.math-option.wrong {
  background: #fab1a0;
  border-color: var(--danger);
  color: var(--danger);
}

.math-option:disabled { cursor: default; }

.math-option-letter {
  background: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.math-option.correct .math-option-letter { background: var(--success); }
.math-option.wrong .math-option-letter { background: var(--danger); }

/* ===== 点读页 ===== */
.reading-instruction {
  text-align: center;
  padding: 12px 20px;
  background: #e8f4fd;
  border-radius: var(--radius-sm);
  color: var(--info);
  font-size: 14px;
  margin-bottom: 20px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.character-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 3px solid transparent;
}

.character-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.character-card.read {
  border-color: var(--success);
  background: linear-gradient(135deg, #f0fff4, #fff);
}

.char-pinyin {
  font-size: 16px;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 8px;
}

.char-main {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.char-meaning {
  font-size: 14px;
  color: var(--text-muted);
}

.char-read-icon {
  font-size: 20px;
  margin-top: 8px;
}

.char-read-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 20px;
  color: var(--success);
}

/* 英语单词卡片 */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.word-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 3px solid transparent;
}

.word-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.word-card.read {
  border-color: var(--success);
  background: linear-gradient(135deg, #f0fff4, #fff);
}

.word-phonetic {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
}

.word-main {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
  font-family: 'Georgia', serif;
}

.word-meaning {
  font-size: 16px;
  color: var(--text-light);
}

.word-read-icon, .word-read-badge {
  margin-top: 8px;
  font-size: 20px;
}

.word-read-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--success);
}

/* 课文朗读 */
.text-reading-container {
  max-width: 700px;
  margin: 0 auto;
}

.text-reading-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.reading-line {
  font-size: 24px;
  font-weight: 600;
  line-height: 2;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 8px;
  border-radius: 8px;
}

.reading-line:hover { background: var(--bg); }
.reading-line.reading-highlight { background: #ffeaa7; }

/* 朗读操作区 */
.reading-actions {
  max-width: 400px;
  margin: 24px auto 0;
}

.reading-actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.pulse {
  animation: btnPulse 1.5s infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(0, 184, 148, 0); }
}

/* ===== 学习结果页 ===== */
.learn-result {
  text-align: center;
  padding: 40px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.learn-result.passed .result-title { color: var(--success); }
.learn-result.failed .result-title { color: var(--danger); }

.result-emoji {
  font-size: 80px;
  margin-bottom: 16px;
  animation: popIn 0.5s;
}

.result-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
}

.result-score {
  font-size: 72px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.result-score-unit {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-light);
}

.result-detail {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.result-bonus {
  display: inline-block;
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}

.result-points {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-message {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.result-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.result-stat-item {
  text-align: center;
  min-width: 80px;
}

.result-stat-icon { font-size: 28px; margin-bottom: 4px; }
.result-stat-value { font-size: 20px; font-weight: 700; color: var(--text); }
.result-stat-label { font-size: 12px; color: var(--text-muted); }

/* ===== 商店道具类型标签 ===== */
.item-type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-light);
  margin-bottom: 8px;
}

/* ===== 浮动数字动画（备用） ===== */
.floating-number {
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
