/* ========== 게임 스테이지 ========== */
.game-stage {
  height: 45vh;
  min-height: 280px;
  max-height: 520px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  position: relative;
}

/* 떨어지는 한자 */
.falling-char {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: clamp(64px, 14vw, 108px);
  line-height: 1;
  opacity: 0.95;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  /* 튐 방지: will-change 제거, transition 최소화 */
}

/* 정답 애니메이션 */
.falling-char.hit {
  animation: correct-pop 350ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  color: #28a745;
}

@keyframes correct-pop {
  0% { transform: translate(-50%, 0) scale(1); }
  50% { transform: translate(-50%, 0) scale(1.3); }
  100% { transform: translate(-50%, 0) scale(1); }
}

/* 오답 애니메이션 */
.falling-char.miss {
  animation: wrong-shake 400ms ease;
  color: #dc3545;
}

@keyframes wrong-shake {
  0%, 100% { transform: translate(-50%, 0); }
  10%, 30%, 50%, 70%, 90% { transform: translate(calc(-50% - 8px), 0); }
  20%, 40%, 60%, 80% { transform: translate(calc(-50% + 8px), 0); }
}

/* ========== 보기 버튼 ========== */
.option-btn {
  min-height: 64px;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-width: 2px;
}

.option-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.option-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* 힌트로 비활성화된 버튼 */
.option-disabled {
  opacity: 0.3;
  pointer-events: none;
  text-decoration: line-through;
}

/* 버튼 클릭 피드백 - 정답 */
.option-btn.btn-correct {
  animation: btn-correct-flash 600ms ease;
}

@keyframes btn-correct-flash {
  0%, 100% { 
    border-color: inherit;
    background-color: transparent;
  }
  50% { 
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.2);
    transform: scale(1.05);
  }
}

/* 버튼 클릭 피드백 - 오답 */
.option-btn.btn-wrong {
  animation: btn-wrong-flash 600ms ease;
}

@keyframes btn-wrong-flash {
  0%, 100% { 
    border-color: inherit;
    background-color: transparent;
  }
  50% { 
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.2);
    transform: scale(0.95);
  }
}

/* ========== HUD 카드 ========== */
.card {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/* 라이프 깜빡임 효과 */
#life.blink-warning {
  animation: life-blink 500ms ease;
}

@keyframes life-blink {
  0%, 100% { color: inherit; }
  50% { 
    color: #ffc107; 
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    transform: scale(1.1);
  }
}

/* 점수 증가 애니메이션 */
#score.score-increase {
  animation: score-bounce 400ms ease;
}

@keyframes score-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); color: #28a745; }
}

/* 콤보 효과 */
#combo.combo-fire {
  animation: combo-fire 500ms ease;
}

@keyframes combo-fire {
  0%, 100% { transform: scale(1); }
  50% { 
    transform: scale(1.3); 
    color: #fd7e14;
    text-shadow: 0 0 10px rgba(253, 126, 20, 0.5);
  }
}

/* ========== 진행률 바 ========== */
.progress {
  border-radius: 10px;
  background-color: #e9ecef;
}

.progress-bar {
  transition: width 1s linear;
  border-radius: 10px;
}

/* ========== 토스트 메시지 ========== */
.game-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 200px;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toast-slide-in 300ms ease;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.toast-correct {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

.toast-wrong {
  background: linear-gradient(135deg, #dc3545, #fd7e14);
  color: white;
}

.toast-hint {
  background: linear-gradient(135deg, #ffc107, #fd7e14);
  color: white;
}

/* ========== 반응형 ========== */
@media (max-width: 576px) {
  .option-btn {
    min-height: 56px;
    font-size: 1rem;
  }
  
  .falling-char {
    font-size: clamp(48px, 12vw, 80px);
  }
  
  .game-stage {
    min-height: 240px;
  }
}

/* ========== 접근성 ========== */
.btn:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
}

/* 다크 모드 대응 (선택사항) */
@media (prefers-color-scheme: dark) {
  .game-stage {
    background: linear-gradient(180deg, #2d3436 0%, #1e272e 100%);
  }
  
  .card {
    background-color: #2d3436;
    border-color: #3d4449;
    color: #f8f9fa;
  }
}