/* 브로우리스트 모바일 — 앱 셸 스타일 (시뮬레이터 내부 스타일은 brow.css / lip.css) */

:root {
    --bg:        #131014;
    --surface:   #1b171d;
    --surface-2: #241f27;
    --line:      #2f2832;
    --text:      #f3ece6;
    --muted:     #a89a92;
    --accent:    #c99a72;
    --accent-2:  #ebcba9;
    --ok:        #4ade80;
    --warn:      #fbbf24;
    --radius:    14px;
}

* { box-sizing: border-box; }

/* HTML 의 hidden 속성은 브라우저 기본 display:none 으로 동작하므로,
   아래 .canvas-loading{display:grid} 같은 작성자 규칙에 밀려 무력화된다.
   실제로 로딩 오버레이가 안 사라져 시뮬레이터가 어둡게 덮이는 문제가 있었다. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior-y: contain;
}

body {
    padding: 0 0 env(safe-area-inset-bottom);
    max-width: 720px;
    margin: 0 auto;
}

/* ── 상단바 ── */
/* 로고(좌) · 프로그램 이름(중앙) · 라이선스(우) 3단 배치.
   양쪽 칸에 같은 최소폭을 줘서 가운데 이름이 화면 정중앙에 오게 한다. */
.app-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: linear-gradient(180deg, #1b171d, #131014);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.app-logo {
    justify-self: start;
    width: 96px;          /* 기존 34px 상자(실제 34×18) 대비 약 3배 */
    height: auto;
    max-height: 46px;
    object-fit: contain;
}
.app-title {
    margin: 0;
    text-align: center;
    /* 이름이 'PMUS 반영구 시뮬레이터' 로 길어졌다. 폭이 좁아지면 단계적으로
       뚝뚝 끊어 줄이는 대신 화면 폭에 물려 매끄럽게 줄인다. 320px 기기에서
       말줄임(…)이 걸리던 것을 없애기 위한 것이다. */
    font-size: clamp(11.5px, 3.6vw, 15.5px);
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.3;
    white-space: nowrap;
}

/* 이름이 길어 좁은 화면에서 잘리므로, 폭에 따라 로고와 글자를 단계적으로 줄인다.
   그래도 모자라면 말줄임으로 처리해 레이아웃이 깨지지 않게 한다. */
.app-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 430px) {
    .app-bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
    .app-logo { width: 84px; max-height: 42px; }
}

@media (max-width: 380px) {
    .app-bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
    .app-logo { width: 72px; max-height: 36px; }
    .app-title { letter-spacing: -0.6px; }
}

/* ── 단계 섹션 ── */
.step { padding: 18px; }
.step-canvas { padding: 0; position: relative; min-height: 300px; }

.step-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
}
.step-num {
    display: grid;
    place-items: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #241812;
    font-size: 12px;
    font-weight: 800;
}

/* ── 사진 선택 ── */
.drop-zone {
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 34px 20px;
    text-align: center;
}
.drop-icon { font-size: 40px; margin-bottom: 10px; }
.drop-main { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.drop-sub  { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.drop-actions { display: flex; flex-direction: column; gap: 9px; }

.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 13px 18px;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
.btn:active { filter: brightness(.9); }
.btn-primary { background: var(--accent); color: #241812; }
.btn-ghost   { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-sm      { padding: 9px 14px; font-size: 13px; }

.photo-preview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}
.photo-preview img {
    width: 100%;
    border-radius: 10px;
    display: block;
    max-height: 260px;
    object-fit: contain;
    background: #0d0b13;
}
.photo-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 11px 2px 12px;
    font-size: 12.5px;
    color: var(--muted);
}
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}
.badge-ok   { color: var(--ok);   border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.10); }
.badge-warn { color: var(--warn); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.10); }

/* ── 부위 탭 ── */
.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px;
}
.mode-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    padding: 11px;
    border-radius: 9px;
    cursor: pointer;
}
.mode-tab.is-active { background: var(--accent); color: #241812; }
/* 아이라인 · 헤어라인(SMP) — 준비 중. 넓으면 네 칸 한 줄, 좁은 폰은 두 칸 두 줄 */
@media (min-width: 480px) { .mode-tabs { grid-template-columns: repeat(4, 1fr); } }
.mode-tab small { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 600; opacity: .8; }
.mode-tab.is-soon { color: var(--muted); opacity: .6; border: 1px dashed var(--line); padding: 7px 6px; }

/* ── 디자인 선택 ── */
.design-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}
.design-card {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    cursor: pointer;
}
.design-card img {
    width: 100%;
    height: 34px;
    object-fit: contain;
    filter: brightness(0) invert(1) opacity(.75);
}
.design-card.is-active {
    border-color: var(--accent);
    background: rgba(201, 154, 114,.12);
    color: var(--accent-2);
}
/* 고른 카드도 흰 그림으로 — filter:none 이면 짙은 갈색 '내 디자인' 이 어두운 카드에 묻혀
   안 보였다 (2026-10-15). 고른 표시는 테두리 · 바탕색으로 충분하다. */
.design-card.is-active img { filter: brightness(0) invert(1); }

/* 사진을 올린 뒤 어떻게 진행하는지 알려주는 안내 */
.step-hint {
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--muted);
}
.step-hint strong { color: var(--accent-2); }

/* ── 시뮬레이터 프레임 ── */
#sim-frame {
    width: 100%;
    height: 900px;
    border: 0;
    display: block;
    background: var(--bg);
}

.canvas-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    background: rgba(19, 16, 20,.94);
    z-index: 20;
}
.spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.canvas-loading p { margin: 0; font-size: 13.5px; color: var(--muted); }
/* ── 로딩 안내 인포그래픽 (2026-11-29 원장님) ──────────────────────────
   사진을 넣고 얼굴 · 입술을 인식하는 몇 초 동안 앱이 멈춘 것처럼 보여 나가 버리는 분이 있다.
   화면 전체를 덮고, 지금 어느 단계인지 · 얼마나 왔는지 · 멈춘 게 아니라는 것을 움직임으로 보여 준다. */
.canvas-loading { position: fixed; inset: 0; z-index: 900; padding: 24px 16px; background: rgba(19, 16, 20, .9);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ld-card { width: min(320px, 100%); display: grid; justify-items: center; gap: 12px; padding: 22px 20px 18px;
    border: 1px solid #3a3340; border-radius: 18px; background: #1d191f;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45); animation: ld-in .28s ease-out; }
@keyframes ld-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.ld-face { width: 112px; height: 130px; color: #d9a87c; overflow: visible; }
.ld-face .ld-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .9;
    stroke-dasharray: 400; stroke-dashoffset: 400; animation: ld-draw 1.2s ease-out forwards; }
.ld-face .ld-brow { animation-delay: .25s; } .ld-face .ld-lip { animation-delay: .5s; }
@keyframes ld-draw { to { stroke-dashoffset: 0; } }
.ld-face .ld-corner { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; opacity: .8; }
.ld-face .ld-scan { animation: ld-scan 2.2s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes ld-scan { from { transform: translateY(0); } to { transform: translateY(160px); } }
.ld-face .ld-dots circle { fill: var(--accent-2, #ebcba9); opacity: 0; transform-box: fill-box; transform-origin: center;
    animation: ld-dot 2.2s ease-out infinite; animation-delay: calc(var(--d) * .12s + .4s); }
@keyframes ld-dot { 0% { opacity: 0; transform: scale(.3); } 18% { opacity: 1; transform: scale(1.5); } 30%, 80% { opacity: .95; transform: scale(1); } 100% { opacity: 0; } }
.ld-title { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: #f3ece6; text-align: center; }
.ld-steps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 7px; }
.ld-steps li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #8f837c; transition: color .25s; }
.ld-steps li i { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2, #4a4150); position: relative; transition: all .25s; }
.ld-steps li.is-on { color: #f3ece6; font-weight: 600; }
.ld-steps li.is-on i { border-color: var(--accent, #c99a72); border-top-color: transparent; animation: spin .8s linear infinite; }
.ld-steps li.is-done { color: #d8cdc6; }
.ld-steps li.is-done i { border-color: var(--accent, #c99a72); background: var(--accent, #c99a72); }
.ld-steps li.is-done i::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px;
    border: solid var(--on-accent, #241812); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ld-bar { width: 100%; height: 6px; border-radius: 99px; background: var(--line, #3a3340); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent, #c99a72); transition: width .35s ease-out; }
.ld-note { margin: 0; min-height: 2.6em; font-size: 12.5px; line-height: 1.45; color: #b3a69e; text-align: center; transition: opacity .3s; }
@media (prefers-reduced-motion: reduce) {
    .ld-face .ld-scan, .ld-face .ld-dots circle { animation: none; } .ld-face .ld-dots circle { opacity: .9; }
    .ld-face .ld-line { animation: none; stroke-dashoffset: 0; } .ld-card { animation: none; }
}


/* ── 토스트 ── */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(22px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: #241f27;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 12px 18px;
    border-radius: 11px;
    font-size: 13.5px;
    max-width: min(90vw, 420px);
    text-align: center;
    /* 오류 안내는 줄을 나눠 보여준다 (메모리 상태를 아랫줄에 붙인다) */
    white-space: pre-line;
    line-height: 1.45;
    z-index: 100;
    box-shadow: 0 8px 28px rgba(0,0,0,.45);
}

@media (max-width: 360px) {
    .design-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── 시뮬레이터 전체화면 모드 ──────────────────────────────────────────
   폰에서 시뮬레이터가 뜨면 위쪽 설정 단계를 접고 한 화면을 통째로 넘긴다.
   ('설정' 버튼으로 다시 펼 수 있다) */
body.sim-fullscreen { max-width: none; }
body.sim-fullscreen .app-bar,
body.sim-fullscreen #step-photo,
body.sim-fullscreen #step-mode,
body.sim-fullscreen #step-design { display: none; }

/* display:revert 를 쓰면 <header> 가 UA 기본값인 block 으로 돌아가
   상단바 3단 그리드가 무너진다(로고·이름·배지가 세로로 쌓임). 명시적으로 되돌린다. */
body.sim-fullscreen.settings-open .app-bar { display: grid; }
body.sim-fullscreen.settings-open #step-photo,
body.sim-fullscreen.settings-open #step-mode,
body.sim-fullscreen.settings-open #step-design { display: block; }
body.sim-fullscreen.settings-open #step-canvas { display: none; }

/* 설정 화면에서는 하단 전체폭 버튼에 가리지 않게 여백을 준다 */
body.sim-fullscreen.settings-open { padding-bottom: 84px; }

body.sim-fullscreen #sim-frame { height: 100dvh !important; }

/* 하단에 가로 전체를 쓰는 버튼 — 손가락으로 누르기 쉽게 */
.settings-toggle {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--accent);
    color: #241812;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 -6px 22px rgba(0,0,0,.45);
    cursor: pointer;
}
.settings-toggle:active { filter: brightness(.93); }
body.sim-fullscreen .settings-toggle { display: none; }
body.sim-fullscreen.settings-open .settings-toggle { display: flex; }

/* ── 라이선스 ───────────────────────────────────────────────────────── */
.lic-badge {
    justify-self: end;
    appearance: none;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
}
.lic-badge.is-warn {
    color: var(--warn);
    border-color: rgba(251,191,36,.4);
    background: rgba(251,191,36,.12);
}

.license-gate { padding-top: 28px; }
.lic-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 18px;
}
.lic-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    margin: 6px auto 26px;
}
.lic-title { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.lic-desc  { margin: 0 0 18px; font-size: 13px; line-height: 1.65; color: var(--muted); }
.lic-desc strong { color: var(--accent-2); }

.lic-device {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 12px 14px;
    margin-bottom: 20px;
}
.lic-device-label { font-size: 11.5px; color: var(--muted); font-weight: 700; }
#lic-device-code {
    flex: 1;
    font-family: ui-monospace, "Consolas", monospace;
    font-size: 16px;
    letter-spacing: 1.5px;
    color: var(--accent-2);
    font-weight: 700;
}

.lic-label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.lic-input {
    width: 100%;
    background: #100e18;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    font-family: ui-monospace, "Consolas", monospace;
    font-size: 12px;
    line-height: 1.55;
    padding: 12px;
    resize: vertical;
    margin-bottom: 14px;
}
.lic-input:focus { outline: none; border-color: var(--accent); }

.lic-error {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.4);
    color: #FCA5A5;
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 12.5px;
    line-height: 1.55;
    margin-bottom: 14px;
}
.lic-error span { color: var(--muted); font-size: 11.5px; }

#lic-activate { width: 100%; }

/* 발급 키 불러오기 (2026-11-27) — 입금 확인 뒤 발급되면 기기 코드로 서버에서 받아 온다 */
.lic-pull { margin-bottom: 16px; }
#lic-pull { width: 100%; }
.lic-pull-help { margin: 8px 2px 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }

/* 등록 키 변경을 실수로 눌렀을 때 — 이전 키로 바로 돌아가기 */
.lic-prev {
    border: 1px solid var(--accent);
    background: rgba(201,154,114,.10);
    border-radius: 12px;
    padding: 12px 13px;
    margin-bottom: 14px;
    text-align: center;
}
.lic-prev-text { margin: 0 0 10px; font-size: 13px; line-height: 1.55; }
.lic-prev-text small { color: var(--muted); font-size: 11.5px; }
#lic-restore-prev { width: 100%; }

.mode-tab.is-locked { opacity: .45; }

.lic-sheet {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(10,8,15,.72);
}
.lic-sheet-box {
    width: 100%;
    max-width: 380px;
    max-height: 88dvh;          /* 내용이 길면 상자 안에서만 스크롤한다 */
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.lic-sheet-title { margin: 0 0 14px; font-size: 15px; font-weight: 800; }
.lic-detail {
    margin: 0 0 18px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    font-size: 12.5px;
}
.lic-detail dt { color: var(--muted); font-weight: 700; white-space: nowrap; }
.lic-detail dd { margin: 0; text-align: right; word-break: break-all; }
.lic-sheet-actions { display: flex; gap: 8px; }
.lic-sheet-actions .btn { flex: 1; }


/* ── 내 디자인 등록 ─────────────────────────────────────────────────── */

/* 등록한 디자인임을 알려주는 꼬리표 */
.design-card { position: relative; }
.design-mine {
    position: absolute;
    left: 6px; top: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(201, 154, 114,.92);
    color: #241812;
    font-size: 9.5px;
    font-weight: 800;
    font-style: normal;
    letter-spacing: -.2px;
}

/* 삭제 단추 — 손가락으로 누를 수 있는 크기로 */
.design-del {
    position: absolute;
    right: 2px; top: 2px;
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(19, 16, 20,.78);
    color: #f3ece6;
    font-size: 17px;
    font-style: normal;
    line-height: 1;
    cursor: pointer;
}
.design-del:active { background: rgba(226,91,111,.9); }

/* 맨 끝의 등록 카드 */
.design-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-style: dashed;
    color: var(--accent);
}
.design-add i {
    font-style: normal;
    font-size: 26px;
    line-height: 1;
}
.design-add span { font-weight: 700; }

/* 등록 대화상자 */
.design-dlg-preview-wrap {
    display: grid;
    place-items: center;
    min-height: 96px;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    /* 투명 배경이 보이도록 밝은 체크무늬를 깐다 — 눈썹은 짙은 갈색이라
       어두운 바탕에서는 추출이 안 된 것처럼 보였다 (2026-10-15) */
    background-color: #f4f1ec;
    background-image:
        linear-gradient(45deg, #e4dfd7 25%, transparent 25%, transparent 75%, #e4dfd7 75%),
        linear-gradient(45deg, #e4dfd7 25%, transparent 25%, transparent 75%, #e4dfd7 75%);
    background-size: 14px 14px;
    background-position: 0 0, 7px 7px;
}
.design-dlg-preview-wrap img {
    max-width: 100%;
    max-height: 130px;
}
.design-dlg-size {
    margin: 0 0 10px;
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
}
.design-dlg-guide {
    margin: 10px 0 14px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--muted);
}
.design-dlg-guide strong { color: var(--accent-2); }
/* 위아래 여백을 '취소 ↔ 등록' 사이 간격(.lic-sheet-actions 의 gap 8px)과
   같게 둔다. 아래가 붙어 있으면 등록 버튼과 한 덩어리로 보인다. */
.design-dlg-flip { width: 100%; margin: 8px 0; }
.design-dlg-flip.is-active {
    background: var(--accent);
    color: #241812;
    font-weight: 800;
}


/* ── 부위 선택 아래 옵션 줄 ─────────────────────────────────────────── */
.opt-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    cursor: pointer;
}
.opt-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    accent-color: var(--accent);
}
.opt-text { display: block; }
.opt-text b {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}
.opt-text em {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    font-style: normal;
    line-height: 1.6;
    color: var(--muted);
}


/* ── 촬영 화면 ──────────────────────────────────────────────────────────
   기본 카메라 앱을 부르면 그 화면 위에 가이드를 그릴 수 없어서,
   앱 안에서 직접 카메라를 열고 점선을 얹는다. */
.cam {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    flex-direction: column;
    background: #0b0910;
}
.cam[hidden] { display: none !important; }

.cam-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    background: #131014;
    border-bottom: 1px solid var(--line);
}
.cam-title { font-size: 14px; font-weight: 800; margin-right: auto; }
.cam-flip, .cam-close {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 12px;
    cursor: pointer;
}
.cam-close { background: var(--accent); color: #241812; border-color: var(--accent); }

.cam-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
}

/* 촬영 틀 — 기준 사진과 같은 비율로 잘라 담는다 */
.cam-frame {
    position: relative;
    /* 실제 비율은 기준 사진에서 잰 값으로 JS 가 넣는다 (FRAME_GUIDE.aspect) */
    aspect-ratio: 0.8;
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
.cam-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* 촬영 거리 맞춤: 50cm 에서 찍어도 얼굴이 타원에 맞도록 가운데를 당겨 보여 준다 (camCrop 과 같은 배율) */
.cam-frame video { transform: scale(var(--cam-zoom, 1)); }
.cam-frame.is-mirrored video { transform: scale(var(--cam-zoom, 1)) scaleX(-1); }

.cam-guide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.cam-guide ellipse {
    fill: none;
    stroke: #ebcba9;
    stroke-width: 0.7;
    stroke-dasharray: 3 2.4;
    opacity: .95;
}
/* 5×5 격자 — 구도를 눈으로 재는 자. 얼굴 윤곽보다 흐리게 둔다 */
.cam-guide .g-grid line {
    stroke: #f3ece6;
    stroke-width: 0.3;
    stroke-dasharray: 1.6 2.2;
    opacity: .6;
}
/* 정가운데 줄 — 얼굴 중심을 맞추는 기준이라 조금 진하게 */
.cam-guide .g-grid line.is-center {
    stroke-width: 0.4;
    opacity: .85;
}


/* 두 눈을 이은 선 — 기울면 주황, 수평이면 초록 */
.cam-guide .g-level {
    stroke: #f5a524;
    stroke-width: 0.8;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity .2s;
}
.cam-guide .g-level.is-on { opacity: .95; }
.cam-guide .g-level.is-ok { stroke: #34d399; }

/* 자세 안내 띠 — 틀 위쪽. 바르면 초록, 아니면 어떻게 고칠지 */
.cam-status {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    max-width: calc(100% - 20px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(20, 20, 24, .78);
    color: #fff;
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.cam-status[hidden] { display: none !important; }
.cam-status.is-ok { background: rgba(16, 150, 100, .9); }
.cam-status.is-warn { background: rgba(190, 110, 10, .9); }
.cam-auto[aria-pressed="true"] { border-color: #34d399; color: #34d399; }
/* 자동 촬영 직전 — 셔터 둘레가 초록으로 */
.cam-shoot.is-ready { border-color: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .35); }

.cam-hint {
    margin: 0;
    max-width: 420px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    text-align: center;
}
.cam-hint strong { color: var(--accent-2); }

.cam-actions {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
    background: #131014;
    border-top: 1px solid var(--line);
}
.cam-shoot {
    appearance: none;
    width: 68px; height: 68px;
    border-radius: 999px;
    border: 4px solid var(--accent);
    background: var(--text);
    cursor: pointer;
}
.cam-shoot:active { transform: scale(.94); }
.cam-shoot:disabled { opacity: .4; }

.cam-error {
    margin: 0 14px calc(14px + env(safe-area-inset-bottom));
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(248,113,113,.12);
    border: 1px solid rgba(248,113,113,.4);
    color: #fca5a5;
    font-size: 12.5px;
    line-height: 1.6;
}
.cam-error[hidden] { display: none !important; }


/* ── 편집 방식 (퀵 / 메뉴얼) ─────────────────────────────────────────── */
.edit-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
.edit-tab {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 11px 8px;
    border: 1.5px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    font-family: inherit;
    cursor: pointer;
}
.edit-tab b { font-size: 14px; font-weight: 800; }
.edit-tab em {
    font-style: normal;
    font-size: 10.5px;
    line-height: 1.4;
    opacity: .85;
}
.edit-tab.is-active {
    border-color: var(--accent);
    background: rgba(201, 154, 114,.12);
    color: var(--accent-2);
}

/* 눈썹·입술 작업이 서로 이어지고 있음을 알리는 한 줄 */
.carry-note {
    margin: 10px 0 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

/* 이어서 쓸 밑그림 고르기 — 좌우로 넘겨 본다 */
.carry-picker {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.carry-picker::-webkit-scrollbar { display: none; }
.carry-item {
    appearance: none;
    flex: 0 0 auto;
    width: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    scroll-snap-align: center;
    padding: 6px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    cursor: pointer;
}
.carry-item img {
    width: 100%;
    height: 74px;
    object-fit: cover;
    object-position: top center;
    border-radius: 6px;
    background: #000;
}
.carry-item span {
    font-size: 10.5px;
    line-height: 1.25;
    text-align: center;
    word-break: keep-all;
}
.carry-item.is-active {
    border-color: var(--accent);
    background: rgba(201, 154, 114,.12);
    color: var(--accent-2);
    font-weight: 700;
}

/* 고른 사진으로 편집을 시작하는 버튼 */
.carry-go {
    appearance: none;
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 14px 0;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #241812;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
}
.carry-go:active { filter: brightness(.93); }

/* ── 진단 ────────────────────────────────────────────────────────────── */
/* 현장에서 안 되는 폰이 스스로 상태를 말하게 하는 화면. 눈에 띄되
   작업을 방해하지 않도록 상단 바 구석에만 둔다. */
/* 상단 바는 로고 | 제목 | 오른쪽 칸 의 3칸 격자다.
   버튼 두 개는 한 칸 안에 나란히 둔다. */
.app-bar-end {
    justify-self: end;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.app-bar-end .lic-badge { justify-self: auto; }

.diag-btn {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, .72);
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
}
.diag-out {
    max-height: 46vh;
    margin: 10px 0 4px;
    padding: 10px 12px;
    overflow: auto;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-all;
    color: #d9d4e4;
    background: rgba(0, 0, 0, .32);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 10px;
    -webkit-user-select: text;
    user-select: text;
}

/* ── 버전 화면 ───────────────────────────────────────────────────────── */
/* 원장님이 가장 먼저 봐야 할 것은 '지금 어떤 판을 쓰고 있나' 와
   '새 판이 있나' 둘뿐이다. 진단 기록은 문제가 있을 때만 펼친다. */
.ver-now {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 10px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 10px;
}
.ver-label { font-size: 12.5px; color: var(--muted); }
#ver-current { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }

.ver-state {
    margin: 0 0 12px;
    padding: 10px 13px;
    font-size: 13px;
    line-height: 1.6;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    white-space: pre-wrap;
}
.ver-state.is-new {                       /* 새 판이 있을 때만 눈에 띄게 */
    color: #ebcba9;
    background: rgba(201, 154, 114, .13);
    border-color: rgba(201, 154, 114, .45);
}
.ver-state.is-bad {
    color: #e8b4b8;
    background: rgba(122, 59, 74, .18);
    border-color: rgba(122, 59, 74, .55);
}

.ver-bar {
    height: 8px;
    margin: 0 0 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
}
.ver-bar > i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--gold, #c99a72);
    border-radius: 999px;
    transition: width .2s ease;
}

.ver-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}
.ver-actions .btn { flex: 1 1 auto; min-width: 0; }

.ver-diag { margin: 6px 0 4px; }
.ver-diag > summary {
    padding: 8px 2px;
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
    list-style: revert;
}

/* 업데이트 내역 — 빌드별로 무엇이 바뀌었는지 (tools/changelog.mjs 가 만든 www/changelog.json) */
.ver-log-list {
    list-style: none;
    margin: 4px 0 8px;
    padding: 0;
    max-height: 42vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--line, #2f2832);
}
.ver-log-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    padding: 9px 2px;
    border-bottom: 1px solid var(--line, #2f2832);
    font-size: 12.5px;
    line-height: 1.55;
}
.ver-log-list .b {
    grid-row: span 2;
    align-self: start;
    min-width: 3.2em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(201, 154, 114,.14);
    color: #ebcba9;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.ver-log-list .t { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ver-log-list .x { color: var(--text, #f3ece6); }
.ver-log-list li.is-now .b { background: #c99a72; color: #241812; }
.ver-log-list li.is-now .t::after { content: " · 지금 쓰는 버전"; color: #ebcba9; }

/* ── 교육용 무료판 ───────────────────────────────────────────────────── */
/* 무료로 쓰고 있다는 것은 늘 보여야 한다. 기한이 눈에 띄되, 상담 중에
   손님 시선을 끌 만큼 요란하지는 않게. */
/* 상단 두 버튼은 어떤 경우에도 글자가 접히지 않게. 접히면 버튼이 세로로
   부풀어 로고·제목 자리를 밀어낸다. */
.diag-btn, .lic-badge { white-space: nowrap; }

.lic-badge.is-free {
    color: #1F1A10;
    background: #ebcba9;
    border-color: #ebcba9;
    font-weight: 800;
}

/* 무료판에는 '등록' 이라는 절차가 없다. 기기 코드를 보내 키를 받으라는
   안내를 그대로 두면 엉뚱한 길을 알려 주는 셈이다. */
body.is-free .lic-device,
body.is-free .lic-label,
body.is-free #lic-token,
body.is-free .lic-pull,
body.is-free #lic-activate { display: none !important; }

body.is-free .lic-card { text-align: center; }
body.is-free .lic-desc { margin-bottom: 4px; }

/* 끝이 가까우면 남은 시간을 같이 보여 준다 */
.lic-badge.is-free.is-soon {
    background: #e8b4b8;
    border-color: #e8b4b8;
    color: #2a1418;
}

/* ── 버전 창의 사용 메뉴얼 ─────────────────────────────────────────────
 * 메뉴얼 링크를 원장님들께 매번 따로 보내드리기 번거로웠다. 앱에서 바로
 * 열리면 늘 최신 것을 보시게 된다. */
.ver-manual {
    display: block;
    width: 100%;
    margin-top: 14px;
    text-align: center;
    text-decoration: none;
}
.ver-manual-note {
    margin: 6px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--muted);
    text-align: center;
}

/* ── 사용 메뉴얼 보는 화면 ─────────────────────────────────────────── */
.manual-view {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}
.manual-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(var(--sa-top, 0px) + 8px) 12px 8px;
    background: #131014;
    border-bottom: 1px solid #3A3147;
}
.manual-title { font-size: 0.95rem; font-weight: 800; color: #F0EBF6; }
.manual-state { flex: 1 1 auto; font-size: 0.74rem; color: var(--muted); }
.manual-close {
    flex: 0 0 auto;
    border: 1px solid #4A3F5E;
    background: #2A2238;
    color: #F0EBF6;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 16px;
}
#manual-frame { flex: 1 1 auto; width: 100%; border: 0; background: var(--bg); }

/* ── 아이폰 웹앱 (홈 화면에 추가 안내 · 사진 저장) ──────────────────── */
.pwa-sheet {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(10, 8, 16, .62);
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.pwa-sheet[hidden] { display: none; }
.pwa-card {
    width: 100%; max-width: 440px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: 18px;
    padding: 22px 20px 18px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}
.pwa-title { margin: 0; font-size: 18px; color: var(--accent-2); }
.pwa-desc, .pwa-note { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.pwa-note { font-size: 12.5px; opacity: .8; }
.pwa-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.55; }
.pwa-steps b { color: var(--accent-2); margin-right: 4px; }
.pwa-k {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 8px; border-radius: 999px;
    background: var(--accent); color: #241812; font-weight: 700; font-size: 13px;
}
/* 사파리 공유 아이콘 (네모에서 위로 나가는 화살표) */
.pwa-share {
    display: inline-block; width: 11px; height: 13px; position: relative;
    border: 2px solid currentColor; border-top: none; border-radius: 0 0 2px 2px;
    margin-top: 3px;
}
.pwa-share::before {
    content: ""; position: absolute; left: 50%; top: -7px; width: 2px; height: 10px;
    background: currentColor; transform: translateX(-50%);
}
.pwa-share::after {
    content: ""; position: absolute; left: 50%; top: -8px; width: 6px; height: 6px;
    border-left: 2px solid currentColor; border-top: 2px solid currentColor;
    transform: translateX(-50%) rotate(45deg);
}
.pwa-card .btn { width: 100%; }

/* 폰 · 태블릿 브라우저 탭: 앱 설치 화면 (전체를 덮는다) */
.pwa-gate {
    position: fixed; inset: 0; z-index: 4000;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}
.pwa-gate[hidden] { display: none; }
.pwa-gate { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pwa-gate .pwa-gate-inner { margin: auto 0; }
/* 아이폰 · 아이패드 3단계가 보일 때: 로고를 줄이고 아래 화살표 자리를 비운다 */
.pwa-gate.is-ios { padding-bottom: calc(64px + env(safe-area-inset-bottom)); padding-top: calc(48px + env(safe-area-inset-top)); }
.pwa-gate.is-ios .pwa-gate-logo { width: min(180px, 44vw); margin-bottom: 0; }
.pwa-gate.is-ios .pwa-gate-inner { gap: 10px; }
.pwa-gate.is-ios .pwa-point-arrow { position: fixed; }
@media (max-height: 800px) {
    .pwa-gate.is-ios { padding-top: calc(14px + env(safe-area-inset-top)); }
    .pwa-gate.is-ios .pwa-gate-logo { width: min(130px, 34vw); }
    .pwa-gate.is-ios .pwa-gate-desc { display: none; }
    .pwa-gate.is-ios .pwa-ios li { padding: 10px 12px; }
    .pwa-gate.is-ios .pwa-ios p { font-size: 14.5px; }
    .pwa-gate.is-ios .pwa-mock span { padding: 6px 12px; font-size: 13px; }
}
.pwa-gate-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.pwa-gate-logo { width: min(260px, 70vw); height: auto; margin-bottom: 6px; }
.pwa-gate-title { margin: 0; font-size: 22px; color: var(--accent-2); }
.pwa-gate-desc { margin: 0; font-size: 15px; line-height: 1.65; color: var(--text); }
.pwa-gate-go { width: 100%; min-height: 56px; font-size: 18px; font-weight: 800; margin-top: 8px; }
.pwa-gate-sub { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--text); }
.pwa-gate-sub b { color: var(--accent-2); }

/* 아이폰 · 아이패드: 설치 화면 안에 바로 보이는 3단계 */
.pwa-ios { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.pwa-ios[hidden] { display: none; }
.pwa-ios li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.pwa-ios .n {
    flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--accent-2); color: #241812;
    display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: 15px;
}
.pwa-ios p { margin: 2px 0 0; font-size: 15.5px; line-height: 1.55; color: var(--text); }
.pwa-ios small { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.pwa-ios small b { color: var(--text); }
/* 공유 목록 흉내 — '홈 화면에 추가' 가 깜빡인다 */
.pwa-mock { margin-top: 8px; border-radius: 12px; overflow: hidden; background: #f2f2f7; display: flex; flex-direction: column; }
.pwa-mock span { padding: 8px 12px; font-size: 13.5px; color: #1c1c1e; border-top: 1px solid #d8d8de; }
.pwa-mock span:first-child { border-top: 0; }
.pwa-mock span.hit { font-weight: 700; background: #fff4c7; animation: pwa-hit 1.2s ease-in-out infinite alternate; }
.pwa-mock em { font-style: normal; margin-right: 6px; }
@keyframes pwa-hit { from { background: #fff4c7; } to { background: #ffd95a; } }
@media (prefers-reduced-motion: reduce) { .pwa-mock span.hit { animation: none; } }

/* 아이폰 · 아이패드: 공유 버튼 자리를 가리키는 화살표 */
.pwa-point { position: fixed; inset: 0; z-index: 4001; background: rgba(8, 6, 14, .72); }
.pwa-point[hidden] { display: none; }
.pwa-point-arrow {
    position: absolute; width: 0; height: 0;
    border-left: 22px solid transparent; border-right: 22px solid transparent;
    animation: pwa-bob 1s ease-in-out infinite alternate;
}
.pwa-point-arrow.up    { top: calc(10px + env(safe-area-inset-top)); border-bottom: 34px solid var(--accent-2); }
.pwa-point-arrow.down  { bottom: calc(10px + env(safe-area-inset-bottom)); border-top: 34px solid var(--accent-2); }
.pwa-point-arrow.right { right: 22px; }
.pwa-point-arrow.center { left: 50%; margin-left: -22px; }
@keyframes pwa-bob { from { transform: translateY(0); } to { transform: translateY(8px); } }
.pwa-point-arrow.down { animation-direction: alternate-reverse; }
@media (prefers-reduced-motion: reduce) { .pwa-point-arrow { animation: none; } }
.pwa-point-card {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: calc(100% - 48px); max-width: 400px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    padding: 20px 18px 14px; display: flex; flex-direction: column; gap: 12px;
}
.pwa-point-step { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--text); display: flex; gap: 10px; align-items: baseline; }
.pwa-point-step > .n { font-style: normal;
    flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--accent-2); color: #241812;
    display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.pwa-point-close { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 8px; cursor: pointer; }

/* 안드로이드 크롬: 설치 창을 바로 여는 버튼 */
.pwa-install-go { display: block; width: 100%; margin: 4px 0 10px; }

/* 안드로이드 설치 안내의 보충 설명 (작은 글씨) */
.pwa-steps small { display: block; margin-top: 3px; font-size: .82em; line-height: 1.5; color: var(--muted); }

/* ── 디자인 탭: 인덱스 파일철 ──────────────────────────────────────────
   서류철 칸막이처럼 탭 머리가 패널 위로 솟고, 고른 탭만 패널과 이어진다. */
.idx-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0;
    padding: 0 6px;
    margin-top: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.idx-tabs::-webkit-scrollbar { display: none; }
.idx-tab {
    appearance: none;
    position: relative;
    flex: 0 0 auto;
    margin-right: -6px;
    padding: 8px 15px 9px;
    border: 1px solid #443b47;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
    background: linear-gradient(180deg, #29232c, #1f1a21);
    color: #a89a92;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transform: translateY(4px);
    box-shadow: -3px -2px 6px rgba(0,0,0,.25);
    z-index: calc(10 - var(--i, 0));
}
.idx-tab.is-on {
    background: var(--surface);
    color: #ebcba9;
    border-color: #6e5440;
    transform: none;
    padding-bottom: 12px;
    z-index: 20;
}
.idx-tab.is-on::before {
    /* 고른 탭 머리의 금색 띠 */
    content: "";
    position: absolute;
    left: 10px; right: 10px; top: -1px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
}
.idx-panel {
    position: relative;
    z-index: 15;
    padding: 12px;
    border: 1px solid #6e5440;
    border-radius: 0 12px 12px 12px;
    background: var(--surface);
}
.idx-panel .design-card { background: rgba(255,255,255,.02); }

/* 탭 다섯 개가 좁은 폰에서도 한 줄에 다 보이게 (옆으로 밀려 '남성' 이 안 보이던 것) */
.idx-tabs { overflow: visible; padding: 0 2px; }
.idx-tab { flex: 1 1 auto; min-width: 0; padding-left: 4px; padding-right: 4px; margin-right: -3px; text-align: center; font-size: clamp(10.5px, 3.1vw, 12.5px); }

/* ── 결제 · 환불 규정 / 무료 체험 안내 ───────────────────────────────── */
.lic-policy-link, #lic-back-trial { display: block; width: 100%; margin-top: 10px; }
.ver-policy { display: block; width: 100%; margin-top: 10px; }
.trial-desc { margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; color: var(--text, #EDE7F6); }
.policy-box { max-height: 86vh; display: flex; flex-direction: column; }
.policy-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    line-height: 1.7;
    padding-right: 4px;
}
.policy-body h2 { font-size: 17px; margin: 0 0 4px; color: #ebcba9; }
.policy-body h3 { font-size: 14px; margin: 16px 0 4px; color: #ebcba9; }
.policy-body ul { margin: 0; padding-left: 18px; }
.policy-body li { margin: 3px 0; }
.policy-body .policy-meta { font-size: 11.5px; color: var(--muted, #a89a92); margin: 0 0 6px; }
.policy-body .policy-todo { color: #F3A0A0; font-size: 12px; }

/* 이용 종료 인사 */
.lic-sign { display: inline-block; margin-top: 6px; color: var(--accent-2, #ebcba9); font-weight: 700; }


/* ── 직원용(판매 · 교육) — PC 에서 열 때 ───────────────────────────────
   시뮬레이터 안은 mobile-ui.js 가 '왼쪽 사진 · 오른쪽 조절' 로 놓는다 (2026-10-15).
   바깥 페이지는 시뮬레이터가 화면을 꼭 채우게 하고, 페이지 전체 스크롤은 막는다
   (전에는 페이지 전체를 내려야 아래 메뉴가 보였다). */
html.ed-staff body.sim-fullscreen { overflow: hidden; height: 100vh; padding-bottom: 0; }
html.ed-staff body.sim-fullscreen #sim-frame { height: 100vh !important; display: block; }
/* 직원용 '사진 · 디자인 변경'(설정) 화면은 처음 화면과 같은 폭(720px)으로 가운데에 —
   전체화면용 max-width:none 이 그대로 남아 PC 에서 가로로 길게 늘어났다 (2026-10-15). */
html.ed-staff body.sim-fullscreen.settings-open { max-width: 720px; overflow: visible; height: auto; }
html.ed-staff body.sim-fullscreen.settings-open .settings-toggle { left: 0; right: 0; margin: 0 auto; max-width: 720px; }

/* 카카오로 7일 체험 시작 (카카오 안내 색) */
.kakao-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 220px; padding: 13px 22px; border-radius: 12px;
    background: #FEE500; color: #191919 !important; font-weight: 800; text-decoration: none;
}

/* 체험 신청 양식 (2026-10-18) */
.trial-form { display: grid; gap: 10px; margin-top: 16px; text-align: left; }
.trial-form > label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--text, #f3ece6); }
.trial-form > label b { color: #ebcba9; }
.trial-form > label i { font-style: normal; font-weight: 500; color: var(--muted, #a89a92); font-size: 12px; }
.trial-form input:not([type="checkbox"]), .trial-form select {
    width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 10px;
    border: 1px solid #443b47; background: #1b171d; color: #f3ece6; font: inherit; font-size: 15px; font-weight: 500;
}
/* 알게 된 경로 (2026-11-20) — 눌러서 고르는 칩, 여러 개 가능 */
.tf-src { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text, #f3ece6); }
.tf-src > span b { color: #ebcba9; }
.tf-src > span i { font-style: normal; font-weight: 500; color: var(--muted, #a89a92); font-size: 12px; }
.tf-src-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tf-chip { position: relative; cursor: pointer; }
.tf-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf-chip span { display: inline-block; padding: 8px 12px; border-radius: 999px; border: 1px solid #443b47; background: #1b171d; color: #d9cfc8; font-size: 13.5px; font-weight: 500; line-height: 1.2; }
.tf-chip input:checked + span { border-color: #c99a72; background: rgba(201, 154, 114, .18); color: #f3ece6; font-weight: 700; }
.tf-chip input:checked + span::before { content: "✓ "; color: #ebcba9; }
.tf-chip input:focus-visible + span { outline: 2px solid #ebcba9; outline-offset: 2px; }
.trial-consents { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid #2f2832; }
.trial-consents label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.45; cursor: pointer; }
.trial-consents input[type="checkbox"] { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: #c99a72; }
.trial-consents .tc-all { padding-bottom: 8px; margin-bottom: 2px; border-bottom: 1px solid #2f2832; }
.trial-consents .req { color: #FF8A80; font-weight: 800; }
.trial-consents .opt { color: #a89a92; font-weight: 800; }
.trial-consents details { margin: -2px 0 4px 26px; font-size: 12px; color: #a89a92; }
.trial-consents summary { cursor: pointer; color: #ebcba9; }
.trial-consents details p { margin: 6px 0 0; line-height: 1.6; }
.trial-form .kakao-btn { width: 100%; border: 0; font-size: 15px; cursor: pointer; margin-top: 4px; }
.trial-form small { text-align: center; color: #a89a92; }
.trial-consents .tc-policy { font-size: 12px; color: #ebcba9; margin: 2px 0 0 26px; }

/* 앨범 단추는 입력칸 이름표(label)다 — 단추와 같은 모양으로 */
label.btn { display: block; text-align: center; -webkit-user-select: none; user-select: none; }
label.design-card { cursor: pointer; }


/* 삼성 인터넷 안내 — 크롬으로 설치해야 갤러리가 바로 열린다 (2026-10-21) */
.pwa-warn { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,152,0,.12); border: 1px solid rgba(255,152,0,.5); color: #FFD9A0; font-size: 13.5px; line-height: 1.55; }
.pwa-warn small { color: #E9CFA8; }
.drop-hint { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: #E9CFA8; text-align: center; }

/* ── 프로그램 설정 (2026-11-17) ───────────────────────────────────── */
.shop-box { max-width: 420px; }
.shop-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.shop-sec:first-of-type { border-top: 0; padding-top: 0; }
.shop-sec h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--text); }
.shop-help { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.shop-foot { margin: 4px 0 14px; }
.shop-logo-row { display: flex; align-items: center; gap: 12px; }
/* 로고 틀은 정사각형(1:1) — 그림이 틀 밖으로 나가지 않게 크기를 못박고 그 안에 맞춰 넣는다 (2026-11-17 현장) */
.shop-logo-prev { flex: none; width: 104px; height: 104px; box-sizing: border-box; padding: 8px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.shop-logo-prev img { display: block; width: 100%; height: 100%; object-fit: contain; }
.shop-logo-btns { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.shop-logo-btns .btn { width: 100%; text-align: center; cursor: pointer; }
.shop-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.shop-preset { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; min-height: 64px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 12px; cursor: pointer; }
.shop-preset i { width: 44px; height: 22px; border-radius: 6px; border: 1px solid rgba(128,128,128,.45); display: block; }
.shop-preset.is-on { border-color: var(--accent); }
.shop-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.shop-colors label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; min-height: 48px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.shop-colors input[type="color"] { width: 44px; height: 30px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.shop-sample { display: flex; align-items: center; gap: 8px; padding: 12px; margin-bottom: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; }
.shop-sample-card { flex: 1 1 auto; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.shop-sample-btn { padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent, #241812); font-weight: 700; }
.shop-sample-ghost { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent-2); }
.shop-wide { width: 100%; }
.shop-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.shop-fonts button { min-height: 46px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 14px; cursor: pointer; }
.shop-fontprev { margin: 2px 0 10px; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.shop-fp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 11.5px; color: var(--muted); font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
.shop-fp-head em { font-style: normal; color: var(--accent-2); }
.shop-fp-title { font-size: 1.15em; font-weight: 700; color: var(--accent-2); margin-bottom: 8px; }
.shop-fp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.shop-fp-val { margin-left: auto; color: var(--text); }
.shop-fp-val b { color: var(--accent); }
.shop-fp-text { margin: 0; line-height: 1.55; color: var(--text-2, var(--text)); }
.shop-fonts button.is-on { border-color: var(--accent); background: var(--sel-bg, var(--surface-2)); }
.shop-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.shop-seg button { min-height: 44px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 13px; cursor: pointer; }
.shop-seg3 { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-stamp-help { margin: 12px 0 8px; }
.shop-seg button.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #241812); font-weight: 700; }
/* 언어 — 그 나라 글자로 적힌 단추 아홉 개 */
.shop-lang button { font-size: 14px; }
/* 매장 로고는 가로로 긴 것이 많다 — 높이를 기준으로 맞춘다 */
.app-logo.is-shop { width: 44px; height: 44px; max-height: 44px; object-fit: contain; border-radius: 6px; }
/* 테스트 버전에 따로 있던 스킨 단추는 설정의 '화면 색' 으로 합쳤다 */
.skin-btn { display: none !important; }

/* 번역본 규정 맨 위 — 효력은 한국어 원문 (2026-11-21) */
.policy-note { display: grid; gap: 8px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line-2, #443b47); border-radius: 10px; background: var(--surface-2, #241f27); }
.policy-note p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text, #f3ece6); }
.policy-note .btn { justify-self: start; }

/* ── 튜토리얼 (2026-11-24, js/tutorial.js) — 게임처럼 빛나는 곳을 따라 누른다 ── */
.tut-root { position: fixed; inset: 0; pointer-events: none; }
.tut-shade { position: fixed; background: rgba(6, 4, 8, .72); pointer-events: auto; transition: all .18s ease; }
.tut-ring { position: fixed; border-radius: 12px; border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 201, 154, 114), .28), 0 0 24px rgba(var(--accent-rgb, 201, 154, 114), .55); pointer-events: none; animation: tutPulse 1.4s ease-in-out infinite; transition: all .18s ease; }
@keyframes tutPulse { 50% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb, 201, 154, 114), .12), 0 0 30px rgba(var(--accent-rgb, 201, 154, 114), .7); } }
@media (prefers-reduced-motion: reduce) { .tut-ring { animation: none; } }
.tut-card { position: fixed; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); pointer-events: auto;
  background: var(--surface, #1b171d); color: var(--text, #f3ece6); border: 1px solid var(--line-2, #443b47); border-radius: 16px; padding: 16px 16px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.tut-card.is-center { top: 50%; transform: translate(-50%, -50%); }
.tut-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.tut-ch { background: var(--accent); color: var(--on-accent, #241812); font-weight: 800; border-radius: 99px; padding: 2px 10px; }
.tut-count { color: var(--muted, #a89a92); font-weight: 700; }
.tut-bar { height: 4px; border-radius: 99px; background: var(--surface-3, #322b35); margin: 10px 0 12px; overflow: hidden; }
.tut-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s ease; }
.tut-title { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.tut-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2, #ddd3cc); }
.tut-plan { margin: 10px 0 0; font-size: 13px; color: var(--accent-2, #ebcba9); }
.tut-hint { margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--accent-2, #ebcba9); }
.tut-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.tut-btn { min-height: 42px; padding: 0 16px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; border: 1px solid var(--line-2, #443b47); background: var(--surface-2, #241f27); color: var(--text, #f3ece6); }
.tut-btn.tut-next { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #241812); }
.tut-btn.tut-next.is-quiet { background: transparent; color: var(--muted, #a89a92); border-color: var(--line-2, #443b47); font-weight: 600; }
.tut-btn.tut-extra { margin-right: auto; border-color: var(--accent); color: var(--accent-2, #ebcba9); }
.tut-btn:disabled { opacity: .45; cursor: default; }
.tut-skip { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 10px; pointer-events: auto; font: inherit; font-size: 12px; color: #fff; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .25); border-radius: 99px; padding: 5px 11px; cursor: pointer; }
.tut-ask { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(6, 4, 8, .74); }
.tut-ask-card { width: min(400px, 100%); background: var(--surface, #1b171d); color: var(--text, #f3ece6); border: 1px solid var(--line-2, #443b47); border-radius: 18px; padding: 22px 18px 16px; text-align: center; box-shadow: 0 16px 48px rgba(0, 0, 0, .55); }
.tut-ask-badge { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--accent-2, #ebcba9); border: 1px solid var(--accent); border-radius: 99px; padding: 3px 10px; }
.tut-ask-card h3 { margin: 12px 0 6px; font-size: 19px; font-weight: 800; }
.tut-ask-card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-2, #ddd3cc); }
.tut-ask-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.tut-course { display: grid; gap: 4px; padding: 16px 10px; border-radius: 14px; border: 1.5px solid var(--accent); background: var(--sel-bg, var(--surface-2, #241f27)); color: var(--text, #f3ece6); font: inherit; cursor: pointer; }
.tut-course b { font-size: 16px; }
.tut-course span { font-size: 12px; color: var(--muted, #a89a92); }
.tut-course:focus-visible, .tut-btn:focus-visible, .tut-skip:focus-visible { outline: 2px solid var(--accent-2, #ebcba9); outline-offset: 2px; }
.tut-ask-btns { display: flex; justify-content: center; margin-top: 10px; }
.tut-ask-foot { margin-top: 10px !important; font-size: 12px !important; color: var(--muted, #a89a92) !important; }
.ver-tutorial { margin-bottom: 8px; }

/* 편집 화면 단계 — 얼굴 사진이 보이게 막은 옅게, 안내 창은 작게 맨 위에 (2026-11-24) */
.tut-root.is-editor .tut-shade { background: rgba(6, 4, 8, .28); }
.tut-root.is-editor .tut-card { padding: 9px 12px 9px; width: min(400px, calc(100vw - 96px)); left: 8px; transform: none; border-radius: 12px; }
.tut-root.is-editor .tut-card.is-center { left: 50%; transform: translate(-50%, -50%); }
/* 세로 화면 편집 단계 · 칭찬 창은 가로 가운데 (2026-11-27 원장님) */
@media (orientation: portrait) { .tut-root.is-editor .tut-card:not(.is-center) { left: 50%; transform: translateX(-50%); } }
.tut-root .tut-card.is-yay:not(.is-center) { left: 50%; transform: translateX(-50%); }
.tut-root.is-editor .tut-bar { margin: 6px 0 6px; height: 3px; }
.tut-root.is-editor .tut-title { font-size: 14.5px; margin: 0 0 2px; }
.tut-root.is-editor .tut-text { font-size: 12.5px; line-height: 1.45; }
.tut-root.is-editor .tut-hint { margin: 4px 0 0; font-size: 12px; }
.tut-root.is-editor .tut-btns { margin-top: 6px; }
.tut-root.is-editor .tut-btn { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.tut-hint svg.li, .tut-ask-badge svg.li { width: 1.1em; height: 1.1em; vertical-align: -0.18em; }

/* 눕힌 폰 (높이 500px 이하 가로) — 첫 화면 사진을 낮춰 시술 부위 · 편집 방식까지 덜 내려가게 (2026-11-24) */
@media (orientation: landscape) and (max-height: 500px) {
    #preview-img { max-height: 42vh; }
    .app-bar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
}

.tut-fold { margin-left: auto; font: inherit; font-size: 11.5px; color: var(--muted, #a89a92); background: none; border: 1px solid var(--line-2, #443b47); border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.tut-card.is-min .tut-bar, .tut-card.is-min .tut-text, .tut-card.is-min .tut-plan, .tut-card.is-min .tut-hint, .tut-card.is-min .tut-btns { display: none; }
.tut-card.is-min .tut-title { margin: 6px 0 0; font-size: 13.5px; }

/* 튜토리얼 — 「여기까지」 목표 표시 · 잘하셨습니다 (2026-11-24) */
.tut-goal { position: fixed; display: none; transform: translateX(-50%); pointer-events: none; text-align: center; animation: tutGoal 1.1s ease-in-out infinite; }
.tut-goal span { display: inline-block; font-size: 11.5px; font-weight: 800; color: var(--on-accent, #241812); background: var(--accent-2, #ebcba9); border-radius: 99px; padding: 2px 8px; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.tut-goal i { display: block; width: 3px; height: 22px; margin: 2px auto 0; border-radius: 3px; background: var(--accent-2, #ebcba9); box-shadow: 0 0 10px rgba(var(--accent-rgb, 201, 154, 114), .9); }
@keyframes tutGoal { 50% { transform: translate(-50%, -4px); } }
@media (prefers-reduced-motion: reduce) { .tut-goal { animation: none; } }
.tut-ring.is-done { border-color: #5fd08a; box-shadow: 0 0 0 4px rgba(95, 208, 138, .3), 0 0 26px rgba(95, 208, 138, .6); animation: none; }
.tut-yay { display: grid; gap: 4px; text-align: center; padding: 10px 4px; }
.tut-yay b { font-size: 20px; color: var(--accent-2, #ebcba9); }
.tut-yay span { font-size: 13px; color: var(--muted, #a89a92); }
/* 박수 — 3초 (2026-11-27 원장님) */
.tut-yay.is-clap b { font-size: 24px; animation: tut-clap .5s ease-out 0s 3 alternate; display: inline-block; }
@keyframes tut-clap { from { transform: scale(1); } to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .tut-yay.is-clap b { animation: none; } }
