/* ── Quiz Layout ── */
#quiz-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Intro ── */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 48px 32px;
  text-align: center;
}
.intro__logo {
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}
.intro__title {
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}
.intro__desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 280px;
}
.intro__meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
}

/* ── Phase Container ── */
.phase {
  display: none;
  flex-direction: column;
  flex: 1;
}
.phase.active { display: flex; }

/* ── Phase 1: Swipe ── */
.swipe-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  perspective: 1000px;
}

.swipe-card {
  position: absolute;
  width: calc(100% - 48px);
  max-width: 400px;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: grab;
  user-select: none;
  touch-action: none;
  will-change: transform;
  transition: box-shadow 0.15s;
}
.swipe-card:active { cursor: grabbing; }

.swipe-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* 좋아요/싫어요 오버레이 */
.swipe-card__like,
.swipe-card__dislike {
  position: absolute;
  top: 24px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 22px;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}
.swipe-card__like    { right: 24px; }
.swipe-card__dislike { left: 24px; }

/* 스와이프 힌트 버튼 */
.swipe-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px 32px;
}
.swipe-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.swipe-btn:active { transform: scale(0.9); }
.swipe-btn--dislike { font-size: 20px; }
.swipe-btn--like { font-size: 20px; }

/* ── Phase 2: Paired Comparison ── */
.paired-area {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.pair-card {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2/3;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pair-card:active { transform: scale(0.97); }
.pair-card__img { width: 100%; height: 100%; object-fit: cover; }
.pair-card.selected {
  box-shadow: 0 0 0 3px var(--fg), var(--card-shadow);
  transform: scale(0.98);
}

.paired-question {
  padding: 20px 24px 8px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
}

/* ── Phase 3: Grid ── */
.grid-area {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}

.grid-card {
  border-radius: calc(var(--radius) * 0.75);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.grid-card:active { transform: scale(0.96); }
.grid-card__img { width: 100%; height: 100%; object-fit: cover; }
.grid-card.selected {
  box-shadow: 0 0 0 3px var(--fg), 0 2px 12px rgba(0,0,0,0.08);
}
.grid-card__check {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--fg);
  color: #fff;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
}
.grid-card.selected .grid-card__check { display: flex; }

/* ── Phase 4: Tuning ── */
.tuning-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  justify-content: center;
}

.tuning-option {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 2px solid rgba(0,0,0,0.08);
  background: #fff;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  cursor: pointer;
  width: 100%;
}
.tuning-option:active { transform: scale(0.97); }
.tuning-option.selected {
  border-color: var(--fg);
  background: rgba(0,0,0,0.03);
}

.tuning-option__emoji { font-size: 36px; flex-shrink: 0; }
.tuning-option__label {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--fg);
}
.tuning-option__desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Loading ── */
.loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
}
.loading__spinner {
  width: 36px; height: 36px;
  border: 2.5px solid rgba(0,0,0,0.1);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading__text { font-size: 14px; color: var(--muted); }

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

/* ── Phase Header Sub ── */
.phase-header__sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Color Mode Card (Phase 4) ── */
.color-mode-card {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2/3;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}
.color-mode-card:active { transform: scale(0.97); }
.color-mode-card.selected {
  box-shadow: 0 0 0 3px var(--fg), var(--card-shadow);
  transform: scale(0.98);
}
.color-mode-card__preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.color-mode-card__strip { flex: 1; }
.color-mode-card__info {
  padding: 14px 12px 16px;
  text-align: center;
}
.color-mode-card__label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.color-mode-card__desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Color Swatch (Phase 5) ── */
.color-swatch-area {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 24px;
  align-content: center;
}
.color-swatch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid rgba(0,0,0,0.08);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.color-swatch:active { transform: scale(0.96); }
.color-swatch.selected { border-color: var(--fg); }
.color-swatch__dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}
.color-swatch__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

/* ── Next Button ── */
.phase-footer {
  padding: 12px 24px 32px;
  display: flex;
  justify-content: center;
}
.phase-footer .btn {
  width: 100%;
  max-width: 320px;
  padding: 16px;
}
