/* === 캘리브레이션 화면 === */
.calibration-container {
  position: fixed;
  inset: 0;
  background: var(--night);
  background-image: url('../images/stars-bg.png');
  background-size: cover;
  background-position: center;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 어둠 오버레이 — 클릭할수록 밝아짐 */
.calibration-darkness {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0.85;
  z-index: 201;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* 시작 안내 메시지 */
.calibration-intro-msg {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: introFadeIn 0.6s ease;
}

.calibration-intro-msg .cal-intro-star {
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 1rem;
  animation: starBreath 2.5s ease-in-out infinite;
}

.calibration-intro-msg p {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.calibration-intro-msg span {
  font-size: 0.85rem;
  color: var(--sand);
  opacity: 0.8;
}

.calibration-intro-msg.fade-out {
  animation: introFadeOut 0.6s ease forwards;
}

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

@keyframes introFadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

/* 캘리브레이션 포인트 - 별 모양 (은은한 버전) */
.calibration-point {
  position: fixed;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle, var(--gold-light) 0%, var(--gold) 40%, transparent 75%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  z-index: 210;
  box-shadow: 0 0 10px rgba(244, 197, 66, 0.4), 0 0 25px rgba(244, 197, 66, 0.15);
  animation: starBreath 2.5s ease-in-out infinite;
}

.calibration-point::after {
  content: '';
  position: absolute;
  inset: 13px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  opacity: 1;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

@keyframes starBreath {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.95);
    box-shadow: 0 0 10px rgba(244, 197, 66, 0.4), 0 0 25px rgba(244, 197, 66, 0.15);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 0 14px rgba(244, 197, 66, 0.5), 0 0 30px rgba(244, 197, 66, 0.2);
  }
}

.calibration-point:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 18px rgba(244, 197, 66, 0.55), 0 0 35px rgba(244, 197, 66, 0.25);
}

.calibration-point:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.calibration-point:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.calibration-point.clicked-1 { background: radial-gradient(circle, #FFE17A 0%, #E8C840 50%, transparent 70%); }
.calibration-point.clicked-2 { background: radial-gradient(circle, #FFD54F 0%, #D4A82E 50%, transparent 70%); }
.calibration-point.clicked-3 { background: radial-gradient(circle, #FFC107 0%, #C09020 50%, transparent 70%); }
.calibration-point.clicked-4 { background: radial-gradient(circle, #FFB300 0%, #A08020 50%, transparent 70%); }

.calibration-point.completed {
  background: radial-gradient(circle, #A5D6A7 0%, var(--sage) 50%, transparent 70%);
  pointer-events: none;
  animation: pointComplete 0.5s ease;
  box-shadow: 0 0 12px rgba(123, 198, 126, 0.35);
}

@keyframes pointComplete {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.6); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* 검증 단계 별 - 부드럽지만 뚜렷한 amber 별빛 */
.calibration-point.validation-point {
  width: 52px;
  height: 52px;
  cursor: default;
  background: radial-gradient(circle,
    rgba(255, 235, 180, 0.5) 0%,
    rgba(244, 197, 66, 0.35) 30%,
    rgba(244, 197, 66, 0.1) 60%,
    transparent 80%);
  box-shadow:
    0 0 14px rgba(244, 197, 66, 0.35),
    0 0 35px rgba(244, 197, 66, 0.12);
  animation: validationPulse 2.5s ease-in-out infinite;
}

/* 외곽 가이드 링 — 부드러운 호흡 */
.calibration-point.validation-point::before {
  content: '';
  position: absolute;
  inset: -8px;
  border: 1.5px solid rgba(244, 197, 66, 0.18);
  border-radius: 50%;
  animation: validationRing 2.5s ease-in-out infinite;
}

/* 중심 코어 — 시선 초점 */
.calibration-point.validation-point::after {
  inset: 16px;
  background: rgba(255, 240, 200, 0.55);
  box-shadow: 0 0 8px rgba(244, 197, 66, 0.35);
}

@keyframes validationPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 0 14px rgba(244, 197, 66, 0.35),
      0 0 35px rgba(244, 197, 66, 0.12);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow:
      0 0 18px rgba(244, 197, 66, 0.45),
      0 0 45px rgba(244, 197, 66, 0.15);
  }
}

@keyframes validationRing {
  0%, 100% {
    border-color: rgba(244, 197, 66, 0.15);
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    border-color: rgba(244, 197, 66, 0.3);
    transform: scale(1.1);
    opacity: 1;
  }
}

/* 별 안 카운트다운 숫자 */
.validation-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255, 240, 200, 0.9);
  z-index: 2;
  text-shadow: 0 0 10px rgba(244, 197, 66, 0.3);
  line-height: 1;
}

/* 진행 텍스트 */
.calibration-progress-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  text-align: center;
  background: rgba(11, 16, 38, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  border: 1px solid var(--border);
}

.progress-text {
  font-size: 0.85rem;
  color: var(--sand);
  opacity: 0.8;
}

.progress-text--validation {
  color: var(--sand);
  font-weight: 600;
  opacity: 1;
}

/* 검증 결과 */
.validation-result {
  text-align: center;
  padding: 1.5rem;
}

.validation-result .accuracy-value {
  font-size: 3.5rem;
  font-weight: 700;
  margin: 0.75rem 0;
}

.validation-result .accuracy-value.good {
  color: var(--sage);
  text-shadow: 0 0 20px rgba(123, 198, 126, 0.3);
}

.validation-result .accuracy-value.fair {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(244, 197, 66, 0.3);
}

.validation-result .accuracy-value.poor {
  color: var(--rose);
  text-shadow: 0 0 20px rgba(232, 93, 117, 0.3);
}

.validation-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* === 캘리브레이션 공통 레이아웃 === */

/* 좌상단 뒤로가기/취소 버튼 */
.cal-back-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 250;
  background: rgba(11, 16, 38, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--sand);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cal-back-btn:hover {
  background: rgba(11, 16, 38, 0.85);
  color: var(--gold);
}

.cal-back-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 중앙 정렬 콘텐츠 wrapper */
.cal-section {
  text-align: center;
  max-width: 500px;
  width: 100%;
}

/* 제목 */
.cal-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--gold);
}

/* 부제목 */
.cal-subtitle {
  color: var(--sand-dark);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

/* 준비사항 리스트 */
.cal-tip-list {
  list-style: none;
  padding: 0;
  color: var(--sand-dark);
}

.cal-tip-list li {
  padding: 0.3rem 0;
}

.cal-tip-list li::before {
  content: '✦ ';
  color: var(--gold);
  opacity: 0.7;
}

/* 캘리브레이션 진행률 바 (하단) */
.cal-progress {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  width: min(360px, calc(100% - 2rem));
  background: rgba(11, 16, 38, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.6rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.cal-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.cal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.cal-progress-text {
  font-size: 0.8rem;
  color: var(--sand);
  opacity: 0.8;
  text-align: center;
}

/* 에러 아이콘 */
.cal-error-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* 결과 화면 피드백 카드 */
.cal-result-tips {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-top: 1rem;
  text-align: left;
}

.cal-result-tips .tip-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rose);
  margin-bottom: 0.5rem;
}

.cal-result-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cal-result-tips li {
  padding: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--sand-dark);
  line-height: 1.5;
}

.cal-result-tips li::before {
  content: '→ ';
  color: var(--gold);
  opacity: 0.6;
}

/* 결과 피드백 메시지 */
.cal-result-msg {
  font-size: 0.9rem;
  color: var(--sand);
  margin-top: 0.5rem;
  line-height: 1.6;
}

/* 로딩 텍스트 */
.cal-loading-title {
  margin-bottom: 0.75rem;
  color: var(--gold);
}

.cal-loading-desc {
  color: var(--sand-dark);
}

/* 반응형 */
@media (max-width: 768px) {
  .calibration-point {
    width: 44px;
    height: 44px;
  }

  .calibration-point::after {
    inset: 12px;
  }

  .calibration-point.validation-point {
    width: 58px;
    height: 58px;
  }

  .calibration-point.validation-point::after {
    inset: 18px;
  }

  .validation-countdown {
    font-size: 1.15rem;
  }

  .calibration-progress-bar {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    transform: none;
  }

  .cal-back-btn {
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .cal-progress {
    bottom: 1rem;
    width: calc(100% - 2rem);
  }
}

/* reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .calibration-point {
    animation: none;
  }

  .calibration-intro-msg .cal-intro-star {
    animation: none;
  }

  .calibration-point.completed {
    animation: none;
  }

  .calibration-point.validation-point {
    animation: none;
  }

  .calibration-point.validation-point::before {
    animation: none;
  }

  .cal-progress-fill {
    transition: none;
  }
}
