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

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.game-container {
  width: 100%;
  min-width: 320px;
  height: 100vh;
  min-height: 100vh;
  position: relative;
  overflow: auto;
}

/* PC端保持最小尺寸 */
@media (min-width: 1440px) {
  .game-container {
    min-width: 1440px;
  }
}

.page {
  width: 100%;
  min-height: 100%;
  display: none;
}

.page.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
}

@media (min-width: 768px) {
  .page.active {
    padding: 40px 20px;
  }
}

/* 答题页面样式 */
.quiz-page {
  background: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* 开始页面样式 */
.start-page {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.start-card {
  width: 180px;
  height: 90px;
  background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .start-card {
    width: 300px;
    height: 150px;
    border-radius: 24px;
    font-size: 72px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
  }
}

.start-card:hover {
  transform: scale(1.05);
  box-shadow: 0 25px 70px rgba(102, 126, 234, 0.6);
}

.start-card:active {
  transform: scale(0.98);
}

.title {
  color: #fff;
  font-size: 28px;
  margin-bottom: 15px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

@media (min-width: 768px) {
  .title {
    font-size: 48px;
    margin-bottom: 20px;
  }
}

.speaker-btn {
  font-size: 32px;
  cursor: pointer;
  margin-bottom: 15px;
  transition: transform 0.2s;
}

@media (min-width: 768px) {
  .speaker-btn {
    font-size: 48px;
    margin-bottom: 30px;
  }
}

.speaker-btn:hover {
  transform: scale(1.2);
}

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

.answer-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  min-height: 60px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  justify-content: center;
}

@media (min-width: 768px) {
  .answer-area {
    gap: 20px;
    margin-bottom: 60px;
    min-height: 80px;
    padding: 20px 40px;
    border-radius: 16px;
  }
}

.answer-slot {
  width: 50px;
  height: 50px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .answer-slot {
    width: 80px;
    height: 80px;
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 36px;
  }
}

.answer-slot.filled {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
  border: 3px solid #00b894;
  animation: popIn 0.3s ease;
}

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

.words-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 100%;
  padding: 10px;
}

@media (min-width: 768px) {
  .words-grid {
    gap: 20px;
    max-width: 800px;
    padding: 40px;
  }
}

.word-card {
  width: 60px;
  height: 60px;
  background: linear-gradient(145deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

@media (min-width: 768px) {
  .word-card {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    font-size: 42px;
  }
}

.word-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

.word-card:active {
  transform: scale(0.95);
}

.word-card.selected {
  opacity: 0.3;
  pointer-events: none;
}

.word-card.wrong {
  animation: shake 0.5s ease;
  border-color: #ff6b6b;
}

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

/* 成功提示 */
.success-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
  color: #fff;
  font-size: 36px;
  padding: 25px 50px;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0, 184, 148, 0.4);
  animation: successPop 0.5s ease;
  z-index: 1000;
}

@media (min-width: 768px) {
  .success-message {
    font-size: 64px;
    padding: 40px 80px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 184, 148, 0.4);
  }
}

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

/* 烟花页面样式 */
.firework-page {
  background: #000;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}

#fireworkCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.countdown {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 20px;
  border-radius: 8px;
  font-family: monospace;
  z-index: 10;
}

@media (min-width: 768px) {
  .countdown {
    top: 40px;
    right: 40px;
    font-size: 48px;
    padding: 10px 30px;
    border-radius: 12px;
  }
}

.hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  z-index: 10;
}

@media (min-width: 768px) {
  .hint {
    bottom: 40px;
    font-size: 24px;
  }
}
