/* 全局样式 - 幼儿友好设计 */

:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --bg: #FFF5E6;
  --text: #2D3436;
  --radius: 20px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部导航 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary), #FF8E8E);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

.logo {
  font-size: 1.4rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.btn-home {
  background: rgba(255,255,255,0.3);
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-home:active {
  transform: scale(0.9);
}

/* ===== 主应用 ===== */
.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

/* ===== 首页 ===== */
.hero {
  text-align: center;
  padding: 24px 0 16px;
}

.hero-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: #666;
}

/* ===== 游戏卡片网格 ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.game-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.game-card:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.game-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  display: block;
}

.game-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
}

.game-desc {
  font-size: 0.8rem;
  color: #888;
}

/* 不同卡片颜色 */
.game-card:nth-child(1) { background: linear-gradient(135deg, #FFE66D, #FFF5CC); }
.game-card:nth-child(2) { background: linear-gradient(135deg, #4ECDC4, #A8E6E0); }
.game-card:nth-child(3) { background: linear-gradient(135deg, #FF8A9E, #FFD4DC); }
.game-card:nth-child(4) { background: linear-gradient(135deg, #A29BFE, #DDD6FE); }
.game-card:nth-child(5) { background: linear-gradient(135deg, #55EFC4, #B8F5E0); }
.game-card:nth-child(6) { background: linear-gradient(135deg, #74B9FF, #D4ECFF); }

/* ===== 内联页面 ===== */
.view-inline {
  width: 100%;
}

.hidden {
  display: none !important;
}

.btn-back {
  display: inline-block;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 1rem;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

/* ===== 安装提示 ===== */
.install-prompt {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  max-width: 90%;
}

.install-text {
  font-size: 0.85rem;
  color: #555;
}

.btn-install {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-dismiss {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
  padding: 4px;
}

/* ===== 内联页面内容 ===== */
.page-content {
  text-align: center;
}

.page-content h2 {
  font-size: 1.5rem;
  color: var(--primary);
  margin: 16px 0;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.color-card {
  aspect-ratio: 1;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}

.color-card:active {
  transform: scale(0.95);
}

.color-name {
  background: rgba(255,255,255,0.85);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.animal-grid,
.nature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.animal-card,
.nature-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 12px;
  font-size: 1.3rem;
  font-weight: bold;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}

.animal-card:active,
.nature-card:active {
  transform: scale(0.95);
}

.music-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.music-buttons .btn {
  min-width: 60px;
  height: 60px;
  font-size: 1.2rem;
}

/* ===== 内联页提示与挑战 ===== */
.page-tip {
  text-align: center;
  font-size: 0.85rem;
  color: #888;
  margin: 4px 0 8px;
}

.mode-entry {
  display: block;
  margin: 20px auto 0;
  min-width: 200px;
}

.quiz-box {
  margin: 20px auto;
  max-width: 400px;
  text-align: center;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.quiz-q {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 12px;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quiz-opt {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
  font-family: inherit;
}

.quiz-opt:active {
  transform: scale(0.9);
}

.quiz-opt.correct {
  outline: 4px solid var(--secondary);
}

.quiz-opt.wrong {
  outline: 4px solid var(--primary);
  opacity: 0.5;
}

.quiz-options.emoji-grid {
  grid-template-columns: repeat(4, 1fr);
}

.quiz-opt.emoji-opt {
  background: #fff;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 动物/自然卡片 ===== */
.animal-card .emoji,
.nature-card .emoji {
  font-size: 2rem;
  display: block;
}

.animal-card .name,
.nature-card .name {
  font-size: 0.9rem;
  display: block;
  margin-top: 4px;
}

/* ===== 音乐旋律 ===== */
.melody-player {
  margin-top: 24px;
  text-align: center;
}

.melody-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.note-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  transform: scale(1.1);
}

/* ===== 通用按钮 ===== */
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

/* ===== 动画 ===== */
@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.pop-in {
  animation: pop 0.3s ease;
}

.bounce {
  animation: bounce 1s ease infinite;
}

.wiggle {
  animation: wiggle 0.5s ease infinite;
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .hero-title {
    font-size: 2rem;
  }
}

@media (min-width: 1024px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* TV 端适配 */
@media (min-width: 1600px) {
  body {
    font-size: 1.2rem;
  }
  
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
  }
  
  .game-icon {
    font-size: 4rem;
  }
  
  .game-name {
    font-size: 1.4rem;
  }
  
  .game-desc {
    font-size: 1rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
}

/* TV 遥控器焦点样式 */
.game-card:focus,
.game-card:focus-visible {
  outline: 4px solid var(--primary);
  outline-offset: 4px;
  transform: scale(1.05);
}
