:root {
  --accent: #b23a55;
  --fg-on-dark: #ffffff;
  --muted-on-dark: rgba(255, 255, 255, 0.78);
  --glass: rgba(18, 14, 15, 0.55);
  --glass-strong: rgba(18, 14, 15, 0.78);
  --line-on-dark: rgba(255, 255, 255, 0.28);
  --stage-bg: #141011;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  /* v18: 카메라 화면(첫 화면 높이 고정) 아래로 상세 영역을 세로 스크롤. 가로 스크롤은 막음 */
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #000;
  color: var(--fg-on-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* 첫 화면 전체를 카메라로 채움 (v18: 고정 위치 대신 문서 흐름 안의 화면 높이 상자 → 아래로 스크롤 가능).
   카메라 상자 크기는 이전과 같다 (보이는 화면 높이). 조작 UI는 영상 위에 겹쳐 놓는다. */
.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  background: var(--stage-bg);
}

/* video는 화면에 직접 보이지 않고 canvas에 그려진다.
   display:none 은 일부 브라우저에서 프레임 갱신이 멈출 수 있어 투명 처리로 둔다. */
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}
#canvas,
#outlineCanvas,
#skinMapCanvas,
#checkCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#outlineCanvas, #skinMapCanvas, #checkCanvas { pointer-events: none; }
#skinMapCanvas[hidden], #outlineCanvas[hidden], #checkCanvas[hidden] { display: none; }
/* WebGL 을 쓸 수 없는 기기: 카메라 원본(video)을 거울 반전으로 직접 표시 (메이크업 없음) */
.stage.no-gl #video { opacity: 1; transform: scaleX(-1); }
.stage.no-gl.fit-contain #video { object-fit: contain; }
.stage.no-gl #canvas { visibility: hidden; }

/* 로딩·오류 안내 (하단 조작 영역보다 아래 층 → 카메라 버튼은 항상 누를 수 있음) */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 86px 200px; /* 왼쪽 부위 메뉴와 겹치지 않게 좌우 여백 */
  text-align: center;
  background: rgba(16, 12, 13, 0.55);
}
.overlay.hidden { display: none; }
.message { margin: 0; font-size: 15px; line-height: 1.6; white-space: pre-line; max-width: 420px; }

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

/* ── 상단 ── */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 14px) 10px calc(var(--safe-left) + 14px);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.topbar button { pointer-events: auto; }
.topbar-row { display: flex; align-items: center; gap: 8px; }
.brand { font-weight: 700; letter-spacing: 0.14em; font-size: 14px; }
.badge {
  font-size: 11px;
  color: var(--muted-on-dark);
  border: 1px solid var(--line-on-dark);
  border-radius: 999px;
  padding: 1px 8px;
}
.notice {
  margin: 4px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted-on-dark);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.stage-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 13px;
  text-align: center;
}

.info-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  background: var(--glass);
  color: #fff;
  font: italic 700 16px Georgia, "Times New Roman", serif;
}
.info-sheet {
  position: absolute;
  z-index: 20;
  top: calc(var(--safe-top) + 50px);
  left: calc(var(--safe-left) + 12px);
  right: calc(var(--safe-right) + 12px);
  max-width: 460px;
  margin: 0 auto;
  max-height: 55%;
  overflow: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #2a2224;
  font-size: 13px;
  line-height: 1.65;
}
.info-sheet h2 { margin: 0 0 6px; font-size: 15px; }
.info-sheet p { margin: 0 0 8px; }
.info-sheet .pill.light { width: 100%; border-color: #ddd; background: #f3eeee; }

.debug-btn {
  margin-left: auto;
  pointer-events: auto;
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-on-dark);
  border: 1px dashed var(--line-on-dark);
}

/* ── 왼쪽 부위 메뉴 ── */
.area-menu {
  position: absolute;
  z-index: 9;
  left: calc(var(--safe-left) + 6px);
  top: calc(var(--safe-top) + 56px);
  bottom: calc(var(--dock-h, 200px) + 6px);
  width: 72px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 14px;
  background: var(--glass);
}
.area-menu::-webkit-scrollbar { display: none; }
.area-btn {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 2px 5px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-on-dark);
  font-size: 9.5px;
  line-height: 1.15;
  text-align: center;
}
.area-name { white-space: nowrap; letter-spacing: -0.02em; }
.area-name.long { font-size: 8px; letter-spacing: -0.04em; } /* ファンデーション 등 긴 이름을 한 줄로 */
.area-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.area-btn.soon { color: rgba(255, 255, 255, 0.62); }
.area-soon {
  font-size: 8px;
  padding: 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.area-btn[aria-current="true"] {
  background: #fff;
  color: #1a1415;
  border-color: #fff;
  font-weight: 700;
}

/* ── 개발자용 ── */
.debug-wrap {
  position: absolute;
  z-index: 30;
  top: calc(var(--safe-top) + 44px);
  left: calc(var(--safe-left) + 86px); /* 왼쪽 부위 메뉴를 가리지 않게 */
  right: calc(var(--safe-right) + 8px);
  max-height: 34%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: #222;
}
.debug-tools { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.debug {
  margin: 0;
  overflow: auto;
  font-size: 10.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

/* ── 하단 조작 영역 ── */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  /* 홈 표시줄(safe-area) 만큼 위로 띄움 */
  padding: 28px calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 14px) calc(var(--safe-left) + 14px);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0));
  pointer-events: none; /* 빈 영역은 터치를 통과시키고, 버튼 등만 터치 받음 */
}
.dock > * { pointer-events: auto; }

.sel-card {
  width: 100%;
  max-width: 460px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--glass-strong);
}
.sel-main { display: flex; align-items: center; gap: 10px; }
.sel-img {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
}
.sel-text { flex: 1; min-width: 0; }
.sel-brand { font-size: 11px; color: var(--muted-on-dark); letter-spacing: 0.04em; }
.sel-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sel-name { font-size: 16px; font-weight: 700; letter-spacing: 0.03em; }
.sel-sub { font-size: 12px; color: var(--muted-on-dark); line-height: 1.5; }
.sel-hex { font-family: ui-monospace, Menlo, monospace; color: var(--fg-on-dark); margin-left: 4px; }
.sel-note { margin: 4px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--muted-on-dark); }
.color-tag {
  font-size: 11px;
  color: var(--muted-on-dark);
  border: 1px solid var(--line-on-dark);
  border-radius: 999px;
  padding: 0 7px;
}
.pill.buy {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  text-decoration: none;
  background: #fff;
  color: #1a1415;
  border-color: #fff;
}

.palette {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: rise 0.18s ease-out;
}
.rec-bar { display: flex; justify-content: center; }
.pill.rec-btn { flex: none; min-height: 32px; padding: 0 14px; font-size: 12.5px; }
.rec-panel {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
}
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rec-head-btns { display: flex; gap: 6px; }
.rec-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 4px; max-width: 100%; min-width: 0; }
.rec-line .color-tag { flex: none; font-size: 9.5px; padding: 0 5px; }
/* 추천 결과를 보는 동안에는 추천 영역이 일반 색상 줄을 대신함 (閉じる로 돌아감) */
body.rec-open .rec-bar,
body.rec-open .prow { display: none; }
.rec-title { font-size: 12px; font-weight: 700; }
.rec-close {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-on-dark);
  background: transparent;
  color: var(--fg-on-dark);
  font-size: 11px;
}
.rec-msg { margin: 4px 0; font-size: 11.5px; line-height: 1.5; }
.rec-msg.busy::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
  vertical-align: -1px;
}
.rec-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0;
}
.rec-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 4px 5px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg-on-dark);
  text-align: center;
}
.rec-dot {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: var(--sw, #888);
}
.rec-text { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; max-width: 100%; }
.rec-name {
  max-width: 100%;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-why { font-size: 9px; line-height: 1.3; color: var(--muted-on-dark); }
.rec-now {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 9px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fff;
  color: #1a1415;
}
.rec-note { margin: 2px 0 0; font-size: 9.5px; line-height: 1.45; color: var(--muted-on-dark); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.prow {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.prow::-webkit-scrollbar { display: none; }
/* 내용이 좁으면 가운데, 넓으면 왼쪽부터 가로 스크롤 */
.prow-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  padding: 9px 9px; /* 선택 테두리(바깥 6px)가 잘리지 않도록 */
}
.pgroup { display: flex; gap: 12px; flex: none; }
.pgroup:empty { display: none; }
.plabel {
  flex: none;
  writing-mode: vertical-rl;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted-on-dark);
}

.swatch {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: var(--sw, #888);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.swatch[aria-pressed="true"] {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.swatch[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.intensity {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--glass);
  font-size: 13px;
}
.intensity label { white-space: nowrap; }
.intensity input { flex: 1; min-width: 0; height: 32px; accent-color: #fff; }
.intensity output { width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

.actions {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 460px;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: 0.4; cursor: default; }

.pill {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-on-dark);
  background: var(--glass);
  color: var(--fg-on-dark);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.pill[aria-expanded="true"],
.pill[aria-pressed="true"] {
  background: #fff;
  color: #1a1415;
  border-color: #fff;
}
.pill.primary {
  flex: 1.25;
  background: var(--accent);
  border-color: var(--accent);
}
.pill.light { flex: none; background: #fff; color: #1a1415; padding: 0 22px; }

/* 가로 화면(높이가 낮은 휴대폰): 조작 영역을 오른쪽 세로 열로 옮겨 얼굴을 가리지 않게 */
@media (orientation: landscape) and (max-height: 500px) {
  .notice { display: none; }
  .dock {
    top: 0;
    left: auto;
    width: min(300px, 40vw);
    justify-content: flex-end;
    gap: 8px;
    padding: calc(var(--safe-top) + 50px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 10px) 12px; /* 위쪽 정보 버튼을 가리지 않게 */
    background: linear-gradient(to left, rgba(0, 0, 0, 0.6) 65%, rgba(0, 0, 0, 0));
  }
  .palette { gap: 6px; }
  .dock { overflow-y: auto; justify-content: flex-start; }
  .dock > :first-child { margin-top: auto; } /* 내용이 적으면 아래쪽 정렬, 많으면 위에서부터 스크롤 */
  .dock > .actions {
    flex: none;
    position: sticky; /* 오른쪽 열이 스크롤돼도 카메라 버튼은 항상 보이게 */
    bottom: 0;
    padding-top: 6px;
    background: rgba(12, 9, 10, 0.92);
    box-shadow: 0 -6px 10px rgba(12, 9, 10, 0.92);
  }
  .swatch { width: 40px; height: 40px; }
  .actions { flex-wrap: wrap; }
  .pill { min-height: 42px; font-size: 13px; }
  .pill.primary { flex-basis: 100%; }
  .overlay { padding: 24px min(300px, 40vw) 24px 90px; }
  .area-menu { top: calc(var(--safe-top) + 48px); bottom: calc(var(--safe-bottom) + 8px); }
}

/* debug 버튼이 보이면 그 버튼이 오른쪽 정렬을 맡음 */
.debug-btn:not([hidden]) + .info-btn { margin-left: 8px; }

/* 세로 화면에서 색상 영역을 열면, 카메라 화면을 조작 영역 위쪽으로 줄여 입술이 가려지지 않게 함
   (닫으면 다시 전체 화면). --dock-h 는 app.js 가 조작 영역 높이로 설정 */
@media (orientation: portrait), (min-height: 501px) {
  body.palette-open .stage { bottom: var(--dock-h, 0px); }
  body.palette-open .dock { background: rgba(12, 9, 10, 0.94); padding-top: 12px; }
}

/* 추천 영역을 연 동안, 세로가 짧은 화면에서는 보조 줄을 숨겨 카메라 영역을 확보 */
@media (max-height: 760px) {
  body.rec-open .sel-note,
  body.rec-open .intensity { display: none; }
}

/* ── 5단계: 부위별 조작 ── */
.ptitle { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted-on-dark); letter-spacing: 0.06em; }
.sel-area {
  font-size: 10.5px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  align-self: center;
}
.color-tag.off { color: #ffd2d2; border-color: rgba(255, 180, 180, 0.6); }
.area-ctrls {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 460px;
}
.chip {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-on-dark);
  background: var(--glass);
  color: var(--fg-on-dark);
  font-size: 11.5px;
  font-weight: 600;
}
/* 선택 칩(계열·농도·스타일·おすすめ 조건 등): 선택된 것만 흰색 */
.chip[aria-pressed="true"] { background: #fff; color: #1a1415; border-color: #fff; }
/* 効果オフ 표시만 점선 */
#areaToggle[aria-pressed="false"] { background: rgba(255, 255, 255, 0.04); color: #ffd2d2; border-style: dashed; }
.area-btn { position: relative; }
.area-dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff6f91;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}
.area-soon.trial { border-style: dashed; }
.rec-level { font-size: 10.5px; font-weight: 700; color: #ffe1ea; }
.info-opt { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: 12.5px; }
.info-opt input { width: 20px; height: 20px; }

/* 짧은 화면에서 추천을 보는 동안 부위 조작 줄도 잠시 숨김 */
@media (max-height: 760px) {
  body.rec-open .area-ctrls,
  body.rec-open .ptitle { display: none; }
}

/* 세로가 짧은 화면(높이 700px 이하): 아래 조작 영역을 촘촘하게 해 카메라 영역 확보 */
@media (max-height: 700px) and (orientation: portrait) {
  .dock { gap: 6px; padding-top: 8px; }
  body.palette-open .dock { padding-top: 8px; }
  .ptitle, .sel-note { display: none; }
  .sel-card { padding: 5px 10px; }
  .sel-name { font-size: 14px; }
  .sel-sub { font-size: 11px; line-height: 1.35; }
  .prow-inner { padding: 6px 8px; gap: 10px; }
  .swatch { width: 38px; height: 38px; }
  .intensity { padding: 0 12px; font-size: 12px; }
  .intensity input { height: 26px; }
  .area-ctrls { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .area-ctrls::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 28px; padding: 0 9px; font-size: 10.5px; }
  .pill { min-height: 44px; font-size: 13px; }
}

/* ── 6단계 ── */
/* 상단: 실제 카메라 화질 배지, 표시 방식 전환 */
.cam-badge,
.top-chip {
  pointer-events: auto;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-on-dark);
  background: var(--glass);
  color: var(--fg-on-dark);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cam-badge.below { border-color: #ffc56b; color: #ffe2b0; }
.top-chip { margin-left: auto; }
.top-chip + .debug-btn:not([hidden]) { margin-left: 0; }
.top-chip ~ .info-btn { margin-left: 0; }
.tag.warn { background: rgba(70, 44, 8, 0.9); color: #ffe2b0; font-size: 12px; max-width: min(92vw, 460px); line-height: 1.5; border-radius: 12px; }

/* 정보 창 안의 선택 줄 (밝은 배경용 칩) */
.info-sheet h3 { margin: 10px 0 4px; font-size: 13.5px; }
.info-sheet .small,
.small { font-size: 11px; line-height: 1.55; color: inherit; opacity: 0.85; }
.cam-info { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.opt-label { font-size: 11.5px; font-weight: 700; margin-right: 2px; }
.chip.dark { background: #f3eeee; color: #2a2224; border: 1px solid #d9cfd1; }
.chip.dark[aria-pressed="true"] { background: #2a2224; color: #fff; border-color: #2a2224; }

/* 왼쪽 메뉴 맨 위 ルック 버튼 */
.area-btn.look-btn { border: 1px solid rgba(255, 255, 255, 0.45); background: rgba(178, 58, 85, 0.55); }
.area-btn.look-btn[aria-expanded="true"] { background: #fff; color: #1a1415; }

/* おすすめルック 창 */
.look-sheet { max-height: calc(100% - var(--safe-top) - 60px - var(--dock-h, 120px)); }
.look-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.look-head h2 { margin: 0; }
.look-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.look-row {
  display: grid;
  grid-template-columns: 22px 92px 22px 1fr;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 10px;
  background: #f6f1f2;
  font-size: 12px;
  line-height: 1.4;
}
.look-row.off { opacity: 0.6; grid-template-columns: 22px 92px 1fr; }
.look-row input { width: 18px; height: 18px; margin: 0; }
.look-area { font-weight: 700; font-size: 11.5px; }
.look-text { display: flex; flex-direction: column; min-width: 0; }
.look-sub { font-size: 10px; opacity: 0.75; }
.rec-dot.small { width: 20px; height: 20px; border-width: 1.5px; border-color: rgba(0, 0, 0, 0.25); }
.look-sheet .pill.primary { width: 100%; flex: none; color: #fff; }
.rec-msg.dark { color: #2a2224; }
.rec-msg.dark.busy::before { border-color: rgba(0, 0, 0, 0.2); border-top-color: #2a2224; }

/* 색상 계열 필터·스타일·농도 빠른 선택 */
.fam-row,
.quick-row,
.slot-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: flex-start;
  padding: 0 2px;
}
.fam-row::-webkit-scrollbar,
.quick-row::-webkit-scrollbar { display: none; }
.fam-row .chip,
.quick-row .chip,
.slot-row .chip { flex: none; min-height: 30px; font-size: 11px; }
.quick-row { justify-content: center; width: 100%; max-width: 420px; }
.style-row { display: flex; flex-direction: column; gap: 4px; }
.style-group { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.style-group::-webkit-scrollbar { display: none; }
.style-label { flex: none; font-size: 11px; color: var(--muted-on-dark); min-width: 2.6em; }
.style-group .chip { flex: none; min-height: 30px; font-size: 11px; }

/* 색 동그라미 안 짧은 이름 (ファンデーション 밝기 단계 등) */
.sw-cap {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translate(-50%, 100%);
  font-size: 8.5px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--muted-on-dark);
  pointer-events: none;
}
.pgroup:has(.sw-cap) { padding-bottom: 12px; }
/* アイシャドウ ベース色 표시 */
.swatch.is-base { outline: 3px dashed #fff; outline-offset: 3px; }
.swatch.is-base::before {
  content: "B";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  color: #1a1415;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* おすすめ 항목 추가 정보 */
.rec-style { font-size: 9.5px; line-height: 1.3; color: #ffe1ea; }
.rec-basis { font-size: 8.5px; line-height: 1.3; color: var(--muted-on-dark); }
.rec-prefs .opt-row { margin: 4px 0; }
.rec-prefs .chip { min-height: 28px; font-size: 11px; }

@media (max-height: 700px) and (orientation: portrait) {
  .fam-row .chip, .quick-row .chip, .style-group .chip, .slot-row .chip { min-height: 26px; font-size: 10.5px; padding: 0 8px; }
  .look-row { grid-template-columns: 20px 80px 20px 1fr; font-size: 11px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .look-sheet { right: calc(min(300px, 40vw) + 8px); max-height: calc(100% - var(--safe-top) - 60px); }
}

/* 상단 줄: 항목이 줄바꿈되거나 눌려 찌그러지지 않게 */
.topbar-row > * { flex: none; }
.badge { white-space: nowrap; }
@media (max-width: 400px) {
  .brand { font-size: 12.5px; letter-spacing: 0.08em; }
  .badge { font-size: 10px; padding: 1px 6px; }
  .topbar-row { gap: 6px; }
  .cam-badge, .top-chip { padding: 0 7px; font-size: 10.5px; }
}
@media (max-width: 340px) {
  .badge { display: none; }
}

/* 임시 제품 테스트 칸: 카메라 해상도·렌더링에는 영향 없음 */
.tester-btn .tester-mark { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid currentColor; border-radius: 50%; font: 600 15px Georgia, serif; }
.tester-btn { border-color: rgba(255, 208, 218, .65); }
.tester-sheet { max-height: calc(100% - var(--safe-top) - var(--safe-bottom) - 76px); }
.tester-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tester-head h2 { margin: 0; }
.tester-head button { flex: none; min-height: 44px; }
.tester-warning { padding: 9px 10px; border-radius: 9px; background: #fff1df; color: #674621; font-size: 12px; }
.tester-list { display: grid; gap: 12px; }
.tester-card { border: 1px solid #e0d7d9; border-radius: 12px; padding: 12px; background: #fff; }
.tester-card h3 { font-size: 14px; margin: 0 0 5px; overflow-wrap: anywhere; }
.tester-card .tester-color { display: flex; align-items: center; gap: 7px; font-family: ui-monospace, monospace; font-size: 12px; }
.tester-swatch { display: inline-block; width: 22px; height: 22px; flex: none; border: 1px solid #b9aeb2; border-radius: 50%; background: var(--sw); }
.tester-card .tester-basis { color: #63565a; font-size: 12px; }
.tester-source { color: #784054; font-size: 12px; display: inline-block; padding: 6px 0 10px; }
.tester-apply { width: 100%; min-height: 44px; font-size: 13px; }

/* v11: 립 실물 비교 도구 (디버그 전용) */
.lip-compare { flex-wrap: wrap; }

/* 상단 둘째 줄: 모드 선택 + 언어 선택 (v22: 언어는 버튼 하나 + 펼침 목록) */
.lang-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.lang-switch { pointer-events: auto; position: relative; flex: none; }
.lang-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-on-dark); border-radius: 999px; background: var(--glass); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.lang-toggle[aria-expanded="true"] { background: #fff; color: #1a1415; }
.lang-caret { font-size: 10px; opacity: .85; }
.lang-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 156px; padding: 6px; border-radius: 14px; background: #fff; box-shadow: 0 8px 28px rgba(0, 0, 0, .45); }
.lang-list[hidden] { display: none; }
.lang-opt { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: #1a1415; font-size: 15px; text-align: left; white-space: nowrap; }
.lang-opt:hover, .lang-opt:focus-visible { background: #f3eeee; outline: none; }
.lang-opt.on { font-weight: 700; background: #fbe7ec; }
.lang-check { width: 14px; color: #b0375a; visibility: hidden; }
.lang-opt.on .lang-check { visibility: visible; }
body.lang-menu-open .topbar { z-index: 45; } /* 열린 언어 목록이 스캔 창·좌우 패널 뒤로 숨지 않게 */
/* 한국어 화면: 한글 글꼴 우선 */
html:lang(ko), html:lang(ko) body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Hiragino Sans", sans-serif; }

/* v15: 제품 데이터 상태 표시 */
.color-tag.low-data { color: #ffe2a8; border-color: rgba(255, 210, 140, 0.6); }
.tester-personal { color: #ffd9e2; }

/* v16: 실물 비교·자동 보정 화면 — 얼굴이 보이도록 아래쪽 정렬, "작게 보기"는 촬영 버튼만 */
.calib-sheet { top: auto; bottom: calc(var(--safe-bottom) + var(--dock-h, 120px) + 8px); max-height: 52%; }
.calib-sheet.compact { max-height: 30%; }
.cal-head-btns { display: flex; gap: 6px; flex: none; }
.cal-head-btns .chip { min-height: 40px; }
.calib-sheet h3 { font-size: 13.5px; margin: 0 0 4px; }
.cal-product { font-weight: 600; margin: 6px 0 2px; overflow-wrap: anywhere; }
.cal-sub { color: #63565a; font-size: 12px; margin: 2px 0; }
.cal-note { color: #6f6266; font-size: 11.5px; margin: 4px 0; }
.cal-msg { padding: 7px 9px; border-radius: 9px; background: #eef6f0; font-size: 12.5px; margin: 6px 0; }
.cal-msg[data-kind="error"] { background: #fdeceb; color: #9b2c22; }
.cal-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.cal-btn { min-height: 40px; padding: 0 12px; font-size: 12.5px; background: #fff; color: #2a2224; border: 1px solid #d9cfd2; }
.cal-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-btn.done { border-color: #2f7a4b; color: #2f7a4b; }
.cal-btn.danger { color: #9b2c22; }
.cal-btn[aria-pressed="true"] { background: #2a2224; color: #fff; }
.cal-btn:disabled { opacity: .45; }
.cal-box { border: 1px solid #e0d7d9; border-radius: 12px; padding: 9px 10px; margin: 8px 0; background: #fff; }
.cal-box summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.cal-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 6px 0; }
.cal-field { display: grid; gap: 2px; font-size: 12px; }
.cal-field select { font-size: 16px; min-height: 36px; border-radius: 8px; border: 1px solid #d9cfd2; background: #fff; }
.cal-check { display: flex; align-items: center; gap: 6px; }
.cal-issues { margin: 4px 0; padding-left: 18px; font-size: 12px; }
.cal-issues .q-unsuitable { color: #9b2c22; }
.cal-issues .q-limited, .cal-issues .q-needs-check { color: #8a5a00; }
.cal-status { font-weight: 600; }
.cal-change { font-size: 12.5px; margin: 2px 0; }
.cal-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; padding: 4px 0; border-top: 1px solid #eee; }
.cal-mono { font-family: ui-monospace, monospace; font-size: 10.5px; overflow-wrap: anywhere; margin: 3px 0; }
.cal-mosaic { width: 100%; max-width: 300px; height: auto; display: block; border-radius: 8px; background: #fff; }
.cal-mosaic.zoom { max-width: 600px; }
.tester-calib { width: 100%; min-height: 40px; margin-top: 8px; font-size: 12.5px; }
@media (max-width: 360px) { .cal-settings { grid-template-columns: 1fr; } }

/* ── v17 (08/25) AI 피부 스캔 ── */
.area-btn.scan-btn { border: 1px solid rgba(255, 255, 255, 0.45); }
.area-btn.scan-btn[aria-expanded="true"] { background: #fff; color: #1a1415; }
.scan-btn .scan-mark { display: grid; place-items: center; width: 24px; height: 24px; font-size: 18px; line-height: 1; }
.scan-sheet { top: calc(var(--safe-top) + 92px); bottom: calc(var(--safe-bottom) + 12px); max-height: none; z-index: 22; overscroll-behavior: contain; }
.scan-sheet.capture { top: auto; bottom: calc(var(--safe-bottom) + var(--dock-h, 120px) + 8px); max-height: 42%; }
.scan-sheet h2 { margin: 0; }
.scan-sheet h3 { font-size: 13.5px; margin: 12px 0 4px; }
.scan-brand { display: grid; gap: 0; }
.scan-kicker { font-size: 10.5px; letter-spacing: .14em; color: #8b7b80; }
.scan-lead { font-size: 13.5px; }
.scan-tips { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; }
.scan-sub { color: #63565a; font-size: 12px; margin: 2px 0; }
.scan-dirs, .scan-regions, .scan-layers { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.scan-regions .cal-btn { border-left: 5px solid var(--rc, #ccc); }
.scan-guide-text { padding: 7px 9px; border-radius: 9px; background: #fff4e5; color: #6d4a10; font-weight: 600; margin: 6px 0; }
.scan-guide-text.ready { background: #e8f6ec; color: #22663a; }
.scan-figure { display: flex; justify-content: center; margin: 6px 0; }
.scan-canvas { max-width: 100%; height: auto; border-radius: 10px; background: #111; }
.scan-quality { border-radius: 10px; padding: 7px 9px; margin: 6px 0; background: #f4f1f2; font-size: 12.5px; }
.scan-quality.q-analyzable { background: #e8f6ec; }
.scan-quality.q-limited { background: #fff4e5; }
.scan-quality.q-retake, .scan-quality.q-impossible { background: #fdeceb; }
.scan-results { display: grid; gap: 8px; }
.scan-card { border: 1px solid #e0d7d9; border-left: 5px solid var(--rc, #ccc); border-radius: 12px; padding: 8px 10px; background: #fff; }
.scan-card h3 { margin: 0 0 4px; }
.scan-source { border-top: 1px solid #f0eaeb; padding-top: 4px; margin-top: 4px; }
.scan-src { font-size: 11.5px; color: #6f6266; margin: 0 0 2px; }
.scan-finding p { margin: 2px 0; }
.scan-fb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 0 6px; }
.scan-fb .cal-btn { min-height: 34px; padding: 0 8px; font-size: 11.5px; }
.scan-details { border: 1px solid #e0d7d9; border-radius: 12px; padding: 8px 10px; margin: 8px 0; background: #fff; }
.scan-details summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.scan-tech { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 10.5px; line-height: 1.5; margin: 6px 0; }
.scan-save { border-top: 1px solid #eee; margin-top: 8px; }
.scan-hist { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; padding: 4px 0; border-top: 1px solid #f0eaeb; }
.cal-msg.error { background: #fdeceb; color: #9b2c22; }
.cal-msg[hidden] { display: none; }
.scan-guide { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: grid; place-items: center; }
.scan-guide[hidden] { display: none; }
.scan-oval { width: min(62vw, 300px); aspect-ratio: 1 / 1.35; border: 3px dashed rgba(255, 255, 255, .8); border-radius: 50%; transform: translateY(-8%); }
.scan-guide.ready .scan-oval { border-color: #49d27a; border-style: solid; }
.scan-guide-label { position: absolute; top: calc(var(--safe-top) + 120px); padding: 3px 8px; border-radius: 8px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 12px; }


/* ── v18 (09/27) 화면 구조: 상단 모드 · 좌우 패널 · 아래 상세 영역 ── */
.lang-row { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.lang-row .lang-switch { margin-left: auto; }
.mode-switch { pointer-events: auto; display: inline-flex; border: 1px solid var(--line-on-dark); border-radius: 999px; background: var(--glass); overflow: hidden; }
.mode-btn { min-height: 32px; padding: 0 12px; border: 0; background: transparent; color: var(--muted-on-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.mode-btn + .mode-btn { border-left: 1px solid var(--line-on-dark); }
.mode-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (max-width: 400px) { .mode-btn { padding: 0 9px; font-size: 11.5px; } }

.side-btn { position: absolute; z-index: 11; top: 46%; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 50px; min-height: 64px; padding: 8px 2px; border: 1px solid var(--line-on-dark); background: var(--glass-strong); color: #fff; font-size: 10px; line-height: 1.2; }
.side-btn.left { left: calc(var(--safe-left)); border-radius: 0 14px 14px 0; border-left: 0; }
.side-btn.right { right: calc(var(--safe-right)); border-radius: 14px 0 0 14px; border-right: 0; }
.side-btn[aria-expanded="true"] { background: #fff; color: #1a1415; }
.side-icon { font-size: 18px; line-height: 1; }
.side-label { word-break: keep-all; text-align: center; }
.panel-backdrop { position: absolute; inset: 0; z-index: 24; background: rgba(0, 0, 0, 0.28); }
.side-panel { position: absolute; z-index: 26; top: calc(var(--safe-top) + 92px); bottom: calc(var(--safe-bottom) + 8px); width: min(84vw, 340px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 12px 16px; background: rgba(22, 17, 18, 0.95); color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
.side-panel.left { left: calc(var(--safe-left)); border-radius: 0 16px 16px 0; }
.side-panel.right { right: calc(var(--safe-right)); border-radius: 16px 0 0 16px; }
.side-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.side-head h2 { margin: 0; font-size: 15px; }
.side-head .chip { min-height: 40px; }
.auto-btn { display: grid; gap: 2px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.5); background: linear-gradient(135deg, rgba(178, 58, 85, 0.85), rgba(120, 40, 70, 0.85)); color: #fff; }
.auto-btn[aria-expanded="true"] { outline: 2px solid #fff; }
.auto-title { font-weight: 700; font-size: 14px; }
.auto-sub { font-size: 11px; color: rgba(255, 255, 255, 0.85); }
.side-label-small { margin: 12px 0 6px; font-size: 11.5px; color: var(--muted-on-dark); letter-spacing: 0.04em; }
.side-note { font-size: 11px; color: var(--muted-on-dark); line-height: 1.5; margin: 10px 0 6px; }
/* 패널 안에서는 부위 메뉴를 격자로 (이전의 화면 왼쪽 세로 메뉴 위치 지정은 쓰지 않음) */
.side-panel .area-menu { position: static; width: auto; top: auto; bottom: auto; left: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0; overflow: visible; background: none; border-radius: 0; }
.side-panel .area-btn { min-height: 64px; border: 1px solid var(--line-on-dark); font-size: 11px; }
.side-panel .area-name.long { font-size: 9.5px; }
.pp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pp-list { display: grid; gap: 8px; }
.pp-card { display: grid; grid-template-columns: 30px 1fr; gap: 6px 10px; align-items: center; padding: 9px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line-on-dark); }
.pp-swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--sw); border: 1px solid rgba(255, 255, 255, 0.5); }
.pp-name { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.pp-shade { font-size: 12px; color: var(--muted-on-dark); }
.pp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pp-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.pp-actions a.chip { display: inline-flex; align-items: center; text-decoration: none; }
.pp-empty { font-size: 12.5px; color: var(--muted-on-dark); }
.check-box { position: absolute; z-index: 8; left: calc(var(--safe-left) + 12px); right: calc(var(--safe-right) + 12px); bottom: calc(var(--dock-h, 110px) + 10px); max-width: 460px; margin: 0 auto; padding: 12px 14px; border-radius: 14px; background: var(--glass-strong); font-size: 12.5px; line-height: 1.55; }
.check-box h2 { margin: 0 0 4px; font-size: 14px; }
.check-box p { margin: 0 0 6px; }
.chk-live { font-weight: 700; color: #cfe9d6; }
.chk-list { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0; padding: 0; list-style: none; font-size: 11.5px; }
.chk-list li { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.soon-tag { display: inline-block; font-size: 10px; padding: 0 6px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.45); color: var(--muted-on-dark); vertical-align: middle; }
/* 점검 모드: 가상 메이크업 조작(색 선택·비교·선택 카드)은 숨김 — 설정 자체는 그대로 남음 */
body.mode-check .dock .sel-card, body.mode-check .dock .palette, body.mode-check .dock .intensity, body.mode-check .dock .quick-row, body.mode-check .dock .area-ctrls, body.mode-check #colorBtn, body.mode-check #compareBtn { display: none !important; }
.details { background: #141011; color: #fff; padding: 18px calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 28px) calc(var(--safe-left) + 16px); }
.details h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: 0.04em; }
.det-item { border-top: 1px solid var(--line-on-dark); }
.det-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 2px; border: 0; background: none; color: #fff; font-size: 14px; font-weight: 700; text-align: left; }
.det-head::after { content: "＋"; font-weight: 400; color: var(--muted-on-dark); margin-left: auto; }
.det-head[aria-expanded="true"]::after { content: "－"; }
.det-body { padding: 0 2px 14px; font-size: 13px; line-height: 1.65; color: rgba(255, 255, 255, 0.9); }
.det-body p { margin: 0 0 8px; }
.det-sub, .det-note { font-size: 12px; color: var(--muted-on-dark); }
.det-list { margin: 4px 0 8px; padding-left: 18px; }
.det-foot { margin-top: 14px; font-size: 11px; color: var(--muted-on-dark); }
.details .cal-btn { background: #fff; }
@media (max-width: 380px) { .scan-sheet:not(.capture) { top: calc(var(--safe-top) + 130px); } }

/* 패널이 열려 있어도: 상단(브랜드·모드·언어)은 누를 수 있게 막 위에, 반대쪽 패널 버튼도 막 위에 (누르면 열린 패널이 닫히고 그쪽이 열림) */
body.panel-open .topbar { z-index: 28; }
body.panel-open .side-btn { z-index: 27; }
.side-btn[aria-expanded="true"] { visibility: hidden; } /* 열린 쪽 버튼은 패널 안 닫기 버튼으로 대신 */
@media (max-width: 380px) { .side-panel { top: calc(var(--safe-top) + 130px); } }
/* 가로 화면: 오른쪽 열(조작 영역)을 가리지 않게 추천 제품 버튼·패널을 그 왼쪽에 */
@media (orientation: landscape) and (max-height: 500px) {
  .side-btn.right { right: calc(min(300px, 40vw) + 4px); }
  .side-panel.right { right: min(300px, 40vw); }
  .side-panel { top: calc(var(--safe-top) + 92px); bottom: calc(var(--safe-bottom) + 4px); }
  .check-box { right: calc(min(300px, 40vw) + 12px); bottom: 10px; }
}

/* ── v19 (10/27) 피부 유형: 카메라 위 작은 표시 + 피부 분석 결과 안 블록 ── */
.skin-chip { display: inline-flex; align-items: center; gap: 2px; border-radius: 999px; background: var(--glass-strong); font-size: 12px; max-width: min(86vw, 360px); pointer-events: auto; }
.skin-chip[hidden] { display: none; }
.skin-chip-btn { border: 0; background: none; color: inherit; font: inherit; padding: 5px 4px 5px 12px; min-height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skin-chip-x { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; min-width: 30px; min-height: 30px; opacity: 0.8; }
body.panel-open .skin-chip { visibility: hidden; }
.st-block { margin-bottom: 6px; }
.st-h { margin: 6px 0 6px; font-size: 14px; }
.st-detail-h { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line-on-dark); }
.st-h4 { margin: 14px 0 4px; font-size: 13px; color: rgba(255, 255, 255, 0.95); }
.st-status { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.details .chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; align-items: center; }
.details .cal-btn[aria-pressed="true"] { background: #f3a6b8; color: #1a1415; border-color: #f3a6b8; }
.details .cal-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.details .cal-btn.danger { background: #ffd6d6; color: #5a0d0d; }
.st-q { border: 1px solid var(--line-on-dark); border-radius: 12px; margin: 8px 0; padding: 8px 10px; }
.st-q legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.st-opt { display: flex; align-items: center; gap: 6px; min-height: 36px; font-size: 13px; }
.st-opt input { width: 18px; height: 18px; flex: none; }
.details .st-mini { font-size: 11px; padding: 3px 10px; min-height: 28px; background: rgba(255, 255, 255, 0.85); color: #222; }
.pp-skin { font-size: 11.5px; line-height: 1.5; margin: 0 0 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); }

/* ── v20 (11/27) 얼굴 부위별 피부 지도 ── */
.sm-off { border: 0; color: #fff; font: inherit; font-size: 12px; pointer-events: auto; }
.sm-off[hidden] { display: none; }
body.panel-open .sm-off { visibility: hidden; }
.sm-block { margin: 18px 0 6px; padding-top: 12px; border-top: 1px dashed var(--line-on-dark); }
.sm-opacity { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.sm-opacity input { width: 110px; }
.sm-map { margin: 8px auto 4px; max-width: 320px; }
.sm-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.sm-svg .sm-zone { cursor: pointer; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; margin: 4px 0 8px; }
.sm-leg { display: inline-flex; align-items: center; gap: 5px; }
.sm-leg i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.6); display: inline-block; }
.sm-zones { display: grid; gap: 6px; margin: 8px 0; }
.sm-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sm-group-name { font-size: 12px; font-weight: 700; min-width: 64px; }
.details .sm-zone-btn { font-size: 11.5px; min-height: 34px; padding: 0 9px; }
.sm-detail { border: 1px solid var(--line-on-dark); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.sm-quality { margin: 8px 0; }
.sm-warn { color: #ffd98a; }

/* ── v21 (12/27) 4개 언어: 언어별 글꼴 (중국어 간체가 일본어 글꼴 모양으로 보이지 않게) ── */
html[lang="ko"] body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
html[lang="zh-CN"] body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
html[lang="en"] body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
@media (max-width: 360px) { .lang-row .mode-btn { padding: 0 9px; font-size: 11.5px; } .lang-toggle { padding: 0 9px; } }

/* ── v21 화장품 사용 기록 ── */
.ur-block { margin: 18px 0 6px; padding-top: 12px; border-top: 1px dashed var(--line-on-dark); }
.ur-input, .ur-notes, .details select { width: 100%; box-sizing: border-box; min-height: 38px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-on-dark); background: rgba(255, 255, 255, 0.08); color: #fff; font: inherit; font-size: 14px; }
.ur-notes { min-height: 72px; resize: vertical; }
.details select option { color: #111; }
.ur-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.ur-row .ur-input { flex: 1 1 160px; width: auto; }
.ur-plist { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; max-height: 220px; overflow-y: auto; }
.details .ur-pick { font-size: 12px; text-align: left; white-space: normal; min-height: 36px; }
.ur-chosen { margin: 6px 0; }
.ur-prod { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.ur-ord { width: 22px; height: 22px; border-radius: 50%; background: #f3a6b8; color: #1a1415; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.ur-pname { font-weight: 600; }
.ur-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-on-dark); }
.ur-urgent-box { border: 1px solid rgba(255, 196, 120, 0.6); border-radius: 12px; padding: 6px 10px; margin: 8px 0; }
.ur-safety { border-radius: 12px; padding: 8px 10px; margin: 8px 0; font-size: 13px; line-height: 1.6; }
.ur-safety p { margin: 4px 0 0; }
.ur-safety-urgent { background: #fff3cd; color: #3d2a00; border: 2px solid #e0a800; }
.ur-safety-caution { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 214, 102, 0.8); }
.ur-details { display: grid; gap: 8px; margin: 8px 0; }
.ur-field { display: grid; gap: 4px; font-size: 12.5px; }
.ur-ctl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.ur-ctl .ur-input { grid-column: 1 / -1; }
.ur-card { border: 1px solid var(--line-on-dark); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.ur-card p { margin: 2px 0; }
.ur-card-title { font-weight: 700; }
.ur-note-raw { white-space: pre-wrap; overflow-wrap: anywhere; }
.ur-inci { overflow-wrap: anywhere; }
.ur-map { max-width: 220px; margin: 4px auto; }
.pp-usage { font-size: 11px; line-height: 1.45; opacity: 0.9; margin-top: 3px; }
.pp-usage[data-discomfort="1"] { color: #ffd98a; }
.details .cal-btn { max-width: 100%; white-space: normal; }
.details .cal-msg { color: #1d3b29; }
.details .cal-msg.error { color: #9b2c22; }
html[lang="en"] .side-btn { width: 64px; font-size: 9px; }
html[lang="en"] .side-label { word-break: normal; overflow-wrap: break-word; }
html[lang="ja"] .side-label, html[lang="zh-CN"] .side-label { word-break: normal; line-break: strict; } /* 일본어·중국어는 글자 단위 줄바꿈 (keep-all 이면 좁은 버튼을 넘침) */
html[lang="ja"] .side-btn { width: 64px; font-size: 9px; }

/* ── v22 (13/27) "피부 분석 결과" 하위 메뉴 · 피부 변화 기록·비교·추세 ── */
.sk-sec-lead { margin: 4px 0 8px; }
.sk-sec { border: 1px solid var(--line-on-dark); border-radius: 12px; margin: 8px 0; overflow: hidden; }
.sk-sec-h { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; text-align: left; }
.sk-sec-h[aria-expanded="true"] { background: rgba(255, 255, 255, 0.12); }
.sk-sec-n { flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.sk-sec-t { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.sk-sec-s { flex: none; max-width: 40%; font-size: 12px; color: var(--muted-on-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-sec-c { flex: none; transition: transform .15s; }
.sk-sec-h[aria-expanded="true"] .sk-sec-c { transform: rotate(180deg); }
.sk-sec-b { padding: 0 12px 10px; }
.sk-sec-b[hidden] { display: none; }
.sk-sec-b > .ur-block, .sk-sec-b > .sm-block, .sk-sec-b > .st-block { margin-top: 6px; padding-top: 0; border-top: 0; }
.hs-block { margin-top: 6px; }
.hs-ctl { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.hs-field { display: grid; gap: 4px; font-size: 12.5px; }
.hs-select { width: 100%; }
.hs-sum { font-weight: 600; }
.hs-empty { font-weight: 600; }
.hs-card { border: 1px solid var(--line-on-dark); border-radius: 12px; padding: 6px 10px; margin: 8px 0; }
.hs-card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.hs-card-t { font-weight: 700; overflow-wrap: anywhere; }
.hs-badge { flex: none; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-on-dark); }
.hs-badge.q-limited { border-color: rgb(255, 214, 102); }
.hs-badge.q-retake, .hs-badge.q-impossible { border-color: #ff8a65; }
.hs-detail { margin-top: 6px; border-top: 1px dashed var(--line-on-dark); padding-top: 6px; }
.hs-detail p { margin: 3px 0; }
.hs-note-raw { white-space: pre-wrap; overflow-wrap: anywhere; }
.hs-group { margin: 4px 0; }
.hs-group > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; font-weight: 600; }
.hs-maps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hs-map { margin: 6px 0; text-align: center; }
.hs-svg { width: 100%; max-width: 160px; height: auto; display: block; margin: 0 auto; }
.hs-status { border-radius: 12px; padding: 8px 10px; margin: 8px 0; border: 1px solid var(--line-on-dark); }
.hs-status p { margin: 4px 0 0; }
.hs-status.hs-comparable { border-color: rgba(130, 200, 255, 0.8); }
.hs-status.hs-limited { border-color: rgb(255, 214, 102); }
.hs-status.hs-not_comparable { border-color: #ff8a65; }
.hs-zone { border-top: 1px dashed var(--line-on-dark); padding: 4px 0; }
.hs-zone-t { font-weight: 600; margin: 2px 0; }
.hs-mline { margin: 2px 0; font-size: 13px; }
.hs-leg-ok { background: rgba(130, 200, 255, 0.5); }
.hs-leg-lim { background: rgba(255, 214, 102, 0.6); }
.hs-leg-no { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .3) 0 2px, transparent 2px 5px); }
.hs-chart-wrap { margin: 8px 0; }
.hs-chart { width: 100%; max-width: 420px; height: auto; display: block; }
.hs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.hs-table td { padding: 3px 4px; border-top: 1px solid var(--line-on-dark); }
.hs-table caption { text-align: left; }
.hs-ba { margin-top: 10px; }
.hs-notes-form { display: grid; gap: 6px; }
.scan-save-q { font-weight: 700; font-size: 15px; margin: 4px 0; }
/* v22: 좁은 화면(≤360px) 영어 아래 버튼 글자가 넘치지 않게 (Choose color · Turn on camera) */
@media (max-width: 360px) { html[lang="en"] .actions button { font-size: 12px; padding-left: 6px; padding-right: 6px; letter-spacing: -0.01em; } }

/* 14/27 성분 정보 찾기 · 전성분 분석 */
.kn-block { margin-top: 12px; border-top: 1px solid rgba(127,127,127,.25); padding-top: 8px; }
.kn-label { display: block; font-size: 13px; margin: 6px 0 4px; }
.kn-input { width: 100%; max-width: 420px; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(127,127,127,.5); font: inherit; background: transparent; color: inherit; }
.kn-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.kn-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kn-pick { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.kn-detail { margin-top: 8px; overflow-wrap: anywhere; }
.kn-sec { margin: 8px 0; }
.kn-sec h5 { margin: 6px 0 2px; font-size: 14px; }
.kn-msg { font-size: 14px; }
.kn-recheck { margin-left: 4px; }
.pp-ing { grid-column: 1 / -1; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(127,127,127,.08); font-size: 13px; overflow-wrap: anywhere; }
.pp-ing-list { margin: 4px 0; padding-left: 20px; }
.pp-ing-list li { margin: 2px 0; }
.pp-ing-open { margin-left: 4px; padding: 2px 8px; font-size: 12px; }

/* 15/27 맞춤 피부 관리 가이드 (아침·저녁) */
.cg-block { margin-top: 8px; overflow-wrap: anywhere; }
.cg-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; align-items: center; }
.cg-row select, .cg-row input[type="text"], .cg-sel select { max-width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(127,127,127,.5); font: inherit; background: transparent; color: inherit; }
.cg-tabs button[aria-selected="true"], .cg-view button[aria-pressed="true"], .cg-src button[aria-pressed="true"] { outline: 2px solid currentColor; }
.cg-steps { margin: 6px 0; padding-left: 22px; }
.cg-step { margin: 6px 0; }
.cg-step-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cg-caution { font-size: 13px; margin-top: 2px; padding: 4px 6px; border-left: 3px solid #d9822b; }
.cg-msg { font-size: 14px; }
.cg-msg.error { color: #d9534f; }
.cg-prefs { margin: 6px 0; padding: 8px; border-radius: 8px; background: rgba(127,127,127,.08); }
.cg-goals { border: 0; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cg-goals legend { font-size: 13px; margin-bottom: 2px; }
.cg-check, .cg-sel { font-size: 14px; display: inline-flex; align-items: center; gap: 4px; margin: 4px 8px 4px 0; }

/* 16/27 메이크업 전 준비 코치 (왼쪽 패널 안) */
.prep-btn { display: block; width: 100%; margin: 6px 0; text-align: left; }
.side-panel.coach-on > :not(.side-head):not(.side-foot):not(#prepCoach):not(#prepBtn) { display: none; }
.prep-coach { margin-top: 6px; overflow-wrap: anywhere; }
.pc-h { margin: 4px 0; font-size: 16px; }
.pc-step { margin: 6px 0; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.06); }
.pc-current { border: 1px solid currentColor; }
.pc-step[data-state="done"], .pc-step[data-state="skipped"] { opacity: .7; }
.pc-list { padding-left: 18px; margin: 6px 0; }
.pc-progress, .pc-finished { font-weight: 700; font-size: 14px; }

/* 18/27 실제 제품 룩 */
.look-sku { margin: 8px 0; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.05); overflow-wrap: anywhere; }
.look-sku-list { margin: 4px 0; padding-left: 16px; font-size: 13px; }
.look-sku-list li { margin: 2px 0; }
.look-saved { padding-left: 16px; font-size: 13px; }
.look-export { width: 100%; box-sizing: border-box; font: 12px/1.3 monospace; }

/* 25/27 안전 안내 (구매·추천보다 먼저, 눈에 띄게) */
.sf-alert { margin: 6px 0; padding: 10px; border-radius: 10px; border: 2px solid #d9534f; background: rgba(217, 83, 79, 0.12); font-size: 14px; overflow-wrap: anywhere; }
.sf-alert p { margin: 4px 0; }

/* 26/27 메이크업 후 점검 */
.chk-live-r { font-weight: 600; }
.chk-sec { margin: 8px 0; padding: 6px 0; border-top: 1px solid rgba(127,127,127,.2); overflow-wrap: anywhere; }
.chk-sec h4 { margin: 2px 0; font-size: 14px; }
.chk-sugg { font-style: italic; }

/* 27/27: 점검 결과 하위 메뉴·코디 상담 */
details.chk-sub { border-top: 1px solid rgba(127,127,127,.25); padding: 6px 0; }
details.chk-sub > summary { cursor: pointer; font-weight: 600; padding: 4px 0; min-height: 32px; }
.chk-good li, .chk-adjust li, .chk-products li { margin: 4px 0; }
.chk-products li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chk-none-needed { font-weight: 600; }
.sty-checks { border: 0; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.sty-checks legend { font-size: .9em; margin-bottom: 4px; }
.sty-chk { font-size: .9em; white-space: nowrap; }
.sty-opt { border: 1px solid rgba(127,127,127,.3); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.sty-opt h4 { margin: 0 0 4px; }
.sty-reasons { margin: 4px 0 0; padding-left: 18px; font-size: .9em; opacity: .85; }
/* 2026-10-31: 분석 단계가 오류로 꺼졌을 때 "분석 다시 시도" */
.recover-btn { pointer-events: auto; border: 1px solid rgba(255, 214, 102, 0.9); background: rgba(40, 30, 0, 0.75); color: #fff; font-weight: 700; min-height: 36px; }

/* 2026-10-31: 피부 고민·성분 근거 (tr-*) — 색은 .details 의 변수만 사용 (밝은/어두운 테마 공통) */
.details { --d-card: rgba(255, 255, 255, 0.05); --d-line: rgba(255, 255, 255, 0.16); --d-warn-bg: rgba(255, 196, 120, 0.12); --d-warn-line: rgba(255, 196, 120, 0.55); --d-danger-bg: rgba(255, 120, 120, 0.12); --d-danger-line: rgba(255, 140, 140, 0.6); --d-ok: #9be3b8; --d-strong: #ffd38a; }
.tr-acc { border: 1px solid var(--d-line); border-radius: 12px; margin: 10px 0; background: var(--d-card); }
.tr-acc > summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-weight: 700; font-size: 13.5px; }
.tr-acc > summary::-webkit-details-marker { display: none; }
.tr-acc > summary::after { content: "▾"; margin-left: auto; opacity: 0.7; transition: transform 0.15s; }
.tr-acc[open] > summary::after { transform: rotate(180deg); }
.tr-acc-b { padding: 2px 12px 12px; }
.tr-alert { border: 1px solid var(--d-danger-line); background: var(--d-danger-bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.tr-alert[data-safety="overlap_actives"], .tr-alert[data-safety="itch_check"], .tr-alert[data-safety="follow_doctor"], .tr-alert[data-safety="pregnancy"] { border-color: var(--d-warn-line); background: var(--d-warn-bg); }
.tr-conflict, .tr-note { border-left: 3px solid var(--d-warn-line); padding: 6px 10px; margin: 8px 0; font-size: 12.5px; }
.tr-cats { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
.tr-cat { border: 1px solid var(--d-line); border-radius: 10px; padding: 8px 10px; }
.tr-cat-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tr-cat p { margin: 4px 0 0; }
.tr-easy { font-size: 12.5px; line-height: 1.6; }
.tr-st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--d-line); white-space: nowrap; }
.tr-st-observed, .tr-st-reported { border-color: var(--d-warn-line); background: var(--d-warn-bg); }
.tr-st-not_observed { color: var(--d-ok); }
.tr-st-cannot_tell, .tr-st-not_measured, .tr-st-experimental_hidden { opacity: 0.8; }
.tr-q { margin: 10px 0; }
.tr-q-l { margin: 0 0 4px; font-weight: 600; font-size: 13px; }
.tr-opt { min-height: 36px; }
.tr-ing { border: 1px solid var(--d-line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: var(--d-card); }
.tr-ing-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tr-consult { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--d-strong); }
.tr-caution { margin-top: 6px; font-size: 12px; }
.tr-caution p { margin: 2px 0; }
.tr-src { font-size: 11.5px; overflow-wrap: anywhere; }
.tr-src a, .kn-sources a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tr-sub { margin: 12px 0 4px; font-size: 13px; }
.tr-adv-referral .tr-sub { color: var(--d-strong); }
.ev-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--d-line, rgba(255,255,255,.3)); white-space: nowrap; margin: 0 4px; }
.ev-badge[data-level="guideline_strong"] { border-color: #6fd39b; color: #9be3b8; }
.ev-badge[data-level="guideline_conditional"], .ev-badge[data-level="regulatory"], .ev-badge[data-level="expert_advice"] { border-color: #8db8ff; color: #b6d0ff; }
.ev-badge[data-level="human_some"] { border-color: #e8c27a; color: #f1d59c; }
.ev-badge[data-level="insufficient"], .ev-badge[data-level="lab_or_listing"] { opacity: 0.75; }
.ev-small { font-size: 9.5px; }
.kn-pclass { font-size: 12px; font-weight: 600; margin: 4px 0; }
.tr-rest { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.tr-rest-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.tr-rest-why { margin-top: -2px; }
.tr-none { list-style: none; }

/* ───────────────────────────────────────────────────────────────────────────
   2026-10-31 디자인: 카메라 아래 영역을 밝고 차분한 전문가 톤으로
   - 카메라 화면(어두운 뷰파인더)·카메라 위 버튼은 그대로 둔다 (영상 위 가독성).
   - 카메라 아래 결과 영역(.details)만 밝은 종이색 배경 + 흰 카드 + 진한 글자.
   - 기존 규칙이 쓰는 변수(--fg-on-dark 등)를 이 영역 안에서만 다시 정의 → 칩·태그·입력칸이 자동으로 밝은 테마가 된다.
   - 대비(WCAG 계산): 본문 15.6:1, 보조 글자 6.6:1, 강조 #9e2f4c 흰 바탕 7.1:1, 배지 5.2~6.1:1
   ─────────────────────────────────────────────────────────────────────────── */
:root {
  --paper: #f7f4f2; --card: #ffffff; --ink: #201a1c; --ink-2: #5e5559; --hair: #e6dedb; --hair-2: #d6ccc8;
  --rose: #9e2f4c; --rose-soft: #f6e4e9; --sage: #2f6b4f; --sage-soft: #e3f0e8; --amber: #8a5a00; --amber-soft: #fbf0d9; --red: #a3261d; --red-soft: #fbe6e3; --blue: #285a9e; --blue-soft: #e5edf8;
  --shadow-1: 0 1px 2px rgba(32, 26, 28, 0.06), 0 1px 1px rgba(32, 26, 28, 0.04);
}
html:lang(ko) .details, html:lang(ko) .details * { word-break: keep-all; overflow-wrap: anywhere; }
.details {
  --fg-on-dark: var(--ink); --muted-on-dark: var(--ink-2); --line-on-dark: var(--hair-2); --glass: var(--card); --glass-strong: var(--card);
  --d-card: var(--card); --d-line: var(--hair); --d-warn-bg: var(--amber-soft); --d-warn-line: #e3b866; --d-danger-bg: var(--red-soft); --d-danger-line: #e2a49b; --d-ok: var(--sage); --d-strong: var(--amber);
  background: var(--paper); color: var(--ink); border-top: 1px solid var(--hair);
  font-size: 14px; letter-spacing: -0.005em;
}
.details h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
/* 큰 메뉴(피부 분석 결과·점검 결과·관리 가이드·코디): 흰 카드 */
.det-item { border-top: 0; background: var(--card); border: 1px solid var(--hair); border-radius: 14px; margin: 10px 0; box-shadow: var(--shadow-1); overflow: hidden; }
.det-head { color: var(--ink); padding: 0 16px; font-size: 15px; }
.det-head::after { color: var(--ink-2); }
.det-head[aria-expanded="true"] { border-bottom: 1px solid var(--hair); }
.det-body { color: var(--ink); padding: 12px 16px 16px; font-size: 13.5px; }
.st-h { color: var(--ink); font-size: 15px; letter-spacing: -0.01em; }
.st-h4 { color: var(--ink); }
.det-sub, .det-note, .det-foot { color: var(--ink-2); }
.details a { color: var(--rose); }
/* 버튼: 흰 바탕 + 얇은 테두리, 선택·주요 버튼은 장미색 */
.details .chip, .details .cal-btn { background: var(--card); color: var(--ink); border: 1px solid var(--hair-2); font-weight: 600; }
.details .chip:hover, .details .cal-btn:hover { border-color: var(--ink-2); }
.details .chip[aria-pressed="true"], .details .cal-btn[aria-pressed="true"] { background: var(--rose); color: #fff; border-color: var(--rose); }
.details .cal-btn.primary { background: var(--rose); color: #fff; border-color: var(--rose); }
.details .cal-btn.danger { background: var(--red-soft); color: var(--red); border-color: #e2a49b; }
.details .st-mini { background: var(--card); color: var(--ink); }
.details :focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.details .color-tag { color: var(--ink-2); border-color: var(--hair-2); background: var(--paper); }
/* 입력칸 */
.ur-input, .ur-notes, .details select, .details input[type="search"], .details input[type="text"], .details input[type="date"], .details textarea { background: var(--card); color: var(--ink); border: 1px solid var(--hair-2); }
.details select option { color: var(--ink); }
/* 하위 메뉴 (피부 분석 결과 안 1~9) */
.sk-sec { border: 1px solid var(--hair); border-radius: 12px; margin: 8px 0; overflow: hidden; background: var(--card); }
.sk-sec-h { background: var(--card); color: var(--ink); }
.sk-sec-h:hover { background: #fbf9f8; }
.sk-sec-h[aria-expanded="true"] { background: var(--rose-soft); }
.sk-sec-n { background: var(--paper); color: var(--rose); border: 1px solid var(--hair); }
.sk-sec-h[aria-expanded="true"] .sk-sec-n { background: var(--rose); color: #fff; border-color: var(--rose); }
.sk-sec-s { color: var(--ink-2); }
.sk-sec-b { padding: 4px 12px 12px; border-top: 1px solid var(--hair); }
/* 알림·상태 문구 */
.pp-skin { background: var(--paper); }
.sm-off { color: var(--ink); }
.sm-leg i { border-color: var(--hair-2); }
.sm-warn, .pp-usage[data-discomfort="1"] { color: var(--amber); }
.ur-ord { background: var(--rose); color: #fff; }
.ur-safety-caution { background: var(--amber-soft); border-color: #e3b866; }
.details .cal-msg { color: var(--sage); }
.details .cal-msg.error, .cg-msg.error { color: var(--red); }
.hs-leg-no { background: repeating-linear-gradient(45deg, rgba(32, 26, 28, .25) 0 2px, transparent 2px 5px); }
/* 근거 수준 배지 (밝은 바탕용) */
.details .ev-badge { background: var(--paper); border-color: var(--hair-2); color: var(--ink-2); }
.details .ev-badge[data-level="guideline_strong"] { background: var(--sage-soft); border-color: #9cc9b0; color: var(--sage); }
.details .ev-badge[data-level="guideline_conditional"], .details .ev-badge[data-level="regulatory"], .details .ev-badge[data-level="expert_advice"] { background: var(--blue-soft); border-color: #a8c0e2; color: var(--blue); }
.details .ev-badge[data-level="human_some"] { background: var(--amber-soft); border-color: #e3c47e; color: var(--amber); }
.details .ev-badge[data-level="insufficient"], .details .ev-badge[data-level="lab_or_listing"] { opacity: 1; background: var(--paper); color: var(--ink-2); border-style: dashed; }
/* 피부 고민 화면 */
.details .tr-acc { box-shadow: none; }
.details .tr-acc > summary { color: var(--ink); }
.details .tr-alert { color: var(--red); font-weight: 600; }
.details .tr-alert[data-safety="overlap_actives"], .details .tr-alert[data-safety="itch_check"], .details .tr-alert[data-safety="follow_doctor"], .details .tr-alert[data-safety="pregnancy"] { color: var(--amber); }
.details .tr-st-observed, .details .tr-st-reported { color: var(--amber); }
.details .tr-adv-avoid .tr-sub { color: var(--red); }
.details .tr-adv-caution .tr-sub { color: var(--sage); }
.details .tr-consult { color: var(--amber); }
/* 숫자 입력이 없는 표시용 화면 접근성: 화면 낭독기 전용 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* 옷 사진 색 */
.sty-photo { border: 1px solid var(--hair); border-radius: 12px; padding: 8px 12px 10px; margin: 10px 0; }
.sty-photo legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.sty-photo-btn { display: inline-flex; align-items: center; cursor: pointer; }
.sty-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.sty-swatch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px 3px 4px; border: 1px solid var(--hair-2); border-radius: 999px; }
.sty-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.15); display: inline-block; }
/* 점검 세부 */
.chk-detail { margin: 4px 0 6px; font-size: 12.5px; }
.chk-how { margin: 2px 0 6px; }
.chk-notvisible, .chk-held { margin: 6px 0 0; }
/* 출처 목록: 한 줄에 하나 */
.tr-src-h { margin: 8px 0 2px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.tr-src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tr-src-list a { display: block; padding: 5px 8px; border-radius: 8px; background: var(--paper); text-decoration: none; color: var(--ink); border: 1px solid var(--hair); }
.tr-src-list a:hover { border-color: var(--rose); }
.tr-src-org { display: block; font-size: 11.5px; font-weight: 700; color: var(--rose); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-src-title { display: block; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-acc-b { padding: 2px 10px 10px; }
.tr-ing { padding: 10px; }
.sk-sec-b { padding: 4px 10px 10px; }
@media (max-width: 400px) { .det-body { padding: 10px 10px 14px; } .details { padding-left: calc(var(--safe-left) + 10px); padding-right: calc(var(--safe-right) + 10px); } }
.tr-src, .tr-src-list { min-width: 0; max-width: 100%; }
.tr-src-list { grid-template-columns: minmax(0, 1fr); }
.tr-src-list li, .tr-src-list a { min-width: 0; overflow: hidden; }
/* "자세히" 접기 (기본은 짧게) */
details.more { margin: 2px 0 0; }
details.more > summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; color: var(--rose, #f3a6b8); padding: 2px 0; min-height: 28px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "▾"; font-size: 10px; transition: transform 0.15s; }
details.more[open] > summary::after { transform: rotate(180deg); }
.more-b { font-size: 12.5px; line-height: 1.6; color: var(--ink-2, rgba(255,255,255,.8)); padding: 2px 0 4px; }
.more-b p { margin: 0 0 6px; }
.short-h { display: inline; }
.tr-alert details.more > summary, .tr-alert .more-b { color: inherit; }
.tr-ing-short { margin: 6px 0 2px; font-size: 13px; line-height: 1.55; }
.tr-consult-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--amber-soft, rgba(255,196,120,.15)); color: var(--amber, #ffd38a); border: 1px solid #e3b866; white-space: nowrap; }

/* v24: 패널 머리(닫기 포함)는 스크롤해도 위에 고정, 아래쪽에도 닫기 */
.side-head { position: sticky; top: -12px; z-index: 2; margin: -12px -12px 8px; padding: 12px 12px 8px; background: inherit; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.side-foot { position: sticky; bottom: -16px; margin: 12px -12px -16px; padding: 10px 12px calc(12px + var(--safe-bottom) * 0); background: linear-gradient(to top, rgba(22, 17, 18, 1) 70%, rgba(22, 17, 18, 0)); }
.side-close-bottom { width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.1); color: #fff; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.side-close-bottom:active { background: rgba(255, 255, 255, 0.2); }

/* v24: 피부 결과 카드 — AI가 먼저 쓴 결과 + 맞아요/수정 */
.st-card { background: var(--card); border: 1px solid var(--hair); border-radius: 16px; padding: 14px 14px 12px; margin: 4px 0 12px; box-shadow: var(--shadow-1); }
.st-card-user { border-color: #c9dccf; }
.st-kicker { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--rose); text-transform: uppercase; }
.st-type { margin: 0 0 4px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.25; }
.st-card .st-status { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.st-reason { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.st-auto { margin: 6px 0; padding: 8px 10px; border-radius: 10px; background: var(--paper); font-size: 12.5px; color: var(--ink-2); }
.st-auto-waiting::before, .st-auto-analyzing::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--rose); vertical-align: 1px; animation: stPulse 1.2s ease-in-out infinite; }
.st-auto-failed { background: var(--amber-soft); color: var(--amber); }
@keyframes stPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .st-auto-waiting::before, .st-auto-analyzing::before { animation: none; } }
.st-adv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 8px 0 10px; }
@media (min-width: 560px) { .st-adv-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.st-adv { border-radius: 12px; padding: 9px 11px; border: 1px solid var(--hair); }
.st-adv h5 { margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.st-adv-avoid { background: var(--red-soft); border-color: #efc3bd; } .st-adv-avoid h5 { color: var(--red); }
.st-adv-try { background: var(--sage-soft); border-color: #bfdccb; } .st-adv-try h5 { color: var(--sage); }
.st-adv-list { margin: 0; padding: 0 0 0 16px; font-size: 12.5px; line-height: 1.55; }
.st-adv-list li + li { margin-top: 4px; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; }
.st-btn { flex: 1 1 auto; min-height: 44px; min-width: 88px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.st-btn.primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.st-btn.ghost { flex: 0 1 auto; background: transparent; color: var(--ink-2); font-weight: 600; }
.st-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.st-btn:active { transform: translateY(1px); }
.st-edit { margin: 10px 0 2px; padding: 10px; border-radius: 12px; background: var(--paper); border: 1px solid var(--hair); }
.st-edit-h { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.st-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.st-opt-btn { min-height: 44px; border-radius: 10px; border: 1px solid var(--hair-2); background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.st-opt-btn[aria-pressed="true"] { background: var(--rose); border-color: var(--rose); color: #fff; }
.st-cav { margin: 0; }
/* v25: 부위별 안내 (헤어 모델 상태·눈 색상 한계) */
.area-note { margin: 6px 2px 2px; font-size: 11.5px; line-height: 1.45; color: var(--muted-on-dark); }
/* v25: 코디 그림 카드 */
.sty-tone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 2px; }
.sty-tone-l { font-size: 12.5px; font-weight: 700; margin-right: 4px; }
.sty-tone-b { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hair-2); background: var(--card); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sty-tone-b[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.sty-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 10px 0; }
.sty-opt { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--hair); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-1); }
.sty-figwrap { margin: 0; }
.sty-fig { display: block; width: 112px; height: auto; border-radius: 12px; }
.sty-figcap { margin-top: 6px; font-size: 10.5px; line-height: 1.35; color: var(--ink-2); }
.sty-optb h4 { margin: 0 0 4px; font-size: 14.5px; letter-spacing: -0.01em; }
.sty-optb p { margin: 0 0 4px; font-size: 12.5px; line-height: 1.5; }
.sty-occ { display: inline-block; font-size: 10.5px !important; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--rose-soft); color: var(--rose); }
@media (max-width: 360px) { .sty-opt { grid-template-columns: 88px minmax(0, 1fr); } .sty-fig { width: 88px; } }

/* ───────────────────────────────────────────────────────────────────────────
   v25 디자인: 색 고르기(팔레트)가 열리면 아래 조작 영역을 밝은 시트로 — 카메라 위 어두운 반투명 대신 깔끔한 흰 바탕.
   - 이 영역 안에서만 색 변수를 다시 정의 → 칩·문구·버튼이 자동으로 밝은 테마. 카메라 위 버튼(왼쪽 메뉴·위쪽)은 그대로.
   - 선택 표시: 흰 테두리 대신 장미색 테두리(밝은 바탕에서 잘 보이게), 색 동그라미는 얇은 테두리 + 선택 시 바깥 고리.
   - 대비: 본문 #201a1c / #fbf9f8 = 15.9:1, 보조 #5e5559 = 6.9:1, 장미색 #9e2f4c = 7.0:1 (WCAG 계산)
   ─────────────────────────────────────────────────────────────────────────── */
@media (orientation: portrait), (min-height: 501px) {
  body.palette-open .dock {
    --fg-on-dark: #201a1c; --muted-on-dark: #5e5559; --line-on-dark: #d6ccc8; --glass: #ffffff; --glass-strong: #ffffff;
    background: #fbf9f8; color: #201a1c;
    border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    padding-top: 14px;
  }
  body.palette-open .dock::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: #d6ccc8; }
  body.palette-open .dock .ptitle { color: #5e5559; letter-spacing: 0.08em; }
  body.palette-open .dock .swatch { border: 1px solid rgba(32, 26, 28, 0.12); box-shadow: 0 1px 2px rgba(32, 26, 28, 0.12); }
  body.palette-open .dock .swatch[aria-pressed="true"] { outline: 2.5px solid #9e2f4c; outline-offset: 3px; }
  body.palette-open .dock .chip { background: #fff; border-color: #d6ccc8; color: #201a1c; }
  body.palette-open .dock .chip[aria-pressed="true"] { background: #fff; color: #9e2f4c; border: 1.5px solid #9e2f4c; }
  body.palette-open .dock .style-group .chip { min-height: 32px; padding: 0 13px; font-size: 12px; }
  body.palette-open .dock .style-label { color: #5e5559; font-weight: 700; }
  body.palette-open .dock .intensity input { accent-color: #9e2f4c; }
  body.palette-open .dock .sel-card { background: #fff; border: 1px solid #e6dedb; }
  body.palette-open .dock .pill { background: #fff; color: #201a1c; border-color: #d6ccc8; }
  body.palette-open .dock .pill.primary { background: #9e2f4c; border-color: #9e2f4c; color: #fff; }
  body.palette-open .dock .rec-panel { border-color: #d6ccc8; background: #fff; }
  body.palette-open .dock .area-note { color: #5e5559; }
  body.palette-open .dock #areaToggle[aria-pressed="false"] { background: #fff; color: #a3261d; }
}
/* 스타일 줄: 그룹 사이 간격·가로 스크롤 */
.style-row { gap: 6px; }
.style-group { padding: 1px 0; }
/* v25: 색 고르기 시트가 열리면 옆 버튼을 카메라 영역 가운데로 (시트 내용을 가리지 않게) */
@media (orientation: portrait), (min-height: 501px) {
  body.palette-open .side-btn { top: max(calc(var(--safe-top) + 150px), calc((100% - var(--dock-h, 0px)) * 0.5 - 32px)); }
}
