/* 비타레인 체험단 당첨자 페이지 — 토큰은 VITARAIN_05_최종명세 §1, 보정 1~23 반영 */

@font-face { font-family: Pretendard; font-weight: 400; font-display: swap; src: url(assets/fonts/Pretendard-Regular.woff2) format("woff2"); }
@font-face { font-family: Pretendard; font-weight: 600; font-display: swap; src: url(assets/fonts/Pretendard-SemiBold.woff2) format("woff2"); }
@font-face { font-family: Pretendard; font-weight: 700; font-display: swap; src: url(assets/fonts/Pretendard-Bold.woff2) format("woff2"); }
@font-face { font-family: Pretendard; font-weight: 800; font-display: swap; src: url(assets/fonts/Pretendard-ExtraBold.woff2) format("woff2"); }

:root {
  --brand: #0768AC;
  --ink: #102D43;
  --muted: #465F72;
  --white: #FFFFFF;
  --water: #EDF7FC;
  --canvas: #F4F8FA;
  --line: #D6E3EB;
  --control: #73899A;
  --disabled-bg: #C9D7E1;   /* 흰 바탕 대비 1.18 → 1.47, 테두리(control)로 버튼 윤곽 3.64:1 */
  --disabled-fg: #33495A;   /* 글자 대비 4.99 → 6.38 */
  --warning-bg: #FFF4DD;
  --warning: #714510;
  --error-bg: #FFF0F1;
  --error: #A32634;
  --success-bg: #E8F7EF;
  --success: #176240;

  /* 향 포인트색 13종 (최종명세 §1) */
  --scent-딸기: #F8DAD8;
  --scent-라벤더: #E9DCEE;
  --scent-레몬: #FCF0BC;
  --scent-망고: #FFE7CD;
  --scent-무향: #BDE7F4;
  --scent-벚꽃: #FFDCE7;
  --scent-베이비: #E3F3F7;
  --scent-복숭아: #EAD4E3;
  --scent-솔: #DAE1D5;
  --scent-아카시아: #FFDED7;
  --scent-자몽: #F3D6D8;
  --scent-장미: #FCCACB;
  --scent-후리지아: #E4F1D4;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/24px Pretendard, system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1:focus, h2:focus { outline: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--white); }
.header { height: 68px; padding: 0 20px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.header img { width: 100px; height: 20px; }
.block { padding: 32px 20px 40px; }
.block > * + *, form > * + * { margin-top: 20px; }

/* 서체 단계 */
.display { font: 800 29px/36px Pretendard, system-ui, sans-serif; letter-spacing: -0.4px; }
.display .brand { display: block; }
.title { font: 800 24px/32px Pretendard, system-ui, sans-serif; letter-spacing: -0.4px; }
.subhead { font-size: 20px; line-height: 28px; font-weight: 700; }
.label { display: block; font-weight: 700; }
.meta { font-size: 14px; line-height: 20px; font-weight: 600; }
.muted { color: var(--muted); }
.brand { color: var(--brand); }
.mt32 { margin-top: 32px !important; }
strong { font-weight: 700; color: var(--brand); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }

/* 버튼 */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--r);
  font-weight: 700; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--brand); color: var(--white); }
.btn.primary:active:not(:disabled) { transform: translateY(1px); }
.btn.secondary { background: var(--white); color: var(--brand); border-color: var(--control); }
.btn:disabled { background: var(--disabled-bg); color: var(--disabled-fg); border-color: var(--control); cursor: not-allowed; }
.btn.busy { background: var(--brand); color: var(--white); }
.btn-text {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--brand); font-weight: 700; text-align: left;
}
.btn-text.back { margin-bottom: -12px; }

.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 로딩 — 스켈레톤 + 타이핑 안내. 안내는 대표 사진 자리 가운데(헤더 아래 약 120px, 보정 22 위치) */
.loading-view { padding: 20px 20px 40px; }
.sk-hero, .sk {
  background: linear-gradient(90deg, var(--canvas) 25%, #E7F0F6 45%, var(--canvas) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-hero { height: 188px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; }
.loading-status { display: flex; flex-direction: column; align-items: center; padding: 0 16px; text-align: center; }
.loading-status .spinner-wrap { background: var(--white); }
.typing { margin-top: 12px; min-height: 24px; font-weight: 700; color: var(--ink); }
.typing::after { content: ""; display: inline-block; width: 2px; height: 18px; margin-left: 2px; vertical-align: -3px; background: var(--brand); animation: blink 1s steps(1) infinite; }
.skeleton .sk { display: block; height: 28px; margin-top: 12px; border-radius: var(--r-sm); }
.skeleton .sk:first-child { margin-top: 20px; height: 32px; }
.sk.w85 { width: 85%; }
.sk.w60 { width: 60%; }
.skeleton .sk.sk-card { height: 72px; margin-top: 20px; border-radius: var(--r); }
.skeleton .sk.sk-short { height: 52px; margin-top: 8px; }
.sk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.skeleton .sk-row .sk.sk-chip { height: 60px; margin: 0; border-radius: var(--r); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes blink { 50% { opacity: 0; } }
.spinner-wrap { width: 48px; height: 48px; border-radius: 50%; background: var(--water); display: flex; align-items: center; justify-content: center; }
.spinner-wrap .spinner { width: 20px; height: 20px; border-color: var(--line); border-top-color: var(--brand); }

/* 카드·박스 */
.card { padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.card.water { background: var(--water); }
.card > * + * { margin-top: 4px; }
.warnbox, .infobox, .errbox { display: flex; gap: 8px; padding: 12px; border-radius: var(--r-lg); }
.warnbox { background: var(--warning-bg); color: var(--warning); }
.warnbox .icon, .infobox .icon, .errbox .icon { margin-top: 2px; }
.infobox { background: var(--water); border-radius: var(--r); }
.infobox .icon { margin-top: 4px; }
.errbox { background: var(--error-bg); color: var(--error); border-radius: var(--r); }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 8px; border-radius: var(--r-sm); background: var(--water); color: var(--brand); font-size: 14px; line-height: 20px; font-weight: 600; }

/* S1 안내 */
.intro { padding: 20px 20px 32px; background: var(--water); }
.intro > * + * { margin-top: 20px; }
.intro .card + .card { margin-top: 8px; }
.hero { width: 100%; height: 188px; object-fit: cover; border-radius: var(--r-lg); }
.prize { display: flex; align-items: center; gap: 12px; }
.prize > div > * { margin: 0; }
.icon-box { width: 48px; height: 48px; flex: none; border-radius: var(--r); background: var(--water); display: flex; align-items: center; justify-content: center; }
.bonus .label { display: flex; align-items: center; gap: 8px; }
.schedule { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.schedule li { min-height: 60px; padding: 8px 6px 8px 8px; min-width: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); display: flex; flex-direction: column; justify-content: center; }
.schedule b { font-weight: 700; white-space: nowrap; letter-spacing: -0.4px; }
.schedule .first { color: var(--brand); }
@media (max-width: 371px) { .schedule b { font-size: 14px; line-height: 20px; } }

.accordion { border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.accordion summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 12px; font-weight: 700; cursor: pointer; list-style: none; border-radius: var(--r); }
.accordion summary::-webkit-details-marker { display: none; }
.accordion[open] summary .icon { transform: rotate(180deg); }
.accordion .bullets { padding: 0 12px 12px; }
.bullets li { position: relative; padding-left: 16px; }
.bullets li + li { margin-top: 8px; }
.bullets li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
.checklist { margin-top: 12px !important; }
.checklist .ad { color: var(--warning); font-weight: 600; }
.checklist .ad::before { display: none; }
.checklist .ad .icon { position: absolute; left: -2px; top: 4px; }
.checklist .ad small { display: block; font-size: 14px; line-height: 20px; }

/* 폼 */
.field > * + * { margin-top: 8px; }
.field > .help, .field > .error { margin-top: 4px; }
.field > .label + .help { margin-top: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted); }
.tag.req { color: var(--brand); }
.help { color: var(--muted); }
.error { color: var(--error); display: flex; gap: 4px; }
.error::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 4px; background: var(--error); -webkit-mask: var(--i-error) center / contain no-repeat; mask: var(--i-error) center / contain no-repeat; }
:root { --i-error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M10 6v5M10 13.6v.2'/%3E%3C/svg%3E"); }

.input, .input-prefix {
  display: block; width: 100%; min-height: 48px; padding: 11px 12px;
  border: 1px solid var(--control); border-radius: var(--r);
  background: var(--white); color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .input-prefix input::placeholder { color: var(--muted); opacity: 1; }
.input:focus, .input-prefix:focus-within { outline: 0; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.input[readonly], .input-prefix.readonly { background: var(--canvas); }
.invalid .input, .invalid .input-prefix, .input.invalid { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.invalid > .help { display: none; }   /* 보정 8: 오류가 있으면 도움말 숨김 */
.input-prefix { display: flex; align-items: center; padding: 0 12px; }
.input-prefix span { padding-right: 10px; margin-right: 10px; border-right: 1px solid var(--line); color: var(--brand); font-weight: 700; }
.input-prefix input { flex: 1; min-width: 0; height: 46px; border: 0; padding: 0; background: none; outline: 0; }
.zip-row { display: flex; gap: 8px; }
.zip-row .input { flex: 1; min-width: 0; }
.zip-row .btn { width: auto; flex: none; }

.postcode { position: relative; height: 400px; border: 1px solid var(--control); border-radius: var(--r); overflow: hidden; padding-top: 44px; }
.postcode #postcode-embed { position: relative; z-index: 1; height: 100%; }
/* 위젯이 뜨기 전까지 보이는 안내. 위젯 화면이 그려지면 그 아래로 가려진다 */
.postcode-loading { position: absolute; top: 44px; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.postcode-close { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; background: none; display: flex; align-items: center; justify-content: center; }

/* 향 선택칩 (보정 10: 색 점 + 이름) */
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chips label { position: relative; display: block; }
.chips input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chips span {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--control); border-radius: var(--r); background: var(--white); font-weight: 700;
}
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--dot, var(--line)); box-shadow: 0 0 0 1px rgba(16, 45, 67, .18); }
.chips input:checked + span { background: var(--water); border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); color: var(--brand); }
.chips input:checked + span::after { content: ""; margin-left: auto; width: 16px; height: 16px; flex: none; background: var(--brand); -webkit-mask: var(--i-check) center / contain no-repeat; mask: var(--i-check) center / contain no-repeat; }
.chips input:focus-visible + span, .segment input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
:root { --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 10.5 3.5 3.5 7.5-8'/%3E%3C/svg%3E"); }

/* 동의 */
.consent { padding: 0 12px; }
.consent > * { margin: 0; }
.consent-row { display: flex; align-items: center; min-height: 52px; border-top: 1px solid var(--line); }
.consent-row:first-child { border-top: 0; font-weight: 700; }
.consent-row label { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.consent-row input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 20px; height: 20px; border: 1px solid var(--control); border-radius: 4px; background: var(--white);
}
.consent-row input:checked, .consent-row input:indeterminate { border-color: var(--brand); background: var(--brand) var(--i-check-w) center / 16px no-repeat; }
.consent-row input:indeterminate { background-image: var(--i-dash-w); }
:root {
  --i-check-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 10.5 3.5 3.5 7.5-8'/%3E%3C/svg%3E");
  --i-dash-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M5 10h10'/%3E%3C/svg%3E");
}
.consent-row .btn-text { flex: none; padding-left: 12px; }
.consent-detail { padding: 0 0 12px 32px; }
.consent-detail a { color: var(--brand); font-weight: 600; word-break: break-all; }
.consent-done { display: flex; align-items: center; gap: 8px; }
.consent-done > * { margin: 0; }

/* 요약 카드 */
.summary { padding: 0 12px; }
.summary > div { display: flex; gap: 12px; padding: 12px 0; margin: 0; align-items: flex-start; }
.summary > div + div { border-top: 1px solid var(--line); }
.summary dt { flex: none; width: 80px; font-size: 14px; line-height: 24px; font-weight: 600; color: var(--muted); }
.summary dd { flex: 1; min-width: 0; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.summary dd img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.summary dd img.cap { width: 64px; height: 64px; border-radius: var(--r-sm); }
.summary dd .url { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.status { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--water); color: var(--brand); }
.status.ok { background: var(--success-bg); color: var(--success); }
.status.ok .icon { stroke-width: 2; }   /* 보정 15·19 */
.status.err { background: var(--error-bg); color: var(--error); }
.status + .title { margin-top: 16px; }

.linkbox > * + * { margin-top: 12px; }
.linktext { padding: 12px; border: 1px solid var(--control); border-radius: var(--r-sm); background: var(--white); word-break: break-all; -webkit-user-select: all; user-select: all; }

/* 메인 — 당첨 확인 결과 */
.result { border-top: 1px solid var(--line); }
.result > div > * + * { margin-top: 12px; }
.steps ol { margin: 8px 0 0; padding-left: 20px; }
.steps li + li { margin-top: 4px; }
#cr-dm .icon { margin-left: 4px; }

/* 설치 안내 캐러셀 (S2) — 옆으로 넘기는 4:5 카드 */
.guide { display: flex; gap: 8px; margin: 12px -20px 0 !important; padding: 0 20px 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; scroll-padding-left: 20px; scrollbar-width: none; }
.guide::-webkit-scrollbar { display: none; }
.guide li { flex: none; width: 74%; max-width: 288px; scroll-snap-align: start; }
.guide img, .guide video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r); background: var(--canvas); }

/* 후기 */
.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 4px; border-radius: var(--r); background: var(--canvas); }
.segment label { position: relative; }
.segment input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segment span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 2px solid transparent; border-radius: 10px; font-weight: 700; }
.segment input:checked + span { background: var(--white); border-color: var(--brand); color: var(--brand); }

.upload { min-height: 112px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--r); display: flex; align-items: center; justify-content: center; }
.upload > div { display: none; width: 100%; }
.upload[data-state="empty"] .up-empty,
.upload[data-state="busy"] .up-busy,
.upload[data-state="fail"] .up-fail { display: block; }
.upload[data-state="done"] .up-done { display: flex; align-items: center; gap: 12px; }
.upload[data-state="done"] { border-style: solid; border-color: var(--line); }
.upload[data-state="fail"] { border: 0; background: var(--error-bg); color: var(--error); }
.upload .btn { width: auto; min-width: 96px; margin: 0 auto; min-height: 44px; }
.up-done img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); background: var(--canvas); }
.up-done b { flex: 1; }
.up-done .btn { margin: 0; }
.up-fail p { display: flex; gap: 8px; }
.up-fail p .icon { margin-top: 4px; }
.up-fail .btn { margin: 12px 0 0 24px; }
.up-fail #cap-contact { margin-top: 12px; }
.progress { height: 4px; margin-top: 12px; border-radius: 2px; background: var(--canvas); overflow: hidden; }
.progress i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--brand); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* 영역 5 */
.more { padding: 32px 20px 40px; background: var(--canvas); }
.more > * + * { margin-top: 16px; }
.products li { display: flex; gap: 12px; align-items: center; }
.products li + li { margin-top: 12px; }
.products li > div { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--line); }
.thumb { width: 80px; height: 80px; flex: none; border: 1px solid var(--line); border-radius: var(--r); background: var(--canvas); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ph { background: var(--white); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); text-align: center; }
.reel { margin: 24px 0 0; }
.reel video { display: block; width: 100%; max-width: 270px; height: auto; aspect-ratio: 9 / 16; margin: 0 auto; border-radius: var(--r-lg); background: var(--white); }
.reel figcaption { margin-top: 8px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); text-align: center; }
.hint { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.more h3 { font-size: 16px; }
.gallery { display: flex; gap: 8px; margin: 12px -20px 0 !important; padding: 0 20px 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery li { flex: none; width: 76px; }
.gallery img { width: 76px; height: 76px; border-radius: var(--r-sm); background: var(--white); object-fit: cover; }
.gallery span { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 4px; font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.stores > * + * { margin-top: 8px; }
.stores .icon { margin-left: auto; }
.stores .btn::before { content: ""; width: 16px; margin-right: auto; }   /* 글자를 가운데로 */
#end-stores { margin-top: 24px; }

.footer { padding: 24px 20px 40px; border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); }
.footer img { width: auto; height: 26px; margin-bottom: 12px; }
.footer p + p { margin-top: 4px; }

/* 토스트 */
.toast {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  width: calc(100% - 40px); max-width: 440px; padding: 12px;
  border-radius: var(--r); background: var(--error-bg); color: var(--error); font-weight: 600;
  box-shadow: 0 8px 24px #102D4326;
}
.toast.ok { background: var(--success-bg); color: var(--success); }

@media (prefers-reduced-motion: reduce) {
  .spinner, .progress i { animation-duration: 2.4s; }
  .sk-hero, .sk, .typing::after { animation: none; }
  .btn.primary:active { transform: none; }
}
