/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #0a0e27;
  color: #fff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ========== 页面切换 ========== */
.page {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}
.page.active { display: flex; }

/* ========== 粒子背景 ========== */
.particle-bg {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

/* ========== 落地页 ========== */
#page-landing {
  background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 40%, #0f3460 100%);
  justify-content: center;
}
.landing-content {
  position: relative; z-index: 1;
  text-align: center; padding: 0 30px;
}
.science-badge {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid rgba(240, 192, 64, 0.4);
  border-radius: 20px;
  font-size: 13px;
  color: #f0c040;
  margin-bottom: 30px;
  letter-spacing: 1px;
}
.landing-title {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, #e0d4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.landing-subtitle {
  font-size: 17px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 40px;
  line-height: 1.5;
}
.btn-primary {
  display: block;
  width: 80%;
  max-width: 320px;
  margin: 0 auto 20px;
  padding: 16px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a2e;
  background: linear-gradient(135deg, #f0c040 0%, #f5d060 100%);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(240, 192, 64, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 10px rgba(240, 192, 64, 0.3);
}
.landing-social-proof {
  font-size: 14px;
  color: rgba(255,255,255,0.4);
}

/* ========== 游戏通用 ========== */
.game-header {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.05);
}
.game-step {
  font-size: 14px;
  color: #f0c040;
  font-weight: 600;
}
.game-title {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
}
.game-area {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ========== 科普卡片 ========== */
.intro-card {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  text-align: center;
}
.intro-icon { font-size: 60px; margin-bottom: 20px; }
.intro-card h2 {
  font-size: 26px;
  margin-bottom: 16px;
  color: #fff;
}
.intro-science {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  margin-bottom: 24px;
  max-width: 340px;
}
.intro-science strong { color: #f0c040; }
.intro-rules {
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 30px;
  text-align: left;
  width: 100%;
  max-width: 340px;
}
.intro-rules p {
  font-size: 15px;
  color: rgba(255,255,255,0.8);
  line-height: 1.8;
}
.intro-rules strong { color: #4fc3f7; }

/* ========== 进度条 ========== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7, #f0c040);
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

/* ========== Stroop 测试 ========== */
#page-stroop { background: linear-gradient(180deg, #0a0e27 0%, #121638 100%); }
.stroop-progress {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.stroop-progress .progress-bar { flex: 1; }
#stroop-question-num { font-size: 14px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.stroop-timer {
  font-size: 28px;
  font-weight: 700;
  color: #f0c040;
  margin-bottom: 30px;
}
.stroop-word {
  font-size: 72px;
  font-weight: 800;
  margin-bottom: 16px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.stroop-hint {
  font-size: 15px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 30px;
}
.stroop-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 320px;
}
.btn-answer {
  width: 100%;
  padding: 18px 0;
  font-size: 20px;
  font-weight: 600;
  border: 2px solid;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  background: transparent;
}
.btn-answer:active { transform: scale(0.96); }
.btn-yes {
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.4);
}
.btn-yes:active { background: rgba(76, 175, 80, 0.15); }
.btn-no {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.4);
}
.btn-no:active { background: rgba(255, 107, 107, 0.15); }
.stroop-feedback {
  margin-top: 16px;
  font-size: 18px;
  font-weight: 600;
  min-height: 28px;
  transition: opacity 0.3s;
}

/* ========== Memory 测试 ========== */
#page-memory { background: linear-gradient(180deg, #0a0e27 0%, #0f2027 100%); }
.memory-info {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 15px;
  color: rgba(255,255,255,0.6);
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(85vw, 300px);
  aspect-ratio: 1;
  margin-bottom: 20px;
}
.memory-cell {
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.15s;
  aspect-ratio: 1;
}
.memory-cell.lit {
  background: rgba(79, 195, 247, 0.6);
  border-color: #4fc3f7;
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.4);
}
.memory-cell.correct {
  background: rgba(76, 175, 80, 0.5);
  border-color: #4caf50;
}
.memory-cell.wrong {
  background: rgba(255, 107, 107, 0.5);
  border-color: #ff6b6b;
}
.memory-cell:active { transform: scale(0.92); }
.memory-hint {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  min-height: 24px;
}

/* ========== Flanker 测试 ========== */
#page-flanker { background: linear-gradient(180deg, #0a0e27 0%, #1a0a2e 100%); }
.flanker-progress {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.flanker-progress .progress-bar { flex: 1; }
#flanker-question-num { font-size: 14px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.flanker-timer {
  font-size: 28px;
  font-weight: 700;
  color: #f0c040;
  margin-bottom: 24px;
}
.flanker-fish {
  font-size: 48px;
  margin-bottom: 12px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 4px;
}
.flanker-fish .fish-center {
  font-size: 64px;
  color: #ff6b6b;
  display: inline-block;
}
.flanker-fish .fish-side {
  font-size: 40px;
  color: rgba(255,255,255,0.4);
  display: inline-block;
}
.flanker-hint {
  font-size: 15px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 30px;
}
.flanker-buttons {
  width: 100%;
  display: flex;
  gap: 16px;
  max-width: 320px;
}
.btn-direction {
  flex: 1;
  padding: 18px 0;
  font-size: 20px;
  font-weight: 600;
  border: 2px solid rgba(79, 195, 247, 0.4);
  border-radius: 16px;
  cursor: pointer;
  color: #4fc3f7;
  background: transparent;
  transition: transform 0.15s;
}
.btn-direction:active {
  transform: scale(0.96);
  background: rgba(79, 195, 247, 0.15);
}
.flanker-feedback {
  margin-top: 16px;
  font-size: 18px;
  font-weight: 600;
  min-height: 28px;
}

/* ========== 结果页A：大脑年龄 + 分享（一屏完整展示） ========== */
#page-result {
  background: linear-gradient(180deg, #0a0e27 0%, #1a1a3e 50%, #0f3460 100%);
  justify-content: center;
  overflow: hidden;
}
.result-a {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  text-align: center;
}
.result-header-label {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 3px;
  margin-bottom: 5vh;
}
.result-brain-age { margin-bottom: 2vh; }
.result-brain-age .label {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
}
.result-brain-age .age {
  font-size: min(80px, 18vw);
  font-weight: 800;
  background: linear-gradient(135deg, #f0c040, #ff9800);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-brain-age .unit {
  font-size: 24px;
  color: #f0c040;
  margin-left: 4px;
}
.result-comparison {
  font-size: 17px;
  color: #4fc3f7;
  margin-bottom: 4vh;
  font-weight: 500;
  line-height: 1.5;
}
.result-share-btn {
  display: block;
  width: 80%;
  max-width: 320px;
  margin: 0 auto 3vh;
  padding: 16px 0;
  font-size: 19px;
  font-weight: 600;
  color: #1a1a2e;
  background: linear-gradient(135deg, #f0c040 0%, #f5d060 100%);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(240, 192, 64, 0.4);
  transition: transform 0.2s;
}
.result-share-btn:active { transform: scale(0.96); }
.result-detail-hook {
  font-size: 15px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: 12px 0;
  line-height: 1.6;
  transition: color 0.2s;
}
.result-detail-hook:active { color: #4fc3f7; }
.result-detail-hook .arrow {
  display: inline-block;
  animation: bounceDown 1.5s ease-in-out infinite;
  margin-left: 4px;
}
@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
.result-brand-a {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}
.result-retry {
  display: block;
  width: 80%;
  max-width: 320px;
  margin: 0 auto;
  padding: 14px 0;
  font-size: 18px;
  font-weight: 600;
  color: #4fc3f7;
  background: transparent;
  border: 2px solid rgba(79, 195, 247, 0.4);
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s;
  text-align: center;
}
.result-retry:active { transform: scale(0.96); background: rgba(79,195,247,0.1); }

/* ========== 结果页B：详细报告 + 入群 ========== */
#page-detail {
  background: linear-gradient(180deg, #0a0e27 0%, #1a1a3e 50%, #0f3460 100%);
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.result-b {
  width: 100%;
  padding: 30px 24px;
  padding-bottom: max(40px, env(safe-area-inset-bottom, 40px));
  text-align: center;
}
.detail-back {
  display: inline-block;
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 20px;
  cursor: pointer;
  padding: 8px 0;
}
.detail-back:active { color: #fff; }
.detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #fff;
}
.result-radar {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 24px;
}
.result-radar canvas { width: 100%; height: auto; }
.result-rank {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.result-rank .rank-label {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}
.result-rank .rank-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}
.result-rank .rank-fill {
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7, #f0c040);
  border-radius: 5px;
  transition: width 1.5s ease-out;
}
.result-rank .rank-text {
  font-size: 16px;
  color: #f0c040;
  font-weight: 600;
}
.detail-divider {
  width: 60px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  margin: 28px auto;
  border-radius: 1px;
}
.detail-cta-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}
.detail-cta-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
  line-height: 1.6;
}
.detail-qrcode-wrap {
  width: 200px;
  margin: 0 auto 16px;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
}
.detail-qrcode-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
.detail-qrcode-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 24px;
}
.detail-brand {
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  margin-top: 20px;
  line-height: 1.6;
}
.detail-science-note {
  font-size: 11px;
  color: rgba(255,255,255,0.15);
  margin-top: 6px;
}
.detail-channel-tip {
  background: rgba(240, 192, 64, 0.1);
  border: 1px solid rgba(240, 192, 64, 0.2);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin: 0 auto 20px;
  max-width: 320px;
  line-height: 1.5;
}

/* ========== 过渡动画 ========== */
.page-transition-enter {
  animation: slideInRight 0.4s ease-out forwards;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.fade-in { animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
