/* 由 wordgame.html 内联样式抽出（内容不变，便于缓存） */

/* ==================== kid-friendly styles (theme via kids.css) ==================== */

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

body {
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial Rounded MT Bold', sans-serif;
  min-height: 100vh;
  background: linear-gradient(180deg, #89CFF0 0%, #87CEEB 25%, #B0E0E6 50%, #FFE5B4 100%);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12px;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  overflow-y: auto;
}

/* ===== GAME WRAPPER ===== */
.game-wrap {
  width: 100%; max-width: 450px; min-height: 100vh; min-height: 100dvh;
  background: rgba(255,255,255,0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-radius: var(--radius-lg); padding: var(--sp-xl);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  display: flex; flex-direction: column; align-items: center;
  position: relative; overflow: hidden;
  animation: slideUp 0.5s var(--spring);
}

/* ===== HEADER ===== */
.header {
  width: 100%; text-align: center; margin-bottom: var(--sp-lg);
}

.game-title {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #FF6B6B, #FFA502, #2ECC71);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px; letter-spacing: 2px;
}

.game-subtitle {
  font-size: 14px; color: var(--text-secondary); margin-bottom: var(--sp-md);
}

/* ===== TOP BAR: stars + level ===== */
.top-bar {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-lg); padding: 0 4px;
}

.star-display {
  display: flex; align-items: center; gap: 6px;
  font-size: 20px; font-weight: 700; color: var(--orange);
}

.star-display .star-count {
  font-size: 24px;
}

.level-display {
  font-size: 16px; font-weight: 600; color: var(--text-secondary);
  background: rgba(78, 205, 196, 0.15); padding: 6px 14px; border-radius: 20px;
}

/* ===== EMOJI DISPLAY ===== */
.emoji-area {
  width: 100%; text-align: center;
  margin: var(--sp-lg) 0; position: relative;
}

.emoji-big {
  font-size: 100px; line-height: 1.2;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.1));
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-8px) rotate(-2deg); }
  66% { transform: translateY(-4px) rotate(2deg); }
}

.emoji-hint {
  font-size: 16px; color: var(--text-secondary); margin-top: 4px;
}

/* ===== ANSWER BUTTONS ===== */
.answer-grid {
  width: 100%; display: grid;
  grid-template-columns: 1fr 1fr; gap: 12px;
  margin: var(--sp-lg) 0;
}

.answer-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 12px; min-height: var(--touch-min);
  border: 3px solid transparent; border-radius: var(--radius);
  font-size: 22px; font-weight: 700;
  cursor: pointer; transition: all 0.2s var(--ease-out);
  background: #fff; color: var(--text);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  position: relative; overflow: hidden;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}

.answer-btn:not(.disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.answer-btn:not(.disabled):active {
  transform: scale(0.95);
}

/* 渐变块按钮（与 学数字/学拼音 统一） */
.answer-btn:nth-child(1) { background: linear-gradient(135deg, #FF6B6B, #e74c3c); border-color: transparent; color: #fff; }
.answer-btn:nth-child(2) { background: linear-gradient(135deg, #4ECDC4, #2cb5a8); border-color: transparent; color: #fff; }
.answer-btn:nth-child(3) { background: linear-gradient(135deg, #F1C40F, #d4ac0d); border-color: transparent; color: #fff; }
.answer-btn:nth-child(4) { background: linear-gradient(135deg, #9B59B6, #7d3c98); border-color: transparent; color: #fff; }

.answer-btn .btn-bg { opacity: 0; }

.answer-btn .btn-text {
  position: relative; z-index: 1;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.25);
}

/* ----- CORRECT STATE ----- */
.answer-btn.correct {
  background: #2ECC71; border-color: #27AE60; color: #fff; transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(46, 204, 113, 0.4);
  animation: correctPulse 0.6s var(--spring);
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1.05); }
}

/* ----- WRONG STATE ----- */
.answer-btn.wrong {
  background: #FF4757; border-color: #FF6B81; color: #fff;
  animation: shake 0.5s ease-in-out;
}

.answer-btn.disabled {
  opacity: 0.5; cursor: not-allowed; transform: none !important;
  pointer-events: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px) rotate(-2deg); }
  30% { transform: translateX(10px) rotate(2deg); }
  45% { transform: translateX(-8px) rotate(-1deg); }
  60% { transform: translateX(6px) rotate(1deg); }
  75% { transform: translateX(-3px); }
}

/* ===== FEEDBACK MESSAGES ===== */
.feedback {
  width: 100%; min-height: 48px;
  display: flex; justify-content: center; align-items: center;
  margin: var(--sp-sm) 0; position: relative;
}

.feedback-msg {
  font-size: 28px; font-weight: 800; padding: 8px 24px;
  border-radius: var(--radius-full);
  animation: bounceIn 0.5s var(--spring);
  display: none;
}

.feedback-msg.show { display: block; }

.feedback-msg.correct {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.feedback-msg.wrong {
  background: linear-gradient(135deg, #FF6B6B, #FF4757);
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-size: 22px;
}

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

/* ===== STAR BURST ANIMATION ===== */
.burst-star {
  position: absolute; font-size: 32px; pointer-events: none;
  z-index: 100; animation: starFly 1s ease-out forwards;
}

@keyframes starFly {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0) rotate(720deg); opacity: 0; }
}

/* ===== CONFETTI ===== */
.confetti-piece {
  position: absolute; width: 10px; height: 10px; border-radius: 2px;
  pointer-events: none; z-index: 99;
  animation: confettiFall 1.5s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--cx), var(--cy)) rotate(720deg) scale(0); opacity: 0; }
}

/* ===== RESTART BUTTON ===== */
.restart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; min-height: var(--touch-min);
  border: none; border-radius: var(--radius-full);
  font-size: 18px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; font-family: inherit;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  margin-top: auto;
}

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

/* ===== 玩法说明 ===== */
/* ===== FINAL SCREEN ===== */
.final-screen {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; width: 100%; min-height: 500px;
  animation: fadeScaleIn 0.6s var(--spring);
}

.final-screen.show { display: flex; }

@keyframes fadeScaleIn {
  0% { opacity: 0; transform: scale(0.5) rotate(-5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.final-trophy {
  font-size: 80px; margin-bottom: var(--sp-lg);
  animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-5deg); }
  75% { transform: translateY(-8px) rotate(5deg); }
}

.final-title {
  font-size: 36px; font-weight: 800;
  background: linear-gradient(135deg, #FF6B6B, #FFA502, #2ECC71);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--sp-md);
}

.final-subtitle {
  font-size: 20px; color: var(--text-secondary); margin-bottom: var(--sp-lg);
  text-align: center; line-height: 1.6;
}

.final-score {
  font-size: 48px; font-weight: 800; color: var(--orange);
  margin-bottom: var(--sp-lg);
  display: flex; align-items: center; gap: 12px;
}

.final-score .score-label {
  font-size: 20px; color: var(--text-secondary); font-weight: 600;
}

.final-message {
  font-size: 22px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: var(--sp-xl); text-align: center; line-height: 1.6;
}

.final-stars-bg {
  position: absolute; top:0;right:0;bottom:0;left:0; pointer-events: none; overflow: hidden;
}

.final-stars-bg span {
  position: absolute; font-size: 20px; animation: floatStar 3s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes floatStar {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%; height: 8px; background: rgba(0,0,0,0.06);
  border-radius: 4px; overflow: hidden; margin-bottom: var(--sp-sm);
}

.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #FF6B6B, #FFA502, #F1C40F, #2ECC71);
  transition: width 0.5s var(--ease-out);
}

/* ===== SPEAK INDICATOR ===== */
.speak-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; color: var(--text-secondary);
  padding: 4px 12px; border-radius: 12px;
  background: rgba(78, 205, 196, 0.1);
  margin-top: 4px;
  animation: fadeIn 0.3s;
}

.speak-indicator .sound-wave {
  display: inline-block; width: 4px; height: 12px;
  background: var(--blue); border-radius: 2px;
  animation: wave 0.6s ease-in-out infinite;
}

.speak-indicator .sound-wave:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.speak-indicator .sound-wave:nth-child(3) { animation-delay: 0.2s; height: 8px; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

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

/* ===== WORD CHINESE LABEL ===== */
.word-chinese {
  font-size: 18px; color: var(--text-secondary); margin-top: 4px;
  font-weight: 500; letter-spacing: 1px;
  display: none;
}

.word-chinese.show { display: block; }

/* ===== 学音标：大号音标符号 ===== */
.emoji-big.ipa {
  font-size: 60px;
  font-weight: 700;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 2px;
}

/* ===== 菜单模式按钮配色（学元音/学辅音/学单词）===== */

.mode-yuan { background-color: #ec407a; background-image: linear-gradient(135deg, #ec407a, #d81b60); }
.mode-fu   { background-color: #42a5f5; background-image: linear-gradient(135deg, #42a5f5, #1e88e5); }
.mode-word { background-color: #66bb6a; background-image: linear-gradient(135deg, #66bb6a, #43a047); }
/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .game-wrap { padding: var(--sp-lg); min-height: 100vh; min-height: 100dvh; }
  .emoji-big { font-size: 80px; }
  .answer-btn { font-size: 18px; padding: 14px 10px; }
  .game-title { font-size: 24px; }
  .final-title { font-size: 28px; }
  .final-score { font-size: 36px; }
}
