/* ========================================
   豆苗AI - 专注力训练平台
   主样式表 - 与总站设计体系统一
   ======================================== */

/* === CSS Variables - 绿蓝渐变体系 === */
:root {
  /* Primary Colors - Green-Blue Gradient */
  --color-primary: #22c55e;
  --color-primary-light: #4ade80;
  --color-primary-dark: #16a34a;
  --color-secondary: #3b82f6;
  --color-secondary-light: #60a5fa;
  --color-secondary-dark: #2563eb;
  
  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #22c55e 0%, #3b82f6 100%);
  --gradient-primary-hover: linear-gradient(135deg, #16a34a 0%, #2563eb 100%);
  
  /* Background & Surface */
  --color-bg: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-card: #ffffff;
  --color-card-hover: #f8fafc;
  
  /* Text */
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  
  /* Border */
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  
  /* Status Colors */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  --color-star: #fbbf24;
  
  /* Game Accent Colors (for game internals) */
  --game-orange: #FF8C42;
  --game-blue: #5BB5F0;
  --game-green: #6BCB77;
  --game-purple: #A78BFA;
  --game-pink: #F472B6;
  --game-yellow: #FCD34D;

  /* Accent Background Colors (for active/matched states) */
  --color-accent-bg: #FFF3EB;
  --color-matched-bg: #F0FFF2;
  --color-track-bg: #F0E8E0;
  --color-empty-star: #E0D8D0;
  --color-empty-star-alt: #E0E0E0;
  --color-surface-white: #ffffff;

  /* Legacy color aliases (used by game components) */
  --color-orange: #FF8C42;
  --color-orange-light: #FFB07A;
  --color-green: #6BCB77;
  --color-green-dark: #4CAF50;
  --color-blue: #5BB5F0;
  --color-blue-dark: #3A9BD9;
  --color-red: #FF6B6B;
  --color-yellow: #FFD93D;
  --color-purple: #A78BFA;

  /* Typography - System Chinese Font Stack */
  --font-cn: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-num: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease-smooth);
  --transition-normal: 250ms var(--ease-smooth);
}

/* === Dark Mode === */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-card: #1e293b;
  --color-card-hover: #334155;
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-border: #334155;
  --color-border-light: #1e293b;
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);

  /* Dark mode accent backgrounds */
  --color-accent-bg: #3d2a1a;
  --color-matched-bg: #1a3d2a;
  --color-track-bg: #334155;
  --color-empty-star: #475569;
  --color-empty-star-alt: #475569;
  --color-surface-white: #1e293b;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-cn);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* === App Container === */
#app {
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--color-bg);
}

/* Desktop: center content with reasonable max-width */
@media (min-width: 769px) {
  #app {
    max-width: 960px;
    background: var(--color-bg);
  }
}

/* === Views === */
.view {
  display: none;
  min-height: 100vh;
  padding: var(--space-md);
  animation: fadeIn 0.3s var(--ease-smooth);
}

.view.active {
  display: flex;
  flex-direction: column;
}

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

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

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

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

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

@keyframes spin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}

@keyframes starPop {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(180deg); opacity: 1; }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* === Home Header === */
.home-header {
  text-align: center;
  background: var(--gradient-primary);
  padding: var(--space-lg) var(--space-md);
}

.home-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: var(--space-sm);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

/* === Home Slogan === */
.header-slogan {
  text-align: center;
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

[data-theme="dark"] .home-header {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .header-slogan {
  color: var(--color-text-secondary);
}

/* === Game Cards === */
/* ===== 游戏分类区块 ===== */
.category-section {
  margin-bottom: var(--space-xl);
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-primary);
}

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

.category-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.category-ability {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
}

.game-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 1;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary);
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--gradient-primary);
}

.game-card:active {
  transform: scale(0.97);
}

.game-card-icon {
  font-size: 40px;
  margin-bottom: var(--space-sm);
}

.game-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.game-card-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.game-card-best {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
}

/* === Stats Panel === */
.stats-panel {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  margin: var(--space-md);
  border: 1px solid var(--color-border);
}

.stats-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  text-align: center;
}

.stat-item {
  padding: var(--space-sm);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

/* === Settings Bar === */
.settings-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-top: auto;
}

.setting-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-md);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-cn);
}

.setting-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.setting-btn:active {
  transform: scale(0.97);
}

.setting-btn.active {
  border-color: var(--color-orange);
  background: var(--color-accent-bg);
}

.setting-btn .icon {
  font-size: 20px;
}

/* === Game View Common === */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  font-size: 16px;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-cn);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.back-btn:active {
  background: rgba(0,0,0,0.05);
}

.game-title {
  font-size: 20px;
  font-weight: 700;
}

.game-info-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.info-item {
  text-align: center;
}

.info-label {
  font-size: 12px;
  color: var(--color-text-light);
}

.info-value {
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-orange);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-cn);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 40px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-card-hover);
  border-color: var(--color-primary);
}

.btn-outline {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-blue {
  background: var(--color-blue);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-blue:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-md);
}

.btn-green {
  background: var(--color-green);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-green:hover {
  background: var(--color-green-dark);
  box-shadow: var(--shadow-md);
}

.btn-large {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: 16px;
  min-height: 48px;
}

.btn-small {
  padding: var(--space-xs) var(--space-md);
  font-size: 13px;
  min-height: 32px;
}

/* === Schulte Grid === */
.schulte-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.schulte-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: var(--space-md) 0;
  flex: 1;
  width: 100%;
  max-width: 500px;
  overflow-y: auto;
}

.schulte-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s var(--ease-bounce);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  user-select: none;
  -webkit-user-select: none;
  border: 2px solid transparent;
}

.schulte-cell:active {
  transform: scale(0.92);
}

.schulte-cell.correct {
  background: var(--color-green);
  color: white;
  border-color: var(--color-green-dark);
  animation: bounceIn 0.3s var(--ease-bounce);
}

.schulte-cell.wrong {
  animation: shake 0.3s ease;
  border-color: var(--color-error);
}

.schulte-cell.next-hint {
  border-color: var(--color-orange-light);
}

#schulte-game-area {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.schulte-next {
  text-align: center;
  padding: var(--space-md);
  font-size: 18px;
  font-weight: 600;
}

.schulte-next span {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 900;
  color: var(--color-orange);
}

/* === Memory Game === */
.memory-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#memory-game-area {
  width: 100%;
}

/* All game area wrappers need full width inside centered flex containers */
[id$="-game-area"] {
  width: 100%;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: var(--space-md) 0;
  flex: 1;
}

.memory-card {
  aspect-ratio: 1;
  perspective: 600px;
  cursor: pointer;
}

.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s var(--ease-bounce);
  transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.memory-card-front {
  background: linear-gradient(135deg, var(--color-blue), var(--color-blue-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(91, 181, 240, 0.3);
}

.memory-card-front::after {
  content: '?';
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 800;
}

.memory-card-back {
  background: var(--color-card);
  transform: rotateY(180deg);
  box-shadow: var(--shadow-card);
  border: 2px solid #F0E8E0;
}

.memory-card.matched .memory-card-back {
  border-color: var(--color-green);
  background: var(--color-matched-bg);
}

.memory-card.matched {
  animation: pulse 0.5s var(--ease-bounce);
}

/* === Stroop Game === */
.stroop-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-md);
  padding-top: var(--space-md);
}

.stroop-word {
  font-size: 56px;
  font-weight: 900;
  text-align: center;
  padding: var(--space-xl);
  margin: var(--space-lg) 0;
  font-family: var(--font-cn);
  transition: all 0.2s var(--ease-bounce);
}

.stroop-word.animate {
  animation: bounceIn 0.3s var(--ease-bounce);
}

.stroop-hint {
  text-align: center;
  font-size: 16px;
  color: var(--color-text-light);
  margin-bottom: var(--space-lg);
}

.stroop-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  width: 100%;
}

.stroop-btn {
  padding: var(--space-lg);
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-cn);
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.stroop-btn.correct {
  animation: bounceIn 0.3s var(--ease-bounce);
  border-color: var(--color-success);
  box-shadow: 0 0 20px rgba(107, 203, 119, 0.4);
}

.stroop-btn.wrong {
  animation: shake 0.3s ease;
  border-color: var(--color-error);
}

.stroop-score-bar {
  display: flex;
  justify-content: space-around;
  width: 100%;
  padding: var(--space-md);
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.stroop-timer {
  width: 100%;
  height: 8px;
  background: var(--color-track-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.stroop-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-orange), var(--color-green));
  border-radius: 4px;
  transition: width 1s linear;
}

/* === Result Modal === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 0.3s var(--ease-smooth);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: bounceIn 0.5s var(--ease-bounce);
}

.modal-icon {
  font-size: 64px;
  margin-bottom: var(--space-md);
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.modal-stars {
  font-size: 36px;
  margin: var(--space-md) 0;
}

.modal-stars .star {
  display: inline-block;
  margin: 0 4px;
}

.modal-stars .star.filled {
  color: var(--color-star);
  animation: starPop 0.5s var(--ease-bounce) forwards;
}

.modal-stars .star.empty {
  color: var(--color-star-empty);
}

.modal-stars .star:nth-child(2) { animation-delay: 0.2s; }
.modal-stars .star:nth-child(3) { animation-delay: 0.4s; }

.modal-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin: var(--space-lg) 0;
}

.modal-stat {
  text-align: center;
}

.modal-stat-value {
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-orange);
}

.modal-stat-label {
  font-size: 13px;
  color: var(--color-text-light);
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* === Result Card (spot / audio / maze overlay result) === */
.result-card {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  z-index: 900;
  animation: fadeIn 0.3s ease-out;
}

/* Inner card wrapper for visual presentation */
.result-card-inner {
  background: var(--color-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.result-stars .star {
  font-size: 40px;
  color: #FFD93D;
  animation: starPop 0.4s ease-out backwards;
}

.result-stars .star.empty {
  color: #E0E0E0;
}

.result-stars .star:nth-child(1) { animation-delay: 0s; }
.result-stars .star:nth-child(2) { animation-delay: 0.15s; }
.result-stars .star:nth-child(3) { animation-delay: 0.3s; }

.result-msg {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.result-stat {
  text-align: center;
}

.result-stat-value {
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 800;
  color: var(--color-orange);
}

.result-stat-label {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* === Countdown Overlay === */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 248, 240, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.countdown-overlay.active {
  display: flex;
}

.countdown-number {
  font-family: var(--font-num);
  font-size: 120px;
  font-weight: 900;
  color: var(--color-orange);
  animation: bounceIn 0.5s var(--ease-bounce);
}

/* === Confetti === */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1001;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* === Difficulty Selector === */
.diff-selector {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-md);
}

.diff-label {
  font-size: 14px;
  color: var(--color-text-light);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.diff-label span {
  font-weight: 700;
  color: var(--color-text);
}

.diff-buttons {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
}

.diff-btn {
  padding: var(--space-xs) var(--space-sm);
  border: 2px solid #E8E0D8;
  border-radius: var(--radius-sm);
  background: var(--color-card);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-cn);
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  color: var(--color-text-light);
  min-width: 48px;
  text-align: center;
}

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

.diff-btn.active {
  border-color: var(--color-orange);
  background: var(--color-accent-bg);
  color: var(--color-orange);
}

/* === Home Actions === */
.home-actions {
  display: flex;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--color-card);
  border: 2px solid #E8E0D8;
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-cn);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  min-height: 52px;
}

.action-btn:active {
  transform: scale(0.97);
}

.action-btn .action-icon {
  font-size: 22px;
}

/* === Report Page === */
.report-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.report-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid #E8E0D8;
  border-radius: var(--radius-md);
  background: var(--color-card);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-cn);
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  color: var(--color-text-light);
  text-align: center;
}

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

.report-tab.active {
  border-color: var(--color-orange);
  background: var(--color-accent-bg);
  color: var(--color-orange);
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.report-stat-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.report-stat-icon {
  font-size: 28px;
  margin-bottom: var(--space-xs);
}

.report-stat-value {
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 800;
  color: var(--color-orange);
}

.report-stat-label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: var(--space-xs);
}

.report-chart-section,
.report-history-section {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.report-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.report-chart-section canvas {
  width: 100%;
  height: 180px;
}

.report-empty {
  text-align: center;
  color: var(--color-text-light);
  padding: var(--space-xl);
  font-size: 14px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid #F0E8E0;
}

.history-item:last-child {
  border-bottom: none;
}

.history-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.history-stars {
  font-size: 16px;
}

.history-detail {
  font-size: 14px;
  color: var(--color-text);
}

.history-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.history-level {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--color-accent-bg);
  color: var(--color-orange);
  border-radius: 4px;
  font-weight: 600;
}

.history-date {
  font-size: 12px;
  color: var(--color-text-light);
}

/* === Parent Portal === */
.parent-pin-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) 0;
}

.parent-pin-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.parent-pin-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.parent-pin-hint {
  font-size: 13px;
  color: var(--color-text-light);
  margin-bottom: var(--space-lg);
}

.pin-dots {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid #E8E0D8;
  transition: all 0.2s var(--ease-bounce);
}

.pin-dot.filled {
  background: var(--color-orange);
  border-color: var(--color-orange);
  transform: scale(1.1);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  width: 100%;
  max-width: 280px;
}

.pin-key {
  padding: var(--space-md);
  border: 2px solid #E8E0D8;
  border-radius: var(--radius-md);
  background: var(--color-card);
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-num);
  cursor: pointer;
  transition: all 0.15s var(--ease-bounce);
  text-align: center;
  min-height: 52px;
}

.pin-key:active {
  transform: scale(0.92);
  background: var(--color-accent-bg);
}

.parent-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.parent-stat {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.parent-stat-value {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-orange);
}

.parent-stat-label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: var(--space-xs);
}

.parent-section {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.parent-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.parent-game-card {
  border: 1px solid #F0E8E0;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}

.parent-game-card:last-child {
  margin-bottom: 0;
}

.parent-game-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.parent-game-icon {
  font-size: 24px;
}

.parent-game-name {
  font-size: 16px;
  font-weight: 700;
}

.parent-game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  font-size: 13px;
  color: var(--color-text-light);
}

.parent-game-stats strong {
  color: var(--color-text);
}

.trend-up {
  color: var(--color-green);
  font-weight: 600;
}

.trend-down {
  color: var(--color-error);
  font-weight: 600;
}

.trend-stable {
  color: var(--color-blue);
  font-weight: 600;
}

.recommendation-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-recommendation-bg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  font-size: 14px;
  line-height: 1.5;
}

.recommendation-item:last-child {
  margin-bottom: 0;
}

/* === Responsive - Tablet === */
@media (min-width: 481px) and (max-width: 768px) {
  #app {
    padding: 0 var(--space-lg);
    max-width: 600px;
  }

  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

  .game-card {
    padding: var(--space-md);
  }

  .game-card-icon {
    font-size: 40px;
    margin-bottom: var(--space-xs);
  }

  .game-card-title {
    font-size: 18px;
  }

  .game-card-desc {
    font-size: 12px;
  }
}

/* === Responsive - Desktop === */
@media (min-width: 769px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .game-card {
    padding: 20px 12px;
  }

  .game-card-icon {
    font-size: 48px;
    margin-bottom: 10px;
  }

  .game-card-title {
    font-size: 20px;
  }

  .game-card-desc {
    font-size: 14px;
  }

  .stats-grid {
    gap: 16px;
  }

  .stat-value {
    font-size: 32px;
  }
}

@media (max-width: 360px) {
  .schulte-cell {
    font-size: 20px;
  }

  .stroop-word {
    font-size: 42px;
  }

  .stats-grid {
    gap: var(--space-sm);
  }

  .stat-value {
    font-size: 24px;
  }

  .diff-btn {
    font-size: 11px;
    padding: 3px 4px;
    min-width: 40px;
  }

  .report-summary {
    grid-template-columns: 1fr 1fr;
  }
}

/* === Utility === */
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.hidden { display: none !important; }

/* === Profile Setup Overlay === */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 140, 66, 0.15) 0%, rgba(91, 181, 240, 0.15) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.profile-card {
  background: var(--color-card);
  border-radius: 28px;
  padding: 32px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(255, 140, 66, 0.2);
  text-align: center;
  animation: bounceIn 0.5s var(--bounce-easing);
}

.profile-card-icon {
  font-size: 64px;
  margin-bottom: 12px;
  animation: sproutGrow 0.8s var(--bounce-easing);
}

.profile-card-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 12px;
  animation: sproutGrow 0.8s var(--bounce-easing);
}

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

.profile-card-desc {
  font-size: 16px;
  color: var(--color-text-light);
  margin-bottom: 24px;
}

.profile-input-wrap {
  margin-bottom: 20px;
}

.profile-input {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--color-border);
  border-radius: 16px;
  font-size: 18px;
  font-family: var(--font-cn);
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--color-bg);
}

.profile-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(255, 140, 66, 0.15);
}

.profile-input.shake {
  animation: shake 0.5s ease-in-out;
  border-color: var(--color-error);
}

.profile-avatar-label {
  font-size: 15px;
  color: var(--color-text-light);
  margin-bottom: 12px;
}

.profile-avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-card);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s var(--bounce-easing);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option:hover {
  transform: scale(1.1);
  border-color: var(--color-primary);
}

.avatar-option.selected {
  border-color: var(--color-primary);
  background: rgba(255, 140, 66, 0.1);
  transform: scale(1.15);
  box-shadow: 0 2px 12px rgba(255, 140, 66, 0.3);
}

.profile-confirm-btn {
  width: 100%;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.8) translateY(20px); }
  60% { transform: scale(1.02) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes sproutGrow {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@media (max-width: 380px) {
  .profile-avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .profile-card {
    padding: 24px 16px;
  }
  .profile-card-icon {
    font-size: 48px;
  }
  .profile-card-logo {
    width: 60px;
    height: 60px;
  }
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 140, 66, 0.3);
  border-radius: 2px;
}

/* ============================================
   找不同游戏
   ============================================ */
.spot-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
}

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

.spot-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spot-canvas-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-light);
  margin-bottom: 8px;
  background: var(--color-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
}

#spot-canvas-1, #spot-canvas-2 {
  border: 3px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-bg);
  cursor: pointer;
  touch-action: none;
  max-width: 45vw;
  height: auto;
}

@media (max-width: 500px) {
  .spot-canvases {
    flex-direction: column;
    align-items: center;
  }
  #spot-canvas-1, #spot-canvas-2 {
    max-width: 80vw;
  }
}

/* ============================================
   听觉反应游戏
   ============================================ */
.audio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 16px;
}

#audio-game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

.audio-prompt {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--color-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 400px;
  transition: color 0.3s ease;
}

.audio-prompt.pulse {
  animation: audioPulse 1s ease-in-out infinite;
}

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

.audio-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.audio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s var(--bounce-easing);
  min-height: 100px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.audio-btn:active {
  transform: scale(0.92);
}

.audio-btn-emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.audio-btn-name {
  font-size: 16px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

@media (max-width: 360px) {
  .audio-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .audio-btn {
    padding: 16px 12px;
    min-height: 80px;
  }
}

/* ============================================
   迷宫追踪游戏
   ============================================ */
.maze-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  width: 100%;
}

.maze-canvas-wrap {
  background: var(--color-card);
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

#maze-canvas {
  display: block;
  border-radius: 12px;
  touch-action: none;
  cursor: pointer;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.maze-hint {
  font-size: 14px;
  color: var(--color-text-light);
  text-align: center;
  padding: 8px 16px;
  background: rgba(107, 203, 119, 0.1);
  border-radius: 12px;
  margin-top: 8px;
}

/* ============================================
   游戏卡片新颜色
   ============================================ */
.game-card.spot {
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

.game-card.audio {
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
}

.game-card.maze {
  background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
}

[data-theme="dark"] .game-card.spot {
  background: linear-gradient(135deg, #1b3a1e 0%, #2d5a31 100%);
}

[data-theme="dark"] .game-card.audio {
  background: linear-gradient(135deg, #1a2e3d 0%, #2a4a5e 100%);
}

[data-theme="dark"] .game-card.maze {
  background: linear-gradient(135deg, #3d2a1a 0%, #5a3e2a 100%);
}

/* ============================================
   24点游戏
   ============================================ */
.game-card.game24 {
  background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
}

[data-theme="dark"] .game-card.game24 {
  background: linear-gradient(135deg, #2d1a3d 0%, #4a2d5a 100%);
}

[data-theme="dark"] .category-header {
  background: var(--color-card-dark);
  border-left-color: var(--color-primary-dark);
}

[data-theme="dark"] .category-name {
  color: var(--color-text-primary-dark);
}

[data-theme="dark"] .category-ability {
  color: var(--color-text-secondary-dark);
}

.game24-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
}

/* 数字卡片区 */
.game24-cards {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  min-height: 100px;
}

.game24-num-card {
  width: 80px;
  height: 100px;
  background: var(--card-color, #5BB5F0);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game24-num-card:active {
  transform: scale(0.95);
}

.game24-num-card.selected {
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8), 0 8px 24px rgba(0, 0, 0, 0.25);
}

.game24-num-card.selected::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--success-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  font-weight: bold;
}

.game24-num-value {
  font-size: 32px;
  font-weight: 700;
  color: white;
  font-family: 'Nunito', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.game24-num-expr {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* 运算符区 */
.game24-ops {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.game24-op-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  background: var(--bg-card);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.game24-op-btn:hover {
  border-color: var(--primary-color);
  background: rgba(255, 140, 66, 0.1);
}

.game24-op-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.4);
}

/* 操作提示 */
.game24-hint {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* 提示文字 */
.game24-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 16px 32px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.game24-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 24点深色模式 */
[data-theme="dark"] .game24-num-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .game24-op-btn {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .game24-op-btn.active {
  background: var(--primary-color);
  color: white;
}

/* ============================================
   快速算术游戏样式
   ============================================ */
.math-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 16px;
  width: 100%;
}

.math-score-bar {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

.math-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.math-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  font-family: 'Nunito', sans-serif;
}

.math-stat-value.time-warning {
  color: var(--error-color);
  animation: pulse 0.5s ease-in-out infinite;
}

#math-game-area {
  width: 100%;
}

.math-question {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  padding: 24px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 280px;
  font-family: 'Nunito', sans-serif;
}

.math-animate {
  animation: math-pop 0.3s ease-out;
}

@keyframes math-pop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

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

.math-option {
  background: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Nunito', sans-serif;
  position: relative;
  overflow: hidden;
}

.math-option:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.math-option:active {
  transform: scale(0.95);
}

.math-option-correct {
  background: var(--success-color) !important;
  border-color: var(--success-color) !important;
  color: white !important;
  animation: correct-bounce 0.3s ease;
}

.math-option-wrong {
  background: var(--error-color) !important;
  border-color: var(--error-color) !important;
  color: white !important;
  animation: wrong-shake 0.3s ease;
}

.math-option-highlight {
  border-color: var(--success-color) !important;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

@keyframes correct-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.math-float-score {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 700;
  color: white;
  animation: float-up 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -150%); }
}

/* 深色模式 */
[data-theme="dark"] .math-score-bar,
[data-theme="dark"] .math-question,
[data-theme="dark"] .math-option {
  background: var(--card-bg);
}

[data-theme="dark"] .math-question {
  color: var(--text-primary);
}

/* ============================================
   报告Tab滚动（6个tab）
   ============================================ */
.report-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.report-tabs::-webkit-scrollbar {
  display: none;
}

/* === Dark Mode Overrides === */
[data-theme="dark"] .setting-btn.active {
  background: rgba(255, 140, 66, 0.15);
}

[data-theme="dark"] .memory-card.matched .memory-card-back {
  background: rgba(107, 203, 119, 0.15);
}

[data-theme="dark"] .progress-track {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .modal-stars .star.empty {
  color: var(--color-text-muted);
}

[data-theme="dark"] .diff-btn.active {
  background: rgba(255, 140, 66, 0.15);
}

[data-theme="dark"] .report-tab.active {
  background: rgba(255, 140, 66, 0.15);
}

[data-theme="dark"] .difficulty-badge {
  background: rgba(255, 140, 66, 0.15);
}

[data-theme="dark"] .pin-key:active {
  background: rgba(255, 140, 66, 0.15);
}

[data-theme="dark"] .recommendation-item {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .game-info-bar {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .schulte-cell {
  background: var(--color-card);
  color: var(--color-text);
}

[data-theme="dark"] .schulte-cell.completed {
  background: rgba(107, 203, 119, 0.2);
}

[data-theme="dark"] .memory-card-back {
  background: var(--color-card);
}

[data-theme="dark"] .stroop-options .stroop-btn {
  background: var(--color-card);
}

[data-theme="dark"] .audio-btn {
  background: var(--color-card);
}

[data-theme="dark"] .spot-canvas-wrapper {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .result-card-inner {
  background: var(--color-card);
}

[data-theme="dark"] .avatar-option {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .avatar-option.selected {
  background: rgba(255, 140, 66, 0.2);
}

[data-theme="dark"] .profile-card,
[data-theme="dark"] .pin-input,
[data-theme="dark"] .maze-canvas-wrap,
[data-theme="dark"] .audio-prompt {
  background: var(--color-bg-secondary);
  color: var(--color-text);
}
