/* 鬼屋单词学习游戏 - 样式文件 */

/* ==================== 基础样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a0a2e 0%, #16213e 50%, #0f0f23 100%);
  min-height: 100vh;
  color: #e0d0f0;
  overflow-x: hidden;
}

/* 星空背景动画 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, #fff, transparent),
    radial-gradient(2px 2px at 50px 160px, #fff, transparent),
    radial-gradient(2px 2px at 90px 40px, #fff, transparent),
    radial-gradient(2px 2px at 130px 80px, #fff, transparent),
    radial-gradient(2px 2px at 160px 120px, #fff, transparent);
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.3;
  animation: twinkle 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

/* ==================== 容器布局 ==================== */
.game-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ==================== 头部导航 ==================== */
.game-header {
  text-align: center;
  padding: 30px 0;
  border-bottom: 2px solid rgba(186, 108, 200, 0.3);
  margin-bottom: 30px;
}

.game-title {
  font-size: 2.5rem;
  color: #da80d6;
  text-shadow: 0 0 20px rgba(218, 128, 214, 0.5);
  margin-bottom: 10px;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 0 0 20px rgba(218, 128, 214, 0.5); }
  to { text-shadow: 0 0 30px rgba(218, 128, 214, 0.8), 0 0 40px rgba(218, 128, 214, 0.4); }
}

.game-subtitle {
  color: #a080c0;
  font-size: 1.1rem;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.nav-btn {
  padding: 12px 24px;
  border: 2px solid #ba68c8;
  background: rgba(186, 104, 200, 0.2);
  color: #e0d0f0;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.nav-btn:hover {
  background: rgba(186, 104, 200, 0.4);
  box-shadow: 0 0 20px rgba(186, 104, 200, 0.5);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: rgba(186, 104, 200, 0.6);
  box-shadow: 0 0 25px rgba(186, 104, 200, 0.7);
}

/* ==================== 鬼屋入口 - 房间选择 ==================== */
.haunted-house {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
}

.room-card {
  background: linear-gradient(145deg, rgba(40, 20, 60, 0.8), rgba(30, 15, 45, 0.9));
  border: 2px solid rgba(186, 108, 200, 0.4);
  border-radius: 15px;
  padding: 25px;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.room-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(186, 108, 200, 0.1), transparent);
  transform: rotate(45deg);
  transition: all 0.6s ease;
  pointer-events: none;
}

.room-card:hover::before {
  left: 100%;
}

.room-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: #ba68c8;
  box-shadow: 0 10px 40px rgba(186, 108, 200, 0.4);
}

.room-card.completed {
  border-color: #81c784;
  box-shadow: 0 0 20px rgba(129, 199, 132, 0.3);
}

.room-card.completed::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  color: #81c784;
  text-shadow: 0 0 10px rgba(129, 199, 132, 0.8);
}

.room-number {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 5px;
}

.room-name {
  font-size: 1.4rem;
  color: #da80d6;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(218, 128, 214, 0.5);
}

.room-word {
  font-size: 1.8rem;
  font-weight: bold;
  color: #fff;
  text-align: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  margin: 15px 0;
  letter-spacing: 2px;
}

.room-word .ing-form {
  color: #ba68c8;
  font-size: 1.4rem;
  display: block;
  margin-top: 5px;
}

.room-description {
  color: #a080c0;
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
}

.ghost-icon {
  font-size: 2.5rem;
  text-align: center;
  display: block;
  margin-bottom: 10px;
  animation: float 3s ease-in-out infinite;
  pointer-events: none;
}

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

/* ==================== 房间挑战界面 ==================== */
.challenge-room {
  display: none;
  animation: fadeIn 0.5s ease;
}

.challenge-room.active {
  display: block;
}

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

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(40, 20, 60, 0.6);
  border-radius: 15px;
  margin-bottom: 20px;
  border: 1px solid rgba(186, 108, 200, 0.3);
}

.back-btn {
  padding: 10px 20px;
  background: rgba(186, 104, 200, 0.3);
  border: 1px solid #ba68c8;
  color: #e0d0f0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(186, 104, 200, 0.5);
}

.current-word-display {
  text-align: center;
}

.current-word-display .base {
  font-size: 2rem;
  color: #fff;
}

.current-word-display .ing {
  font-size: 1.5rem;
  color: #ba68c8;
}

/* ==================== 幽灵角色 ==================== */
.ghost-container {
  text-align: center;
  padding: 30px;
  position: relative;
}

.ghost-sprite {
  font-size: 6rem;
  display: inline-block;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
  animation: ghostFloat 4s ease-in-out infinite;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ghost-sprite:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.8));
}

@keyframes ghostFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-20px) rotate(2deg);
    opacity: 1;
  }
}

.ghost-speech {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 15px 25px;
  display: inline-block;
  margin-top: 20px;
  position: relative;
  backdrop-filter: blur(5px);
}

.ghost-speech::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(255, 255, 255, 0.1);
}

/* ==================== 挑战模块 ==================== */
.challenge-section {
  background: rgba(30, 15, 45, 0.6);
  border: 1px solid rgba(186, 108, 200, 0.3);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
}

.challenge-title {
  font-size: 1.3rem;
  color: #da80d6;
  margin-bottom: 20px;
  text-align: center;
  text-shadow: 0 0 10px rgba(218, 128, 214, 0.5);
}

/* 读音练习 */
.pronunciation-area {
  text-align: center;
}

.speak-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #ba68c8;
  background: linear-gradient(145deg, rgba(186, 104, 200, 0.3), rgba(186, 104, 200, 0.1));
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px;
}

.speak-btn:hover {
  background: rgba(186, 104, 200, 0.5);
  box-shadow: 0 0 30px rgba(186, 104, 200, 0.6);
  transform: scale(1.1);
}

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

.record-btn {
  border-color: #4fc3f7;
}

.record-btn:hover {
  background: rgba(79, 195, 247, 0.5);
  box-shadow: 0 0 30px rgba(79, 195, 247, 0.6);
}

.record-btn.recording {
  animation: pulse 1s infinite;
  background: rgba(244, 67, 54, 0.5);
  border-color: #f44336;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(244, 67, 54, 0.6); }
  50% { box-shadow: 0 0 40px rgba(244, 67, 54, 0.8); }
}

.playback-btn {
  border-color: #81c784;
}

.playback-btn:hover {
  background: rgba(129, 199, 132, 0.5);
  box-shadow: 0 0 30px rgba(129, 199, 132, 0.6);
}

/* 拼写练习 */
.spelling-area {
  text-align: center;
}

.word-slots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.word-slot {
  width: 50px;
  height: 60px;
  border: 2px dashed rgba(186, 108, 200, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.word-slot.filled {
  border-style: solid;
  border-color: #ba68c8;
  background: rgba(186, 108, 200, 0.2);
}

.word-slot.correct {
  border-color: #81c784;
  background: rgba(129, 199, 132, 0.2);
  animation: successPulse 0.5s ease;
}

.word-slot.incorrect {
  border-color: #e57373;
  background: rgba(229, 115, 115, 0.2);
  animation: shake 0.5s ease;
}

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

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

.letter-bank {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.letter-tile {
  width: 45px;
  height: 55px;
  border: 2px solid rgba(186, 108, 200, 0.6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(145deg, rgba(186, 104, 200, 0.4), rgba(186, 104, 200, 0.2));
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.letter-tile:hover {
  background: rgba(186, 104, 200, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(186, 104, 200, 0.4);
}

.letter-tile.used {
  opacity: 0.3;
  pointer-events: none;
}

.spelling-hint {
  color: #a080c0;
  font-size: 0.95rem;
  margin-top: 15px;
}

.drag-instruction {
  color: #888;
  font-size: 0.85rem;
  margin-top: 10px;
}

/* 时态练习 */
.tense-area {
  text-align: center;
}

.tense-pairs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  max-width: 500px;
  margin: 0 auto;
}

.tense-card {
  padding: 20px;
  border: 2px solid rgba(186, 108, 200, 0.4);
  border-radius: 12px;
  background: rgba(40, 20, 60, 0.6);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.tense-card:hover {
  border-color: #ba68c8;
  background: rgba(60, 30, 80, 0.8);
  transform: translateY(-3px);
}

.tense-card.selected {
  border-color: #fff;
  background: rgba(186, 104, 200, 0.4);
  box-shadow: 0 0 20px rgba(186, 104, 200, 0.5);
}

.tense-card.matched {
  border-color: #81c784;
  background: rgba(129, 199, 132, 0.2);
  opacity: 0.5;
  pointer-events: none;
}

.tense-card .word {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 5px;
}

.tense-card .form {
  font-size: 0.85rem;
  color: #a080c0;
}

.tense-card .ing-highlight {
  color: #ba68c8;
  font-weight: bold;
}

.double-consonant-note {
  text-align: center;
  color: #ffb74d;
  font-size: 0.9rem;
  margin-top: 15px;
  padding: 10px;
  background: rgba(255, 183, 77, 0.1);
  border-radius: 8px;
}

/* ==================== 完成挑战 ==================== */
.challenge-complete {
  text-align: center;
  padding: 40px;
}

.complete-badge {
  font-size: 5rem;
  animation: spin 3s linear infinite;
  display: inline-block;
}

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

.complete-message {
  font-size: 1.5rem;
  color: #da80d6;
  margin: 20px 0;
  text-shadow: 0 0 15px rgba(218, 128, 214, 0.5);
}

.complete-word {
  font-size: 2.5rem;
  color: #fff;
  margin: 20px 0;
}

.next-btn, .claim-btn {
  padding: 15px 40px;
  font-size: 1.2rem;
  background: linear-gradient(145deg, #ba68c8, #8e24aa);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px;
}

.next-btn:hover, .claim-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(186, 104, 200, 0.6);
}

/* ==================== 奖杯室 ==================== */
.trophy-room {
  display: none;
  padding: 20px;
}

.trophy-room.active {
  display: block;
}

.trophy-header {
  text-align: center;
  margin-bottom: 30px;
}

.trophy-title {
  font-size: 2rem;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.trophy-count {
  color: #a080c0;
  margin-top: 10px;
}

.badge-collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  padding: 20px;
}

.badge-item {
  background: linear-gradient(145deg, rgba(40, 20, 60, 0.8), rgba(30, 15, 45, 0.9));
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.badge-item:hover {
  transform: translateY(-5px);
  border-color: #ffd700;
  box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.badge-item.locked {
  opacity: 0.5;
  filter: grayscale(100%);
}

.badge-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.badge-word {
  font-size: 1.2rem;
  color: #fff;
  font-weight: bold;
}

.badge-room {
  font-size: 0.85rem;
  color: #a080c0;
  margin-top: 5px;
}

.empty-collection {
  text-align: center;
  padding: 50px;
  color: #888;
}

.empty-collection .icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

/* ==================== 进度指示器 ==================== */
.progress-container {
  text-align: center;
  margin: 20px 0;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(186, 108, 200, 0.3);
  border: 2px solid rgba(186, 108, 200, 0.5);
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: #ba68c8;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(186, 104, 200, 0.8);
}

.progress-dot.completed {
  background: #81c784;
  border-color: #81c784;
}

/* ==================== 反馈动画 ==================== */
.feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  font-weight: bold;
  z-index: 1000;
  pointer-events: none;
  animation: feedbackPop 1s ease forwards;
}

.feedback.correct {
  color: #81c784;
  text-shadow: 0 0 30px rgba(129, 199, 132, 0.8);
}

.feedback.incorrect {
  color: #e57373;
  text-shadow: 0 0 30px rgba(229, 115, 115, 0.8);
}

@keyframes feedbackPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1) translateY(-50px);
  }
}

/* ==================== 蜡烛装饰 ==================== */
.candle {
  position: fixed;
  bottom: 20px;
  font-size: 2rem;
  animation: flicker 0.5s ease-in-out infinite alternate;
  opacity: 0.8;
}

.candle.left {
  left: 20px;
}

.candle.right {
  right: 20px;
}

@keyframes flicker {
  from { opacity: 0.6; transform: scaleY(1); }
  to { opacity: 1; transform: scaleY(1.05); }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .game-title {
    font-size: 1.8rem;
  }

  .haunted-house {
    grid-template-columns: 1fr;
  }

  .ghost-sprite {
    font-size: 4rem;
  }

  .word-slot {
    width: 40px;
    height: 50px;
    font-size: 1.2rem;
  }

  .letter-tile {
    width: 40px;
    height: 50px;
    font-size: 1.1rem;
  }

  .tense-pairs {
    grid-template-columns: 1fr;
  }

  .nav-buttons {
    flex-wrap: wrap;
  }
}

/* ==================== 辅助类 ==================== */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

.text-glow {
  text-shadow: 0 0 10px currentColor;
}
