/* ============================================================
   跟着小猪学英语 - 样式表
   视觉化、无英文文字、儿童友好设计
   ============================================================ */

/* ===== iOS Audio Unlock Start Overlay ===== */
.start-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #FFB6D9 0%, #C7CEEA 50%, #B5EAD7 100%);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-content {
  text-align: center;
  padding: 20px;
}

.start-pig {
  width: 120px;
  height: 120px;
  animation: pigWiggle 2s infinite ease-in-out;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
  margin-bottom: 16px;
}

.start-title {
  font-family: 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-shadow: 3px 3px 0 #FF6B9D, 6px 6px 0 rgba(0,0,0,0.1);
  margin-bottom: 30px;
  letter-spacing: 2px;
}

.start-button {
  background: linear-gradient(135deg, #FF6B9D 0%, #FF8E53 100%);
  color: #fff;
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 24px;
  font-weight: 700;
  padding: 16px 48px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4), 0 4px 0 #d8527a;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  animation: startButtonPulse 1.5s infinite ease-in-out;
  display: inline-block;
  -webkit-touch-callout: none;
  user-select: none;
}

.start-button:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4), 0 0px 0 #d8527a;
}

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

.start-hint {
  margin-top: 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

.start-hint-ipad {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

@media (max-width: 480px) {
  .start-pig {
    width: 90px;
    height: 90px;
  }
  .start-title {
    font-size: 24px;
  }
  .start-button {
    font-size: 20px;
    padding: 14px 36px;
  }
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: linear-gradient(135deg, #FFB6D9 0%, #C7CEEA 50%, #B5EAD7 100%);
  position: relative;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===== Screen System ===== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  animation: screenFadeIn 0.5s ease;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Home Screen ===== */
#home-screen {
  background: linear-gradient(160deg, #FFE4F1 0%, #E4D4F0 50%, #D4E8F0 100%);
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px;
}

.home-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 0;
  text-align: center;
}

.home-header {
  margin-bottom: 16px;
}

.home-pig {
  width: 120px;
  height: 120px;
  display: inline-block;
  animation: pigWiggle 2s infinite ease-in-out;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
}

@keyframes pigWiggle {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-8px); }
}

.home-title {
  font-family: 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-shadow: 3px 3px 0 #FF6B9D, 6px 6px 0 rgba(0,0,0,0.1);
  margin: 12px 0 6px;
  letter-spacing: 2px;
}

.home-subtitle {
  font-size: 16px;
  color: #fff;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}

/* ===== Star Counter (Home) ===== */
.star-counter-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 50px;
  margin: 0 auto 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.star-counter-home .star-icon {
  font-size: 24px;
  animation: starTwinkle 1.5s infinite;
}

.star-counter-home .star-count {
  font-size: 22px;
  font-weight: 800;
  color: #FFA000;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

@keyframes starTwinkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(15deg); }
}

/* ===== Level Selection Bar ===== */
.levels-bar {
  display: flex;
  gap: 8px;
  padding: 4px 4px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 4px;
}

.levels-bar::-webkit-scrollbar {
  display: none;
}

.level-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 3px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 80px;
  flex-shrink: 0;
  position: relative;
  -webkit-touch-callout: none;
  user-select: none;
}

.level-tab:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.level-tab.active {
  background: var(--level-color, #4CAF50);
  border-color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px) scale(1.05);
}

.level-tab.active .level-tab-name {
  color: #fff;
}

.level-tab.active .level-tab-progress {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.level-tab.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(200, 200, 200, 0.7);
}

.level-tab.locked:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.level-tab-emoji {
  font-size: 28px;
  line-height: 1;
}

.level-tab-name {
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

.level-tab-progress {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ===== Level Unlock Badge ===== */
.level-unlock-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
  border-radius: 30px;
  padding: 12px 24px;
  margin-top: 16px;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
  animation: unlockPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  justify-content: center;
}

.unlock-emoji {
  font-size: 36px;
  animation: unlockSpin 1s ease;
}

.unlock-text {
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

@keyframes unlockPop {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

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

@media (max-width: 480px) {
  .level-tab {
    min-width: 68px;
    padding: 8px 10px;
  }
  .level-tab-emoji {
    font-size: 22px;
  }
  .level-tab-name {
    font-size: 11px;
  }
  .level-tab-progress {
    font-size: 10px;
    padding: 1px 6px;
  }
}

/* ===== Scenes Grid ===== */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 0 4px;
}

.scene-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 18px 10px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scene-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.scene-card:active {
  transform: translateY(-2px) scale(0.98);
}

.scene-card-emoji {
  font-size: 56px;
  margin-bottom: 6px;
  display: block;
  animation: sceneCardBounce 2s infinite ease-in-out;
  animation-delay: var(--delay, 0s);
}

@keyframes sceneCardBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.scene-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.scene-card-stars {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 215, 0, 0.25);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #FF9800;
}

.scene-card-completed {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 18px;
}

/* ===== Game Screen ===== */
#game-screen {
  background: var(--scene-bg, linear-gradient(135deg, #81C784 0%, #AED581 100%));
  flex-direction: column;
  align-items: center;
  padding: 12px;
  transition: background 0.5s ease;
}

.game-container {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* ===== Game Top Bar ===== */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-icon:hover {
  background: #fff;
  transform: scale(1.05);
}

.game-progress {
  flex: 1;
  display: flex;
  justify-content: center;
}

.progress-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.3s;
}

.progress-dot.current {
  background: #fff;
  width: 32px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.progress-dot.completed {
  background: #FFD700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.star-counter-game {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.star-counter-game .star-icon {
  font-size: 20px;
}

.star-counter-game .star-count {
  font-size: 20px;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

/* ===== Character Section (Pig + Scene Info) ===== */
.character-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.pig-character {
  width: 80px;
  height: 80px;
  animation: pigBounce 1.5s infinite ease-in-out;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  flex-shrink: 0;
}

@keyframes pigBounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}

.scene-info-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  padding: 10px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.scene-emoji-medium {
  font-size: 32px;
  animation: gentleBounce 2s infinite;
}

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

.scene-name {
  font-size: 22px;
  font-weight: 800;
  color: #333;
}

/* ===== Question Area (Visual Only, No English Text) ===== */
.question-area {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border-radius: 32px;
  padding: 24px 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 200px;
  position: relative;
}

.visual-question-display {
  font-size: 120px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 160px;
}

.visual-question-display span {
  display: inline-block;
  animation-fill-mode: both;
}

.speaking-indicator {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

/* ===== Tap-to-Hear Speaker Button (iOS fallback) ===== */
.tap-speaker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #42A5F5 0%, #1E88E5 100%);
  border: 3px solid #fff;
  border-radius: 30px;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(33, 150, 243, 0.4);
  transition: all 0.2s;
  -webkit-touch-callout: none;
  user-select: none;
  animation: speakerHint 2s infinite ease-in-out;
}

.tap-speaker:active {
  transform: scale(0.95);
}

.tap-speaker-icon {
  font-size: 24px;
}

.tap-speaker-text {
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

@keyframes speakerHint {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(33, 150, 243, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6); }
}

.speaking-indicator.hidden {
  display: none;
}

.dot-flashing {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #FF6B9D;
  animation: dotFlash 1.4s infinite ease-in-out;
}

.dot-flashing:nth-child(2) {
  animation-delay: 0.2s;
  background: #FFD93D;
}

.dot-flashing:nth-child(3) {
  animation-delay: 0.4s;
  background: #4FC3F7;
}

@keyframes dotFlash {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ===== Visual Animations ===== */
@keyframes rainFall {
  0% { transform: translateY(-20px); }
  100% { transform: translateY(20px); }
}

@keyframes puddleJump {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.1); }
}

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

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

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

@keyframes pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes fly {
  0%, 100% { transform: translate(0, 0) rotate(-5deg); }
  25% { transform: translate(-10px, -10px) rotate(5deg); }
  50% { transform: translate(0, -15px) rotate(-5deg); }
  75% { transform: translate(10px, -10px) rotate(5deg); }
}

@keyframes drive {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(15px); }
}

@keyframes slide {
  0% { transform: translateX(-20px); opacity: 0.7; }
  100% { transform: translateX(20px); opacity: 1; }
}

@keyframes snowFall {
  0% { transform: translateY(-15px) rotate(0deg); }
  100% { transform: translateY(15px) rotate(360deg); }
}

@keyframes flicker {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.1); filter: brightness(1.3); }
}

@keyframes glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255,255,200,0.5)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 25px rgba(255,255,200,0.9)); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@keyframes blink {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

@keyframes peek {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(20px); }
}

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-10px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-5px); }
}

@keyframes dinoWalk {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-5px) rotate(-3deg); }
  75% { transform: translateX(5px) rotate(3deg); }
}

@keyframes lookAround {
  0%, 100% { transform: rotate(-15deg); }
  50% { transform: rotate(15deg); }
}

@keyframes wave {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(20deg); }
}

@keyframes flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes blow {
  0%, 100% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
}

@keyframes ride {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-2deg); }
}

/* ===== Answer Area ===== */
.answer-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.answer-display {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 12px 20px;
  min-height: 48px;
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.answer-placeholder {
  font-size: 32px;
  opacity: 0.5;
  text-align: center;
}

.answer-text {
  color: #333;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

.answer-text.listening {
  color: #4CAF50;
  animation: pulse 1s infinite;
}

/* ===== Spacebar Button (replaces mic button) ===== */
.spacebar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.keyboard-hints {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Keyboard Controls Container ===== */
.keyboard-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* ===== Answer Reveal Row ===== */
.answer-reveal-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  position: relative;
  flex-wrap: wrap;
}

.answer-reveal-display {
  display: none;
  background: linear-gradient(135deg, #FFE082 0%, #FFB74D 100%);
  color: #5D4037;
  font-size: 22px;
  font-weight: 800;
  font-family: 'Fredoka', 'Baloo 2', sans-serif;
  padding: 6px 22px;
  border-radius: 24px;
  box-shadow: 0 4px 14px rgba(255, 183, 77, 0.4);
  border: 3px solid #fff;
  animation: revealPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.answer-reveal-display.show {
  display: inline-block;
}

@keyframes revealPop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.kb-hint-answer {
  background: linear-gradient(135deg, #FFE082 0%, #FFB74D 100%);
  color: #5D4037;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(255, 183, 77, 0.3);
  transition: all 0.2s;
}

.kb-hint-answer:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(255, 183, 77, 0.45);
}

.kb-hint-answer:active {
  transform: translateY(1px);
}

.kb-hint {
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #999;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid #e0e0e0;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.kb-hint:hover {
  background: #fff;
  border-color: #ccc;
  color: #666;
}

.kb-hint:active {
  transform: scale(0.95);
}

.spacebar-button {
  width: 260px;
  height: 72px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, #FF6B9D 0%, #FF8E53 100%);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4), 0 4px 0 #d8527a;
  transition: all 0.15s;
  -webkit-touch-callout: none;
  user-select: none;
}

.spacebar-button:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 28px rgba(255, 107, 157, 0.5), 0 4px 0 #d8527a;
}

.spacebar-button:active,
.spacebar-button.listening {
  transform: translateY(4px);
  box-shadow: 0 2px 12px rgba(76, 175, 80, 0.4), 0 0px 0 #4a9b60;
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
}

.spacebar-text {
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  letter-spacing: 1px;
  z-index: 2;
}

.spacebar-button.listening .spacebar-text {
  animation: textPulse 0.8s infinite;
}

@keyframes textPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(0.97); }
}

.spacebar-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: rgba(76, 175, 80, 0.3);
  opacity: 0;
  transition: all 0.3s;
}

.spacebar-button.listening .spacebar-pulse {
  opacity: 1;
  animation: spacebarPulse 1.2s infinite;
}

@keyframes spacebarPulse {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.08); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.3; }
}

/* ===== Tap Answer Mode (for iPad/iOS without speech recognition) ===== */
.tap-mode-hint {
  display: none;
  font-family: 'Fredoka', 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  background: rgba(255, 255, 255, 0.25);
  padding: 8px 20px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  animation: pulse 1.5s infinite ease-in-out;
}

.tap-mode-hint.show {
  display: block;
}

.tap-answers {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 500px;
}

.tap-answers.show {
  display: flex;
}

.tap-answer-btn {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  -webkit-touch-callout: none;
  user-select: none;
  animation: tapBtnPopIn 0.4s ease backwards;
  padding: 0;
}

.tap-answer-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}

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

.tap-answer-emoji {
  font-size: 52px;
  line-height: 1;
}

.tap-answer-btn.correct {
  background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
  border-color: #388E3C;
  animation: tapBtnCorrect 0.6s ease;
}

.tap-answer-btn.incorrect {
  background: linear-gradient(135deg, #EF5350 0%, #E53935 100%);
  border-color: #C62828;
  animation: tapBtnShake 0.5s ease;
}

.tap-answer-btn.reveal-correct {
  background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
  border-color: #388E3C;
  animation: tapBtnReveal 0.4s ease;
}

@keyframes tapBtnPopIn {
  0% { transform: scale(0) translateY(20px); opacity: 0; }
  60% { transform: scale(1.1) translateY(-5px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes tapBtnCorrect {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1.1); }
}

@keyframes tapBtnShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-3deg); }
  40% { transform: translateX(10px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(2deg); }
}

@keyframes tapBtnReveal {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1.1); opacity: 1; }
}

@media (max-width: 480px) {
  .tap-answer-btn {
    width: 78px;
    height: 78px;
    border-radius: 18px;
    border-width: 3px;
  }
  .tap-answer-emoji {
    font-size: 40px;
  }
  .tap-answers {
    gap: 8px;
  }
}

/* ===== Score Display ===== */
.score-display {
  text-align: center;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.score-stars {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.score-star {
  font-size: 32px;
  opacity: 0.3;
  transform: scale(0);
  transition: all 0.3s;
}

.score-star.earned {
  opacity: 1;
  transform: scale(1);
  animation: starBurst 0.6s ease;
}

@keyframes starBurst {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.5) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ===== Next Button ===== */
.btn-next {
  background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
  border: none;
  padding: 12px 36px;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 6px 20px rgba(255, 160, 0, 0.4);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  display: none;
  margin-top: 4px;
  animation: btnSlideUp 0.4s ease;
}

.btn-next.show {
  display: block;
}

.btn-next:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(255, 160, 0, 0.5);
}

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

/* ===== Reward Screen ===== */
#reward-screen {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd700 100%);
  align-items: center;
  justify-content: center;
}

.reward-container {
  text-align: center;
  padding: 20px;
  max-width: 500px;
}

.reward-pig {
  width: 140px;
  height: 140px;
  animation: pigCelebrate 1s ease;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
}

@keyframes pigCelebrate {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.reward-title {
  font-family: 'Baloo 2', 'PingFang SC', sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.15);
  margin: 16px 0 16px;
}

.reward-stars-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.reward-star-big {
  font-size: 48px;
  animation: starPop 0.5s ease;
  animation-delay: var(--delay, 0s);
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes starPop {
  0% { opacity: 0; transform: scale(0) rotate(-180deg); }
  60% { opacity: 1; transform: scale(1.4) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.reward-stats {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-bottom: 28px;
}

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

.stat-icon {
  font-size: 36px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.reward-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.btn-icon-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  font-size: 36px;
  cursor: pointer;
  transition: all 0.3s;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.btn-replay {
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-home-game {
  background: linear-gradient(135deg, #42A5F5 0%, #1E88E5 100%);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-icon-large:hover {
  transform: scale(1.1);
}

/* ===== Confetti Canvas ===== */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* ===== Floating Stars ===== */
.floating-stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 998;
  overflow: hidden;
}

.floating-star {
  position: absolute;
  font-size: 24px;
  animation: floatUp 2s ease-out forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-100px) scale(1.5);
    opacity: 1;
  }
  100% {
    transform: translateY(-250px) scale(0.5);
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Decorative Background Elements ===== */
.bg-cloud {
  position: fixed;
  font-size: 60px;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
  animation: cloudFloat 20s infinite linear;
}

@keyframes cloudFloat {
  from { transform: translateX(-100px); }
  to { transform: translateX(calc(100vw + 100px)); }
}

/* ===== Browser Support Warning ===== */
.browser-warning {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  text-align: center;
  z-index: 2000;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  display: none;
}

.browser-warning.show {
  display: block;
}

.browser-warning h2 {
  font-size: 24px;
  color: #FF6B6B;
  margin-bottom: 12px;
}

.browser-warning p {
  font-size: 16px;
  color: #555;
  line-height: 1.5;
}

/* ===== Dinosaur Overlay ===== */
.dinosaur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 997;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 70%);
}

.dinosaur-overlay.show {
  display: flex;
  animation: dinoOverlayFadeIn 0.3s ease;
}

@keyframes dinoOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dinosaur-content {
  text-align: center;
  position: relative;
}

.dinosaur-img {
  width: 360px;
  height: 360px;
  max-width: 80vw;
  max-height: 60vh;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.3));
}

/* ===== Different Entry Animations for Each Dinosaur (Dynamic / Happy) ===== */
.dinosaur-img.allosaurus {
  animation: dinoBounceIn 0.6s ease, dinoHappy 1.2s infinite ease-in-out 0.6s;
}

.dinosaur-img.stegosaurus {
  animation: dinoSlideUp 0.5s ease, dinoStomp 0.8s infinite ease-in-out 0.5s;
}

.dinosaur-img.brachiosaurus {
  animation: dinoGrowIn 0.7s ease, dinoSwayGentle 1.8s infinite ease-in-out 0.7s;
}

.dinosaur-img.diplodocus {
  animation: dinoSwingIn 0.6s ease, dinoTailWag 1.4s infinite ease-in-out 0.6s;
}

.dinosaur-img.ceratosaurus {
  animation: dinoRoarIn 0.5s ease, dinoRoar 0.9s infinite ease-in-out 0.5s;
}

.dinosaur-img.kentrosaurus {
  animation: dinoSpinIn 0.5s ease, dinoSpike 1.1s infinite ease-in-out 0.5s;
}

/* ===== Static (Bad Answer) - No Continuous Animation ===== */
.dinosaur-img.static {
  animation: dinoFadeIn 0.4s ease;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.3)) grayscale(0.3) brightness(0.95);
}

.dinosaur-label {
  font-family: 'Fredoka', 'Baloo 2', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-top: 12px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dinosaur-label.good {
  color: #4CAF50;
}

.dinosaur-label.bad {
  color: #FF7043;
}

@keyframes dinoBounceIn {
  0% { transform: scale(0) translateY(-100px) rotate(-20deg); }
  60% { transform: scale(1.2) translateY(10px) rotate(5deg); }
  80% { transform: scale(0.95) translateY(-5px) rotate(-2deg); }
  100% { transform: scale(1) translateY(0) rotate(0deg); }
}

@keyframes dinoHappy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-2deg); }
}

@keyframes dinoSlideUp {
  0% { transform: translateY(150px) scale(0.3); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes dinoStomp {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-6px) scale(1.02, 0.98); }
  50% { transform: translateY(0) scale(0.98, 1.02); }
  75% { transform: translateY(-4px) scale(1.01, 0.99); }
}

@keyframes dinoGrowIn {
  0% { transform: scaleY(0) scaleX(0.5); opacity: 0; }
  60% { transform: scaleY(1.1) scaleX(1.05); opacity: 1; }
  100% { transform: scaleY(1) scaleX(1); opacity: 1; }
}

@keyframes dinoSwayGentle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}

@keyframes dinoSwingIn {
  0% { transform: translateX(-300px) rotate(-45deg); opacity: 0; }
  60% { transform: translateX(20px) rotate(5deg); opacity: 1; }
  100% { transform: translateX(0) rotate(0deg); opacity: 1; }
}

@keyframes dinoTailWag {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(-2deg) translateX(-4px); }
  75% { transform: rotate(2deg) translateX(4px); }
}

@keyframes dinoRoarIn {
  0% { transform: scale(2) rotate(15deg); opacity: 0; }
  60% { transform: scale(0.95) rotate(-5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes dinoRoar {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  30% { transform: translateY(-10px) rotate(-1deg) scale(1.04); }
  60% { transform: translateY(-2px) rotate(1deg) scale(1); }
}

@keyframes dinoSpinIn {
  0% { transform: scale(0) rotate(-360deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes dinoSpike {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-3px) rotate(-1deg); }
  60% { transform: translateY(-5px) rotate(1deg); }
}

@keyframes dinoFadeIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
  .home-pig {
    width: 90px;
    height: 90px;
  }

  .home-title {
    font-size: 24px;
    letter-spacing: 1px;
  }

  .home-subtitle {
    font-size: 14px;
  }

  .scenes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .scene-card {
    min-height: 130px;
    padding: 14px 8px 10px;
  }

  .scene-card-emoji {
    font-size: 44px;
  }

  .scene-card-name {
    font-size: 13px;
  }

  .pig-character {
    width: 64px;
    height: 64px;
  }

  .scene-name {
    font-size: 18px;
  }

  .scene-emoji-medium {
    font-size: 28px;
  }

  .visual-question-display {
    font-size: 88px;
    height: 130px;
  }

  .spacebar-button {
    width: 220px;
    height: 62px;
  }

  .kb-hint {
    font-size: 13px;
    padding: 6px 10px;
  }

  .spacebar-text {
    font-size: 18px;
  }

  .reward-pig {
    width: 110px;
    height: 110px;
  }

  .reward-title {
    font-size: 32px;
  }

  .reward-stats {
    gap: 30px;
  }

  .btn-icon-large {
    width: 70px;
    height: 70px;
    font-size: 30px;
  }
}

@media (max-height: 700px) and (min-width: 481px) {
  .visual-question-display {
    font-size: 90px;
    height: 120px;
  }

  .pig-character {
    width: 64px;
    height: 64px;
  }

  .spacebar-button {
    width: 160px;
    height: 52px;
  }

  .kb-hint {
    font-size: 12px;
    padding: 5px 8px;
  }

  .spacebar-text {
    font-size: 15px;
  }
}

/* ===== Accessibility ===== */
button:focus-visible {
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}