/* ====================
   奇妙英语岛 - 组件样式表（移动端优化版）
   Magic English Island - Components Stylesheet
==================== */

/* 响应式断点 */
@media (max-width: 768px) {
  .navbar-container { padding: 0 15px !important; }
  .logo span { display: none; }
  
  .nav-links {
    display: flex !important;
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-red), var(--primary-orange));
    flex-direction: column;
    padding: 15px;
    gap: 0;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    z-index: 999;
    border-radius: 0 0 20px 20px;
  }
  
  .nav-links.active {
    transform: translateY(0);
  }
  
  .nav-links li {
    width: 100%;
  }
  
  .nav-links li a {
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.1);
  }
  
  .nav-links li a:hover,
  .nav-links li a.active {
    background: rgba(255,255,255,0.25);
    transform: scale(1.02);
  }
  
  .nav-toggle { display: flex !important; }
  
  h1 { font-size: 2rem !important; }
  h2 { font-size: 1.5rem !important; }
  h2::after, h2::before { display: none !important; }
  
  .container { padding: 0 15px !important; }
  
  .card { padding: 20px !important; }
  
  .btn { padding: 12px 25px !important; font-size: 1rem !important; }
  
  .hero-section { padding: 100px 0 40px !important; }
  
  .quick-entry-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px !important; }
  
  .alphabet-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important; gap: 12px !important; }
  
  .memory-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 10px !important; }
  
  .word-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; gap: 15px !important; }
  
  .song-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px !important; }
  
  .story-grid { grid-template-columns: 1fr !important; }
  
  .game-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px !important; }
  
  .footer-content { grid-template-columns: 1fr !important; gap: 25px !important; }
  
  .carousel-container { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
  
  .progress-bar { height: 15px !important; }
  
  .audio-btn { width: 45px !important; height: 45px !important; font-size: 1.2rem !important; }
  
  .player-controls { gap: 10px !important; }
  
  .control-btn { width: 50px !important; height: 50px !important; font-size: 1.2rem !important; }
  
  .control-btn.play-btn { width: 65px !important; height: 65px !important; font-size: 1.5rem !important; }
}

@media (max-width: 480px) {
  .quick-entry-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  
  .alphabet-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)) !important; gap: 8px !important; }
  
  .memory-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }
  
  .word-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  
  .song-grid { grid-template-columns: 1fr !important; }
  
  .game-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  
  .letter { font-size: 2.5rem !important; }
  
  .letter-phonetic { font-size: 0.8rem !important; }
  
  .word-english { font-size: 1.3rem !important; }
  
  .word-chinese { font-size: 0.9rem !important; }
}

/* ==================== 导航栏样式 ==================== */
.navbar {
  background: linear-gradient(135deg, var(--primary-red), var(--primary-orange));
  padding: 12px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--white);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.logo-icon {
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 5px;
}

.nav-links li a {
  display: block;
  padding: 10px 18px;
  color: var(--white);
  font-weight: bold;
  border-radius: 20px;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.nav-links li a:hover,
.nav-links li a.active {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.nav-links li a.active {
  background: var(--white);
  color: var(--primary-red);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}

/* ==================== 页脚样式 ==================== */
.footer {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: var(--white);
  padding: 40px 0 20px;
  margin-top: 50px;
}

.footer-section h3 {
  color: var(--white);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.footer-section p,
.footer-section a {
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  line-height: 1.7;
}

.footer-section a:hover {
  color: var(--sunshine-yellow);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 2px solid rgba(255,255,255,0.2);
}

.footer-bottom p {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
}

/* ==================== 主视觉区样式 ==================== */
.hero-section {
  padding: 130px 0 60px;
  text-align: center;
  background: linear-gradient(135deg, #E0F7FA 0%, #FFF3E0 50%, #F3E5F5 100%);
}

.island-illustration {
  width: 100%;
  max-width: 700px;
  height: 350px;
  margin: 25px auto;
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.welcome-message {
  font-size: 1.3rem;
  color: var(--primary-blue);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ==================== 快速入口样式 ==================== */
.quick-entry {
  padding: 50px 0;
  background: var(--white);
}

.quick-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 20px;
  background: linear-gradient(135deg, var(--light-gray), var(--white));
  border-radius: 15px;
  transition: all 0.3s ease;
  cursor: pointer;
  border-bottom: 4px solid;
}

.entry-card:nth-child(1) { border-color: var(--primary-red); }
.entry-card:nth-child(2) { border-color: var(--primary-orange); }
.entry-card:nth-child(3) { border-color: var(--primary-yellow); }
.entry-card:nth-child(4) { border-color: var(--primary-green); }
.entry-card:nth-child(5) { border-color: var(--primary-blue); }
.entry-card:nth-child(6) { border-color: var(--primary-purple); }

.entry-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.entry-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 2rem;
}

.entry-card:nth-child(1) .entry-icon { background: linear-gradient(135deg, var(--primary-red), #FF8A80); }
.entry-card:nth-child(2) .entry-icon { background: linear-gradient(135deg, var(--primary-orange), #FFB74D); }
.entry-card:nth-child(3) .entry-icon { background: linear-gradient(135deg, var(--primary-yellow), #FFE082); }
.entry-card:nth-child(4) .entry-icon { background: linear-gradient(135deg, var(--primary-green), #81C784); }
.entry-card:nth-child(5) .entry-icon { background: linear-gradient(135deg, var(--primary-blue), #64B5F6); }
.entry-card:nth-child(6) .entry-icon { background: linear-gradient(135deg, var(--primary-purple), #B39DDB); }

.entry-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--dark-gray);
  text-align: center;
}

/* ==================== 特色推荐区样式 ==================== */
.featured-section {
  padding: 50px 0;
  background: linear-gradient(135deg, #F8F9FA, #E9ECEF);
}

.carousel-container {
  position: relative;
  max-width: 1000px;
  margin: 30px auto 0;
}

.carousel-item {
  min-width: 280px;
  margin: 0 12px;
  background: var(--white);
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* ==================== 字母卡片样式 ==================== */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 18px;
  padding: 30px 0;
}

.letter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 15px;
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.letter-card:hover {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.letter-card.active {
  background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
  transform: scale(1.08);
}

.letter {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary-blue);
  transition: color 0.2s ease;
}

.letter-card:hover .letter {
  color: var(--primary-red);
}

.letter-phonetic {
  font-size: 0.9rem;
  color: var(--dark-gray);
  margin-top: 5px;
}

/* ==================== 单词卡片样式 ==================== */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.word-card {
  background: var(--white);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  text-align: center;
  cursor: pointer;
}

.word-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.word-image {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--light-gray), var(--medium-gray));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.word-english {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 5px;
}

.word-chinese {
  font-size: 0.95rem;
  color: var(--dark-gray);
}

/* ==================== 音频播放按钮样式 ==================== */
.audio-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-green), var(--island-green));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: all 0.2s ease;
  margin: 10px auto;
}

.audio-btn:hover {
  transform: scale(1.1);
}

.audio-btn.playing {
  animation: sound-wave 0.5s ease infinite;
}

@keyframes sound-wave {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ==================== 主题分类标签样式 ==================== */
.theme-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}

.theme-tab {
  padding: 10px 20px;
  border: 3px solid var(--primary-blue);
  border-radius: 20px;
  background: var(--white);
  color: var(--primary-blue);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.theme-tab:hover,
.theme-tab.active {
  background: var(--primary-blue);
  color: var(--white);
  transform: scale(1.05);
}

/* ==================== 儿歌播放器样式 ==================== */
.music-player {
  background: linear-gradient(135deg, var(--primary-pink), var(--primary-purple));
  border-radius: 25px;
  padding: 35px;
  text-align: center;
  color: var(--white);
  margin: 25px auto;
  max-width: 600px;
}

.player-info {
  margin-bottom: 25px;
}

.song-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.lyrics-container {
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  max-height: 200px;
  overflow-y: auto;
}

.lyrics-line {
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 5px;
}

.lyrics-line.active {
  background: var(--primary-yellow);
  font-weight: bold;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.control-btn {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--primary-purple);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  transform: scale(1.1);
}

.control-btn.play-btn {
  width: 75px;
  height: 75px;
  background: var(--primary-yellow);
  color: var(--primary-orange);
  font-size: 1.8rem;
}

/* ==================== 故事阅读器样式 ==================== */
.story-reader {
  max-width: 800px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.story-header {
  background: linear-gradient(135deg, var(--primary-orange), var(--primary-yellow));
  padding: 30px;
  text-align: center;
}

.story-title {
  font-size: 1.8rem;
  color: var(--dark-gray);
}

.story-content {
  padding: 30px;
}

.story-text {
  font-size: 1.2rem;
  line-height: 1.9;
  color: var(--dark-gray);
}

.story-text .clickable-word {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-yellow);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.story-text .clickable-word:hover {
  background: var(--primary-orange);
  color: var(--white);
}

/* ==================== 游戏区域样式 ==================== */
.game-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 25px;
  background: var(--white);
  border-radius: 25px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.game-header {
  text-align: center;
  margin-bottom: 25px;
}

.game-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
  border-radius: 20px;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--dark-gray);
}

.game-area {
  min-height: 350px;
  background: linear-gradient(180deg, #E3F2FD, #BBDEFB);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-instructions {
  text-align: center;
  font-size: 1.1rem;
  color: var(--primary-blue);
  margin-bottom: 15px;
}

/* ==================== 记忆翻牌游戏样式 ==================== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 450px;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: all 0.2s ease;
  transform-style: preserve-3d;
}

.memory-card.flipped {
  background: var(--white);
  transform: rotateY(180deg);
}

.memory-card.matched {
  background: linear-gradient(135deg, var(--primary-green), var(--island-green));
  animation: match-success 0.5s ease;
}

@keyframes match-success {
  0%, 100% { transform: scale(1) rotateY(180deg); }
  50% { transform: scale(1.15) rotateY(180deg); }
}

/* ==================== 奖励徽章样式 ==================== */
.reward-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary-yellow), var(--primary-orange));
  border-radius: 15px;
  margin: 8px;
  animation: badge-pop 0.5s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.badge-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.badge-name {
  font-weight: bold;
  color: var(--dark-gray);
}

/* ==================== 进度条样式 ==================== */
.progress-bar {
  width: 100%;
  height: 18px;
  background: var(--medium-gray);
  border-radius: 10px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-green), var(--island-green));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.95rem;
  color: var(--dark-gray);
}

/* ==================== 录音按钮样式 ==================== */
.record-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-red), var(--primary-orange));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--white);
  transition: all 0.2s ease;
  margin: 12px auto;
}

.record-btn:hover {
  transform: scale(1.1);
}

.record-btn.recording {
  animation: recording-pulse 1s ease infinite;
}

@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
  50% { box-shadow: 0 0 0 15px rgba(255, 107, 107, 0); }
}

/* ==================== 模态框样式 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: 25px;
  padding: 35px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: modal-pop 0.3s ease;
}

@keyframes modal-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark-gray);
  background: none;
  border: none;
}

/* ==================== 提示消息样式 ==================== */
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary-green), var(--island-green));
  color: var(--white);
  padding: 12px 25px;
  border-radius: 25px;
  font-weight: bold;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 3000;
  animation: toast-bounce 0.5s ease;
}

@keyframes toast-bounce {
  0% { transform: translateX(-50%) translateY(80px); opacity: 0; }
  50% { transform: translateX(-50%) translateY(-8px); }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==================== 加载动画样式 ==================== */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--medium-gray);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== 返回顶部按钮样式 ==================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--white);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px);
}

/* ==================== 触摸优化 ==================== */
.entry-card,
.word-card,
.letter-card,
.memory-card,
.song-card,
.story-card,
.game-card,
.carousel-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.entry-card:active,
.word-card:active,
.song-card:active {
  transform: scale(0.97);
}

/* ==================== 禁用水平滚动 ==================== */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light-gray);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}
