/* 키오스크 전용 밝고 경쾌한 테마 (ver1 디자인). 매장 화면이라 OS 다크 모드와 관계없이 밝게 둔다 (관리자 화면은 tokens.css 그대로). */
:root, :root[data-theme="light"] {
  --bg: #fff9f2;
  --surface: #ffffff;
  --surface-2: #fff1e8;
  --ink: #2b2445;
  --ink-2: #5d5675;
  --ink-3: #8e87a3;
  --line: #f3e3d6;
  --accent: #f43f7a;          /* 큰 글자·배경용 (흰 글자 대비 3.6:1) */
  --accent-strong: #d42a62;   /* 작은 글자용 (흰 바탕 대비 4.8:1) */
  --accent-ink: #ffffff;
  --accent-soft: #ffe4ee;
  --sky: #2f9bff;
  --sky-soft: #e2f1ff;
  --sun: #ffc23d;
  --sun-soft: #fff4d6;
  --mint: #19c39a;
  --mint-soft: #dcf8ef;
  --warn: #a35a00;
  --warn-soft: #fff1cc;
  --ok: #128a5c;
  --ok-soft: #dcf8ef;
  --grad: linear-gradient(135deg, #f43f7a 0%, #ff5e3a 100%);
  --radius: 22px;
  --shadow: 0 2px 4px rgba(244, 63, 122, .06), 0 12px 32px rgba(43, 36, 69, .08);
  color-scheme: light;
}

html, body { height: 100%; }
body {
  overflow-x: hidden;
  word-break: keep-all; /* 한국어를 어절 단위로 줄바꿈 */
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 194, 61, .28), transparent 32%),
    radial-gradient(circle at 96% 18%, rgba(47, 155, 255, .18), transparent 30%),
    radial-gradient(circle at 80% 96%, rgba(244, 63, 122, .16), transparent 34%),
    radial-gradient(circle at 4% 88%, rgba(25, 195, 154, .16), transparent 30%),
    var(--bg);
  background-attachment: fixed;
}

.app {
  min-height: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(16px, 4vw, 40px) 32px;
}

/* ---------- 상단 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 2px dashed var(--line);
}
.brand {
  font-weight: 900; letter-spacing: .14em; font-size: 15px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.steps {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  visibility: hidden;
}
.steps.show { visibility: visible; }
.steps li {
  font-size: 14px;
  color: var(--ink-3);
  padding: 4px 10px;
  border-radius: 999px;
}
.steps li.done { color: var(--ok); font-weight: 600; }
.steps li.done::before { content: "✓ "; }
.steps li.now { background: var(--grad); color: var(--accent-ink); font-weight: 800; box-shadow: 0 4px 12px rgba(244, 63, 122, .3); }

main { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding-top: 32px; animation: in .25s ease; }
.screen[hidden] { display: none; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: clamp(48px, 9vw, 88px); line-height: 1.05; margin: 0 0 20px; letter-spacing: -.03em; }
.hero h1:not(.h-md) {
  background: linear-gradient(120deg, #f43f7a 0%, #ff7a3d 45%, #ffb21f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: .06em;
}
h1.h-md { font-size: clamp(32px, 6vw, 48px); }
h2 { font-size: clamp(26px, 4.4vw, 36px); margin: 0 0 24px; letter-spacing: -.02em; }
h3 { font-size: 18px; margin: 0 0 10px; }
.eyebrow { color: var(--accent-strong); font-weight: 800; font-size: 20px; margin: 0 0 8px; }
.lead { font-size: clamp(19px, 3vw, 24px); color: var(--ink-2); margin: 0 0 32px; }
.fineprint { color: var(--ink-3); font-size: 15px; margin: 16px 0 0; }
.hint { color: var(--ink-3); font-size: 16px; margin: 12px 0 0; min-height: 24px; }
.hint.err { color: var(--danger); }

/* ---------- 버튼 ---------- */
.btn {
  border: 0;
  border-radius: 16px;
  padding: 18px 28px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(244, 63, 122, .32); }
.btn-primary:disabled { box-shadow: none; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-xl { font-size: 26px; padding: 24px 64px; border-radius: 999px; }
.btn-sm { font-size: 17px; padding: 12px 22px; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 28px;
  flex-wrap: wrap;
}
.actions[hidden] { display: none; }
.actions .btn-primary { margin-left: auto; min-width: 220px; }

/* ---------- S1 ---------- */
.hero { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 40px 0; }
.howto { display: flex; gap: 12px; list-style: none; padding: 0; margin: 0 0 40px; flex-wrap: wrap; justify-content: center; }
.howto li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 18px 10px 10px; font-size: 18px;
}
.howto b {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 15px;
}
.howto li { box-shadow: var(--shadow); border-color: transparent; }
.howto li:nth-child(2) b { background: var(--sky); }
.howto li:nth-child(3) b { background: var(--mint); }

/* ---------- S2 ---------- */
.notice {
  background: var(--sky-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 20px;
}
.notice ul { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 17px; }
.notice li + li { margin-top: 6px; }
.notice b { color: var(--ink); }

.choices { display: grid; gap: 12px; }
.choice {
  display: flex; gap: 18px; align-items: flex-start;
  background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .box {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  border: 2px solid var(--ink-3); display: grid; place-items: center; margin-top: 2px;
}
.choice input:checked ~ .box { background: var(--accent); border-color: var(--accent); }
.choice input:checked ~ .box::after {
  content: ""; width: 9px; height: 16px; border: solid var(--accent-ink);
  border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -2px);
}
.choice input:focus-visible ~ .box { outline: 3px solid var(--accent); outline-offset: 3px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-text { display: flex; flex-direction: column; gap: 4px; }
.choice-text b { font-size: 20px; }
.choice-text span { color: var(--ink-2); font-size: 16px; }
.field-group {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 20px;
}
.field-group label { display: block; margin-bottom: 10px; font-size: 18px; }
.height-input {
  width: 140px; font-size: 20px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); font-family: var(--font);
}
.height-input:focus { outline: none; border-color: var(--accent); }
.req {
  font-style: normal; font-size: 13px; font-weight: 700; color: var(--accent-strong);
  background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; margin-left: 6px; vertical-align: 2px;
}

/* ---------- S3 · 분류 탭 ---------- */
.category-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.category-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  cursor: pointer; text-align: left; color: var(--ink); font: inherit; touch-action: manipulation;
}
.category-tab:active { transform: scale(.98); }
.category-tab b { font-size: 18px; }
.category-tab span { font-size: 13px; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 분류마다 색을 다르게: 상의 핑크, 하의 하늘, 신발 노랑, 모자 민트 */
.category-tab { --cat: var(--accent); --cat-soft: var(--accent-soft); --cat-ink: var(--accent-strong); border-color: transparent; box-shadow: var(--shadow); }
.category-tab:nth-child(2) { --cat: var(--sky); --cat-soft: var(--sky-soft); --cat-ink: #1167c4; }
.category-tab:nth-child(3) { --cat: var(--sun); --cat-soft: var(--sun-soft); --cat-ink: #8a5a00; }
.category-tab:nth-child(4) { --cat: var(--mint); --cat-soft: var(--mint-soft); --cat-ink: #0e8068; }
.category-tab.has-pick span { color: var(--cat-ink); font-weight: 700; }
.category-tab.has-pick b::after { content: " ✓"; color: var(--cat-ink); }
.category-tab[aria-selected="true"] { border-color: var(--cat); background: var(--cat-soft); }
.category-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- S3 · 의상 목록 ---------- */
.garments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.garment {
  background: var(--surface); border: 2px solid transparent; border-radius: var(--radius);
  padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); transition: border-color .15s ease, transform .1s ease;
}
.garment:active { transform: scale(.98); }
.garment[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); transform: translateY(-3px); }
.garment[aria-checked="true"] .pic::after {
  content: "✓"; position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 900; font-size: 16px;
}
.garment .pic { position: relative; background: linear-gradient(160deg, var(--sun-soft), var(--accent-soft)); border-radius: 14px; aspect-ratio: 5 / 6; display: grid; place-items: center; padding: 12px; overflow: hidden; }
.garment img { width: 100%; height: 100%; object-fit: contain; }
.garment .name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.empty-note { color: var(--ink-3); font-size: 16px; padding: 40px 0; text-align: center; }

/* ---------- S3 · 고른 옷 요약 (S4 하단에서도 같이 쓴다) ---------- */
.outfit { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; min-height: 44px; align-items: center; }
.outfit-empty { color: var(--ink-3); font-size: 16px; }
.picked-item {
  display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 2px solid var(--accent-soft);
  border-radius: 999px; padding: 4px 14px 4px 4px; font-size: 15px; font-weight: 600; color: var(--ink);
}
.picked-item img { width: 34px; height: 34px; object-fit: contain; background: var(--sun-soft); border-radius: 50%; padding: 3px; }

/* ---------- S4 ---------- */
.stage {
  position: relative;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 0 0 6px var(--surface), 0 0 0 9px var(--accent-soft), var(--shadow);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  width: min(100%, 62vh * 3 / 4);
  margin: 0 auto;
}
.stage video, .stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage video { transform: scaleX(-1); }
.guide { position: absolute; inset: 2% 15% 0; width: 70%; height: 98%; fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 3; stroke-dasharray: 10 8; pointer-events: none; }
.guide.off { display: none; }
.guide-label {
  position: absolute; left: 50%; bottom: 7%; transform: translate(-50%, 50%);
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; pointer-events: none;
}
.guide-label.off { display: none; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 180px; font-weight: 900; color: var(--sun); text-shadow: 0 4px 0 #f43f7a, 0 8px 30px rgba(0, 0, 0, .4);
}
.countdown[hidden] { display: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .4s ease; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #fff; padding: 40px; font-size: 19px; background: linear-gradient(160deg, #3a2f63, #2b2445);
}
.stage-msg[hidden] { display: none; }
.picked {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 14px; color: var(--ink-2); font-size: 17px;
}
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn[hidden] { display: none; }

/* ---------- S5 ---------- */
.loading { margin: auto 0; text-align: center; padding: 60px 0; }
.loading[hidden], .result[hidden], .failed[hidden] { display: none; }
.loading p { color: var(--ink-2); font-size: 18px; }
.spinner {
  width: 72px; height: 72px; margin: 0 auto 28px; border-radius: 50%;
  border: 6px solid var(--sun-soft); border-top-color: var(--accent); border-right-color: var(--sky); border-bottom-color: var(--sun);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result, .failed { display: flex; flex-direction: column; flex: 1; }
.failed p { color: var(--ink-2); font-size: 18px; }
.result-frame {
  position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
  box-shadow: 0 0 0 6px var(--surface), var(--shadow);
  aspect-ratio: 3 / 4; margin: 0 auto; width: min(100%, 60vh * 3 / 4);
}
.result-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mock-tag {
  position: absolute; top: 14px; left: 14px; background: rgba(0, 0, 0, .7); color: #fff;
  font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 8px;
}
.mock-tag[hidden] { display: none; }
.fit-notes { margin-top: 16px; display: grid; gap: 8px; }
.fit-note {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; font-size: 15px; color: var(--ink-2); margin: 0;
}
.fit-note b { color: var(--ink); }

/* ---------- S6 ---------- */
.share { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.share-thumb { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.share-options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.option > div { display: flex; flex-direction: column; gap: 2px; }
.option b { font-size: 19px; }
.option span { color: var(--ink-2); font-size: 15px; }
.option code { font-family: inherit; font-weight: 700; color: var(--ink); }
.deliver-status { margin: 4px 0 0; padding: 14px 18px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.deliver-status[hidden] { display: none; }

/* ---------- 종료 ---------- */
.check {
  width: 88px; height: 88px; border-radius: 50%; background: var(--mint); margin-bottom: 28px; position: relative;
  box-shadow: 0 0 0 10px var(--mint-soft);
}
.check::after {
  content: ""; position: absolute; left: 32px; top: 18px; width: 20px; height: 38px;
  border: solid #fff; border-width: 0 6px 6px 0; transform: rotate(45deg);
}

/* ---------- 모달·토스트 ---------- */
.modal { position: fixed; inset: 0; background: rgba(43, 36, 69, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border-radius: 28px; border-top: 8px solid var(--sun); padding: 32px;
  width: min(520px, 100%); box-shadow: var(--shadow); max-height: 86vh; overflow-y: auto;
}
.modal-card p { font-size: 19px; color: var(--ink-2); }

/* ---------- 사이즈 선택 팝업 ---------- */
.size-modal-card { cursor: default; }
.size-list { display: grid; gap: 10px; margin-top: 4px; }
.size-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 18px; cursor: pointer; text-align: left; color: var(--ink); font: inherit;
  transition: border-color .15s ease, background-color .15s ease;
}
.size-option:active { transform: scale(.99); }
.size-option b { font-size: 19px; }
.size-option span { font-size: 14px; color: var(--ink-3); }
.size-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.size-option.selected b::after { content: " ✓"; color: var(--accent-strong); }
.size-list .fineprint { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-size: 17px;
  max-width: calc(100% - 32px); z-index: 20; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .steps { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .steps li { padding: 4px 8px; font-size: 13px; }
  .category-tabs { grid-template-columns: repeat(2, 1fr); }
  .category-tab { padding: 10px 12px; }
  .category-tab b { font-size: 16px; }
  .garments { grid-template-columns: repeat(2, 1fr); }
  .share { grid-template-columns: 1fr; }
  .share-thumb { max-width: 220px; }
  .actions .btn { flex: 1; }
  .actions .btn-primary { min-width: 0; width: 100%; flex-basis: 100%; order: -1; }
  .btn-xl { padding: 22px 40px; }
}
