/* ===================== 05 진단 질문 ===================== */
.diagnosis {
  position: relative;
  /* 답변 반영 연출의 보이지 않는 안내 문구가 좁은 화면에서 가로 스크롤을 만들지 않게 한다. */
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px var(--page-pad) 40px;
}
.diagnosis-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.diagnosis-eyebrow {
  color: var(--color-brand-blue);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}
.diagnosis-intro h1 {
  margin-top: 5px;
  font-size: 34px;
  line-height: 44px;
}
.diagnosis-sub {
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 22px;
}
.diagnosis-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: none;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.status-badge .dot {
  width: 7px;
  height: 7px;
}
.status-badge--blue {
  background: var(--color-bg-soft-blue);
}
.status-badge--blue .dot {
  background: var(--color-brand-blue);
}
.status-badge--lime {
  background: var(--color-bg-soft-lime);
}
.status-badge--lime .dot {
  background: var(--color-status-positive);
}
.diagnosis-stage {
  padding: 24px;
}
.analysis-glass {
  position: relative;
  height: 196px;
  transition: transform 700ms ease, opacity 700ms ease;
}
.glass-doc {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 13px 23px;
  border-radius: 20px;
  border: 1px solid rgba(53, 87, 255, 0.14);
  background: linear-gradient(to right, #e8edff 0%, #f6f8ff 56%, #f4ffe0 100%);
}
.glass-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(32px);
}
.glass-glow--blue {
  right: 70px;
  top: -119px;
  width: 330px;
  height: 330px;
  background: rgba(53, 87, 255, 0.24);
}
.glass-glow--lime {
  right: -60px;
  top: 33px;
  width: 270px;
  height: 270px;
  background: rgba(199, 255, 51, 0.34);
}
.glass-doc-title {
  position: relative;
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}
.glass-typing {
  position: relative;
  min-height: 56px;
  margin-top: 6px;
  color: rgba(105, 108, 118, 0.8);
  font-size: 12px;
  line-height: 18px;
}
.glass-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  border-radius: 1px;
  background: rgba(53, 87, 255, 0.88);
}
.analysis-glass.is-typed .glass-cursor {
  animation: caret-blink 1s steps(1, end) infinite;
}
.glass-rows {
  position: relative;
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: pre-wrap;
}
.glass-rows li:nth-child(2) {
  opacity: 0.44;
}
.glass-rows li:nth-child(3) {
  opacity: 0.3;
}
.glass-rows li:nth-child(4) {
  opacity: 0.22;
}
.glass-rows b {
  font-weight: 600;
}
.glass-front {
  position: absolute;
  inset: -1px;
  padding: 51px 39px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(250, 250, 247, 0.35);
  backdrop-filter: blur(3.5px);
  -webkit-backdrop-filter: blur(3.5px);
}
.glass-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 19px;
}
.glass-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(53, 87, 255, 0.62);
}
.glass-pulse {
  position: absolute;
  left: 39px;
  top: 76px;
  width: 40px;
  height: 42px;
}
.pulse-ring {
  position: absolute;
  left: 0.75px;
  top: 3.75px;
  width: 38.5px;
  height: 38.5px;
  border-radius: 50%;
  border: 1.5px solid rgba(53, 87, 255, 0.14);
}
.pulse-dot {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse-blue 3.76s ease-in-out infinite;
}
.pulse-dot--blue {
  background: #3557ff;
}
.pulse-dot--lime {
  background: #c7ff33;
  animation-name: pulse-lime;
}
/* 크로스 펄스: 상태마다 0.62초 머문 뒤 0.32초 ease-in-out 이동 (4단계 3.76초 순환) */
@keyframes pulse-blue {
  0%,
  16.49%,
  100% {
    left: 20px;
    top: 7px;
    width: 14px;
    height: 14px;
    opacity: 1;
  }
  25%,
  41.49% {
    left: 36px;
    top: 23px;
    width: 10px;
    height: 10px;
    opacity: 0.9;
  }
  50%,
  66.49% {
    left: 20px;
    top: 39px;
    width: 5px;
    height: 5px;
    opacity: 0.72;
  }
  75%,
  91.49% {
    left: 4px;
    top: 23px;
    width: 10px;
    height: 10px;
    opacity: 0.9;
  }
}
@keyframes pulse-lime {
  0%,
  16.49%,
  100% {
    left: 20px;
    top: 39px;
    width: 5px;
    height: 5px;
    opacity: 0.72;
  }
  25%,
  41.49% {
    left: 4px;
    top: 23px;
    width: 10px;
    height: 10px;
    opacity: 0.9;
  }
  50%,
  66.49% {
    left: 20px;
    top: 7px;
    width: 14px;
    height: 14px;
    opacity: 1;
  }
  75%,
  91.49% {
    left: 36px;
    top: 23px;
    width: 10px;
    height: 10px;
    opacity: 0.9;
  }
}
.glass-caption {
  margin: 30px 0 0 64px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 18px;
}
.question-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-16);
  border: 1px solid var(--color-border-subtle);
  background: #fff;
  box-shadow: var(--shadow-floating);
}
.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.question-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  line-height: 26px;
}
.question-title .dot {
  width: 9px;
  height: 9px;
  background: var(--color-brand-lime);
}
.question-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-brand-blue);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.question-counter span {
  font-size: 24px;
  line-height: 24px;
}
.question-choices {
  margin: 0;
  padding: 0;
  border: 0;
}
.question-label,
.question-prompt {
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}
.question-prompt {
  display: flex;
  align-items: center;
  gap: 6px;
}
.question-emoji {
  font-size: 30px;
  line-height: 30px;
}
/* 여러 개 선택 가능 표시와 질문 이유 (AI가 이 정보를 묻는 이유) */
.question-mode {
  margin-left: 6px;
  color: var(--color-brand-blue);
  font-size: 12px;
  font-weight: 600;
}
.question-reason {
  margin: 4px 0 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 18px;
}
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.choice-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.choice-chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
.choice-chip input:checked + span {
  border-color: var(--color-brand-blue);
  background: var(--color-bg-soft-blue);
  color: var(--color-brand-blue);
  font-weight: 600;
}
.choice-chip input:focus-visible + span {
  outline: 3px solid var(--color-brand-blue);
  outline-offset: 2px;
}
.answer-box {
  position: relative;
}
.answer-box textarea {
  display: block;
  width: 100%;
  height: 130px;
  padding: 15px 17px 30px;
  border-radius: 14px;
  border: 1px solid var(--color-border-strong);
  resize: vertical;
  font-size: 14px;
  line-height: 22px;
}
.answer-box--tall textarea {
  height: 162px;
}
.answer-box textarea::placeholder {
  color: var(--color-text-secondary);
  font-size: 13px;
}
.answer-box textarea:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 3px rgba(53, 87, 255, 0.14);
}
.answer-count {
  position: absolute;
  right: 17px;
  bottom: 10px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
}
/* 결과 분석 중 진행 표시 (질문 카드 바로 앞). 기다리는 동안 입력은 잠기고, 막대는 끝을 알 수 없는 진행(indeterminate)을 보여 준다. */
.diagnosis-report-progress {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-16);
  border: 1px solid var(--color-brand-blue);
  background: var(--color-bg-soft-blue);
}
.diagnosis-report-progress[hidden] {
  display: none;
}
.diagnosis-report-progress:focus-visible {
  outline: 3px solid var(--color-brand-blue);
  outline-offset: 3px;
}
.diagnosis-report-progress-copy {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.diagnosis-report-progress-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(53, 87, 255, 0.18);
  overflow: hidden;
}
.diagnosis-report-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 36%;
  border-radius: inherit;
  background: var(--color-brand-blue);
  animation: diagnosis-report-progress-slide 1.4s ease-in-out infinite;
}
@keyframes diagnosis-report-progress-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(280%);
  }
}
/* 동작 줄이기: 움직이지 않는 고정 진행 상태 */
:root[data-motion='reduce'] .diagnosis-report-progress-bar {
  animation: none;
  width: 100%;
  opacity: 0.55;
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) .diagnosis-report-progress-bar {
    animation: none;
    width: 100%;
    opacity: 0.55;
  }
}
.question-card[aria-busy='true'] textarea:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}
.diagnosis-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 80px;
  padding: 0 16px 0 24px;
  border-top: 1px solid var(--color-border-subtle);
}
.diagnosis-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.diagnosis-note .dot {
  width: 9px;
  height: 9px;
  background: var(--color-status-positive);
}
.diagnosis-error {
  color: var(--color-status-error);
  font-size: 13px;
  font-weight: 600;
}
.diagnosis-next {
  min-width: 244px;
  height: 48px;
}
.diagnosis.is-absorbing .analysis-glass {
  transform: scale(0.98);
  opacity: 0.6;
}
.diagnosis.is-reflecting-answer .question-card {
  pointer-events: none;
}
.answer-transfer {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: visible;
  pointer-events: none;
}
.answer-summary-capsule {
  position: absolute;
  left: var(--transfer-start-x, 75%);
  top: var(--transfer-start-y, 70%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 48px));
  min-height: 38px;
  padding: 9px 15px;
  border: 1px solid rgba(53, 87, 255, 0.24);
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 36, 51, 0.16);
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.94);
  white-space: nowrap;
}
.answer-summary-capsule > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.answer-summary-capsule .dot,
.answer-transfer-complete .dot {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--color-brand-blue);
}
.answer-transfer-trail {
  position: absolute;
  left: var(--transfer-target-x, 80%);
  top: calc(var(--transfer-target-y, 30%) + 24px);
  width: 2px;
  height: var(--transfer-trail-height, 120px);
  border-radius: 2px;
  background: linear-gradient(to bottom, rgba(53, 87, 255, 0.08), rgba(53, 87, 255, 0.58), rgba(199, 255, 51, 0.12));
  opacity: 0;
  transform: translateX(-50%) scaleY(0.35);
  transform-origin: top;
}
.answer-transfer-halo,
.answer-transfer-core {
  position: absolute;
  left: var(--transfer-target-x, 80%);
  top: var(--transfer-target-y, 30%);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
}
.answer-transfer-halo {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(53, 87, 255, 0.26);
  background: rgba(53, 87, 255, 0.07);
  box-shadow: 0 0 28px rgba(53, 87, 255, 0.24);
}
.answer-transfer-core {
  width: 12px;
  height: 12px;
  background: var(--color-brand-blue);
  box-shadow: 0 0 0 7px rgba(199, 255, 51, 0.34);
}
.answer-transfer-complete {
  position: absolute;
  left: var(--transfer-target-x, 80%);
  top: calc(var(--transfer-target-y, 30%) - 48px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(31, 36, 51, 0.12);
  color: var(--color-brand-blue);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  opacity: 0;
  transform: translate(-50%, -50%) translateY(6px);
  white-space: nowrap;
}
.diagnosis.is-reflecting-answer .answer-summary-capsule {
  animation: answer-capsule-transfer 4680ms linear both;
}
.diagnosis.is-reflecting-answer .answer-transfer-trail {
  animation: answer-transfer-trail 4680ms linear both;
}
.diagnosis.is-reflecting-answer .answer-transfer-halo {
  animation: answer-target-halo 4680ms linear both;
}
.diagnosis.is-reflecting-answer .answer-transfer-core {
  animation: answer-target-core 4680ms linear both;
}
.diagnosis.is-reflecting-answer .answer-transfer-complete {
  animation: answer-transfer-complete 4680ms linear both;
}
.diagnosis.is-question-entering .question-card {
  animation: question-arrive 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Figma 07A→07D: 0.8s 대기+0.32s 전환 / 0.7s+0.32s / 0.8s+0.32s / 1.1s+0.32s */
@keyframes answer-capsule-transfer {
  0%, 17.09% { opacity: 0; transform: translate(-50%, -50%) scale(0.94); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  23.93%, 38.89% { opacity: 1; transform: translate(-50%, -50%) scale(1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  45.73%, 62.82% { opacity: 1; transform: translate(calc(-50% + var(--transfer-dx, 0px)), calc(-50% + var(--transfer-dy, -160px))) scale(1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  69.66%, 100% { opacity: 0; transform: translate(calc(-50% + var(--transfer-dx, 0px)), calc(-50% + var(--transfer-dy, -160px))) scale(0.72); }
}
@keyframes answer-transfer-trail {
  0%, 38.89% { opacity: 0; transform: translateX(-50%) scaleY(0.35); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  45.73%, 62.82% { opacity: 0.8; transform: translateX(-50%) scaleY(1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  69.66%, 100% { opacity: 0; transform: translateX(-50%) scaleY(0.2); }
}
@keyframes answer-target-halo {
  0%, 38.89% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  45.73%, 62.82% { opacity: 0.74; transform: translate(-50%, -50%) scale(0.78); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  69.66%, 93.16% { opacity: 1; transform: translate(-50%, -50%) scale(1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes answer-target-core {
  0%, 38.89% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  45.73%, 62.82% { opacity: 0.88; transform: translate(-50%, -50%) scale(0.78); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  69.66%, 93.16% { opacity: 1; transform: translate(-50%, -50%) scale(1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}
@keyframes answer-transfer-complete {
  0%, 62.82% { opacity: 0; transform: translate(-50%, -50%) translateY(6px); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  69.66%, 93.16% { opacity: 1; transform: translate(-50%, -50%) translateY(0); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-3px); }
}
@keyframes question-arrive {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 동작 줄이기 (data-motion: base.css 참고) */
:root[data-motion='reduce'] .pulse-dot--blue {
  left: 20px;
  top: 7px;
  width: 14px;
  height: 14px;
  animation: none;
}
:root[data-motion='reduce'] .pulse-dot--lime {
  left: 20px;
  top: 39px;
  width: 5px;
  height: 5px;
  animation: none;
}
:root[data-motion='reduce'] .diagnosis.is-reflecting-answer .answer-summary-capsule,
:root[data-motion='reduce'] .diagnosis.is-reflecting-answer .answer-transfer-trail,
:root[data-motion='reduce'] .diagnosis.is-reflecting-answer .answer-transfer-halo,
:root[data-motion='reduce'] .diagnosis.is-reflecting-answer .answer-transfer-core,
:root[data-motion='reduce'] .diagnosis.is-reflecting-answer .answer-transfer-complete,
:root[data-motion='reduce'] .diagnosis.is-question-entering .question-card {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) .pulse-dot--blue {
    left: 20px;
    top: 7px;
    width: 14px;
    height: 14px;
    animation: none;
  }
  :root:not([data-motion]) .pulse-dot--lime {
    left: 20px;
    top: 39px;
    width: 5px;
    height: 5px;
    animation: none;
  }
  :root:not([data-motion]) .diagnosis.is-reflecting-answer .answer-summary-capsule,
  :root:not([data-motion]) .diagnosis.is-reflecting-answer .answer-transfer-trail,
  :root:not([data-motion]) .diagnosis.is-reflecting-answer .answer-transfer-halo,
  :root:not([data-motion]) .diagnosis.is-reflecting-answer .answer-transfer-core,
  :root:not([data-motion]) .diagnosis.is-reflecting-answer .answer-transfer-complete,
  :root:not([data-motion]) .diagnosis.is-question-entering .question-card {
    animation: none;
  }
}
@media (max-width: 1023px) {
  .diagnosis-intro {
    flex-direction: column;
  }
  .diagnosis-intro h1 {
    font-size: 28px;
    line-height: 36px;
  }
  .diagnosis-stage {
    padding: 0;
  }
  .glass-glow {
    display: none;
  }
}
@media (max-width: 767px) {
  .diagnosis {
    padding-top: 24px;
  }
  .diagnosis-intro h1 {
    font-size: 24px;
    line-height: 32px;
  }
  .analysis-glass {
    height: 220px;
  }
  .glass-front {
    padding: 24px 20px;
  }
  .glass-pulse {
    left: 20px;
    top: 56px;
  }
  .glass-caption {
    margin: 14px 0 0 56px;
  }
  .question-card {
    padding: 18px;
  }
  .question-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .question-title {
    font-size: 16px;
  }
  .question-prompt {
    align-items: flex-start;
  }
  .diagnosis-actions {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 0 0;
  }
  .diagnosis-next {
    width: 100%;
    min-width: 0;
  }
}
