/* ==========================================================================
   RE:PERSONAL — Diagnosis Quiz Page
   1-5 Likert Scale UI
   ========================================================================== */

/* ── Intro ─────────────────────────────────────────────────────────────── */

.diag-intro {
  min-height: 100vh;
  background: #09090B;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem var(--pad);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

/* Staggered fade-in for intro elements */
.intro-wrap > * {
  opacity: 0;
  transform: translateY(16px);
  animation: intro-el-in 0.7s ease forwards;
}

.intro-wrap > *:nth-child(1) { animation-delay: 0.3s; }
.intro-wrap > *:nth-child(2) { animation-delay: 0.5s; }
.intro-wrap > *:nth-child(3) { animation-delay: 0.7s; }
.intro-wrap > *:nth-child(4) { animation-delay: 1.0s; }
.intro-wrap > *:nth-child(5) { animation-delay: 1.3s; }
.intro-wrap > *:nth-child(6) { animation-delay: 1.5s; }
.intro-wrap > *:nth-child(7) { animation-delay: 1.7s; }

@keyframes intro-el-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide nav and footer on diagnosis page */
body.page-diagnosis .nav,
body.page-diagnosis .footer {
  display: none;
}

body.page-diagnosis {
  background: #09090B;
}

/* Back button */
.diag-back {
  position: fixed;
  top: 1.2rem;
  left: 1.5rem;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: rgba(250,250,250,0.4);
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.2s;
}

.diag-back:hover {
  color: rgba(250,250,250,0.8);
}

.diag-back svg {
  width: 16px;
  height: 16px;
}

.diag-intro.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-wrap {
  max-width: 640px;
  width: 100%;
}

.intro-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(250,250,250,0.25);
  margin-bottom: 1.5rem;
}

.intro-title {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3rem);
  color: #FAFAFA;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
}

.intro-desc {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  color: rgba(250,250,250,0.4);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.intro-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.intro-process-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 64px;
  padding: 0.8rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(250,250,250,0.06);
  background: rgba(250,250,250,0.02);
}

.intro-process-step--result {
  border-color: rgba(250,250,250,0.15);
  background: rgba(250,250,250,0.05);
}

.intro-process-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(250,250,250,0.2);
}

.intro-process-step--result .intro-process-num {
  color: rgba(250,250,250,0.5);
}

.intro-process-label {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(250,250,250,0.6);
  white-space: nowrap;
}

.intro-process-step--result .intro-process-label {
  color: #FAFAFA;
}

.intro-process-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.58rem;
  color: rgba(250,250,250,0.2);
}

.intro-process-arrow {
  color: rgba(250,250,250,0.12);
  font-size: 0.7rem;
  padding: 0 0.15rem;
  flex-shrink: 0;
}

.intro-details {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.intro-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.intro-detail-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  color: rgba(250,250,250,0.2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.intro-detail-value {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(250,250,250,0.7);
}

.intro-detail-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(250,250,250,0.1);
}

/* Track selection */
.intro-track-section {
  margin-bottom: 2.5rem;
}

.intro-track-question {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(250,250,250,0.5);
  margin-bottom: 1rem;
}

.intro-tracks {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.intro-track-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.2rem 1rem;
  border: 1px solid rgba(250,250,250,0.08);
  border-radius: 10px;
  background: rgba(250,250,250,0.02);
  cursor: pointer;
  transition: all 0.25s;
  flex: 1;
  max-width: 180px;
  text-align: center;
}

.intro-track-btn:hover {
  border-color: rgba(250,250,250,0.2);
  background: rgba(250,250,250,0.05);
}

.intro-track-btn.selected {
  border-color: #FAFAFA;
  background: rgba(250,250,250,0.08);
}

.intro-track-icon {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(250,250,250,0.2);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(250,250,250,0.1);
  border-radius: 6px;
}

.intro-track-btn.selected .intro-track-icon {
  background: #FAFAFA;
  color: #09090B;
  border-color: #FAFAFA;
}

.intro-track-title {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  color: rgba(250,250,250,0.7);
}

.intro-track-desc {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-size: 0.68rem;
  color: rgba(250,250,250,0.25);
  line-height: 1.4;
}

@media (max-width: 540px) {
  .intro-tracks { flex-direction: column; align-items: center; }
  .intro-track-btn { max-width: 280px; width: 100%; }
}

.intro-start-btn {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #09090B;
  background: #FAFAFA;
  border: none;
  padding: 0.85rem 2.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: -0.01em;
}

.intro-start-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(250,250,250,0.12);
}

.intro-note {
  font-family: 'Pretendard Variable', 'Pretendard', sans-serif;
  font-size: 0.7rem;
  color: rgba(250,250,250,0.15);
  margin-top: 1rem;
}

@media (max-width: 540px) {
  .intro-process-arrow { display: none; }
  .intro-process { flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
  .intro-process-step { min-width: 56px; }
}

.diag-eyebrow {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.diag-title {
  font-weight: 800;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: var(--space-lg);
}

.diag-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 480px;
  margin: 0 auto var(--space-2xl);
}

/* ── Axis Grid: 3x2 ───────────────────────────────────────────────────── */

.diag-axes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  max-width: 420px;
  margin: 0 auto var(--space-2xl);
}

@media (min-width: 640px) {
  .diag-axes { grid-template-columns: repeat(3, 1fr); }
}

.diag-axis {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.axis-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.axis-text {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.diag-meta {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.03em;
}

.diag-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-md);
}

/* ── Quiz Visualization ───────────────────────────────────────────────── */

.quiz-viz-container {
  width: 320px;
  height: 320px;
  margin: 0 auto var(--space-md);
  pointer-events: none;
}

.quiz-viz-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 480px) {
  .quiz-viz-container {
    width: 260px;
    height: 260px;
  }
}

/* ── Quiz Section ─────────────────────────────────────────────────────── */

#quiz-section {
  padding: calc(var(--nav-h) + var(--space-xl)) 0 var(--space-3xl);
  min-height: 100vh;
  background: #09090B;
  color: #FAFAFA;
}

.quiz-container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ── Quiz Header: Progress + Counter ──────────────────────────────────── */

.quiz-header {
  margin-bottom: var(--space-3xl);
}

.progress-track {
  width: 100%;
  height: 3px;
  background: rgba(250,250,250,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.progress-fill {
  height: 100%;
  background: #FAFAFA;
  width: 0;
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-counter {
  display: block;
  text-align: right;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: rgba(250,250,250,0.3);
  font-variant-numeric: tabular-nums;
}

/* ── Quiz Body ────────────────────────────────────────────────────────── */

.quiz-body {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.q-category {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.75rem;
  color: rgba(250,250,250,0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xl);
}

.q-text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  line-height: 1.6;
  color: #FAFAFA;
  margin: 0 auto var(--space-2xl);
  max-width: 520px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ── Likert Scale Buttons ─────────────────────────────────────────────── */

.q-scale {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
  max-width: 520px;
  margin: 0 auto;
}

.scale-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-md) var(--space-xs);
  border: 1.5px solid rgba(250,250,250,0.12);
  border-radius: var(--radius-md);
  background: rgba(250,250,250,0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 88px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.scale-btn:hover {
  background: rgba(250,250,250,0.08);
  border-color: rgba(250,250,250,0.2);
}

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

.scale-btn.selected {
  background: #FAFAFA;
  border-color: #FAFAFA;
}

.scale-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: rgba(250,250,250,0.7);
  line-height: 1;
}

.scale-btn.selected .scale-num {
  color: #09090B;
}

.scale-label {
  font-family: var(--font-body);
  font-size: 0.62rem;
  color: rgba(250,250,250,0.3);
  text-align: center;
  line-height: 1.3;
  white-space: pre-line;
}

.scale-btn.selected .scale-label {
  color: rgba(9, 9, 11, 0.5);
}

/* ── Quiz Navigation ──────────────────────────────────────────────────── */

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
}

.btn-text {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(250,250,250,0.4);
  cursor: pointer;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  transition: color 0.2s, background 0.2s;
}

.btn-text:hover {
  color: rgba(250,250,250,0.7);
  background: rgba(250,250,250,0.06);
}

.quiz-nav .btn-primary {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: #09090B;
  background: #FAFAFA;
  border: none;
  padding: 0.7rem 2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
}

.quiz-nav .btn-primary:hover {
  background: #fff;
}

.quiz-nav .btn-primary:active {
  transform: scale(0.98);
}

.quiz-nav .btn-primary:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Calculating Section ──────────────────────────────────────────────── */

.calc-section {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calc-content {
  text-align: center;
}

.calc-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-xl);
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 2.5px solid #F4F4F5;
  border-top-color: #18181B;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.calc-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .q-scale {
    gap: 4px;
  }

  .scale-btn {
    min-height: 72px;
    padding: var(--space-sm) 2px;
    border-radius: var(--radius-sm);
  }

  .scale-num {
    font-size: 1.05rem;
  }

  .scale-label {
    font-size: 0.55rem;
  }

  .quiz-nav .btn-primary {
    padding: 0.65rem 1.4rem;
  }

  .btn-text {
    padding: 0.65rem 0.8rem;
  }
}

@media (max-width: 360px) {
  .scale-label {
    display: none;
  }

  .scale-btn {
    min-height: 56px;
    padding: var(--space-sm);
  }
}
