/* =========================================================
   루메인 헤어 — MIDNIGHT CHROME
   에디토리얼 구조(헤어라인·serif 워드마크·모노 라벨·직각) +
   도시적/최첨단 색감(그래파이트 · 일렉트릭 블루 · 크롬 화이트)
   ========================================================= */

:root {
  /* 베이스 — 차가운 그래파이트 */
  --bg:        #0A0B0D;
  --bg-2:      #0E1013;
  --surface:   #121519;
  --surface-2: #171B21;
  --surface-3: #1D222A;

  /* 헤어라인 */
  --line:      rgba(255,255,255,.08);
  --line-2:    rgba(255,255,255,.16);

  /* 텍스트 — 크리스프 쿨 */
  --text:      #EEF1F5;
  --text-dim:  #98A2AF;
  --text-faint:#5B646F;

  /* 액센트 — 일렉트릭 */
  --accent:    #4EA8FF;   /* 일렉트릭 블루 */
  --accent-2:  #7CC4FF;
  --accent-dim:rgba(78,168,255,.14);
  --chrome:    #EDF0F3;   /* 크롬 화이트 (프라이머리 CTA) */
  --steel:     #8A94A6;

  --danger:    #FF5A6E;
  --ok:        #34E0B0;

  --radius: 0px;          /* 직각 = 에디토리얼/테크 */
  --radius-sm: 0px;
  --shadow: 0 24px 60px rgba(0,0,0,.6);
  --glow: 0 0 0 1px rgba(78,168,255,.5), 0 0 24px rgba(78,168,255,.25);

  --serif: 'Cormorant Garamond', 'Noto Serif KR', serif;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sans: 'Pretendard', 'Noto Sans KR', -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
/* 미세한 테크 그리드 텍스처 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background:
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px) 0 0 / 100% 46px,
    radial-gradient(900px 500px at 82% -8%, rgba(78,168,255,.10), transparent 60%);
}
#app { height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

/* ================= 상단 바 ================= */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 2.6vw, 36px); height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,11,13,.72); backdrop-filter: blur(14px);
  flex: 0 0 auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 400; font-size: 20px;
  color: #0A0B0D; background: linear-gradient(150deg, #FFFFFF, #C3CBD6);
  border: 1px solid var(--line-2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b {
  font-family: var(--serif); font-weight: 300; font-size: 17px;
  letter-spacing: 0.42em; text-transform: uppercase; padding-left: 0.42em;
}
.brand-text em { font-style: normal; color: var(--text-faint); font-size: 10.5px; letter-spacing: 0.22em; font-family: var(--mono); text-transform: uppercase; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.credit-pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); background: transparent;
  border: 1px solid var(--line); padding: 9px 14px;
}
.credit-pill b { color: var(--accent-2); }
.credit-exp {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--text-dim); margin-left: -6px;
}
.credit-exp.expired { color: #e05555; font-weight: 700; }

/* ================= 버튼 ================= */
button { font-family: inherit; cursor: pointer; border: none; font-weight: 600; transition: .16s ease; letter-spacing: 0; }
.primary-btn {
  background: var(--chrome); color: #0A0B0D; padding: 13px 24px;
  font-size: 15px; font-weight: 700; border: 1px solid var(--chrome);
  letter-spacing: .01em;
}
.primary-btn:hover { background: #FFFFFF; box-shadow: 0 0 24px rgba(237,240,243,.18); }
.primary-btn:disabled { background: transparent; color: var(--text-faint); border-color: var(--line); cursor: not-allowed; box-shadow: none; }
.ghost-btn {
  background: transparent; color: var(--text); padding: 13px 20px;
  font-size: 14px; border: 1px solid var(--line-2); font-weight: 500;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.big-btn { font-size: 17px; padding: 18px 34px; }
.link-btn { background: none; color: var(--text-dim); padding: 8px 4px; font-weight: 500; font-size: 13px; font-family: var(--mono); letter-spacing: .06em; }
.link-btn:hover { color: var(--text); }
.danger-btn { background: transparent; color: var(--danger); border: 1px solid rgba(255,90,110,.35); padding: 11px 18px; font-size: 13px; font-family: var(--mono); letter-spacing: .05em; }

/* ================= 화면 컨테이너 ================= */
#screens { flex: 1 1 auto; overflow: hidden; position: relative; display: flex; }
.screen { padding: clamp(22px,3vh,34px) clamp(20px, 4vw, 56px) 48px; min-height: 100%; animation: fade .3s ease; overflow-y: auto; width: 100%; }

/* ===== 스튜디오: 한 화면 3단 (원본 → 스타일 메뉴 → AI 결과) ===== */
.studio { display: flex; width: 100%; height: 100%; gap: 1px; background: var(--line); animation: fade .3s ease; }
.col { background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
/* 배치: [스타일 메뉴] [손님 촬영] [AI 결과]
   촬영 칸이 가운데인 이유 — 손님이 화면을 보는 방향이 그대로 사진의 시선이 된다.
   옆칸에 두면 눈이 돌아가 정면이 안 나온다. 그래서 가운데를 촬영에 내주고
   조금 더 넓게 잡는다. 스타일 메뉴는 "고르는" 칸이라 좁아도 되고,
   모델컷은 워터마크를 잘라내며 얼굴이 커져 작아도 알아보기 충분하다. */
/* ★ 3열 폭은 비율로만 잡는다 — 매장마다 태블릿 해상도가 다르므로 고정 px 금지.
   배치(3×3 / 2×2)에 따라 필요한 폭이 다르다:
     3×3 — 카드가 3열이라 메뉴가 넓어야 태그 3개가 한 줄에 들어간다.
     2×2 — 카드가 2열이라 메뉴가 좁아도 되고, 그만큼 손님이 보는 AI PREVIEW 로 넘긴다.
   합이 항상 화면 가로를 남김없이 채우도록 전부 flex-basis 0 으로 둔다. */
.col-menu { flex: 1 1 0; }
.col-original { flex: 1.14 1 0; }
.col-result { flex: 1 1 0; }

.studio.menu-3x3 .col-menu     { flex: 1.22 1 0; }
.studio.menu-3x3 .col-original { flex: 1.06 1 0; }
.studio.menu-3x3 .col-result   { flex: 1.06 1 0; }

/* ★ 2026-09-12 — 2×2 모델 사진이 너무 작다는 제보로 폭 배분을 다시 잡는다.
   [원인] 2×2 는 메뉴 칸이 셋 중 가장 좁았다(0.86 : 1.06 : 1.20). 그 좁은 칸을
     다시 2열로 나누니 사진 한 장이 칸 폭의 절반밖에 안 됐다 — 사진 크기는
     결국 '칸 폭'이 정한다(세로는 3:4 로 따라온다).
   [수정] 메뉴 0.86 → 1.10 으로 넓히고 결과·촬영 칸에서 그만큼 가져온다.
     합(3.12)은 그대로라 화면을 남김없이 채우는 성질은 유지된다.
     사진 폭이 약 28% 커진다(실측: 123px → 158px). */
.studio.menu-2x2 .col-menu     { flex: 1.10 1 0; }
.studio.menu-2x2 .col-original { flex: 1.00 1 0; }
.studio.menu-2x2 .col-result   { flex: 1.02 1 0; }
/* 1×1 은 스타일이 하나뿐이라 메뉴는 좁히고, 손님이 보는 결과·염색 칸을 넓힌다. */
.studio.menu-1x1 .col-menu     { flex: 0.72 1 0; }
.studio.menu-1x1 .col-original { flex: 1.04 1 0; }
.studio.menu-1x1 .col-result   { flex: 1.30 1 0; }
.col-head { flex: 0 0 auto; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: clamp(13px,1.9vh,18px) clamp(14px,1.3vw,20px) 11px; border-bottom: 1px solid var(--line); }
.col-head .t { font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.col-head .n { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--accent); }
.col-head .c { font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; color: var(--text-faint); white-space: nowrap; }
.col-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: clamp(12px,1.8vh,18px); gap: 12px; }
.col-body.scroll { overflow-y: auto; }
.col-foot { flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: clamp(11px,1.8vh,16px) clamp(14px,1.3vw,20px); border-top: 1px solid var(--line); background: var(--bg-2); }
.col-foot .fcount .n { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.col-foot .fcount .s { font-family: var(--mono); font-size: 10px; letter-spacing: .03em; color: var(--text-faint); margin-top: 3px; }
/* ★ 2026-09-11 — "사진을 먼저 촬영" 이 col-menu 폭(3열 중 1열)에서 두 줄로
   줄바꿈됐다(1000px 미만 미디어쿼리가 아니라 이 기본 규칙이 진짜 원인이었다 —
   3열 레이아웃은 뷰포트가 넓어도 각 열은 좁다). 줄바꿈을 막고, 좁은 열에서도
   맞도록 글자를 살짝 줄인다. fcount 쪽이 대신 줄어든다(원래도 줄바꿈 허용).*/
.col-foot .gen-cta { margin-left: auto; white-space: nowrap; font-size: 14px; padding-left: 18px; padding-right: 18px; }
.col-foot .fcount { min-width: 0; }

/* 스테이지 박스는 각 컬럼 안에서 재사용 */
.stage-box-wrap { flex: 1; min-height: 0; display: flex; }
.stage-box {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  border: 1px solid var(--line-2);
  background: repeating-linear-gradient(122deg, #101316 0 11px, #14171C 11px 22px);
  display: grid; place-items: center;
}
.stage-box .corner-tag {
  position: absolute; left: 14px; top: 14px; z-index: 3;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); background: rgba(10,11,13,.55); border: 1px solid var(--line-2); padding: 6px 11px;
}
/* 전/후면 카메라 전환 버튼 — 촬영 화면 우상단 */
.stage-box .cam-flip {
  position: absolute; right: 14px; top: 14px; z-index: 4;
  font-size: 12px; font-weight: 700; letter-spacing: -.01em;
  color: var(--text); background: rgba(10,11,13,.62); border: 1px solid var(--line-2);
  padding: 8px 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stage-box .cam-flip:active { background: rgba(10,11,13,.82); }
/* 결과는 통일된 3:4 세로컷(generate.js normalizePortrait). 남는 자투리는 검은색이 아니라
   스튜디오 라이트그레이로 채워 배경과 이어지게 한다(좌우 검은 여백 방지). */
.stage-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #d7dbe0; }
/* 결과 이미지는 눌러서 크게 볼 수 있다 (오른쪽 칸이 좁아 손님에게 보여주기 어렵다) */
.stage-img.zoomable { cursor: zoom-in; }
/* ★ 2026-09-12 — 얼굴 고정 실패 경고. 원장에게만(isOwner) 보인다 — 손님 화면
   그대로는 예전 결정(조용히 AI 얼굴을 내보냄)을 유지하되, 원장은 몰라서
   손님에게 그대로 보여주는 사고를 막아야 한다는 실측 제보로 새로 추가한다. */
.stage-facelock-warn {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: rgba(58,12,12,.88); border-top: 1px solid #c0392b;
  color: #ffdcd6; font-size: 12.5px; font-weight: 500; line-height: 1.5;
  padding: 10px 14px;
}
.stage-facelock-warn b { color: #ff9a90; }

/* 얼굴 고정을 '자동으로 끈' 컷 — 실패가 아니라 정책이 걸린 것이라 색을 달리한다.
   빨강으로 두면 원장이 고장으로 읽는다. 파랑 = "알고 그런 것, 다만 알아두시라". */
.stage-facelock-note {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: rgba(12,28,58,.90); border-top: 1px solid #2f6fe0;
  color: #d9e6ff; font-size: 12.5px; font-weight: 500; line-height: 1.5;
  padding: 10px 14px;
}
.stage-facelock-note b { color: #8fb8ff; }

/* 결과 도구 버튼 (크게 보기 · 저장) — 확정 버튼보다 한 단계 낮은 위계 */
.stage-tools { display: flex; gap: 8px; }
.tool-btn {
  flex: 1; background: transparent; color: var(--text-dim);
  border: 1px solid var(--line-2); padding: 9px 10px; font-weight: 500;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent-2); }
/* 홈 화면 설치 안내 배너(2026-09-12) — 상단바 바로 아래 한 줄. [닫기]면 그 기기에서 다시 안 뜬다. */
.install-banner {
  position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 70;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--accent); color: var(--text); font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.install-banner span { flex: 1; min-width: 0; line-height: 1.4; }
.install-banner .tool-btn { flex: none; }
/* 설정 화면 "이 매장 링크" 블록(2026-09-12) — 원장이 언제든 보고 복사할 수 있는 자리 */
.shop-link-box { padding: 10px 12px; background: var(--bg); border: 1px solid var(--accent); }
.shop-link-box code { font-family: var(--mono); font-size: 11.5px; line-height: 1.6; word-break: break-all; color: var(--accent-2); }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* idle 상태 — 촬영 진입 */
.stage-idle { text-align: center; padding: 30px; }
.stage-idle .kline { width: 44px; height: 1px; background: var(--accent); margin: 0 auto 20px; }
.stage-idle h2 { font-size: clamp(19px,2.8vh,26px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.25; }
.stage-idle p { color: var(--text-dim); margin-top: 10px; font-weight: 300; font-size: 14px; }
.stage-idle .btns { display: flex; gap: 12px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }

/* generating 상태 */
.stage-gen { text-align: center; padding: 30px; width: 100%; }
.stage-gen .elapsed { font-family: var(--mono); font-size: 40px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stage-gen .elapsed span { font-size: 16px; color: var(--text-faint); }
.stage-gen h2 { font-size: 17px; font-weight: 700; margin-top: 8px; letter-spacing: -0.02em; }
.stage-gen .genbar { height: 2px; background: var(--line-2); margin: 22px auto 18px; max-width: 320px; overflow: hidden; position: relative; }
.stage-gen .genbar::after { content:""; position:absolute; inset:0; width:40%; background: var(--accent); box-shadow: 0 0 16px var(--accent); animation: sweep 1.4s ease-in-out infinite; }
@keyframes sweep { 0%{ transform: translateX(-120%);} 100%{ transform: translateX(320%);} }
.stage-gen .lines { display: flex; flex-direction: column; gap: 7px; align-items: center; margin-top: 10px; }
.stage-gen .gl { font-family: var(--mono); font-size: 12px; letter-spacing: .03em; color: var(--text-faint); }
.stage-gen .gl.on { color: var(--accent-2); }
.stage-gen .gl.ok { color: var(--ok); }
.stage-gen .note { margin-top: 20px; font-size: 12px; color: var(--text-faint); font-weight: 300; }

/* result 상태 — 하단 예상이미지 바(이미지에 굽혀넣음) + 필름스트립 */
.result-strip { display: flex; gap: 8px; overflow-x: auto; padding-top: 2px; }
.result-strip .rs {
  flex: 0 0 auto; width: 54px; height: 70px; position: relative; cursor: pointer;
  border: 1px solid var(--line-2); background: #d7dbe0; overflow: hidden;
}
.result-strip .rs img { width: 100%; height: 100%; object-fit: cover; }
.result-strip .rs.on { border-color: var(--accent); box-shadow: var(--glow); }
.result-strip .rs.err { display: grid; place-items: center; color: var(--danger); font-size: 16px; }

/* 염색 미리보기 — 커트만 vs 커트+염색 좌우 비교 (㉑)
   어느 쪽이 무엇인지 헷갈리면 손님이 잘못된 걸 보고 결정한다. 라벨을 크게 박는다. */
.compare-pair { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); }
.compare-pair figure { position: relative; margin: 0; overflow: hidden; background: #d7dbe0; }
.compare-pair img { width: 100%; height: 100%; object-fit: contain; display: block; }
.compare-pair figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 8px;
  background: rgba(10,11,13,.82); color: var(--text);
  font-size: 12px; font-weight: 700; text-align: center; letter-spacing: -.01em;
}
.compare-pair figcaption span { display: block; font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: .06em; color: var(--text-dim); margin-top: 2px; }
/* 오른쪽(염색)이 옵션이라는 걸 색으로도 구분 */
.compare-pair figure:last-child figcaption { color: var(--accent-2); }

/* 염색 비교 스트립 — 커트만(기준) + 만든 염색색깔들을 옆으로 나란히 놓고 비교 */
.dye-strip { position: absolute; inset: 0; display: flex; gap: 1px; overflow-x: auto; background: var(--line-2); scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.dye-strip .dcp { flex: 0 0 62%; position: relative; margin: 0; overflow: hidden; background: #d7dbe0; scroll-snap-align: start; }
.dye-strip .dcp img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dye-strip .dcp figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px;
  background: rgba(10,11,13,.82); color: var(--text);
  font-size: 12px; font-weight: 700; text-align: center; letter-spacing: -.01em;
}
/* 첫 칸(커트만)은 비교의 기준이라 색으로 구분 */
.dye-strip .dcp:first-child figcaption { color: var(--text-dim); }
.dye-strip .dcp:not(:first-child) figcaption { color: var(--accent-2); }

.dye-toggle { width: 100%; flex: none; }
.dye-toggle em { font-style: normal; color: var(--text-faint); font-size: 9px; letter-spacing: .08em; margin-left: 6px; }
.dye-toggle.on { border-color: var(--accent); color: var(--accent-2); background: var(--accent-dim); }
/* 염색 색상 3종 선택 */
.dye-block { margin-top: 6px; }
/* 1×1(염색 전문점) 모드 — 염색이 주인공이라 블록을 도드라지게 해 손님을 색 비교로 이끈다. */
.dye-block.funnel { margin-top: 10px; padding: 12px 13px 13px; background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 12px; }
.dye-block.funnel .dye-lbl { color: var(--accent-2); font-size: 13px; font-weight: 700; }
.dye-block.funnel .dye-lbl b { color: var(--accent-2); }
.dye-lbl { font-size: 12px; color: var(--text-dim); margin-bottom: 7px; }
.dye-lbl b { font-weight: 700; }
.dye-lbl em { font-style: normal; color: var(--text-faint); font-size: 10px; letter-spacing: .04em; margin-left: 6px; }
.dye-colors { display: flex; gap: 7px; flex-wrap: wrap; }
.dye-chip { flex: 1 1 88px; padding: 10px 6px; font-size: 12px; letter-spacing: -.02em; white-space: nowrap; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-dim); cursor: pointer; }
.dye-chip.made { color: var(--text); border-color: var(--line); }
.dye-chip.on { border-color: var(--accent); color: var(--accent-2); background: var(--accent-dim); }
.dye-off { width: 100%; flex: none; margin-top: 7px; }

/* 스테이지 하단(변신 상태별 액션) */
.stage-extra { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; }
.confirm-inline {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer;
}
.confirm-inline.checked { border-color: var(--accent); background: var(--accent-dim); }
.confirm-inline .box { flex: 0 0 22px; width: 22px; height: 22px; border: 1px solid var(--text-faint); display: grid; place-items: center; font-size: 14px; color: transparent; }
.confirm-inline.checked .box { background: var(--accent); border-color: var(--accent); color: #04121f; }
.confirm-inline .ct { font-size: 13px; line-height: 1.45; font-weight: 300; }
.confirm-inline .ct b { color: var(--accent-2); font-weight: 600; }
.stage-actions { display: flex; gap: 10px; }
.stage-actions .primary-btn, .stage-actions .ghost-btn { flex: 1; text-align: center; }

/* 가운데 — 스타일 메뉴(헤어 라인 실루엣) */
.col-menu .col-body { padding-top: clamp(14px,2vh,20px); }
/* 카드 배치는 원장이 "스타일 관리"에서 고른다 (2×2 = 4칸 · 3×3 = 9칸).
   기본은 3열 — 카탈로그가 9종이라 3×3 으로 딱 떨어진다.
   카드가 좁아진 만큼 열 간격은 조금 좁히고 행 간격은 유지(이름·태그가 붙지 않게). */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; align-content: start; }
.menu-grid.layout-3x3 { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
/* 1×1 (단일 스타일) — 큐사랑류 염색 전문점용. 스타일 하나만 크게, 곧장 염색으로. */
.menu-grid.layout-1x1 { grid-template-columns: 1fr; height: 100%; min-height: 0; align-content: start; }
.menu-grid.layout-1x1 .style-card { display: flex; flex-direction: column; min-height: 0; }
/* ★ 2026-09-11 — aspect-ratio:auto + flex:1 1 auto 가 넓은 칸에서 사진을
   가로로 길게 늘였다(원장 제보 "왼쪽 사진이 가로로 넓다"). 1×1 은 카드가
   하나뿐이라 세로로 채울 이유가 없다 — 카탈로그 실제 비율(3:4)로 고정한다. */
.menu-grid.layout-1x1 .style-card .thumb { aspect-ratio: 3/4; flex: none; min-height: 0; }
.menu-grid.layout-1x1 .style-card .meta { flex: 0 0 auto; padding-top: 10px; }
.col-menu .col-body > .menu-grid.layout-1x1 { flex: 1 1 auto; }
/* 2×2 는 카드가 4장뿐이라 폭이 남는다. 손님에게 보여주는 화면이므로
   무한정 늘리지 않고 가운데로 모아 썸네일 비율을 지킨다. */
/* ★ 2×2 는 "스크롤 없이 한눈에 비교" 가 존재 이유다. 그래서 폭이 아니라 높이가
   기준이 된다. 카드 높이를 3:4 썸네일이 정하게 두면(=폭×4/3) 두 줄이 항상
   화면을 넘는다. 대신 그리드가 남은 높이를 정확히 2등분하고, 썸네일이 그 안에서
   남는 높이를 가져가게 뒤집는다. 카드가 작아져도 4개가 다 보이는 쪽이 맞다. */
/* ★ 2026-09-12 (2차) — 행 높이를 화면에 맞춰 누르지 않는다.
   [증상] 브라우저 100% 에서만 사진이 작고 좌우에 검은 여백이 생겼다. 50% 로
     줄이면 제대로 나왔다(원장 스크린샷 2장).
   [원인] 여기 있던 `grid-template-rows: repeat(2, minmax(0,1fr)) + height:100%`
     가 각 행을 '화면 높이의 절반' 으로 강제했다. 100% 에서는 그 절반이 3:4
     사진보다 낮아 썸네일이 눌리고(flex-shrink), 납작해진 박스 안에서
     object-fit:contain 이 사진을 좌우 여백과 함께 작게 담았다.
     50% 는 CSS 높이가 두 배라 안 눌려서 꽉 찼던 것 — 줌에 따라 달라 보인 이유다.
   [수정] 행을 내용 높이로 둔다(3×3·1×1 과 모바일 규칙이 이미 이 방식이다).
     사진은 어떤 줌에서도 칸 폭을 꽉 채우고 3:4 로 따라온다. 세로가 모자라면
     메뉴 칸이 스크롤된다 — '4장 무조건 한 화면' 보다 '사진이 제대로 보이는 것'
     을 택한다(v217 에서 이미 같은 판단을 했다). */
.menu-grid.layout-2x2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: none; grid-auto-rows: auto;
  gap: 10px; height: auto; min-height: 0; align-content: start; width: 100%;
}
/* ★ 2026-09-12 — align-items:center 로 썸네일이 가로로 늘어나지 않게 한다.
   그래야 아래 aspect-ratio 가 '높이에서 폭을 계산' 할 수 있다. */
.menu-grid.layout-2x2 .style-card { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
/* ★ 2026-09-12 — 사진이 너무 작던 문제(원장 제보).
   [이전] 박스를 칸 폭에 꽉 채우고 높이만 눌러서(납작한 박스) contain 으로
   담으니, 사진이 박스 높이에 갇혀 좌우에 큰 여백만 남고 작게 보였다.
   [지금] 박스 자체를 사진 비율(3:4)로 만든다. 높이는 행이 주는 만큼 끝까지
   쓰고(flex:1 + height:100%), 폭은 그 높이에서 계산된다(width:auto).
   → 사진이 세로를 꽉 채워 가장 크게 나오고, 남는 폭은 좌우 칸 사이의
   여백이 된다(원장 요청: "2×2는 좌우 박스 사이에 공백을 둬서"). */
.menu-grid.layout-2x2 .style-card .thumb {
  /* 1×1·3×3 과 같은 방식 — 칸 폭을 꽉 채우고 높이는 3:4 로 따라온다.
     flex:none 이라 줄어들지 않는다(줄어들면 위 [증상]의 검은 여백이 생긴다). */
  width: 100%; aspect-ratio: 3/4; height: auto; flex: none;
}
.menu-grid.layout-2x2 .style-card .meta { flex: 0 0 auto; width: 100%; padding-top: 5px; }
/* ★ 이름 칸이 2줄을 미리 잡아두고 있어(min-height:2.8em) 카드 높이의 절반을
   글자가 먹었다 — 실측: 카드 69px 중 meta 60px, 썸네일 9px.
   2×2 는 카드가 4장뿐이라 이름이 한 줄로 충분하다. 줄인 만큼 사진이 커진다. */
.menu-grid.layout-2x2 .style-card .meta .name { min-height: 0; -webkit-line-clamp: 1; }
.menu-grid.layout-2x2 .style-card .meta .name-en { min-height: 0; -webkit-line-clamp: 1; margin-top: 2px; }
.menu-grid.layout-2x2 .style-card .meta .tags { margin-top: 4px; }
/* ★ 위 칸(스타일 고르기 헤더 · 성별 박스)의 상하 여백을 줄여, 줄인 만큼을
   사진 높이로 넘긴다(원장 요청). 메뉴 칸에만 적용 — 촬영·결과 칸은 그대로. */
.col-menu .col-head { padding-top: clamp(9px,1.2vh,12px); padding-bottom: 8px; }
.col-menu .col-body { padding-top: 10px; gap: 8px; }
.col-menu .gender-pick { margin-bottom: 6px; padding: 6px 10px; }
.col-menu .gender-pick .cc-row { margin-bottom: 0; }
.col-menu .gender-pick .cc-opt { padding: 5px 6px; }
/* ★ 2026-09-12 (2차) — 2등분을 그만뒀으므로 남은 높이를 차지할 이유도 없다.
   flex:1 로 두면 그리드가 늘어나면서 다시 행을 눌러 사진이 작아진다. */
.col-menu .col-body > .menu-grid.layout-2x2 { flex: none; }
.style-card .thumb svg { width: 100%; height: 100%; display: block; }
.style-card .sil { color: var(--steel); transition: .18s ease; }
.style-card:hover .sil, .style-card.selected .sil { color: var(--accent-2); }
.style-card .thumb .sil-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 10% 14%; }

/* 결과 컬럼 빈 상태 */
.result-empty { text-align: center; color: var(--text-faint); padding: 24px; }
.result-empty .ic { font-size: 34px; opacity: .5; margin-bottom: 12px; }
.result-empty p { font-size: 13px; font-weight: 300; line-height: 1.5; }

@media (max-width: 1000px) {
  #screens { overflow-y: auto; }
  .studio { flex-direction: column; height: auto; min-height: 100%; }
  .col { flex: none !important; }
  .col-original .col-body, .col-result .col-body { min-height: 46vh; }
  /* ★ 2026-09-12 — 폰에서 결과 사진이 납작한 띠로 찌그러지던 문제
     (원장 제보: "크게 보기를 누르지 않으면 거의 알아볼 수 없을 정도").
     [원인] .stage-box 가 flex:1 + min-height:0 이라, 아래 stage-extra
       (크게보기·저장·염색칩·동의·결정 버튼)가 커지면 사진 박스가 0 까지 눌린다.
       실측: 460×87px. 2×2 썸네일이 눌리던 것과 정확히 같은 원인이다.
     [곁들여] 개발자 진단 뱃지는 이 박스 안(top:52px)에 있어서 같이 잘려
       안 보였다 — 뱃지가 안 보이던 것도 이 한 가지 원인이다.
     [수정] 스택 레이아웃에서는 결과 규격(3:4)으로 고정하고 줄어들지 않게 한다.
       칸 폭이 곧 사진 폭이 되고, 아래 내용은 그만큼 밀려 스크롤된다. */
  .col-original .col-body > .stage-box,
  .col-result .col-body > .stage-box { flex: none; aspect-ratio: 3/4; min-height: 0; }
  /* 1열로 풀리면 "가운데"가 없어지므로 시선 논리가 사라진다.
     대신 실제 진행 순서(촬영 → 스타일 선택 → 결과)를 따르게 되돌린다. */
  .col-original { order: -1; }
  /* 3단이 세로로 풀리면 메뉴가 화면 전체 폭을 쓰므로 3열 그대로 두면 된다. */

  /* ★ 세로로 풀리면 메뉴 열 높이가 '내용 높이'로 바뀐다. 그런데 2×2 그리드는
     height:100% + rows:1fr 로 "열 높이를 2등분"하는 태블릿 전용 설계라, 높이가
     없으면 행이 0으로 접혀 썸네일(사진)이 사라진다(폰에서 사진 안 뜨는 원인).
     스택 레이아웃에선 자연 비율(3:4) 썸네일로 되돌리고 그리드는 내용만큼 늘린다. */
  .menu-grid.layout-2x2 { height: auto; grid-template-rows: none; grid-auto-rows: auto; }
  .col-menu .col-body > .menu-grid.layout-2x2 { flex: none; }
  .menu-grid.layout-2x2 .style-card { min-height: 0; }
  .menu-grid.layout-2x2 .style-card .thumb { aspect-ratio: 3/4; flex: none; }
  /* 1×1 도 같은 이유로 폰에서 썸네일이 0으로 접힌다(사진 안 뜸) — 자연 비율로 되돌린다. */
  .menu-grid.layout-1x1 { height: auto; align-content: start; }
  .col-menu .col-body > .menu-grid.layout-1x1 { flex: none; }
  .menu-grid.layout-1x1 .style-card { min-height: 0; }
  .menu-grid.layout-1x1 .style-card .thumb { aspect-ratio: 3/4; flex: none; }
}

/* 모바일 — 2×2 는 2열로. 단, 3×3 은 원장 의도대로 3열을 유지한다
   (손님이 한 화면에 더 많이 보길 원함). gap 을 좁혀 좁은 폭에서도 3장이 들어가게.
   (layout-* 클래스보다 나중에·같은 특이도로 둬야 이 규칙이 이긴다) */
@media (max-width: 620px) {
  .menu-grid, .menu-grid.layout-2x2 {
    grid-template-columns: repeat(2, 1fr); gap: 14px 10px; max-width: none;
  }
  .menu-grid.layout-3x3 { grid-template-columns: repeat(3, 1fr); gap: 10px 7px; max-width: none; }
  /* 3열이 좁아지면 이름·태그 글자만 살짝 줄여 뭉개짐을 막는다(썸네일은 그대로). */
  .menu-grid.layout-3x3 .style-card .name { font-size: 12px; }
  .menu-grid.layout-3x3 .style-card .tags { gap: 3px; }
  .menu-grid.layout-3x3 .style-card .tag { font-size: 9px; padding: 2px 5px; }
}

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen-head { margin-bottom: 26px; }
.screen-head h1 { font-size: clamp(24px, 3.4vh, 34px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.12; }
.screen-head p { color: var(--text-dim); margin-top: 10px; font-size: 15px; font-weight: 300; letter-spacing: -0.01em; }
/* 에디토리얼 룰 라인 + 모노 eyebrow */
.eyebrow {
  color: var(--accent); font-family: var(--mono); font-weight: 400; font-size: 11px;
  letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 9px;
  display: inline-flex; align-items: center; gap: 12px;
}
.eyebrow::before { content: ""; width: 30px; height: 1px; background: var(--accent); display: inline-block; }

/* ================= 홈 ================= */
.home-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.hero-card {
  background: var(--bg-2); padding: clamp(28px, 4vh, 46px);
  display: flex; flex-direction: column; justify-content: space-between; min-height: 340px;
  position: relative; overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; right: -80px; bottom: -80px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(78,168,255,.16), transparent 68%);
}
.hero-card h2 { font-size: clamp(24px, 3.6vh, 34px); font-weight: 800; line-height: 1.22; letter-spacing: -0.035em; }
.hero-card h2 span { color: var(--accent-2); }
.hero-card p { color: var(--text-dim); font-size: 15px; margin-top: 16px; max-width: 92%; line-height: 1.65; font-weight: 300; }
.hero-card p b { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

.stat-col { display: grid; gap: 1px; grid-template-rows: repeat(3, 1fr); background: var(--line); }
.stat-card {
  background: var(--surface); padding: 22px 24px; display: flex; align-items: center; gap: 18px;
}
.stat-card .num { font-family: var(--serif); font-size: 38px; font-weight: 400; color: var(--text); min-width: 66px; letter-spacing: -0.02em; }
.stat-card .lbl { color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.4; }
.stat-card .lbl small { display: block; color: var(--text-faint); font-size: 11px; margin-top: 4px; font-family: var(--mono); letter-spacing: .04em; font-weight: 400; }

/* 컷 단위 재생성 (A-2) — 그 썸네일만 돌고 나머지는 그대로 남는다 */
.result-strip .rs { position: relative; }
.result-strip .rs.busy img { opacity: .3; }
.rs-spin, .sb-ring {
  display: block; border: 2px solid rgba(255,255,255,.22);
  border-top-color: var(--accent-2); border-radius: 50%;
  animation: lum-spin .8s linear infinite;
}
.rs-spin { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; }
.sb-ring { width: 34px; height: 34px; margin-bottom: 10px; }
.stage-busy {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; z-index: 4;
  background: rgba(10,11,13,.62); color: var(--text); font-size: 13px; font-weight: 300;
}
@keyframes lum-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rs-spin, .sb-ring { animation: none; } }

/* 원장 모드 배지 — 지금 어느 층에 있는지 한눈에 */
.mode-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-2); border: 1px solid rgba(78,168,255,.45); padding: 4px 9px;
}
/* 손님 모드에서는 상단바가 로고만 남아 허전하지 않게 높이를 줄인다 */
#topbar:not(.owner-on) { height: 54px; }

/* ================= 스타일 카드 그리드 ================= */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 20px; }
.style-card {
  background: transparent; border: none; overflow: visible; cursor: pointer; transition: .18s ease; position: relative;
}
.style-card .thumb {
  aspect-ratio: 3/4; background: var(--surface); position: relative; overflow: hidden;
  border: 1px solid var(--line-2); transition: .18s ease;
}
.style-card:hover .thumb { border-color: var(--accent); }
.style-card.selected .thumb { border-color: var(--accent); box-shadow: var(--glow); }
/* ★ 2026-09-12 — cover 는 박스 비율이 사진 비율(3:4)과 다르면 위·아래를
   잘라낸다. 2×2 배치는 높이가 화면에 맞춰 눌리면서 박스가 3:4보다 납작해져
   머리 위·이마가 잘렸다(원장 제보 "원래 사진의 비율대로 나오게 해줘").
   contain 으로 바꾸면 박스가 어떤 비율이든 사진 전체가 항상 다 보인다
   (3:4 박스에 3:4 사진이면 cover 와 결과가 똑같아 3×3·1×1 은 그대로다). */
.style-card .thumb img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(.15) contrast(1.02); }
.style-card .thumb .front { position: absolute; inset: 0; }
/* 스타일 관리 화면에서 기본 카탈로그(읽기 전용) 표시 */
.style-card.is-builtin .thumb::after {
  content: 'BUILT-IN'; position: absolute; left: 8px; top: 8px; z-index: 3;   /* 우상단은 선택 배지 자리 */
  font-family: var(--mono); font-size: 8px; letter-spacing: .14em;
  color: var(--text-dim); background: rgba(10,11,13,.72);
  border: 1px solid rgba(255,255,255,.12); padding: 3px 6px; pointer-events: none;
}
/* ★ 영문명이 카드 높이를 흔들던 진짜 범인이다.
   "TWO BLOCK DOWN PERM" / "SHORT HIPPIE PERM" 처럼 긴 영문명만 2줄이 되고,
   그리드는 행 단위로 키를 맞추므로 그 행 전체가 통째로 늘어난다
   (태그를 한 줄로 만든 뒤에도 카드 높이가 2~3종으로 갈린 이유).
   축약하지 않고 자리를 2줄로 고정한다 — 짧은 이름도 같은 높이를 차지한다. */
.style-card .meta .name-en {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 5px; text-align: center;
  line-height: 1.25; min-height: 2.5em;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.style-card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: 30px;
  background: repeating-linear-gradient(122deg, #14171C 0 10px, #171B21 10px 20px); }
.style-card .select-badge {
  position: absolute; top: 9px; right: 9px; width: 24px; height: 24px;
  background: var(--accent); color: #04121f; display: none; place-items: center; font-weight: 800; font-size: 13px;
}
.style-card.selected .select-badge { display: grid; }
.style-card .meta { padding: 12px 2px 0; }
/* ★ 2026-09-12 — 태그 줄은 이미 가운데 정렬인데(justify-content:center,
   아래 참조) 이름만 왼쪽 정렬이라 사진 밑에서 어긋나 보였다(원장 요청). */
.style-card .meta .name { font-weight: 500; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); line-height: 1.4; text-align: center; }
.style-card .meta .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--text-dim); background: transparent; border: 1px solid var(--line-2); padding: 3px 8px; text-transform: uppercase; }

/* ★ AI 헤어 코디 — 얼굴형 추천 배지. 선택 배지(우상단)와 겹치지 않게 좌상단. */
.style-card.recommended .thumb { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.style-card .rec-flag {
  position: absolute; top: 8px; left: 8px; z-index: 4;
  font-family: var(--sans); font-weight: 700; font-size: 10.5px; letter-spacing: .02em;
  color: #04121f; background: var(--accent); padding: 4px 8px; border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap;
}
.style-card .rec-flag.r2 { background: #8fb4c4; }
.style-card .rec-reason {
  font-size: 10.5px; line-height: 1.35; color: var(--accent-2); margin-top: 7px;
}
.menu-grid.layout-3x3 .style-card .rec-flag { font-size: 9.5px; padding: 3px 6px; }
.menu-grid.layout-3x3 .style-card .rec-reason { font-size: 9.5px; }

/* ★ 태그 3개는 어떤 카드에서도 반드시 한 줄이어야 한다.
   줄바꿈이 생기면 그 카드만 키가 커져 그리드 전체가 어긋난다(9종 중 9종이 그러했다).
   폭이 모자랄 때 "줄을 바꾸는" 대신 "글자를 줄인다" — 카드 폭을 컨테이너로 삼아
   태그 크기를 카드 폭에 비례시킨다. 텍스트는 절대 축약하지 않는다
   ("고난도" 같은 정보는 원장에게 유의미하므로 ④ 축약은 쓰지 않았다).
   패딩·간격도 em 이라 글자와 함께 줄어들어 비율이 유지된다.
   카드 밖(이력·설정 모달)의 .tag 는 위 기본값 10px 그대로 둔다. */
.style-card { container-type: inline-size; }
.style-card .meta .tags {
  flex-wrap: nowrap; gap: .4em;
  font-size: clamp(6.5px, 6.0cqw, 10px);
  /* 태그 3개를 카드 폭 가운데에 모은다. 태그 폭 합은 카드마다 다른데
     (숏/미디엄, 없음/가르마펌 …) 좌측 정렬이면 그 차이가 카드마다
     오른쪽 빈칸으로 남아 3×3 에서 줄이 안 맞아 보인다. */
  justify-content: center;
}
.style-card .meta .tags .tag {
  font-size: 1em; padding: .28em .6em; white-space: nowrap; flex: 0 0 auto;
}
/* 한글 스타일명은 절대 자르지 않는다. 폭이 좁아 2줄이 되어도 자리를 미리 잡아둔다. */
.style-card .meta .name { min-height: 2.8em; }
.tag.diff { color: var(--accent-2); border-color: rgba(78,168,255,.4); }

.add-card {
  border: 1px dashed var(--line-2); background: transparent; display: grid; place-items: center;
  aspect-ratio: 3/4; cursor: pointer; color: var(--text-faint); transition: .18s;
}
.add-card:hover { border-color: var(--accent); color: var(--accent-2); }
.add-card .plus { font-size: 36px; font-weight: 200; }

/* ================= 스텝 인디케이터 ================= */
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 30px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 9px; color: var(--text-faint); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.step .dot { width: 24px; height: 24px; background: transparent; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11px; }
.step.active { color: var(--accent-2); }
.step.active .dot { background: var(--accent); color: #04121f; border-color: var(--accent); box-shadow: 0 0 16px rgba(78,168,255,.4); }
.step.done { color: var(--text-dim); }
.step.done .dot { border-color: var(--ok); color: var(--ok); }
.step-sep { flex: 0 0 24px; height: 1px; background: var(--line-2); }

/* ================= 동의 화면 ================= */
.consent-wrap { max-width: 880px; margin: 0 auto; }
.consent-box { background: var(--surface); border: 1px solid var(--line-2); padding: clamp(24px, 3.4vh, 36px); }
.consent-table { width: 100%; border-collapse: collapse; margin: 2px 0 14px; }
/* 5행이 모달 높이를 다 먹는다. 내용은 유지하고 행간·패딩만 줄인다. */
.consent-table td { padding: 8px 11px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.45; vertical-align: top; }
.consent-table tr:first-child td { border-top: 1px solid var(--line); }
.consent-table td:first-child { color: var(--accent-2); font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; width: 118px; white-space: nowrap; padding-top: 10px; }
.consent-table td:last-child { color: var(--text); font-weight: 300; }
.consent-table td:last-child b { font-weight: 600; color: var(--text); }
.check-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px;
  background: var(--bg-2); border: 1px solid var(--line); margin-top: 9px; cursor: pointer; transition: .15s;
}
.check-row:hover { border-color: var(--line-2); }
.check-row.checked { border-color: var(--accent); background: var(--accent-dim); }
.check-row .box {
  flex: 0 0 22px; width: 22px; height: 22px; border: 1px solid var(--text-faint);
  display: grid; place-items: center; font-size: 15px; color: transparent; margin-top: 1px; transition: .15s;
}
.check-row.checked .box { background: var(--accent); border-color: var(--accent); color: #04121f; }
.check-row .ctext { font-size: 13.5px; line-height: 1.5; font-weight: 300; }
.check-row .ctext b { color: var(--accent-2); font-weight: 600; }
.check-row .req { color: var(--danger); font-size: 10px; font-weight: 700; font-family: var(--mono); letter-spacing: .1em; margin-left: 6px; vertical-align: middle; }
.minor-toggle { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal > .minor-toggle.modal-fixed .check-row:first-child { margin-top: 0; }

.form-row { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.field { flex: 1 1 200px; }
.field label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
  padding: 13px 14px; font-size: 15px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.action-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; gap: 14px; }
.action-bar .spacer { flex: 1; }

/* ================= 촬영 화면 ================= */
.capture-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 26px; align-items: start; }
.cam-stage {
  background: #000; border: 1px solid var(--line-2); overflow: hidden;
  aspect-ratio: 4/3; position: relative; display: grid; place-items: center;
}
.cam-stage video, .cam-stage img { width: 100%; height: 100%; object-fit: cover; }
.cam-stage video { transform: scaleX(-1); }
/* 가이드 타원 — 크기·위치는 js/preprocess.js 의 GUIDE 에서 인라인으로 주입된다.
   크롭 좌표와 같은 값을 써야 하므로 여기에 수치를 적지 않는다. */
.cam-guide { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cam-guide .oval {
  position: absolute; border: 2px dashed rgba(78,168,255,.75); border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(6,8,11,.34);   /* 타원 밖을 어둡게 — 어디에 맞출지 즉시 보인다 */
}
.cam-guide .guide-hint {
  position: absolute; left: 0; right: 0; bottom: 12%; text-align: center;
  font-size: 13px; font-weight: 300; color: var(--text); line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
}
.cam-guide .guide-hint b { color: var(--accent-2); font-weight: 700; }
.cam-guide .guide-hint span { font-size: 11px; color: var(--text-dim); }

/* 실제로 저장될 범위 (㉖). 바깥은 잘려나간다 — 옆자리 손님이 여기 걸리면
   그대로 API 로 나가므로, 촬영 순간에 눈으로 확인할 수 있어야 한다.
   좌표는 js/preprocess.js 의 cropRect() 가 인라인으로 주입한다. */
.cam-crop {
  position: absolute; border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 0 0 9999px rgba(6,8,11,.5);
}

/* 자동 촬영 카운트다운 — 숫자가 뜨는 순간은 "이제 진짜로 찍는다" 는 뜻이다.
   안정 확인 중(잠시만요)에는 이 요소가 hidden 이라 아무것도 뜨지 않는다. */
.cam-count {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: clamp(72px, 26vh, 190px); font-weight: 200; line-height: 1;
  color: #fff; text-shadow: 0 4px 30px rgba(0,0,0,.85);
  animation: cam-count-pop .45s ease-out;
}
@keyframes cam-count-pop {
  from { transform: scale(1.35); opacity: .25; }
  to   { transform: scale(1);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .cam-count { animation: none; } }

/* 촬영 품질 상태 — 셔터가 잠긴 이유를 손님 앞에서 바로 읽을 수 있어야 한다 */
.cam-status {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4;   /* 상단은 코너 태그 자리 */
  padding: 9px 12px; font-size: 12.5px; font-weight: 500; line-height: 1.5;
  text-align: center; backdrop-filter: blur(6px);
}
.cam-status.ok { color: var(--ok); background: rgba(10,11,13,.7); border: 1px solid rgba(52,224,176,.45); }
.cam-status.warn { color: #FFD9A0; background: rgba(38,20,8,.78); border: 1px solid rgba(255,170,80,.5); }
.cam-empty { color: var(--text-faint); text-align: center; padding: 30px; background: repeating-linear-gradient(122deg, #101316 0 11px, #14171C 11px 22px); position:absolute; inset:0; display:grid; place-items:center; align-content:center; }
.cam-empty .ico { font-size: 44px; margin-bottom: 12px; opacity: .7; }
.capture-side { display: flex; flex-direction: column; gap: 16px; }
.hint-box { background: var(--surface); border: 1px solid var(--line); padding: 20px 22px; }
.hint-box h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 14px; color: var(--accent-2); }
.hint-box ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.hint-box li { font-size: 14px; color: var(--text-dim); padding-left: 22px; position: relative; line-height: 1.4; font-weight: 300; }
.hint-box li::before { content: "—"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.file-drop { border: 1px dashed var(--line-2); padding: 20px; text-align: center; color: var(--text-faint); font-size: 13px; font-family: var(--mono); letter-spacing: .04em; }

/* ================= 생성 로딩 ================= */
.gen-loading { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.spinner { width: 58px; height: 58px; border: 1px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 26px; box-shadow: 0 0 30px rgba(78,168,255,.25); }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-loading h2 { font-size: 22px; margin-bottom: 10px; font-weight: 700; letter-spacing: -0.03em; }
.gen-loading p { color: var(--text-dim); font-weight: 300; }
.gen-progress { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.gen-progress .pline { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--text-faint); }
.gen-progress .pline.active { color: var(--accent-2); }

/* ================= 결과 비교 ================= */
.result-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.compare-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.compare-item { display: flex; flex-direction: column; gap: 12px; }
.compare-item .label { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.compare-item.original .label { color: var(--text-faint); }
.result-frame {
  background: var(--surface); border: 1px solid var(--line-2); overflow: hidden; position: relative; cursor: pointer; transition: .18s;
}
.result-frame:hover { border-color: var(--accent); }
.result-frame.pick { border-color: var(--accent); box-shadow: var(--glow); }
.result-frame canvas, .result-frame img { width: 100%; display: block; }
.result-frame .pick-badge {
  position: absolute; top: 10px; left: 10px; background: var(--accent); color: #04121f;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; padding: 5px 11px; display: none; text-transform: uppercase;
}
.result-frame.pick .pick-badge { display: block; }
.result-caption { font-size: 13px; color: var(--text-dim); text-align: center; font-weight: 300; }
.result-caption b { color: var(--text); font-weight: 500; }

.confirm-banner { margin-top: 30px; background: var(--surface); border: 1px solid var(--line-2); padding: 24px 26px; }
.confirm-banner .warn { color: var(--accent-2); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }

/* ================= 완료 ================= */
.done-wrap { max-width: 660px; margin: 7vh auto 0; text-align: center; }
.done-icon { width: 78px; height: 78px; border: 1px solid var(--ok); color: var(--ok); display: grid; place-items: center; font-size: 38px; margin: 0 auto 26px; box-shadow: 0 0 30px rgba(52,224,176,.2); }
.done-wrap h1 { font-size: 30px; margin-bottom: 14px; font-weight: 800; letter-spacing: -0.035em; }
.done-wrap p { color: var(--text-dim); font-size: 16px; line-height: 1.65; font-weight: 300; }
.done-wrap p b { color: var(--accent-2); }
.purge-note { margin-top: 24px; background: var(--bg-2); border: 1px solid var(--line); padding: 16px 20px; font-size: 13.5px; color: var(--text-dim); font-weight: 300; line-height: 1.55; }
.purge-note b { color: var(--ok); font-weight: 600; }
/* 지점 표시 — 이 링크가 어느 지점인지 원장이 한눈에 확인 */
.shop-tag { padding: 11px 14px; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent-2); font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.shop-tag span { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--text-dim); letter-spacing: .04em; }

/* ================= 모달 ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5,6,8,.72); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; animation: fade .2s; padding: 20px; }

/* 미니 카메라 오버레이 (대표 모델 촬영 — 진짜 카메라) */
.cam-overlay { position: fixed; inset: 0; background: rgba(5,6,8,.94); z-index: 200; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.cam-box { width: min(460px, 100%); display: flex; flex-direction: column; gap: 14px; }
.cam-box video { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #000; border: 1px solid rgba(255,255,255,.14); transform: scaleX(-1); }
.cam-actions { display: flex; gap: 10px; justify-content: center; }
.cam-actions .primary-btn, .cam-actions .ghost-btn { min-width: 130px; }

/* ★ 모달 3단 고정 — [헤더][본문(여기만 스크롤)][고정][푸터]
   예전엔 모달 전체가 하나의 스크롤 박스여서 버튼이 본문 맨 끝에 매달려 있었다.
   배율 100% 에서 [동의하고 촬영] 이 화면 밖으로 나가 손님 앞에서 진행이 막혔다.
   이제 배율·화면 높이와 무관하게 버튼은 항상 보인다.
   dvh 를 쓰는 이유 — 모바일 브라우저 주소창이 접혔다 펴지며 vh 가 흔들린다. */
.modal {
  background: var(--surface); border: 1px solid var(--line-2);
  width: min(580px, 100%); max-height: 90dvh;
  display: flex; flex-direction: column; position: relative;
  overflow: hidden; padding: 0; box-shadow: var(--shadow);
}
.modal-head { flex: 0 0 auto; padding: 26px 30px 12px; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 30px 18px; overscroll-behavior: contain; }
.modal > .modal-fixed { flex: 0 0 auto; padding: 14px 30px; border-top: 1px solid var(--line); background: var(--bg-2); margin: 0; }
.modal .modal-actions {
  flex: 0 0 auto; margin: 0; padding: 15px 30px;
  border-top: 1px solid var(--line-2);
  background: var(--surface);            /* 불투명 필수 — 뒤로 본문이 비치면 안 된다 */
  align-items: center;
}
/* 헤더가 없는 모달(완료 화면 등)은 본문 위쪽 여백을 되살린다 */
.modal > .modal-body:first-child { padding-top: 26px; }

/* 아래에 내용이 더 있다는 신호. 스크롤 가능한 걸 모르면 버튼이 사라진 것과 같다. */
.scroll-fade {
  position: absolute; left: 1px; right: 1px; height: 34px;
  bottom: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(transparent, var(--surface));
}
.modal.has-more .scroll-fade { opacity: 1; }
.modal.has-more .modal-body { scrollbar-color: var(--line-2) transparent; }

/* 비활성 버튼의 이유 */
.act-hint { flex: 1; font-size: 12.5px; color: var(--accent-2); font-weight: 500; text-align: left; }
.act-hint[hidden] { display: none; }

.modal h2 { font-size: 21px; margin-bottom: 6px; font-weight: 700; letter-spacing: -0.03em; }

/* 결과 크게 보기 — 손님에게 보여주는 화면이라 이미지를 최대한 키우고
   장식은 최소로. 여러 장 생성했으면 ‹ › 로 넘긴다. */
.lightbox { padding: clamp(12px, 3vh, 28px); }
.lb-wrap { width: min(720px, 100%); display: flex; flex-direction: column; gap: 12px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.lb-name { font-size: 14px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.lb-head .tool-btn, .lb-foot .tool-btn { flex: 0 0 auto; }
.lb-stage { position: relative; display: grid; place-items: center; background: #d7dbe0; border: 1px solid var(--line-2); }
.lb-stage img { display: block; max-width: 100%; max-height: 72vh; }
/* 단일/비교 뷰 컨테이너. 비교는 원본|결과 두 칸을 나란히(항상 좌우로 고정).
   ★ !important 로 못박는다 — 어떤 화면폭·어떤 캐시에서도 절대 세로로 쌓이지 않게. */
.lb-view { display: flex !important; flex-direction: row !important; width: 100%; }
.lb-view.is-compare { flex-direction: row !important; flex-wrap: nowrap !important; align-items: stretch; }
.lb-view .lb-pane { position: relative; flex: 1 1 0; min-width: 0; margin: 0; display: grid; place-items: center; }
.lb-view.is-compare .lb-pane { flex: 1 1 50% !important; width: 50% !important; max-width: 50% !important; }
.lb-view.is-compare .lb-pane img { max-height: 62vh; width: 100%; object-fit: contain; }
.lb-view.is-compare .lb-pane + .lb-pane { border-left: 2px solid var(--bg); }
/* 모바일: 원본|결과가 반드시 한 화면에 좌우로 다 보이도록 높이를 더 조인다
   (세로로 넘쳐 스크롤이 생기면 손님은 '상하 비교'로 오해한다). */
@media (max-width: 620px) {
  .lb-view.is-compare .lb-pane img { max-height: 46vh; }
}
.lb-pane figcaption {
  position: absolute; left: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(10,11,13,.72); border: 1px solid var(--line-2); color: var(--text-dim);
  padding: 5px 9px; pointer-events: none;
}
.lb-pane figcaption.res { border-color: var(--accent); color: var(--accent-2); }

/* 라이트박스 염색 비교 — 커트만 + 염색색깔들을 크게 옆으로 넘겨보며 비교.
   결과칸 .dye-strip(절대배치)과 섞이지 않게 .lb-strip 을 따로 둔다. */
.lb-view.is-strip { display: block; width: 100%; }
.lb-strip { display: flex; gap: 8px; overflow-x: auto; width: 100%; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.lb-strip .dcp { flex: 0 0 86%; position: relative; margin: 0; display: grid; place-items: center; scroll-snap-align: center; }
.lb-strip .dcp img { max-height: 72vh; width: 100%; object-fit: contain; display: block; }
.lb-strip .dcp figcaption {
  position: absolute; left: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  background: rgba(10,11,13,.72); border: 1px solid var(--line-2); color: var(--text);
  padding: 5px 10px; pointer-events: none;
}
.lb-strip .dcp:not(:first-child) figcaption { border-color: var(--accent); color: var(--accent-2); }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 62px; font-size: 24px; line-height: 1; font-weight: 400;
  background: rgba(10,11,13,.66); border: 1px solid var(--line-2); color: var(--text);
}
.lb-nav:hover { border-color: var(--accent); color: var(--accent-2); background: rgba(10,11,13,.86); }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.lb-btns { display: flex; gap: 8px; }
/* 지금 보고 있는 것이 원본인지 결과인지 — 비교 전환 중 헷갈리지 않게 못박는다 */
.lb-badge {
  position: absolute; left: 12px; bottom: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(10,11,13,.72); border: 1px solid var(--accent); color: var(--accent-2);
  padding: 6px 11px; pointer-events: none;
}
.lb-badge.orig { border-color: var(--line-2); color: var(--text-dim); }
.modal .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 4px; font-weight: 300; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* 손님 조건 (㉓ 새치 · ㉔ 아동) — 프롬프트의 조건문을 코드 분기로 옮기면서
   원장이 직접 고르게 된 값들. 촬영 칸 바로 아래에 둔다. */
.cust-conds { margin-bottom: 10px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); }
.cust-conds .cc-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cust-conds .cc-label { font-size: 11px; color: var(--text-faint); width: 30px; flex: none; letter-spacing: .04em; }
.cust-conds .cc-opt {
  flex: 1; font-size: 12px; padding: 7px 6px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--text-dim);
}
.cust-conds .cc-opt.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); font-weight: 700; }
.cust-conds .cc-zones { flex-wrap: wrap; }
.cust-conds .cc-zones .cc-opt { flex: 0 0 auto; padding: 6px 9px; font-size: 11px; }
.cust-conds .cc-note { font-size: 11px; line-height: 1.5; color: var(--text-faint); margin-top: 2px; }
.cust-conds .cc-note b { color: var(--text-dim); }
/* 잠긴 선택지 — 있다는 건 보이되 누를 수 없다는 게 한눈에 읽혀야 한다.
   (숨기면 "없는 기능", 잠그면 "곧 되는 기능" 으로 읽힌다) */
.cust-conds .cc-opt[disabled] { opacity: .4; cursor: not-allowed; }
.cust-conds .cc-opt[disabled]:hover { background: var(--bg); }
.cust-conds .cc-why { font-size: 10px; color: var(--text-faint); flex: none; letter-spacing: .04em; }
/* 성별은 손님 조건이 아니라 카드 목록의 머리다 — 아래 여백만 조금 더 준다 */
.gender-pick { margin-bottom: 12px; }
/* 잠긴 전면 노출 버튼 (여성 내장 카드) */
.sm-tools .tool-btn[disabled] { opacity: .45; cursor: not-allowed; }

.tag-opt { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 8px 13px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-dim); cursor: pointer; }
.tag-opt.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); }

/* AI 자동 분석 (등록 화면) */
.ai-analyze { }
.ai-note { color: var(--text-dim); font-size: 12px; font-weight: 300; line-height: 1.5; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; padding: 5px 10px; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent-2); border-radius: 999px; }

/* ---- 구조 칩 직접 고치기 (2026-09-09) ------------------------------
   자동 판독은 완벽해지지 않는다. 그런데 그 머리를 직접 자른 원장은 정답을
   이미 알고 있다. 칩 자체를 native select 로 만들어 태블릿에서 탭 한 번에
   OS 기본 선택기가 뜨게 한다 — 드롭다운을 직접 그리면 모달 안에서 잘린다. */
.mz-axis { display: inline-flex; align-items: center; gap: 4px; }
.mz-axis > .mz-axis-name { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--text-faint); }
.mz-axis > select {
  font-family: var(--mono); font-size: 11px; letter-spacing: .02em; padding: 5px 22px 5px 10px;
  background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent-2);
  border-radius: 999px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 10px center, right 6px center; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.mz-axis > select:focus { outline: 1px solid var(--accent-2); outline-offset: 1px; }
/* 원장이 직접 고친 축 — 자동 재판독이 덮지 않는다는 걸 눈으로 알린다. */
.mz-axis.locked > select { background-color: var(--accent); color: #fff; border-color: var(--accent-2); font-weight: 600; }
.mz-axis > .mz-unlock { border: 0; background: none; color: var(--text-faint); cursor: pointer; font-size: 11px; padding: 0 2px; line-height: 1; }
.mz-conflict { color: #c0392b; }
/* 저장공간 막대 — %는 실측이다(probeFreeBytes). 한도에 닿으면 사진이 통째로
   안 저장되므로, 눈에 띄어야 하고 무엇을 해야 하는지까지 적는다. */
.sm-storebar { margin: 6px 0 4px; font-size: 12px; }
.sm-storebar .track { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.sm-storebar .fill { height: 100%; background: var(--accent); transition: width .3s; }
.sm-storebar.warn .fill { background: #e0a030; }
.sm-storebar.crit .fill { background: #c0392b; }
.sm-storebar .txt { margin-top: 5px; color: var(--text-dim); line-height: 1.6; }
.sm-storebar .msg { margin-top: 5px; line-height: 1.6; }
.sm-storebar.warn .msg { color: #e0a030; }
.sm-storebar.crit .msg { color: #c0392b; }
.sm-storebar .msg.dim { color: var(--text-faint); font-size: 11px; }

/* 복원 화면 — 넣기 전에 무엇이 들었는지 먼저 보여준다. */
.imp-box { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 12px; line-height: 1.9; }
.imp-box > div:first-child { margin-bottom: 4px; color: var(--accent-2); }
.imp-opt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 12px; }
.imp-opt input { margin-top: 3px; flex: none; }
.imp-opt em { display: block; font-style: normal; color: var(--text-faint); font-size: 11px; margin-top: 1px; }

/* 다른 저장 공간(?shop=) 에 카드가 있을 때 — 지워진 게 아님을 먼저 말한다. */
.sm-salon-find { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--accent); background: var(--accent-dim); border-radius: 8px; font-size: 12px; line-height: 1.7; }
.sm-salon-find > b { display: block; margin-bottom: 4px; color: var(--accent-2); }
.sm-salon-find .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sm-salon-find .hint { margin-top: 8px; color: var(--text-dim); font-size: 11px; }
.sm-salon-find code { font-family: var(--mono); }

/* 촬영 가이드 — 등록 시점에 조건을 알려준다(합성이 실패한 뒤가 아니라). */
.mz-guide { margin-top: 8px; padding: 8px 10px; border-left: 2px solid var(--accent); background: var(--accent-dim); border-radius: 0 6px 6px 0; }
.mz-guide b { display: block; margin-bottom: 4px; }
.mz-guide span { display: block; line-height: 1.6; }

.sm-store { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--text-dim); margin: 4px 0 10px; }
.sm-store .warn { color: var(--accent-2); }

.thumb-upload { aspect-ratio: 3/4; border: 1px dashed var(--line-2); display: grid; place-items: center; cursor: pointer; overflow: hidden; color: var(--text-faint); position: relative; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.thumb-upload img { width: 100%; height: 100%; object-fit: cover; }
.thumb-upload:hover { border-color: var(--accent); }

/* ---- 사진 등록 칸 (촬영 / 갤러리) ----
   예전엔 128px 짜리 칸을 옆에 붙여놨는데, 그 크기로는 올린 사진이 쓸 만한지
   판단이 안 된다(헤어 레퍼런스라 실루엣을 봐야 한다). 사진을 위로 올려
   크게 키우고 입력칸을 아래로 내린다. */
.shot { display: flex; flex-direction: column; gap: 8px; }
.shot-label { text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--text-faint); }
.shot-label .opt { font-size: 9px; letter-spacing: .06em; opacity: .8; border: 1px solid var(--line); padding: 1px 5px; margin-left: 3px; }
.shot-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.shot-btns .tool-btn { flex: 1 1 calc(50% - 3px); padding: 11px 6px; font-size: 11px; letter-spacing: .06em; }
.shot-btns .shot-clear { flex: 1 1 100%; }
/* 빈 칸에는 무엇을 눌러야 하는지 적어준다 — 박스 자체는 클릭에 반응하지 않는다 */
.thumb-upload .ph-guide { display: block; line-height: 1.7; font-size: 13px; color: var(--text-dim); letter-spacing: .06em; }
.thumb-upload .ph-guide em { display: block; font-style: normal; font-size: 10px; color: var(--text-faint); letter-spacing: .04em; margin-top: 4px; }
.thumb-upload { cursor: default; }        /* 클릭 대상이 아니다 */
.thumb-upload:hover { border-color: var(--line-2); }

/* 카드 등록/수정 모달 상단 — 정면 · 측면을 크게, 입력칸은 아래 전체 폭 */
/* 1행 = 정면·측면 사진(각 최대 225px), 3열째는 비워 사진이 과하게 늘어나지 않게 한다.
   2행 = 입력칸이 전체 폭을 쓴다. */
.card-form-top {
  display: grid; grid-template-columns: minmax(0, 225px) minmax(0, 225px) 1fr;
  gap: 18px; margin-top: 14px;
}
.card-form-fields { grid-column: 1 / -1; }
@media (max-width: 620px) {
  .card-form-top { grid-template-columns: 1fr 1fr; gap: 12px; }
  .shot-btns .tool-btn { flex: 1 1 100%; }
}

/* ================= 스타일 카드 관리 ================= */
.sm-modal { width: min(940px, 100%); }
.sm-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 18px; background: var(--bg-2); border: 1px solid var(--line);
}
.sm-layout { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sm-layout label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.sm-hint { flex-basis: 100%; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; margin-top: 2px; }
.sm-hint:empty { display: none; }
.sm-hint b { color: var(--accent-2); font-weight: 600; }
.seg { display: flex; }
.seg button {
  background: transparent; border: 1px solid var(--line-2); color: var(--text-dim);
  padding: 9px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; font-weight: 400;
}
.seg button + button { margin-left: -1px; }          /* 테두리 겹쳐 한 덩어리로 */
.seg button:hover { color: var(--text); border-color: var(--line-2); }
.seg button.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); z-index: 1; }
.sm-count { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--text-dim); }
.sm-count b { color: var(--accent-2); font-size: 13px; }
/* 스타일 관리 진입 시 남/여 탭 — 성별을 먼저 고르고 그 성별 카드만 관리한다 */
.seg-gender { margin-bottom: 8px; }
.seg-gender button { flex: 1 1 0; padding: 12px 14px; font-size: 14px; letter-spacing: .04em; font-family: var(--sans, inherit); font-weight: 600; }
.sm-sub { color: var(--text-dim); font-size: 12.5px; font-weight: 300; line-height: 1.5; margin-bottom: 14px; }
.sm-sub b { color: var(--text); font-weight: 500; }
/* 카테고리 분류 칩 — 17종이 한꺼번에 안 쏟아지게 분류로 들어간다 */
.sm-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cat-chip { background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-dim); padding: 7px 13px; font-size: 12.5px; letter-spacing: .01em; cursor: pointer; border-radius: 999px; }
.cat-chip span { opacity: .55; font-size: 11px; margin-left: 1px; }
.cat-chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); }
.cat-chip:hover { border-color: var(--line-2); color: var(--text); }
.sm-restore { font-size: 12px; color: var(--text-dim); margin: -6px 0 14px; }
.sm-restore:empty { display: none; }
.sm-restore b { color: var(--text); }
.sm-restore button { background: none; border: none; color: var(--accent-2); cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0; }
.sm-count .warn { color: var(--danger); }

.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 22px 14px; }
/* 폰에선 minmax(148) 이 경계에 걸려 1열로 떨어진다 → 2열 고정.
   관리 카드는 버튼(전면 노출·모델화·삭제)이 붙어 3열은 뭉개지므로 2열이 맞다. */
@media (max-width: 620px) {
  .sm-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 10px; }
  .sm-tools .tool-btn { font-size: 9px; padding: 6px 4px; letter-spacing: .02em; }
}
.sm-item { display: flex; flex-direction: column; gap: 9px; }
.sm-item .style-card .meta { padding-top: 10px; }
.sm-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.sm-tools .tool-btn { flex: 1 1 auto; padding: 7px 5px; font-size: 9.5px; letter-spacing: .05em; }
.sm-tools .tool-btn.feat { flex: 1 1 100%; }
.sm-tools .tool-btn.feat.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); }
.sm-tools .tool-btn.danger { color: var(--danger); border-color: rgba(255,90,110,.3); }
.sm-tools .tool-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ================= 이력 · 폐기율 통계 ================= */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat-row .sbox { background: var(--bg-2); padding: 16px 12px; text-align: center; }
.stat-row .sbox .n { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.stat-row .sbox .l { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-top: 6px; }
/* 폐기율이 높으면 눈에 띄어야 한다. 목표치는 실측 후 정하므로 지금은 관측용 경고선만. */
.stat-row .sbox.warn .n { color: var(--danger); }
@media (max-width: 560px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* ================= 하단 고지 ================= */
#disclaimer-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 12px clamp(20px,2.6vw,36px); font-size: 12.5px; color: var(--text-dim); font-weight: 300;
  background: var(--bg-2); border-top: 1px solid var(--line);
}
#disclaimer-bar .disc-icon { color: var(--accent); font-size: 14px; }
#disclaimer-bar b { color: var(--accent-2); font-weight: 600; }

/* 빈 상태 */
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-faint); font-weight: 300; }
.empty-state .ico { font-size: 44px; margin-bottom: 16px; opacity: .6; }

/* 유틸 */
.muted { color: var(--text-faint); font-size: 12px; font-family: var(--mono); letter-spacing: .04em; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.demo-flag { font-family: var(--mono); font-size: 9.5px; font-weight: 400; letter-spacing: .12em; color: var(--accent-2); background: transparent; border: 1px solid rgba(78,168,255,.4); padding: 3px 8px; text-transform: uppercase; }
[hidden] { display: none !important; }

/* 태블릿 세로/작은 화면 */
@media (max-width: 820px) {
  .home-grid, .capture-grid { grid-template-columns: 1fr; }
  .brand-text em { display: none; }
}

/* ================= 이력 — 건별 수동 판정 ================= */
/* 실패 판정을 눈으로만 하면 배치마다 기준이 흔들린다. 클릭으로 남겨
   temperature 조정 전후를 같은 잣대로 비교할 수 있게 한다. */
.log-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.log-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center;
  padding: 9px 11px; background: var(--bg-2); border: 1px solid var(--line); }
.log-row.judged.ok { border-color: rgba(52,224,176,.4); }
.log-row.judged.fail { border-color: rgba(255,90,110,.45); }
.log-row .lr-main b { font-size: 13px; font-weight: 600; }
.log-row .lr-meta { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .04em; color: var(--text-faint); margin-top: 3px; }
.log-row .lr-btns { display: flex; gap: 4px; }
.log-row .lr-btns .tool-btn { flex: none; padding: 6px 9px; font-size: 10px; }
.log-row .lr-btns .tool-btn.on { border-color: var(--accent); color: var(--accent-2); background: var(--accent-dim); }
.log-row .lr-btns .tool-btn.on.danger { border-color: var(--danger); color: var(--danger); background: rgba(255,90,110,.12); }
.log-row .lr-reasons { grid-column: 1 / -1; display: flex; gap: 5px; flex-wrap: wrap; padding-top: 2px; }
.log-row .lr-reasons .tag-opt { padding: 5px 10px; font-size: 10px; }

/* ================= 반복 실패 안내 · 최근 오류 ================= */
/* 1회 실패와 시각적으로 구분돼야 한다 — 같은 회색 박스면 원장이 차이를 못 읽는다 */
.fail-escalate { gap: 0; }
.fail-escalate .fe-title { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin-top: 6px; }
.fail-escalate .fe-why { margin-top: 10px; color: var(--danger); font-size: 14px; font-weight: 600; }
.fail-escalate .fe-cta { margin-top: 20px; }
.fail-escalate .fe-code {
  margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap;
}
.fail-escalate .fe-code > span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint);
}
.fail-escalate code, .err-row code {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--accent-2);
  background: var(--surface); border: 1px solid var(--line-2); padding: 6px 10px; user-select: all;
}
.fail-escalate .muted { margin-top: 14px; }

/* 상단바 — 최근 오류가 있으면 눈에 띄게 */
#navErrors.has-error { color: var(--danger); border-color: rgba(255,90,110,.45); }
#navErrors.has-error::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px;
  background: var(--danger); vertical-align: middle;
}

/* 최근 오류 목록 */
.err-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; }
.err-row { border: 1px solid var(--line); border-left: 2px solid var(--steel); padding: 13px 15px; background: var(--surface); }
.err-row.need-support { border-left-color: var(--danger); }
.err-row .er-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.err-row .er-when { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--text-faint); }
.err-row .er-tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; padding: 3px 8px;
  border: 1px solid var(--line-2); color: var(--text-dim);
}
.err-row.need-support .er-tag { color: var(--danger); border-color: rgba(255,90,110,.4); }
.err-row .er-ko { margin-top: 9px; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.err-row .er-meta { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-dim); }
.err-row .er-copy { padding: 5px 10px; font-size: 11px; }
.err-row .er-detail {
  margin-top: 10px; font-family: var(--mono); font-size: 10.5px; line-height: 1.6; color: var(--text-faint);
  background: var(--bg-2); border: 1px solid var(--line); padding: 9px 11px; word-break: break-all;
}


/* 만들기 버튼 — 잠그지 않고 '아직 준비 안 됨' 만 표시한다.
   disabled 로 잠그면 왜 안 되는지 알 수 없고 터치 문제와 구분도 안 된다. */
.primary-btn.is-off { opacity: .55; }


/* ================= 모바일: [만들기] 를 화면 하단에 고정 =================
   ★ 2026-08-05 — '만들기가 아예 안 눌러진다' 는 제보의 실제 원인.
     모바일에서 세 칸이 세로로 쌓이면서 이 버튼이 화면 밖 아래로 밀렸다.
     헤드리스 실측: 390x844 화면에서 버튼 위치 y=1368 (화면 높이의 1.6배 아래),
     360x640 에서 y=1223. 눌리지 않은 게 아니라 닿을 수 없었다.
     손님 앞에서 쓰는 도구라 이 버튼은 항상 손 닿는 곳에 있어야 한다. */
@media (max-width: 1000px) {
  .col-menu .col-foot {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--bg-2); border-top: 1px solid var(--line-2);
    box-shadow: 0 -6px 18px rgba(0,0,0,.35);
    padding-bottom: calc(clamp(11px,1.8vh,16px) + env(safe-area-inset-bottom, 0px));
  }
  /* ★ 2026-09-11 — "사진을 먼저 촬영" 같은 상태 문구가 좁은 버튼 폭에서
     두 줄로 줄바꿈됐다. 글자 크기를 줄이고 좌우 패딩을 좁혀 한 줄에 담고,
     그래도 넘치면(초소형 화면) nowrap 으로 버튼이 늘어나게 한다. */
  .col-menu .col-foot .gen-cta {
    min-width: 44%; min-height: 48px;
    font-size: 13px; padding-left: 14px; padding-right: 14px; white-space: nowrap;
  }
  /* 고정 바가 마지막 내용을 가리지 않도록 아래 여백을 준다 */
  #app { padding-bottom: 84px; }
}

/* 무엇이 부족해 생성이 안 되는지 상시 표시 — 토스트는 놓치기 쉽다. */
.col-foot .gen-need { color: var(--accent-2); font-weight: 600; margin-top: 3px; }
.col-foot .gen-need:empty { display: none; }
