:root {
  --bg: #fff8f3;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #8a7d76;
  --line: #f0e4dc;
  --primary: #ff6b4a;
  --primary-dark: #e9532f;
  --soft: #ffe9e1;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  line-height: 1.5;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }

#app { max-width: 460px; margin: 0 auto; min-height: 100vh; }

.screen { padding: 12px 20px 48px; }

h1 { font-size: 24px; line-height: 1.35; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 6px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 0 0 6px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
small { color: var(--muted); font-weight: 400; }

/* ---------- 버튼 ---------- */
.primary, .secondary, .ghost {
  display: block; width: 100%;
  border: 0; border-radius: 14px;
  padding: 16px; font-size: 16px; font-weight: 700;
  transition: transform .08s, background .15s;
}
.primary { background: var(--primary); color: #fff; margin-top: 20px; }
.primary:hover { background: var(--primary-dark); }
.primary:active, .secondary:active, .ghost:active { transform: scale(.98); }
.primary:disabled { background: #e6d9d2; color: #fff; cursor: not-allowed; }
.primary.small { padding: 10px 14px; font-size: 14px; margin-top: 10px; }
.secondary { background: var(--soft); color: var(--primary-dark); }
.ghost { background: transparent; color: var(--muted); font-weight: 500; margin-top: 8px; }

.chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font-size: 15px; font-weight: 600;
}
.chip small { font-size: 12px; }
.chip.on { border-color: var(--primary); background: var(--soft); color: var(--primary-dark); }

.grid2, .grid3 { display: grid; gap: 10px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.actions .grid2 { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { flex-direction: row; padding: 9px 14px; font-size: 14px; border-radius: 999px; }

/* ---------- 상단바 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; margin: 0 -8px;
}
.topbar-title { font-weight: 700; font-size: 15px; }
.icon-btn, .icon-btn-space { width: 40px; height: 40px; }
.icon-btn { background: none; border: 0; font-size: 22px; border-radius: 10px; }
.icon-btn:hover { background: var(--soft); }
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: 6px; transition: width .3s; }

/* ---------- 시작 ---------- */
.hero { text-align: center; padding: 20px 0 8px; }
.hero-art { display: flex; justify-content: center; gap: 4px; margin-bottom: 12px; }
.hero-art .hair-art { width: 96px; height: 120px; background: var(--soft); border-radius: 24px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p { color: var(--muted); font-size: 14px; margin: 0; }
.block { margin-top: 28px; }
.block h2 { margin-bottom: 10px; }
.fine { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ---------- 질문 ---------- */
.question { padding-top: 28px; }
.mirror { display: inline-block; background: var(--soft); color: var(--primary-dark); font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin: 0 0 14px; }
.answers { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.answer {
  text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 16px;
  padding: 20px; font-size: 17px; font-weight: 600;
}
.answer:hover { border-color: #ffc2b2; }
.answer.on { border-color: var(--primary); background: var(--soft); }

/* ---------- 결과 ---------- */
.face-card {
  text-align: center; background: var(--card); border-radius: var(--radius);
  padding: 24px 20px; margin-top: 8px; box-shadow: 0 2px 12px rgba(80, 40, 20, .06);
}
.face-outlines { display: flex; justify-content: center; gap: 12px; margin-bottom: 8px; }
.face-outline { width: 80px; height: 96px; }
.face-card .sub { margin: 0; }
.face-card h1 { color: var(--primary-dark); margin: 2px 0 6px; }
.principle { margin: 0; font-size: 15px; }
.avoid { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; font-size: 13px; }
.avoid span { width: 100%; color: var(--muted); }
.avoid em { font-style: normal; background: #f5efeb; padding: 4px 10px; border-radius: 999px; text-decoration: line-through; color: #8a7066; }

.section-title { margin-top: 32px; }
.style-card {
  display: flex; gap: 14px; background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-top: 12px; box-shadow: 0 2px 12px rgba(80, 40, 20, .06);
}
.style-art { flex: 0 0 100px; }
.style-art .hair-art { width: 100px; height: 125px; background: var(--soft); border-radius: 14px; }
.style-body { flex: 1; min-width: 0; }
.rank { font-size: 12px; font-weight: 700; color: var(--primary); }
.reason { font-size: 14px; color: #5b4f49; margin: 0; }
.later { font-size: 13px; color: var(--muted); background: #f5efeb; padding: 12px 14px; border-radius: 12px; margin-top: 16px; }
.disclaimer { font-size: 13px; color: var(--muted); text-align: center; margin: 20px 0 0; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- 옵션 ---------- */
.preview {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  background: var(--bg); padding: 8px 0 12px; border-bottom: 1px solid var(--line);
}
.preview .hair-art { width: 72px; height: 90px; background: var(--soft); border-radius: 14px; flex: 0 0 auto; }
.preview h2 { font-size: 17px; margin: 0; }
.preview .sub { margin: 0; font-size: 12px; }
.opt-group { margin-top: 26px; }
.opt-group h3 small { font-size: 12px; margin-left: 4px; }
.subgroup { margin-top: 14px; }
.subgroup h4 { font-size: 14px; margin: 0 0 8px; color: var(--muted); }
.pics { display: grid; gap: 8px; }
.pics.four { grid-template-columns: repeat(4, 1fr); }
.pics.three { grid-template-columns: repeat(3, 1fr); }
.pic {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 6px 4px 8px;
  font-size: 12px; font-weight: 600;
}
.pic .hair-art { width: 100%; height: auto; aspect-ratio: 120 / 150; }
.pic.on { border-color: var(--primary); background: var(--soft); color: var(--primary-dark); }
.text-input {
  width: 100%; margin-top: 10px; padding: 12px 14px; font: inherit; font-size: 14px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card);
}
.text-input:focus { outline: none; border-color: var(--primary); }

/* ---------- 주문서 카드 ---------- */
.order-card {
  background: #fff; border-radius: 22px; padding: 22px 20px 18px; margin-top: 8px;
  box-shadow: 0 6px 24px rgba(80, 40, 20, .1); border: 2px solid var(--line);
}
.greet {
  background: var(--primary); color: #fff; font-size: 18px; font-weight: 800;
  border-radius: 14px; padding: 14px 16px; line-height: 1.4;
}
.greet small { display: block; color: #ffe3da; font-size: 13px; font-weight: 500; margin-top: 2px; }
.o-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.o-style { margin-top: 16px; }
.o-style strong { font-size: 22px; }
.o-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.o-pics figure { margin: 0; background: var(--soft); border-radius: 14px; padding: 8px 8px 6px; text-align: center; }
.o-pics .hair-art { width: 100%; height: auto; aspect-ratio: 120 / 150; }
.o-pics figcaption { font-size: 12px; font-weight: 700; color: var(--primary-dark); }
.o-lines { margin: 18px 0 0; padding-left: 22px; font-size: 16px; }
.o-lines li { margin-bottom: 10px; padding-left: 2px; }
.o-lines li::marker { color: var(--primary); font-weight: 800; }
.o-donts { margin-top: 14px; background: #fff4f1; border-radius: 14px; padding: 12px 14px; }
.o-donts ul { margin: 0; padding-left: 18px; font-size: 15px; }
.o-donts li { margin-bottom: 4px; }
.o-note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.o-foot { text-align: right; font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-top: 14px; }

.term {
  background: none; border: 0; padding: 0; font-weight: 700; color: inherit;
  border-bottom: 2px dotted var(--primary); border-radius: 0;
}
.term:hover { background: var(--soft); }

.tip { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }

/* ---------- 용어 시트 ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(40, 25, 20, .4); animation: fade .2s; }
.sheet {
  position: relative; width: 100%; max-width: 460px; max-height: 80vh; overflow: auto;
  background: #fff; border-radius: 22px 22px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
.sheet h2 { font-size: 22px; margin-top: 2px; }
.sheet .sub { margin: 0; }
.term-desc { font-size: 17px; margin: 8px 0 0; }
.glossary { margin: 12px 0 0; }
.glossary dt { font-weight: 800; margin-top: 12px; color: var(--primary-dark); }
.glossary dd { margin: 2px 0 0; font-size: 14px; }

@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(43, 35, 32, .92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
