:root {
  --accent: #F47B1A;
  --accent-2: #F3A54E;
  --accent-soft: #FEF1E5;
  --accent-tint: #FFF8F2;
  --ink-900: #211D1D;
  --ink-700: #3B3535;
  --ink-500: #534C4B;
  --ink-400: #8A8482;
  --ink-300: #B7B2B0;
  --paper: #FFFFFF;
  --paper-2: #FAF9F9;
  --paper-3: #F2F0EF;
  --line: #E4E0DF;
  --line-2: #D5D2D1;
  /* 카테고리 컬러 */
  --c-sleep: #6C63FF;
  --c-sleep-soft: #EEEDFF;
  --c-energy: #F47B1A;
  --c-energy-soft: #FEF1E5;
  --c-gut: #2FA56B;
  --c-gut-soft: #E6F6EE;
  --c-eye: #2E8FD8;
  --c-eye-soft: #E6F2FB;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow-sm: 0 2px 8px -2px rgba(33, 29, 29, 0.06);
  --shadow-md: 0 12px 32px -12px rgba(33, 29, 29, 0.14);
  --shadow-lg: 0 30px 70px -24px rgba(33, 29, 29, 0.22);
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink-700);
  background: var(--paper-2);
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, p { word-break: keep-all; }

/* 배경 분위기 */
.bg-wrap {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 85% -5%, rgba(244, 123, 26, 0.10) 0%, transparent 42%),
    radial-gradient(circle at 5% 100%, rgba(244, 123, 26, 0.06) 0%, transparent 40%),
    var(--paper-2);
}

/* 스테이지 */
.stage {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
  position: relative;
}

/* 상단바 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 4px 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .logo { height: 22px; width: auto; }
.topbar .event-pill {
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px; border-radius: 999px;
  letter-spacing: -0.01em;
}

/* 화면(스크린) 공통 */
.screen { display: none; flex: 1; flex-direction: column; padding-bottom: 40px; }
.screen.active { display: flex; animation: screenIn 0.5s var(--ease); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* === 인트로 === */
.intro {
  justify-content: center;
  text-align: center;
  align-items: center;
  gap: 0;
}
.intro .badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 9px 16px; border-radius: 999px;
  margin-bottom: 26px;
  letter-spacing: -0.01em;
}
.intro .badge .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(244,123,26,.5); }
  50% { transform: scale(1.3); opacity: .6; box-shadow: 0 0 0 7px rgba(244,123,26,0); }
}
.intro h1 {
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.22;
  color: var(--ink-900);
}
.intro h1 .accent { color: var(--accent); }
.intro p {
  margin-top: 20px;
  font-size: 16.5px;
  color: var(--ink-500);
  line-height: 1.7;
  letter-spacing: -0.01em;
  max-width: 420px;
}
.intro .dispenser {
  margin: 38px 0 34px;
  width: 200px; height: 200px;
  position: relative;
}
.intro .dispenser .ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.08); opacity: 1; }
}
.intro .dispenser svg { position: relative; z-index: 1; width: 100%; height: 100%; }
.intro .meta {
  margin-top: 8px;
  display: flex; gap: 18px; justify-content: center;
  font-size: 13px; color: var(--ink-400);
  letter-spacing: -0.01em;
}
.intro .meta span { display: inline-flex; align-items: center; gap: 6px; }
.intro .meta b { color: var(--ink-700); font-weight: 700; }

/* 버튼 */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.02em;
  padding: 18px 28px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  transition: transform 0.18s var(--ease), background 0.18s, box-shadow 0.18s;
  box-shadow: 0 14px 30px -10px rgba(244, 123, 26, 0.5);
}
.btn-primary:hover { background: #e06d10; transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(244,123,26,.6); }
.btn-primary:active { transform: translateY(0); }
.btn-primary .arrow { transition: transform 0.2s; }
.btn-primary:hover .arrow { transform: translateX(4px); }
.intro .btn-primary { margin-top: 36px; }
.intro .tiny {
  margin-top: 14px;
  font-size: 12px; color: var(--ink-400);
  letter-spacing: -0.005em;
}

/* === 퀴즈 === */
.quiz-head { padding-top: 8px; }
.progress {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 36px;
}
.progress .bar {
  flex: 1; height: 8px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress .bar .fill {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  transition: width 0.45s var(--ease);
}
.progress .count {
  font-size: 13.5px; font-weight: 700; color: var(--ink-400);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.progress .count b { color: var(--accent); font-size: 15px; }

.q-card { flex: 1; display: flex; flex-direction: column; }
.q-num {
  font-size: 14px; font-weight: 800; color: var(--accent);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.q-title {
  font-size: clamp(24px, 6.4vw, 30px);
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.035em;
  line-height: 1.3;
}
.q-sub {
  margin-top: 12px;
  font-size: 15px; color: var(--ink-500);
  line-height: 1.6;
  letter-spacing: -0.01em;
}
.q-options {
  margin-top: 32px;
  display: flex; flex-direction: column; gap: 12px;
}
.q-opt {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left;
  padding: 20px 22px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 16px;
  font-size: 16.5px; font-weight: 600;
  color: var(--ink-700);
  letter-spacing: -0.015em;
  transition: all 0.18s var(--ease);
  position: relative;
}
.q-opt:hover {
  border-color: var(--accent-2);
  background: var(--accent-tint);
  transform: translateY(-2px);
}
.q-opt .dot {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line-2);
  flex-shrink: 0;
  transition: all 0.18s;
  position: relative;
}
.q-opt:hover .dot { border-color: var(--accent); }
.q-opt.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.q-opt.selected .dot {
  border-color: var(--accent);
  background: var(--accent);
}
.q-opt.selected .dot::after {
  content: ''; position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff;
}
.q-opt .label { flex: 1; }
.q-back {
  margin-top: 22px;
  align-self: flex-start;
  font-size: 14px; font-weight: 600; color: var(--ink-400);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.15s;
}
.q-back:hover { color: var(--ink-700); }

/* === 결과 === */
.result { padding-top: 8px; }
.result-loading {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  min-height: 60vh;
}
.result-loading .spinner {
  width: 64px; height: 64px;
  border: 5px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-loading p { font-size: 16px; color: var(--ink-500); font-weight: 600; letter-spacing: -0.01em; }

.result-body { display: none; }
.result-body.show { display: block; animation: screenIn 0.55s var(--ease); }

.result-hero {
  text-align: center;
  padding: 20px 0 8px;
}
.result-hero .eyebrow {
  font-size: 14px; font-weight: 700; color: var(--ink-400);
  letter-spacing: -0.01em;
}
.result-hero .type-badge {
  margin: 16px auto 0;
  width: 110px; height: 110px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 52px;
  position: relative;
  animation: popIn 0.6s var(--ease) backwards;
}
.result-hero .type-badge::after {
  content: ''; position: absolute; inset: -8px;
  border-radius: 50%;
  border: 2px dashed currentColor;
  opacity: 0.4;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
.result-hero h2 {
  margin-top: 22px;
  font-size: clamp(28px, 7.4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink-900);
  line-height: 1.25;
}
.result-hero .tagline {
  margin-top: 12px;
  font-size: 16px; color: var(--ink-500);
  line-height: 1.65;
  letter-spacing: -0.01em;
  max-width: 440px;
  margin-left: auto; margin-right: auto;
}
.match-row {
  margin: 26px auto 0;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  box-shadow: var(--shadow-sm);
}
.match-row .label { font-size: 13.5px; color: var(--ink-500); font-weight: 600; }
.match-row .pct {
  font-size: 20px; font-weight: 800; color: var(--accent);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.result-desc {
  margin-top: 28px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  font-size: 15.5px;
  color: var(--ink-700);
  line-height: 1.75;
  letter-spacing: -0.01em;
  text-align: center;
}

/* 알약 조합 */
.combo-title {
  margin: 36px 0 18px;
  text-align: center;
}
.combo-title h3 {
  font-size: 21px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.03em;
}
.combo-title p { margin-top: 8px; font-size: 14px; color: var(--ink-400); }

.pills-grid {
  display: flex; flex-direction: column; gap: 12px;
}
.pill-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(16px);
  text-decoration: none;
  color: inherit;
}
.pill-card.in { animation: pillDrop 0.6s var(--ease) forwards; }
.pill-card.in:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
@keyframes pillDrop {
  0% { opacity: 0; transform: translateY(-24px) scale(0.9); }
  60% { opacity: 1; transform: translateY(4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.pill-card .pill-visual {
  width: 60px; height: 60px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
}
.pill-card .pill-visual img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(33, 29, 29, 0.12));
}
.pill-card .pill-info { flex: 1; min-width: 0; }
.pill-card .name-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pill-card .pill-info .name {
  font-size: 16.5px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.02em;
}
.pill-card .pill-info .note {
  margin-top: 4px;
  font-size: 13.5px; color: var(--ink-500);
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.pill-card .pill-tag {
  font-size: 10.5px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

/* 공유 + CTA */
.result-actions {
  margin-top: 36px;
  display: flex; flex-direction: column; gap: 12px;
}
.btn-share {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink-900);
  color: #fff;
  font-size: 16.5px; font-weight: 800;
  letter-spacing: -0.02em;
  padding: 18px;
  border-radius: 16px;
  transition: all 0.18s var(--ease);
}
.btn-share:hover { background: #000; transform: translateY(-2px); }
.btn-share svg { width: 20px; height: 20px; }
.btn-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16.5px; font-weight: 800;
  letter-spacing: -0.02em;
  padding: 18px;
  border-radius: 16px;
  transition: all 0.18s var(--ease);
  box-shadow: 0 14px 30px -12px rgba(244,123,26,.5);
  text-decoration: none;
}
.btn-cta:hover { background: #e06d10; transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(244,123,26,.6); }
.btn-cta .arrow { transition: transform 0.2s; }
.btn-cta:hover .arrow { transform: translateX(4px); }

/* 쿠폰(보조) 버튼 */
.btn-coupon {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15.5px; font-weight: 800;
  letter-spacing: -0.02em;
  padding: 16px;
  border-radius: 16px;
  transition: all 0.18s var(--ease);
}
.btn-coupon:hover { background: #fde3cd; transform: translateY(-1px); }
.btn-retry {
  background: none;
  color: var(--ink-400);
  font-size: 14.5px; font-weight: 600;
  padding: 14px;
  letter-spacing: -0.01em;
  transition: color 0.15s;
}
.btn-retry:hover { color: var(--ink-700); }

.disclaimer {
  margin-top: 28px;
  padding: 16px 18px;
  background: var(--paper-3);
  border-radius: 12px;
  font-size: 11.5px;
  color: var(--ink-400);
  line-height: 1.7;
  letter-spacing: -0.005em;
}

/* === 영양제 라인업(랜딩) === */
.lineup {
  margin-top: 30px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
}
.lineup-head { text-align: center; }
.lineup-head h3 {
  font-size: 18px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.03em;
}
.lineup-head p {
  margin-top: 6px; font-size: 13px; color: var(--ink-400);
  letter-spacing: -0.01em;
}
.lineup-grid {
  margin-top: 18px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.lineup-cat {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 10px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.18s var(--ease);
}
.lineup-cat:hover {
  border-color: var(--accent-2);
  background: var(--accent-tint);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.lineup-cat .orb {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lineup-cat .orb img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: block;
}
.lineup-cat .cat-name {
  font-size: 14px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.01em;
}
.lineup-cat .cat-desc {
  font-size: 11.5px; color: var(--ink-400);
  letter-spacing: -0.005em;
}
.lineup-more {
  display: block; margin-top: 16px; text-align: center;
  font-size: 14px; font-weight: 700; color: var(--accent);
  text-decoration: none; letter-spacing: -0.01em;
  padding: 8px;
  transition: opacity 0.15s;
}
.lineup-more:hover { text-decoration: underline; }

/* === 리드 모달 === */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
  background: rgba(33, 29, 29, 0.55);
  backdrop-filter: blur(6px);
}
.modal.open { display: flex; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 600px;
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  padding: 32px 24px calc(28px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s var(--ease);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}
.modal-card .grip {
  width: 44px; height: 5px; border-radius: 999px;
  background: var(--line-2);
  margin: 0 auto 22px;
}
.modal-card .coupon {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 800;
  padding: 8px 14px; border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.modal-card h3 {
  font-size: 23px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.032em; line-height: 1.35;
}
.modal-card .sub {
  margin-top: 10px; font-size: 14.5px; color: var(--ink-500);
  line-height: 1.6; letter-spacing: -0.01em;
}
.modal-card form { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.modal-card input {
  padding: 16px 18px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 15.5px; background: var(--paper-2);
  font-weight: 500;
  transition: all 0.15s;
}
.modal-card input:focus {
  outline: 0; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 4px rgba(244, 123, 26, 0.13);
}
.modal-card .consent {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--ink-500); line-height: 1.5;
  margin-top: 4px;
}
.modal-card .consent input { width: auto; margin-top: 2px; accent-color: var(--accent); padding: 0; }
.modal-card .consent a { color: var(--accent); text-decoration: underline; }
.modal-card .btn-submit {
  margin-top: 8px;
  background: var(--accent); color: #fff;
  font-size: 16.5px; font-weight: 800; letter-spacing: -0.02em;
  padding: 17px; border-radius: 14px;
  transition: all 0.18s;
}
.modal-card .btn-submit:hover { background: #e06d10; }
.modal-card .skip {
  margin-top: 4px;
  color: var(--ink-400); font-size: 13.5px; font-weight: 600;
  padding: 10px;
}

/* 토스트(공유 완료) */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--ink-900); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 13px 22px; border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 200;
  letter-spacing: -0.01em;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 완료 화면 */
.done-screen { text-align: center; align-items: center; justify-content: center; }
.done-screen .check {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--accent-soft);
  display: grid; place-items: center;
  margin-bottom: 24px;
  animation: popIn 0.5s var(--ease);
}
.done-screen .check svg { width: 44px; height: 44px; color: var(--accent); }
.done-screen h2 { font-size: 28px; font-weight: 800; color: var(--ink-900); letter-spacing: -0.035em; }
.done-screen p { margin-top: 14px; font-size: 15.5px; color: var(--ink-500); line-height: 1.7; max-width: 380px; }

@media (min-width: 601px) {
  .stage { padding: 0 24px; }
  .modal-card { border-radius: 26px; margin-bottom: 24px; }
  .modal { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .pill-card { opacity: 1; transform: none; }
}
