/* ============================================
   行桌 — 星座科普互动网站
   Design System & Global CSS
   ============================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* 颜色体系 */
  --bg-primary: #0F0F23;
  --bg-card: #1E1D35;
  --bg-card-locked: #1A1A2E;
  --primary: #8B5CF6;
  --primary-light: #A78BFA;
  --accent: #FBBF24;
  --accent-glow: rgba(251, 191, 36, 0.5);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-locked: #4A4A6A;
  --danger: #EF4444;

  /*  claymorphism 阴影 */
  --shadow-clay-1: 0 4px 12px rgba(139, 92, 246, 0.25);
  --shadow-clay-2: inset 0 1px 3px rgba(168, 130, 255, 0.15);
  --shadow-clay-strong: 0 8px 24px rgba(139, 92, 246, 0.35);

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* 圆角 */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50%;

  /* 字体 */
  --font-heading: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 896px;
  overflow: hidden;
  background: var(--bg-primary);
}

/* --- Screen Management --- */
.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(30px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.screen.screen-exit {
  opacity: 0;
  transform: translateX(-30px);
  pointer-events: none;
}

/* --- Top Bar (通用) --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  height: 56px;
  flex-shrink: 0;
  z-index: 10;
}

.app-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.settings-btn, .back-btn, .placeholder-right {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.back-btn {
  font-size: 18px;
  font-weight: 700;
}

.settings-btn:active, .back-btn:active {
  background: var(--primary);
}

.detail-title, .game-title, .achievement-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

/* =============================================
   SCREEN 1 — 首页 / 星空地图
   ============================================= */

/* Hero 区 */
.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  background: linear-gradient(180deg, #0F0F23 0%, #1E0D47 40%, #0F0F23 100%);
  text-align: center;
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.hero-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 搜索框 */
.search-wrap {
  padding: 0 var(--space-lg);
  margin-top: -8px;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border-radius: 24px;
  padding: 10px 12px 10px 16px;
  height: 44px;
  box-shadow: var(--shadow-clay-2);
}

.search-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

/* 筛选折叠按钮 */
.filter-toggle {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary-light);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s;
}
.filter-toggle.active {
  background: var(--primary);
  color: #fff;
}

/* 搜索输入清除按钮 */
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394A3B8'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
  cursor: pointer;
}

/* 筛选栏（可折叠） */
.filter-bar {
  padding: 0 var(--space-lg);
  margin-top: var(--space-sm);
  flex-shrink: 0;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
}

.filter-bar.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(139,92,246,0.3);
}

.filter-chip.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(139,92,246,0.35);
}

/* 搜索结果提示 */
.search-result-info {
  padding: 6px var(--space-lg) 2px;
  flex-shrink: 0;
}

.search-result-info span {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-secondary);
}

.search-result-info .result-highlight {
  color: var(--primary-light);
  font-weight: 600;
}

/* 无结果空状态 */
.filter-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px var(--space-lg);
  text-align: center;
}

.filter-empty-state .empty-emoji {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.filter-empty-state .empty-text {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.filter-empty-state .empty-hint {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-locked);
}

/* 区域标题 */
.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  padding: var(--space-md) var(--space-lg) var(--space-xs);
  flex-shrink: 0;
}

/* 精选星座卡片行 — 横向滚动 */
.featured-section {
  flex-shrink: 0;
}

.card-row-scroll {
  display: flex;
  gap: 10px;
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.card-row-scroll::-webkit-scrollbar {
  display: none;
}

/* 精选卡片 — 横向滚动小卡 */
.featured-card {
  flex-shrink: 0;
  width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-clay-1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.featured-card:active {
  transform: scale(0.95);
}
.featured-card .card-name {
  font-size: 13px;
}
.featured-card .card-count {
  font-size: 10px;
}

.featured-card.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
}
.featured-card.explored {
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.featured-card.explored .card-name {
  color: var(--primary-light);
}

/* 星座卡片（首页 & 图鉴通用） */
.constellation-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 140px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-clay-1), var(--shadow-clay-2);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.constellation-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-clay-strong);
}

.card-star {
  font-size: 32px;
  line-height: 1;
}

.card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.card-count {
  font-size: 11px;
  color: var(--text-secondary);
}

/* 全部星座网格 */
.all-constellations-section {
  flex-shrink: 0;
  padding-bottom: 80px;
}

.constellation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 var(--space-lg);
}

.grid-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 72px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.grid-card:active {
  transform: scale(0.95);
  background: rgba(139, 92, 246, 0.2);
}

.grid-card .card-name {
  font-size: 11px;
  font-weight: 600;
}

.grid-card .card-difficulty {
  margin-top: 0;
  gap: 2px;
}

.grid-card .difficulty-stars {
  font-size: 8px;
  letter-spacing: 0.5px;
}

.grid-card .difficulty-label {
  display: none;
}

.grid-card .card-lock-hint {
  display: none;
}

.grid-card .card-star {
  font-size: 22px;
}

.grid-card .card-name {
  font-size: 12px;
}

/* 锁定卡片 */
.constellation-card.locked, .grid-card.locked {
  background: var(--bg-card-locked);
}

.constellation-card.locked .card-star,
.grid-card.locked .card-star {
  filter: grayscale(1);
  opacity: 0.4;
}

.constellation-card.locked .card-name,
.grid-card.locked .card-name {
  color: var(--text-locked);
}

/* 已探索卡片 — 网格中的微妙高亮 */
.grid-card.explored {
  border-left: 3px solid var(--primary);
}
.grid-card.explored .card-name {
  color: var(--primary-light);
}

/* =============================================
   SCREEN 2 — 星座详情页
   ============================================= */

#screen-detail {
  background: var(--bg-primary);
}

/* 星图示意区 */
.illustration-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 220px;
  background: linear-gradient(180deg, #0F0F23 0%, #1E0D47 50%, #0F0F23 100%);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.pinyin-label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.star-canvas {
  width: 100%;
  height: 180px;
}

/* Tab 栏 */
.tab-bar {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  flex-shrink: 0;
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
  background: var(--bg-card);
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
}

/* 内容卡片 */
.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-lg) var(--space-lg);
}

.content-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.content-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.content-card-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* 语音朗读按钮 */
.audio-btn {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.audio-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.audio-btn:active {
  transform: scale(0.97);
}

/* 朗读状态条 */
.audio-playing-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: var(--space-sm);
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: #6366f1;
}

.audio-wave {
  animation: audioPulse 0.8s ease-in-out infinite;
}

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

.audio-status {
  flex: 1;
}

.audio-stop-btn {
  padding: 2px 8px;
  font-size: 14px;
  border: none;
  border-radius: 50%;
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}
.audio-stop-btn:hover {
  background: rgba(239,68,68,0.3);
  transform: scale(1.1);
}

/* 趣味知识卡片 */
.fun-fact-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border-left: 4px solid var(--accent);
}

.fun-fact-emoji {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.fun-fact-content {
  flex: 1;
}

.fun-fact-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.fun-fact-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* 星图展示区 */
.star-map-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-md);
}

.star-map-container canvas {
  width: 100%;
  max-width: 300px;
}

/* 游戏启动按钮 */
.game-launch-btn {
  margin: var(--space-md) var(--space-lg) var(--space-lg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: var(--radius-xl);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-clay-strong);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

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

/* =============================================
   SCREEN 3 — 连线游戏页
   ============================================= */

#screen-game {
  background: var(--bg-primary);
  overflow: hidden;
  touch-action: none;
}

.game-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.score-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
}

.score-badge span:first-child {
  font-size: 14px;
}

#game-score {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

.game-constellation-name {
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-lg) 0;
  flex-shrink: 0;
}

.game-instruction {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-lg) var(--space-sm);
  flex-shrink: 0;
}

/* 游戏区 */
.game-area {
  flex: 1;
  position: relative;
  min-height: 380px;
  flex-shrink: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.game-area canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* 进度条 */
.game-progress-wrap {
  padding: var(--space-md) var(--space-lg);
  flex-shrink: 0;
}

.game-progress-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-align: center;
}

.game-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.game-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* 完成按钮 */
.game-complete-btn {
  margin: var(--space-sm) var(--space-lg) var(--space-lg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: var(--radius-xl);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-clay-strong);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

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

.game-complete-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* 游戏成功动画 */
.game-success-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 35, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 20;
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  padding: 16px;
}

.game-success-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* -------- 通关分析卡片 -------- */
.analysis-card {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(145deg, rgba(30, 27, 75, 0.95), rgba(17, 24, 39, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: analysisSlideUp 0.5s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(139, 92, 246, 0.08);
}

@keyframes analysisSlideUp {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

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

.analysis-emoji {
  font-size: 48px;
  animation: bounceIn 0.6s ease;
}

.analysis-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  color: #E2E8F0;
}

.analysis-rating {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  padding: 3px 14px;
  border-radius: 12px;
  margin-top: 2px;
}

.analysis-rating.s { background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; }
.analysis-rating.a { background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; }
.analysis-rating.b { background: linear-gradient(135deg, #06B6D4, #3B82F6); color: #fff; }
.analysis-rating.c { background: linear-gradient(135deg, #10B981, #059669); color: #fff; }
.analysis-rating.d { background: linear-gradient(135deg, #6B7280, #4B5563); color: #fff; }

/* 雷达图 */
.analysis-chart-wrap {
  position: relative;
  width: 200px;
  height: 200px;
}

.analysis-radar {
  width: 200px;
  height: 200px;
}

.analysis-chart-label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-locked);
}

/* 统计卡片 */
.analysis-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.analysis-stat {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.analysis-stat-value {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  color: #C4B5FD;
}

.analysis-stat-label {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 历史对比 */
.analysis-compare {
  width: 100%;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
}

.analysis-compare-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  color: #A5B4FC;
  margin-bottom: 8px;
}

.analysis-compare-hint {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-locked);
  text-align: center;
}

.analysis-compare-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.analysis-compare-row + .analysis-compare-row {
  border-top: 1px solid rgba(139, 92, 246, 0.06);
}

.compare-label {
  font-family: var(--font-body);
  color: var(--text-secondary);
  min-width: 40px;
}

.compare-this {
  font-family: var(--font-heading);
  font-weight: 700;
  color: #C4B5FD;
  min-width: 36px;
}

.compare-vs {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-locked);
}

.compare-best {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
}

.compare-diff {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  margin-left: auto;
}

.compare-diff.up { color: #34D399; }
.compare-diff.down { color: #F87171; }

/* 操作按钮 */
.analysis-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.analysis-btn {
  flex: 1;
  padding: 11px 0;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-family: var(--font-heading);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.analysis-btn:active {
  transform: scale(0.96);
}

.analysis-btn.retry {
  background: linear-gradient(135deg, #8B5CF6, #6366F1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.analysis-btn.detail {
  background: rgba(139, 92, 246, 0.12);
  color: #C4B5FD;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* =============================================
   SCREEN 4 — 星座图鉴 / 成就收集
   ============================================= */

#screen-achievement {
  background: var(--bg-primary);
}

/* 进度概览 */
.progress-overview {
  padding: 0 var(--space-lg) var(--space-md);
  flex-shrink: 0;
}

.progress-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 80px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay-2);
}

.progress-num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 28px;
  color: var(--accent);
}

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

/* 图鉴网格区 */
.achievement-section {
  flex-shrink: 0;
}

.locked-title {
  color: var(--text-secondary) !important;
}

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

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay-1);
  cursor: pointer;
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

.achievement-card.locked {
  background: var(--bg-card-locked);
}

.achievement-card .card-star {
  font-size: 28px;
}

.achievement-card.locked .card-star {
  filter: grayscale(1);
  opacity: 0.3;
}

.achievement-card .card-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.achievement-card.locked .card-name {
  color: var(--text-locked);
}

.achievement-card .card-badge {
  font-size: 12px;
}

/* 底部留白 */
.bottom-spacer {
  height: 90px;
  flex-shrink: 0;
}

/* =============================================
   底部导航栏（首页和图鉴页共用）
   ============================================= */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 64px;
  background: var(--bg-card);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: color var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-body);
}

.nav-item.active .nav-label {
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* =============================================
   响应式 & 辅助
   ============================================= */

/* 超小屏幕适配 */
@media (max-width: 360px) {
  .hero-title { font-size: 22px; }
  .constellation-card { height: 120px; padding: 12px; }
  .constellation-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-card { height: 68px; }
}

/* 横屏适配 */
@media (max-height: 500px) {
  .hero-section { padding: var(--space-lg) var(--space-lg); }
  .illustration-area { height: 160px; }
}

/* 滚动条美化 */
.screen::-webkit-scrollbar {
  width: 4px;
}

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

.screen::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 2px;
}

/* 选中文本颜色 */
::selection {
  background: var(--primary);
  color: white;
}

/* =============================================
   难度进度指示器（首页）
   ============================================= */
.progress-section {
  padding: 8px 16px 2px;
}

.progress-tiers {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.progress-tier {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
}

.progress-tier.unlocked {
  background: rgba(139, 92, 246, 0.15);
  color: #8B5CF6;
  border: 1.5px solid rgba(139, 92, 246, 0.3);
}

.progress-tier.locked {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1.5px solid rgba(148, 163, 184, 0.2);
}

.progress-tier .tier-stars {
  font-size: 11px;
}

.progress-tier .tier-icon-unlocked { margin-left: 2px; }
.progress-tier .tier-icon-locked  { margin-left: 2px; font-size: 11px; }

.progress-hint {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
  min-height: 18px;
  font-family: 'Nunito', sans-serif;
}

/* =============================================
   卡片难度 & 锁定样式
   ============================================= */
/* card-status 已合并到 card-difficulty 行 */
.card-lock-icon,
.card-explored-icon {
  font-size: 13px;
  margin-right: 3px;
  flex-shrink: 0;
}

.card-difficulty {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.difficulty-stars {
  font-size: 11px;
  color: #f59e0b;
  letter-spacing: 1px;
}

.difficulty-label {
  font-size: 10px;
  color: #94a3b8;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
}

.card-lock-hint {
  font-size: 10px;
  color: #f59e0b;
  margin-top: 2px;
  font-family: 'Nunito', sans-serif;
}

/* 锁定卡片 */
.constellation-card.locked {
  opacity: 0.55;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.constellation-card.locked .card-name {
  color: #94a3b8;
}

/* 已探索卡片 */
.constellation-card.explored {
  border-color: rgba(139, 92, 246, 0.3);
}

.constellation-card.explored .card-name {
  color: #8B5CF6;
}

/* Toast 提示 */
#toast-msg {
  font-family: 'Fredoka', sans-serif;
}

/* =============================================
   成就页难度分组
   ============================================= */
.achievement-tier {
  margin-bottom: 8px;
}

/* =============================================
   PWA 安装横幅
   ============================================= */
.pwa-install-banner{
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b69 100%);
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  border-radius: 16px;
  padding: 12px 16px;
  z-index: 9000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  min-width: 320px;
  max-width: 92vw;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.pwa-banner-content{
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-icon{
  font-size: 32px;
  flex-shrink: 0;
}

.pwa-text{
  flex: 1;
  min-width: 0;
}

.pwa-title{
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.pwa-desc{
  color: #a78bfa;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  margin-top: 2px;
}

.pwa-install-btn{
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.pwa-install-btn:active{
  transform: scale(0.95);
}

.pwa-dismiss-btn{
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.pwa-dismiss-btn:hover{
  color: #fff;
}

/* =============================================
   星图全景
   ============================================= */
.sky-map-entry {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.6), rgba(139,92,246,0.4));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}
.sky-map-entry:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.8), rgba(139,92,246,0.6));
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

#screen-sky-map {
  background: #020212;
}

.sky-map-bar {
  background: rgba(10, 10, 40, 0.9) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 10;
}

.sky-map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sky-map-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.sky-map-tool-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

.sky-map-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 52px);
  overflow: hidden;
  touch-action: none;
}

#sky-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sky-map-hint {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  padding: 6px 18px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
  white-space: nowrap;
  font-family: var(--font-body);
  animation: skyHintFade 3s ease-in-out forwards;
}

@keyframes skyHintFade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.sky-map-legend {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot.spring   { background: #86efac; }
.legend-dot.summer   { background: #fca5a5; }
.legend-dot.autumn   { background: #fde047; }
.legend-dot.winter   { background: #c4b5fd; }
.legend-dot.polar    { background: #93c5fd; }
.legend-dot.southern { background: #5eead4; }

/* =============================================
   新手引导教程
   ============================================= */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  display: none;
}
.tutorial-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.tutorial-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 0;
}

/* 第二步时让触摸事件穿透遮罩，到达 Canvas */
.tutorial-overlay.passthrough {
  pointer-events: none !important;
}

/* 气泡 */
.tutorial-bubble {
  position: absolute;
  z-index: 2;
  background: linear-gradient(135deg, #2d1b69 0%, #1e1145 100%);
  border: 2px solid rgba(139,92,246,0.5);
  border-radius: 20px;
  padding: 20px 22px;
  text-align: center;
  max-width: 260px;
  box-shadow: 0 12px 40px rgba(139,92,246,0.35);
}
.tutorial-bubble.top {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
}
.tutorial-bubble-arrow {
  display: none;
}
.tutorial-bubble.bottom .tutorial-bubble-arrow {
  display: none;
}

.tutorial-bubble-step {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: all 0.3s ease;
}
.tutorial-dot.active {
  background: #8B5CF6;
  box-shadow: 0 0 8px rgba(139,92,246,0.6);
  width: 24px;
  border-radius: 4px;
}
.tutorial-dot.done {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,0.5);
}

.tutorial-bubble-text {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
  margin-bottom: 6px;
}
.tutorial-bubble-hint {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

/* 手势动画 */
.tutorial-hand {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  width: 64px;
  height: 64px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.tutorial-hand.visible {
  opacity: 1;
}

.tutorial-hand-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 12px rgba(139,92,246,0.5));
}

/* 手势滑动轨迹动画 */
@keyframes handSwipe {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(10px, -6px); }
  40%  { transform: translate(30px, -5px); }
  55%  { transform: translate(48px, 0); }
  70%  { transform: translate(60px, 5px); }
  85%  { transform: translate(48px, 0); }
  100% { transform: translate(0, 0); }
}

.tutorial-hand.swiping .tutorial-hand-svg {
  animation: handSwipe 2.2s ease-in-out infinite;
}

/* 目标星星高亮脉冲 */
.tutorial-highlight {
  animation: tutorialPulse 1.2s ease-in-out infinite;
}

@keyframes tutorialPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(139,92,246,0.8)); }
  50%      { filter: drop-shadow(0 0 18px rgba(139,92,246,1)); }
}

/* 跳过按钮 */
.tutorial-skip {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 5;
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 12px;
  padding: 4px 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
}
.tutorial-skip:active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* 完成庆祝文字飞入 */
@keyframes tutorialCelebrate {
  0% { transform: translate(-50%, 20px); opacity: 0; }
  60% { transform: translate(-50%, -14px); opacity: 1; }
  80% { transform: translate(-50%, 4px); }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

.tutorial-celebrate {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #FBBF24;
  white-space: nowrap;
  z-index: 4;
  animation: tutorialCelebrate 0.6s ease-out forwards;
  text-shadow: 0 0 20px rgba(251,191,36,0.5);
}

/* =============================================
   成就徽章系统
   ============================================= */

/* 徽章通知弹窗 */
.badge-notification {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  animation: badgeFadeIn 0.35s ease-out;
}
.badge-notification.badge-fadeout {
  animation: badgeFadeOut 0.35s ease-in forwards;
}
@keyframes badgeFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes badgeFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.badge-popup {
  position: relative;
  background: linear-gradient(145deg, #1e1145, #2d1b69);
  border: 2px solid rgba(251,191,36,0.4);
  border-radius: 24px;
  padding: 32px 36px 28px;
  text-align: center;
  max-width: 280px;
  box-shadow: 0 0 60px rgba(251,191,36,0.25);
  animation: badgeBounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes badgeBounceIn {
  from { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.06); }
  to   { transform: scale(1); opacity: 1; }
}

.badge-popup-glow {
  position: absolute;
  top: -20px; left: -20px; right: -20px; bottom: -20px;
  border-radius: 30px;
  background: radial-gradient(ellipse at 50% 30%, rgba(251,191,36,0.15), transparent 70%);
  pointer-events: none;
}

.badge-popup-emoji {
  font-size: 52px;
  margin-bottom: 8px;
  animation: badgeEmojiFloat 2s ease-in-out infinite;
}
@keyframes badgeEmojiFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%     { transform: translateY(-6px) scale(1.08); }
}

.badge-popup-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  color: rgba(251,191,36,0.8);
  margin-bottom: 6px;
  letter-spacing: 2px;
}
.badge-popup-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #FBBF24;
  margin-bottom: 6px;
  text-shadow: 0 0 16px rgba(251,191,36,0.4);
}
.badge-popup-desc {
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

/* WeChat TTS 提示弹窗 */
.wechat-tts-prompt {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  animation: badgeFadeIn 0.3s ease-out;
}
.wechat-tts-popup {
  position: relative;
  background: linear-gradient(160deg, #1a1a3e, #2a1a4e);
  border: 1.5px solid rgba(138,107,255,0.35);
  border-radius: 20px;
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 300px;
  width: 85%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: bounceIn 0.45s ease-out;
}
.wechat-tts-icon {
  font-size: 48px;
  margin-bottom: 14px;
}
.wechat-tts-title {
  font-family: var(--font-heading);
  font-size: 20px;
  color: #ffd700;
  margin-bottom: 14px;
  font-weight: 700;
}
.wechat-tts-desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.8;
  margin-bottom: 22px;
}
.wechat-tts-desc b {
  color: #ffd700;
  font-weight: 600;
}
.wechat-tts-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.wechat-tts-btn {
  padding: 10px 20px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.wechat-tts-btn:active {
  transform: scale(0.95);
}
.wechat-tts-btn.copy-btn {
  background: linear-gradient(135deg, #8a6bff, #6b4cff);
  color: #fff;
  box-shadow: 0 4px 15px rgba(138,107,255,0.35);
}
.wechat-tts-btn.close-btn {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.15);
}

/* 图鉴页徽章区域 */
.badge-section {
  padding: 0 var(--space-lg) var(--space-lg);
}

.badge-section-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #FBBF24;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.badge-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 14px 8px 10px;
  text-align: center;
  border: 1.5px solid rgba(255,255,255,0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.badge-card.unlocked {
  border-color: rgba(251,191,36,0.3);
  background: linear-gradient(145deg, var(--bg-card), rgba(251,191,36,0.06));
}
.badge-card.unlocked::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(251,191,36,0.08), transparent 60%);
  pointer-events: none;
}
.badge-card.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.badge-card-emoji {
  font-size: 32px;
  margin-bottom: 6px;
}
.badge-card-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
}
.badge-card-desc {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.3;
}
.badge-card.locked .badge-card-name {
  color: #94a3b8;
}
.badge-card .badge-lock {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  opacity: 0.4;
}

/* ========== 设置弹窗 ========== */
.settings-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  animation: badgeFadeIn 0.25s ease-out;
}
.settings-panel {
  background: linear-gradient(160deg, #1e1145, #2d1b69);
  border: 1.5px solid rgba(138,107,255,0.25);
  border-radius: 20px;
  width: 86%;
  max-width: 340px;
  box-shadow: 0 12px 50px rgba(0,0,0,0.5);
  animation: badgeBounceIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px 14px;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-icon {
  font-size: 20px;
  margin-right: 8px;
}
.settings-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.settings-close:active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.settings-body {
  padding: 10px 20px 20px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.settings-label {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(255,255,255,0.85);
}
.settings-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0;
}
.settings-info {
  text-align: center;
  padding-top: 12px;
}
.settings-version {
  font-family: var(--font-heading);
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}
.settings-desc {
  font-family: var(--font-body);
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  margin-top: 4px;
}

/* Toggle 开关 */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
}
.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 26px;
  transition: background 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.settings-toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #8a6bff, #6b4cff);
}
.settings-toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* 危险按钮 */
.settings-btn-danger {
  padding: 6px 16px;
  border-radius: 10px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  font-family: var(--font-heading);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-btn-danger:active {
  background: rgba(239,68,68,0.25);
  transform: scale(0.96);
}
