/* ─────────────────────────────────────────────
   썸 스캐너 — mobile-first stylesheet
   ───────────────────────────────────────────── */

:root {
  --bg:        #0a0612;
  --bg-2:      #140822;
  --ink:       #f4eefb;
  --ink-dim:   #a99cc0;
  --ink-faint: #6d6285;

  --pink:      #ff3d81;
  --violet:    #a855f7;
  --cyan:      #22d3ee;

  --card:      rgba(255,255,255,.05);
  --card-line: rgba(255,255,255,.10);

  --grad: linear-gradient(115deg, var(--pink), var(--violet) 55%, var(--cyan));

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --pad: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
               "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.6;
  letter-spacing: -.015em;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ── 배경 오로라 ───────────────────────────── */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  width: 62vmax; height: 62vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .40;
  will-change: transform;
}
.b1 { background: var(--pink);   top: -26vmax; left: -22vmax; animation: drift1 19s ease-in-out infinite; }
.b2 { background: var(--violet); bottom: -30vmax; right: -24vmax; animation: drift2 23s ease-in-out infinite; }
.b3 { background: var(--cyan);   top: 34%; left: 42%; opacity: .18; animation: drift3 27s ease-in-out infinite; }

@keyframes drift1 { 50% { transform: translate3d(14vw, 9vh, 0) scale(1.14); } }
@keyframes drift2 { 50% { transform: translate3d(-13vw, -11vh, 0) scale(1.2); } }
@keyframes drift3 { 50% { transform: translate3d(-18vw, 14vh, 0) scale(.82); } }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .30;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ── 앱 셸 ─────────────────────────────────── */
.app {
  position: relative; z-index: 2;
  width: 100%; max-width: 460px;
  margin-inline: auto;
  min-height: 100svh;
  display: grid;
}

.screen {
  grid-area: 1 / 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--safe-t) + 30px) var(--pad) calc(var(--safe-b) + 30px);
  gap: 18px;
}
.screen.is-active { display: flex; animation: screenIn .55s cubic-bezier(.2,.9,.25,1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(16px); } }

/* ── 1. 인트로 ─────────────────────────────── */
.intro-mark { position: relative; display: grid; place-items: center; width: 190px; height: 190px; }
.heart-pulse { font-size: 68px; animation: beat 1.7s ease-in-out infinite; filter: drop-shadow(0 0 22px rgba(255,61,129,.75)); }
@keyframes beat { 0%,100% { transform: scale(1); } 14% { transform: scale(1.16); } 28% { transform: scale(1); } 42% { transform: scale(1.1); } }

.ring {
  position: absolute; inset: 0; margin: auto;
  width: 84px; height: 84px;
  border: 1.5px solid rgba(255,61,129,.55);
  border-radius: 50%;
  animation: ripple 2.8s cubic-bezier(.2,.7,.3,1) infinite;
}
.r2 { animation-delay: .9s; }
.r3 { animation-delay: 1.8s; }
@keyframes ripple {
  from { transform: scale(.55); opacity: .85; }
  to   { transform: scale(2.35); opacity: 0; }
}

.title { font-size: 40px; font-weight: 800; line-height: 1.15; letter-spacing: -.04em; }
.title-sub {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: .22em;
  color: var(--ink-faint); margin-bottom: 10px;
  text-transform: uppercase;
}
.lede { color: var(--ink-dim); font-size: 15.5px; }
.lede b { color: var(--ink); font-weight: 700; }

.h2 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.sub { color: var(--ink-dim); font-size: 14px; margin-top: -6px; }
.sub b { color: var(--ink); }

.tiny { color: var(--ink-faint); font-size: 11.5px; line-height: 1.65; margin-top: 4px; }
.tiny b { color: var(--ink-dim); font-weight: 600; }

/* ── 버튼 ──────────────────────────────────── */
.btn {
  position: relative; overflow: hidden;
  width: 100%; max-width: 330px;
  padding: 17px 22px;
  border: 0; border-radius: 999px;
  font: inherit; font-size: 16.5px; font-weight: 800; letter-spacing: -.02em;
  color: #fff; cursor: pointer;
  transition: transform .16s ease, opacity .2s ease, box-shadow .25s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.965); }

.btn-primary {
  background: var(--grad);
  box-shadow: 0 12px 34px -10px rgba(255,61,129,.75), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn-primary:disabled { opacity: .32; box-shadow: none; cursor: not-allowed; }
.btn-primary:disabled .btn-glow { display: none; }

.btn-glow {
  position: absolute; top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.42), transparent);
  animation: sheen 3.4s ease-in-out infinite;
}
@keyframes sheen { 0% { left: -60%; } 55%, 100% { left: 125%; } }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--card-line);
  color: var(--ink-dim);
  font-weight: 700;
}

.back {
  position: absolute; top: calc(var(--safe-t) + 16px); left: 14px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: none; border: 0;
  color: var(--ink-dim); font-size: 24px; cursor: pointer;
}

/* ── 2. 입력 ───────────────────────────────── */
#form-phone { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.field { width: 100%; position: relative; }
.phone-input {
  width: 100%;
  background: transparent;
  border: 0; outline: 0;
  color: var(--ink);
  font: inherit;
  font-size: 32px; font-weight: 800; letter-spacing: .04em;
  text-align: center;
  padding: 12px 0 14px;
  font-variant-numeric: tabular-nums;
}
.phone-input::placeholder { color: rgba(255,255,255,.16); font-weight: 700; }

.field-line { height: 2px; border-radius: 2px; background: var(--card-line); position: relative; overflow: hidden; }
.field-line::after {
  content: ""; position: absolute; inset: 0;
  background: var(--grad);
  transform: scaleX(0); transform-origin: center;
  transition: transform .4s cubic-bezier(.2,.9,.25,1);
}
.field.is-filled .field-line::after { transform: scaleX(1); }

.err { color: #ff6b8b; font-size: 13px; font-weight: 600; min-height: 19px; }

/* ── 3. 스캐닝 ─────────────────────────────── */
.radar {
  position: relative;
  width: min(64vw, 250px); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168,85,247,.20), transparent 70%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12), 0 0 60px -12px rgba(168,85,247,.6);
  display: grid; place-items: center;
}
.radar-grid {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 30px, rgba(255,255,255,.07) 30px 31px),
    linear-gradient(rgba(255,255,255,.07), rgba(255,255,255,.07)) 50% / 1px 100% no-repeat,
    linear-gradient(rgba(255,255,255,.07), rgba(255,255,255,.07)) 50% / 100% 1px no-repeat;
}
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,61,129,.55), transparent 62deg);
  animation: sweep 1.9s linear infinite;
  mask: radial-gradient(circle, #000 99%, transparent 100%);
}
@keyframes sweep { to { transform: rotate(360deg); } }

.radar-blip {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
  animation: blip 1.9s ease-in-out infinite;
}
.p1 { top: 24%; left: 33%; animation-delay: .25s; }
.p2 { top: 62%; left: 68%; animation-delay: 1.0s; }
.p3 { top: 72%; left: 30%; animation-delay: 1.55s; }
@keyframes blip { 0%, 62%, 100% { opacity: 0; transform: scale(.5); } 70% { opacity: 1; transform: scale(1); } }

.radar-core { font-size: 34px; filter: drop-shadow(0 0 14px rgba(255,61,129,.9)); animation: beat 1.7s ease-in-out infinite; }

.pct { font-size: 46px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pct small { font-size: 20px; color: var(--ink-faint); margin-left: 2px; }

.bar-track { width: 100%; max-width: 300px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.10); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width .28s ease; }

.log {
  list-style: none;
  width: 100%; max-width: 320px;
  min-height: 108px;
  font-size: 12.5px; color: var(--ink-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: left;
}
.log li { animation: logIn .3s ease both; padding: 2px 0; }
.log li:last-child { color: var(--cyan); }
@keyframes logIn { from { opacity: 0; transform: translateX(-8px); } }

/* ── 4. 결과 ───────────────────────────────── */
#screen-result { justify-content: flex-start; gap: 16px; }

.result-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 26px 20px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 26px 60px -28px rgba(0,0,0,.9);
  animation: cardIn .6s cubic-bezier(.2,.9,.25,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }

.rc-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .22em;
  color: var(--cyan);
  border: 1px solid rgba(34,211,238,.4);
  padding: 4px 11px; border-radius: 99px;
}
.rc-head { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rc-title { font-size: 15px; font-weight: 600; color: var(--ink-dim); letter-spacing: -.02em; }

.initials { display: flex; gap: 10px; }
.initials span {
  width: 58px; height: 68px;
  display: grid; place-items: center;
  font-size: 34px; font-weight: 800;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,61,129,.22), rgba(168,85,247,.14));
  border: 1px solid rgba(255,255,255,.14);
  animation: flip .5s cubic-bezier(.2,.9,.25,1) both;
}
.initials span:nth-child(2) { animation-delay: .12s; }
.initials span:nth-child(3) { animation-delay: .24s; }
@keyframes flip { from { opacity: 0; transform: rotateX(-85deg) translateY(10px); } }

.initials-cap { font-size: 11.5px; color: var(--ink-faint); letter-spacing: .1em; margin-top: -6px; }

.type-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.type-emoji { font-size: 44px; }
.type-name {
  font-size: 27px; font-weight: 800; letter-spacing: -.035em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.type-desc { font-size: 14px; color: var(--ink-dim); max-width: 27ch; }

.score { display: flex; flex-direction: column; align-items: center; margin-top: 2px; }
.score-num { font-size: 60px; font-weight: 800; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.score-num small { font-size: 24px; color: var(--ink-faint); }
.score-cap { font-size: 12px; color: var(--ink-faint); letter-spacing: .14em; margin-top: 4px; }

.stats { width: 100%; display: flex; flex-direction: column; gap: 11px; margin-top: 8px; }
.stat { display: grid; grid-template-columns: 62px 1fr 38px; align-items: center; gap: 10px; }
.stat-label { font-size: 12.5px; color: var(--ink-dim); text-align: left; }
.stat-track { display: block; height: 7px; border-radius: 99px; background: rgba(255,255,255,.09); overflow: hidden; }
.stat-bar { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width 1s cubic-bezier(.2,.9,.25,1); }
.stat-val { font-size: 12.5px; font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

.facts { width: 100%; display: flex; flex-direction: column; gap: 1px; margin-top: 10px; border-radius: var(--r-md); overflow: hidden; }
.fact { display: grid; grid-template-columns: 86px 1fr; gap: 10px; align-items: baseline; padding: 13px 14px; background: rgba(255,255,255,.045); text-align: left; }
.fact dt { font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.fact dd { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }

.verdict {
  width: 100%;
  font-size: 14.5px; font-weight: 600; line-height: 1.65;
  color: var(--ink);
  padding: 15px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, rgba(255,61,129,.16), rgba(34,211,238,.10));
  border: 1px solid rgba(255,255,255,.10);
  margin-top: 8px;
}

.rc-foot { font-size: 10.5px; color: var(--ink-faint); letter-spacing: .1em; margin-top: 6px; }

.actions { width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ── 사용 횟수 배지 / 페이월 ───────────────── */
.quota-badge {
  font-size: 12.5px; font-weight: 600; color: var(--ink-dim);
  padding: 7px 15px; border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--card-line);
}
.quota-badge b { color: var(--ink); font-weight: 800; }
.quota-badge .q-dim { color: var(--ink-faint); font-weight: 500; }
.quota-badge .q-bonus { color: var(--cyan); font-weight: 800; margin-left: 4px; }
.quota-badge.is-empty { color: var(--ink-faint); }

.lock-mark { font-size: 52px; filter: drop-shadow(0 0 18px rgba(168,85,247,.6)); }

.plan {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  text-align: left;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan-name { font-size: 15.5px; font-weight: 800; letter-spacing: -.02em; }
.plan-price {
  font-size: 22px; font-weight: 800; letter-spacing: -.03em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.plan-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.plan-list li { font-size: 13.5px; color: var(--ink-dim); padding-left: 22px; position: relative; }
.plan-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--cyan); font-weight: 800;
}
.plan-list b { color: var(--ink); font-weight: 700; }

/* ── 보조 칩 버튼 ──────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 17px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--card-line);
  color: var(--ink-dim);
  font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, border-color .2s ease, color .2s ease;
  touch-action: manipulation;
}
.chip:active { transform: scale(.96); }
.chip:hover { border-color: rgba(255,61,129,.5); color: var(--ink); }
.chip[hidden] { display: none; }

/* ── 연령 선택 ─────────────────────────────── */
.age-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.age-btn {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--card-line);
  color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .16s ease, border-color .2s ease, background .2s ease;
}
.age-btn:active { transform: scale(.975); }
.age-btn:hover { border-color: rgba(255,61,129,.55); background: rgba(255,255,255,.075); }

.age-emoji { font-size: 30px; line-height: 1; }
.age-text { display: flex; flex-direction: column; gap: 2px; }
.age-text b { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.age-text small { font-size: 12px; color: var(--ink-faint); }

/* ── 동의 체크박스 ─────────────────────────── */
.consent-box { display: flex; flex-direction: column; gap: 14px; }

.check { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.check input {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto;
  width: 21px; height: 21px; margin-top: 1px;
  border: 1.5px solid var(--card-line);
  border-radius: 7px;
  background: rgba(255,255,255,.04);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.check input::after {
  content: "✓";
  font-size: 13px; font-weight: 800; color: #fff;
  opacity: 0; transform: scale(.5);
  transition: opacity .18s ease, transform .18s ease;
}
.check input:checked { background: var(--grad); border-color: transparent; }
.check input:checked::after { opacity: 1; transform: scale(1); }
.check span { font-size: 13.5px; line-height: 1.55; color: var(--ink-dim); }
.check b { color: var(--ink); font-weight: 700; }

/* ── 문자 인증 ─────────────────────────────── */
#form-sms { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }

.code-wrap { width: 100%; animation: screenIn .4s cubic-bezier(.2,.9,.25,1) both; }
.code-wrap[hidden] { display: none; }

.code-input { letter-spacing: .42em; text-indent: .42em; font-variant-numeric: tabular-nums; }

.sms-timer {
  font-size: 12.5px; font-weight: 600; color: var(--ink-faint);
  margin-top: 8px; font-variant-numeric: tabular-nums;
}
.sms-timer.is-soon { color: #ff6b8b; }

/* ── 결과 안전 안내 ────────────────────────── */
.safety {
  width: 100%;
  font-size: 12.5px; line-height: 1.6;
  color: var(--ink-dim);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(34,211,238,.08);
  border: 1px solid rgba(34,211,238,.24);
}
.safety b { color: var(--ink); font-weight: 700; }
.safety[hidden] { display: none; }

/* ── 토스트 ────────────────────────────────── */
.toast {
  position: fixed; z-index: 50;
  left: 50%; bottom: calc(var(--safe-b) + 26px);
  transform: translate(-50%, 24px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(20,8,34,.94);
  border: 1px solid var(--card-line);
  backdrop-filter: blur(10px);
  font-size: 13.5px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 접근성 / 소형 화면 ────────────────────── */
@media (max-width: 340px) {
  .title { font-size: 33px; }
  .phone-input { font-size: 26px; }
  .initials span { width: 50px; height: 60px; font-size: 29px; }
  .score-num { font-size: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
