/* public-test.css — habit/test.html 인라인 <style>에서 이동 (C4, 2026-08-22)
   규칙 순서·셀렉터·값 무변경. */

/* 변수: app/static/css/tokens.css 의 `html.scope-exam` 블록 */

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

body {
  background: var(--navy);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  min-height: 100vh;
}

/* ── 헤더 ── */
.exam-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy2);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.exam-progress-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── 진행바 ── */
.progress-bar-wrap {
  height: 4px;
  background: var(--navy3);
}

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

/* ── 메인 컨테이너 ── */
.exam-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

/* ── 영역 헤더 ── */
.area-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.area-badge {
  display: inline-block;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.area-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.area-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── 문항 카드 ── */
.question-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.question-card.answered {
  border-color: rgba(201, 168, 76, 0.4);
}

.question-no {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.question-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
  font-weight: 500;
}

/* ── 선택지 ── */
.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

.choice-btn:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
}

.choice-btn.selected {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.16);
  color: #8a6a13;
}

.choice-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 0.15s;
}

.choice-btn.selected .choice-marker {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
}

.direct-choice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.direct-time-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 8px 56px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.direct-time-inputs input {
  width: 72px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--navy2);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.95rem;
  text-align: center;
}

.direct-time-inputs input:disabled {
  background: var(--navy3);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.65;
}

/* 취침 시각(clock) 직접기입 — 입력폭·간격은 .direct-time-inputs 를 그대로 상속 */
.direct-clock-inputs {
  flex-wrap: wrap;
}

.direct-clock-preview {
  margin-left: 4px;
  color: var(--gold, #c9a84c);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.direct-clock-hint {
  padding: 0 16px 6px 56px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: keep-all;
}

.direct-clock-warn {
  margin: 0 16px 8px 56px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 8px;
  background: rgba(255, 176, 32, 0.1);
  color: #ffb020;
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: keep-all;
}

.direct-input-wrap {
  margin-top: 10px;
}

.direct-input-field {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--navy2);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.98rem;
  box-sizing: border-box;
}

.direct-input-field:focus {
  outline: none;
  border-color: var(--gold, #c9a84c);
}

/* v1.5 Q50-9 직접 입력 안내문(2026-09-22, P4a).
   이 클래스를 쓰는 마크업은 v1.5 Q50 에서만 렌더된다 — v1.3 화면에는 나타나지 않는다. */
.direct-input-hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: keep-all;
}

@media (max-width: 520px) {
  .direct-time-inputs {
    padding-left: 0;
    flex-wrap: wrap;
  }

  .direct-time-inputs input {
    width: 64px;
  }

  .direct-clock-preview {
    flex-basis: 100%;
    margin-left: 0;
    white-space: normal;
  }

  .direct-clock-hint,
  .direct-clock-warn {
    padding-left: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .direct-clock-warn {
    padding-left: 10px;
  }
}

/* ── 내부보정 섹션 안내 ── */
.correction-notice {
  background: rgba(79, 140, 255, 0.08);
  border: 1px solid rgba(79, 140, 255, 0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.correction-notice strong {
  color: var(--blue);
}

/* ── 하단 네비게이션 ── */
.exam-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy2);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Noto Sans KR', sans-serif;
  border: none;
}

.nav-btn-prev {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.nav-btn-prev:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.nav-btn-next {
  background: var(--gold);
  color: var(--navy);
  flex: 1;
  max-width: 300px;
}

.nav-btn-next:hover {
  background: var(--gold-light);
}

.nav-btn-next:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.nav-btn-submit {
  background: var(--success);
  color: #fff;
  flex: 1;
  max-width: 300px;
}

.nav-btn-submit:hover {
  opacity: 0.9;
}

.nav-btn-submit:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.nav-page-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── 로딩 ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 246, 250, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 16px;
}

.loading-overlay.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── 에러 ── */
.error-box {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: #f85149;
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: none;
}

/* ── 답변 미완료 경고 ── */
.question-card.unanswered-warn {
  border-color: rgba(248, 81, 73, 0.5);
  animation: shake 0.3s ease;
}

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