/* Reusable test runner styles for static quiz pages (love-language, conflict-style, etc.) */

.test-screen {
  display: block;
  margin-bottom: 8px;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
[hidden] { display: none !important; }

/* JS boot 후 entrance 애니메이션이 첫 화면을 채우므로 깜빡임 방지로 opacity 0 시작.
   JS 미로드 폴백: .js-ready 없으면 평소처럼 visible. */
body.js-ready .test-screen:not([hidden]) {
  opacity: 0;
}

/* ---- Background scene (drifting blobs + rising hearts) ---- */
/* 콘텐츠 뒤로 완전히 들어가도록 음수 z-index.
   body는 isolation으로 stacking context root를 만들어 의도치 않은 z-index 충돌 방지. */
body { isolation: isolate; }
.bgScene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
body.show-bg-scene .bgScene { opacity: 1; }

.bgBlob,
.bgHeart {
  position: absolute;
  will-change: transform;
}
.bgBlob {
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.65;
}
.bgHeart {
  width: 18px;
  height: 18px;
  color: rgba(236, 90, 138, 0.55);
  opacity: 0.8;
}

/* ---- Card mode: quiz/result containers shrink to 480px floating card ---- */
/* HTML에서 #quiz, #result에 class="card-mode" 추가 시 활성화 */
.test-screen.card-mode {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(236, 90, 138, 0.12);
  border: 1px solid rgba(251, 228, 236, 0.6);
}
.test-screen.card-mode + .test-screen.card-mode { margin-top: 16px; }

/* ---- Analyzing screen: cute pulsing dots while we "analyze" answers ---- */
#analyzing .analyzingContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 12px 16px;
}
.analyzingBeats {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.analyzingBeats span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f47aa3 0%, #ec5a8a 100%);
  animation: analyzeBounce 1s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  box-shadow: 0 4px 14px rgba(236, 90, 138, 0.32);
}
.analyzingBeats span:nth-child(2) { animation-delay: 0.15s; }
.analyzingBeats span:nth-child(3) { animation-delay: 0.3s; }
@keyframes analyzeBounce {
  0%, 80%, 100% { transform: translateY(0) scale(1); opacity: 0.65; }
  40% { transform: translateY(-12px) scale(1.15); opacity: 1; }
}
#analyzing h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #2a1a23;
}
#analyzing p {
  margin: 0;
  font-size: 14px;
  color: #8b6675;
}

/* 카드 모드(테스트 진행 중)일 때만 외곽 요소 숨김 — 테스트에 집중.
   배경 scene 자체는 인트로에서도 노출되므로 토글이 분리되어 있음. */
body.testing-active .crumbs,
body.testing-active #intro,
body.testing-active #about-this-test,
body.testing-active .related {
  display: none !important;
}
body.testing-active .article {
  background: transparent;
  box-shadow: none;
  border: none;
  padding-top: 24px;
}

/* Reference panel (5가지 유형 설명 등) — 결과 화면 안에서만 표시되는 보조 정보 */
.panel.reference,
.panel.about-detail {
  background: #fff8fb;
  border-color: #fce4ec;
}
.panel.reference h2,
.panel.about-detail h2 {
  font-size: 16px;
  margin-bottom: 12px;
}
.panel.about-detail h3 {
  font-size: 14px;
  margin: 14px 0 6px;
  color: #2a1a23;
}
.panel.about-detail p {
  font-size: 14px;
  line-height: 1.6;
  color: #4a3340;
  margin: 0 0 10px;
}
.panel.about-detail p:last-child { margin-bottom: 0; }
.panel.about-detail ul {
  margin: 6px 0 12px;
  padding-left: 20px;
}
.panel.about-detail li {
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 4px;
}
.reference-list {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}
.reference-list li {
  font-size: 14px;
  line-height: 1.55;
  color: #4a3340;
  margin-bottom: 6px;
}
.reference-list li:last-child {
  margin-bottom: 0;
}
.reference-list strong {
  color: #2a1a23;
}
.reference-note {
  margin-top: 12px;
  font-size: 13px;
  color: #8b6675;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.actions > * { flex: 1 1 0; min-width: 0; }

.bottomBar {
  margin-top: 28px;
}

.primaryButton,
.secondaryButton,
.answerButton {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  font: inherit;
  text-align: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease;
}
.primaryButton, .secondaryButton {
  border: 0;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}
.primaryButton {
  background: linear-gradient(135deg, #f47aa3 0%, #ec5a8a 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(236, 90, 138, 0.32);
}
.primaryButton:disabled { background: #f1d6df; cursor: not-allowed; box-shadow: none; }
.secondaryButton {
  background: #ffe4ee;
  color: #b8366b;
}

.textButton {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #8b6675;
  padding: 8px 0;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}

.testHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  color: #a07d8c;
  font-size: 14px;
  margin: 14px 0 8px;
}

.progressTrack, .meterTrack {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #fce4ec;
}
.progressFill, .meterFill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.45s ease;
}
.progressFill { background: linear-gradient(90deg, #ec5a8a, #f8a5c2); }

/* meter color variants — primary uses pink, others use lilac */
.meterFill.anxietyFill { background: linear-gradient(90deg, #ec5a8a, #f8a5c2); }
.meterFill.avoidanceFill { background: linear-gradient(90deg, #b889d9, #d4a8f0); }

.questionBlock { padding: 28px 0 18px; }
.questionBlock h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.35;
  color: #2a1a23;
}

.answerList {
  display: grid;
  gap: 10px;
}
.answerButton {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid #f3d9e2;
  background: #fff;
  color: #4a3340;
  text-align: left;
}
.answerButton.selected {
  border-color: #ec5a8a;
  background: #fff0f5;
  color: #b8366b;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #ec5a8a, 0 4px 14px rgba(236, 90, 138, 0.18);
}
.answerMark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #d8b8c4;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}
.answerButton.selected .answerMark { border-color: #ec5a8a; }
.answerMarkDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ec5a8a;
  display: block;
}

.resultHero { padding: 12px 0 0; }
.resultHero h1 { font-size: 30px; margin: 6px 0 8px; }
.resultHero p { margin: 0; }

.resultCounter,
.hubTotalCounter {
  font-size: 13px;
  color: #b8366b;
  font-weight: 600;
  min-height: 1.55em; /* skeleton과 텍스트 모두 같은 높이 → layout shift 방지 */
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.resultCounter { margin-top: 10px !important; }
.hubTotalCounter { margin: 14px 0 0; }

/* hidden 상태에서도 공간 유지: visibility로만 숨김 */
.resultCounter[hidden],
.hubTotalCounter[hidden] {
  display: block !important;
  visibility: hidden;
}

/* 로딩 중 skeleton: 둥근 막대 + shimmer */
.resultCounter[data-loading],
.hubTotalCounter[data-loading] {
  visibility: visible;
  color: transparent !important;
  user-select: none;
  position: relative;
}
.resultCounter[data-loading]::before,
.hubTotalCounter[data-loading]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 180px;
  max-width: 60%;
  height: 0.95em;
  border-radius: 6px;
  transform: translateY(-50%);
  background: linear-gradient(
    90deg,
    rgba(251, 228, 236, 0.7) 0%,
    rgba(255, 240, 245, 0.95) 50%,
    rgba(251, 228, 236, 0.7) 100%
  );
  background-size: 200% 100%;
  animation: counterShimmer 1.4s ease-in-out infinite;
}
.hubTotalCounter[data-loading]::before {
  left: 0;
}
@keyframes counterShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .resultCounter[data-loading]::before,
  .hubTotalCounter[data-loading]::before {
    animation: none;
  }
}

/* ---- Feedback widget (별점 + 의견) ---- */
.feedbackWidget {
  margin-top: 28px;
  padding: 20px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffe9f0 0%, #fde2ed 100%);
  border: 1px solid #fbe4ec;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feedbackTitle {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #2a1a23;
}
.feedbackStars {
  display: flex;
  gap: 6px;
}
.feedbackStar {
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  line-height: 0;
  border-radius: 8px;
  transition: transform 0.15s ease;
}
.feedbackStar:hover { transform: scale(1.08); }
.feedbackStar:active { transform: scale(0.94); }
.feedbackStar svg {
  width: 30px;
  height: 30px;
  fill: #f4c8d6;
  transition: fill 0.15s ease;
}
.feedbackStar.hover svg,
.feedbackStar.active svg {
  fill: #ec5a8a;
}
.feedbackStar:focus-visible {
  outline: 2px solid #ec5a8a;
  outline-offset: 2px;
}
.feedbackComment {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f3d9e2;
  background: #fff;
  font: inherit;
  letter-spacing: -0.01em;
  color: #4a3340;
}
.feedbackComment:focus {
  outline: 2px solid #ec5a8a;
  outline-offset: 1px;
  border-color: transparent;
}
.feedbackSubmit {
  align-self: flex-end;
  width: auto;
  min-width: 120px;
  min-height: 44px;
  padding: 10px 22px;
}
.feedbackThanks {
  margin: 4px 0;
  font-size: 14px;
  color: #b8366b;
  font-weight: 600;
}

.panel {
  margin-top: 16px;
  border: 1px solid #fbe4ec;
  border-radius: 18px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(236, 90, 138, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.panel > * { margin-block: 6px; }
.panel > *:first-child { margin-top: 0; }
.panel > *:last-child { margin-bottom: 0; }
.meter + .meter { margin-top: 14px; }
.meterHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #4a3340;
}

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff4e1;
  color: #8a5a00;
  font-size: 14px;
  margin: 10px 0;
}
