:root {
  --navy: #1B2A49; --navy-2: #24365e; --coral: #FF7A59; --coral-2: #ff9a7f; --teal: #2A9D8F;
  --bg: #F4F5F9; --card: #ffffff; --ink: #1c2135; --muted: #6b7280; --line: #e6e8f0;
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px -12px rgba(20, 30, 60, .18);
  --shadow-lg: 0 20px 50px -20px rgba(27, 42, 73, .35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Pretendard Variable", Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; font-weight: 800; } h2 { font-size: 1.3rem; font-weight: 800; } h3 { font-size: 1.02rem; font-weight: 700; }
h1 em { color: var(--coral); font-style: normal; }
small { font-weight: 400; font-size: .8rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
.hidden { display: none !important; }
a { color: var(--coral); }
:focus-visible { outline: 3px solid var(--coral-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- 상단바 ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; padding-top: calc(.55rem + env(safe-area-inset-top, 0px)); flex-wrap: wrap; box-shadow: 0 4px 24px -8px rgba(0, 0, 0, .35); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 900; letter-spacing: .1em; cursor: pointer; font-size: .95rem; }
.logo { width: 20px; height: 20px; border-radius: 50%; border: 5px solid var(--coral); display: inline-block; box-shadow: 0 0 0 2px rgba(255, 122, 89, .25); }
.tabs { display: flex; gap: .2rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; color: #cbd2e0; border: 0; padding: .45rem .85rem; border-radius: 999px; font-size: .88rem; cursor: pointer; white-space: nowrap; font-family: inherit; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: .35rem; }
.tabs button i { font-style: normal; font-size: .7rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: rgba(255, 255, 255, .12); display: inline-grid; place-items: center; font-weight: 700; }
.tabs button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tabs button.active { background: var(--coral); color: #fff; font-weight: 700; }
.tabs button.active i { background: rgba(255, 255, 255, .25); }
.tabs button:disabled { opacity: .4; cursor: not-allowed; }

main { max-width: 1120px; margin: 0 auto; padding: 1rem 16px 3rem; }
.view { display: flex; flex-direction: column; gap: 1rem; animation: viewIn .35s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view, .reveal { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; } }

/* ---------- 랜딩 ---------- */
.hero { position: relative; overflow: hidden; border-radius: 22px; min-height: 420px; display: flex; align-items: center; color: #fff; box-shadow: var(--shadow-lg); background: var(--navy); isolation: isolate; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; z-index: -2; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, rgba(27, 42, 73, .96) 0%, rgba(27, 42, 73, .85) 38%, rgba(27, 42, 73, .15) 75%, rgba(27, 42, 73, 0) 100%); }
.hero-inner { padding: 2.4rem 2.2rem; max-width: 560px; }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700; letter-spacing: .12em; color: var(--coral-2); text-transform: uppercase; margin-bottom: .6rem; }
.eyebrow::before { content: ""; width: 18px; height: 3px; background: var(--coral); border-radius: 2px; }
.hero p { margin: .6rem 0 1.2rem; color: #dfe4f0; font-size: 1.02rem; max-width: 46ch; }
.hero .actions { margin-bottom: 1.2rem; }
.steps { display: flex; flex-wrap: wrap; gap: .4rem; }
.steps span { background: rgba(255, 255, 255, .12); backdrop-filter: blur(6px); padding: .28rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.55rem; font-weight: 900; color: var(--navy); letter-spacing: -.02em; line-height: 1.1; }
.stat b em { color: var(--coral); font-style: normal; }
.stat span { color: var(--muted); font-size: .82rem; }
.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.how .card { position: relative; padding-top: 1.1rem; overflow: hidden; }
.how .num { position: absolute; right: .9rem; top: .5rem; font-size: 2.6rem; font-weight: 900; color: #eef1f7; line-height: 1; letter-spacing: -.04em; }
.how .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #fff1ec; color: var(--coral); font-size: 1.25rem; }
.how h3 { margin-top: .2rem; }
.how p { margin: 0; color: var(--muted); font-size: .86rem; }
.feature { display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.4rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.2rem; box-shadow: var(--shadow); }
.feature.flip { grid-template-columns: 1fr 1.05fr; } .feature.flip .ftxt { order: -1; }
.feature img { width: 100%; height: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; aspect-ratio: 4/3; }
.feature .ftxt { padding: .4rem .6rem; }
.feature .ftxt p { color: var(--muted); margin: .3rem 0 .8rem; }
.feature ul { margin: 0; padding-left: 1.1rem; color: var(--ink); font-size: .92rem; display: grid; gap: .3rem; }
.two-opt { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.two-opt .card { border-top: 4px solid var(--coral); } .two-opt .card:last-child { border-top-color: var(--teal); }
.two-opt .card p { margin: 0; color: var(--muted); font-size: .88rem; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: .6rem; flex-wrap: wrap; }
.section-title p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- 카드·레이아웃 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem; display: flex; flex-direction: column; gap: .7rem; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.customer { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.customer:hover { transform: translateY(-3px); border-color: var(--coral); box-shadow: var(--shadow-lg); }
.customer .zones { display: flex; gap: 4px; }
.customer .zones .chip { width: 28px; height: 28px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--navy); font-size: .95rem; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row { display: flex; align-items: center; gap: .5rem; }
.row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .row.gap { gap: 1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; } .actions.end { justify-content: flex-end; }

.btn { border: 1px solid var(--navy); background: var(--navy); color: #fff; padding: .55rem 1.05rem; border-radius: 12px; font-size: .9rem; cursor: pointer; font-weight: 700; font-family: inherit; transition: transform .12s, box-shadow .12s, background .12s; display: inline-flex; align-items: center; gap: .4rem; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(27, 42, 73, .6); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, var(--coral), #ff6a44); border-color: transparent; }
.btn.ghost { background: #fff; color: var(--navy); }
.btn.light { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; backdrop-filter: blur(6px); }
.btn.danger { color: #c0392b; border-color: #e5b4ad; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: .32rem .65rem; font-size: .8rem; border-radius: 9px; }
.btn.lg { padding: .75rem 1.4rem; font-size: 1rem; border-radius: 14px; }

label { display: inline-flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
input[type=number], input[type=text], select, textarea { font: inherit; font-weight: 500; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); min-width: 0; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255, 122, 89, .18); }
input[type=number] { width: 5.2rem; }
input[type=range] { accent-color: var(--coral); width: 100%; }
textarea { width: 100%; resize: vertical; }
.chip { display: inline-block; width: 22px; height: 22px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .1); background: #ddd; vertical-align: middle; box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .12); }
.chip.lg { width: 46px; height: 46px; border-radius: 12px; }
.tag { background: #eef1f7; color: var(--navy); font-size: .7rem; padding: .18rem .55rem; border-radius: 999px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.tag.coral { background: #fff1ec; color: #d9552f; } .tag.teal { background: #e6f4f1; color: var(--teal); }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .45rem .4rem; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lab-table input { width: 4.4rem; }
.formula-table td:last-child, .formula-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.formula-table tr.dev td { color: var(--teal); font-weight: 700; }
.formula-table tr.total td { font-weight: 800; border-top: 2px solid var(--navy); font-size: 1rem; }
.formula-table .gbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--coral); vertical-align: middle; margin-right: .4rem; opacity: .8; }

.summary { background: #f7f8fc; border: 1px solid var(--line); border-radius: 12px; padding: .75rem .95rem; font-size: .9rem; }
.note { color: #b45309; background: #fff7ed; border-radius: 12px; padding: .55rem .85rem; font-size: .85rem; border: 1px solid #fde4c8; }
.note:empty { display: none; }

.photo-box { display: flex; flex-direction: column; gap: .5rem; }
.canvas-wrap canvas { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); cursor: crosshair; touch-action: manipulation; }
.zone-pick { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.zone-pick label { flex-direction: row; align-items: center; gap: .25rem; }

/* ---------- 색 선택 ---------- */
.palette { display: flex; flex-wrap: wrap; gap: .45rem; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 72px; cursor: pointer; font-size: .72rem; text-align: center; color: var(--muted); transition: transform .12s; }
.swatch:hover { transform: translateY(-2px); }
.swatch .chip { width: 46px; height: 46px; border-radius: 14px; }
.swatch.on .chip { outline: 3px solid var(--coral); outline-offset: 2px; }
.swatch.on { color: var(--ink); font-weight: 700; }

.option-cards { display: flex; flex-direction: column; gap: .55rem; }
.opt { display: grid; grid-template-columns: 54px 1fr auto; gap: .8rem; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: .65rem .75rem; cursor: pointer; background: #fff; transition: border-color .12s, transform .12s, box-shadow .12s; }
.opt:hover { border-color: #ffb59f; transform: translateY(-1px); box-shadow: var(--shadow); }
.opt.chosen { border-color: var(--coral); background: #fff7f3; box-shadow: 0 0 0 3px rgba(255, 122, 89, .15); }
.opt .chip { width: 54px; height: 54px; border-radius: 14px; }
.opt .name { font-weight: 800; }
.opt .meta { font-size: .78rem; color: var(--muted); }
.ring { --p: 0; --c: var(--teal); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #eef1f7 0); position: relative; font-weight: 900; font-size: .95rem; color: var(--ink); }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.ring b { position: relative; z-index: 1; font-size: .95rem; }
.ring small { position: relative; z-index: 1; font-size: .55rem; color: var(--muted); font-weight: 600; margin-top: -2px; }
.ring.mid { --c: #d97706; } .ring.lo { --c: #c0392b; }
.ach { font-weight: 800; font-size: 1.15rem; text-align: right; }
.ach.hi, .hi { color: var(--teal); } .ach.mid, .mid { color: #d97706; } .ach.lo, .lo { color: #c0392b; }
.scen { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.scen span { font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: #eef1f7; transition: background .12s; }
.scen span:hover { background: #dfe4f0; }
.scen span.on { background: var(--navy); color: #fff; }

.preview-row { display: flex; align-items: center; gap: 1rem; row-gap: 2.2rem; flex-wrap: wrap; padding-bottom: 1.2rem; }
.hair-preview { width: 120px; height: 150px; border-radius: 60px 60px 42px 42px; position: relative; background: linear-gradient(180deg, #333, #555); box-shadow: inset 0 -30px 40px rgba(0, 0, 0, .28), inset 14px 0 28px rgba(255, 255, 255, .14), 0 10px 24px -12px rgba(0, 0, 0, .5); overflow: hidden; transition: background .3s; }
.hair-preview::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 150' preserveAspectRatio='none'%3E%3Cg fill='none' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M22 8c6 40-4 90 4 140' stroke='rgba(255,255,255,.22)'/%3E%3Cpath d='M38 4c2 50-6 100 2 146' stroke='rgba(0,0,0,.25)'/%3E%3Cpath d='M52 2c-4 46 6 96 0 148' stroke='rgba(255,255,255,.28)'/%3E%3Cpath d='M66 2c4 44-6 100 2 148' stroke='rgba(0,0,0,.22)'/%3E%3Cpath d='M80 4c-2 50 6 94 0 146' stroke='rgba(255,255,255,.2)'/%3E%3Cpath d='M96 8c-6 40 4 90-2 140' stroke='rgba(0,0,0,.28)'/%3E%3Cpath d='M30 6c1 60-2 80 3 144' stroke='rgba(255,255,255,.12)'/%3E%3Cpath d='M88 6c-1 60 2 80-3 144' stroke='rgba(255,255,255,.12)'/%3E%3C/g%3E%3C/svg%3E") center/100% 100% no-repeat; pointer-events: none; }
.hair-preview span { position: absolute; bottom: -1.45rem; left: 0; right: 0; text-align: center; font-size: .78rem; color: var(--muted); font-weight: 600; }
.hair-preview.target { outline: 2px dashed var(--coral); outline-offset: 3px; }
.arrow { font-size: 1.6rem; color: var(--muted); }
.preview-meta { font-size: .85rem; flex: 1; min-width: 200px; }
.preview-card { margin-top: .2rem; }

/* 가상 염색 (사진) */
.tryon { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.tryon-stage { position: relative; width: 100%; max-width: 520px; margin: 0 auto; border-radius: 14px; overflow: hidden; background: #111; touch-action: none; user-select: none; -webkit-user-select: none; }
.tryon-stage canvas { display: block; width: 100%; height: auto; }
.tryon-stage canvas.after { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.tryon-stage .divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); pointer-events: none; }
.tryon-stage .divider::after { content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: var(--navy); font-size: .7rem; font-weight: 800; padding: .35rem .5rem; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.tryon-stage .lbl { position: absolute; top: .5rem; padding: .2rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 800; color: #fff; background: rgba(27, 42, 73, .75); backdrop-filter: blur(4px); }
.tryon-stage .lbl.l { left: .5rem; } .tryon-stage .lbl.r { right: .5rem; background: rgba(255, 122, 89, .9); }
.tryon-stage .hint { position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); background: rgba(0, 0, 0, .6); color: #fff; padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; white-space: nowrap; }
.tryon-ctrl { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.tryon-ctrl label { flex-direction: row; align-items: center; gap: .5rem; min-width: 220px; flex: 1; }
.tryon-ctrl input[type=range] { flex: 1; }

/* ---------- 모발 DNA ---------- */
.dna-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.timeline { display: flex; flex-direction: column; gap: .5rem; }
.visit { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; background: #fff; }
.visit .chips { display: flex; gap: 4px; align-items: center; }
.visit .chips .chip { width: 30px; height: 30px; }
.visit .de { font-weight: 800; font-size: 1.05rem; text-align: right; }
.visit .de.ok { color: var(--teal); } .visit .de.bad { color: #c0392b; }
.bar { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--coral), #ffb59f); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--muted); }
.chart .axis { stroke: var(--line); }
.chart .target { stroke: var(--teal); stroke-dasharray: 4 4; }
.chart .line { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: #fff; stroke: var(--coral); stroke-width: 2.5; }
.chart .area { fill: url(#gArea); }
.chart .val { font-weight: 800; fill: var(--ink); font-size: 11px; }

.foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 2.2rem; color: var(--muted); font-size: .75rem; display: flex; flex-direction: column; gap: .3rem; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 92vw; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(27, 42, 73, .55); backdrop-filter: blur(3px); }
.dlg { padding: 1.3rem; display: flex; flex-direction: column; gap: .75rem; width: 380px; max-width: 88vw; }
.dlg label input { width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: .65rem 1.1rem; border-radius: 999px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); z-index: 50; animation: toastIn .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.skel { background: linear-gradient(90deg, #eef1f7, #f7f8fc, #eef1f7); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: 8px; }
@keyframes skel { to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .how { grid-template-columns: 1fr 1fr; }
  .feature, .feature.flip { grid-template-columns: 1fr; } .feature.flip .ftxt { order: 0; }
  .feature img { max-height: 240px; }
}
@media (max-width: 720px) {
  .grid2, .dna-grid, .two-opt { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr 1fr; gap: .5rem; } .stat { padding: .7rem .75rem; } .stat b { font-size: 1.2rem; }
  .opt { grid-template-columns: 46px 1fr auto; } .opt .chip { width: 46px; height: 46px; }
  .ring { width: 56px; height: 56px; } .ring b { font-size: .85rem; }
  .hair-preview { width: 90px; height: 112px; }
  .hero { min-height: 380px; align-items: flex-end; } .hero::before { background: linear-gradient(180deg, rgba(27, 42, 73, .1) 0%, rgba(27, 42, 73, .75) 45%, rgba(27, 42, 73, .96) 100%); } .hero img { object-position: 60% 30%; }
  .hero-inner { padding: 1.4rem 1.2rem; } h1 { font-size: 1.55rem; } .hero p { font-size: .92rem; }
  .brand span:last-child { display: none; }
  .tabs button i { display: none; }
}
@media (max-width: 480px) { .how { grid-template-columns: 1fr; } .stat-row { grid-template-columns: 1fr; } }
