/* 퍼스널 컬러 측정 — 라이트/다크 자동 대응, 시스템 고딕 우선 */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.10);
  --accent: #0071e3;
  --ok: #1d8a4e;
  --warn: #b8730a;
  --crit: #c0392b;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0f;
    --surface: #17171c;
    --surface-2: #202027;
    --text: #f5f5f7;
    --text-2: #98989f;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #0a84ff;
    --ok: #32d17a;
    --warn: #ffb340;
    --crit: #ff6961;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
    'Noto Sans KR', 'Malgun Gothic', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.screen { display: none; }
.screen.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 타이포 ─────────────────────────────────────────────────────────────── */

.hero { padding: 24px 4px 8px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}
h1 { margin: 0 0 14px; font-size: 34px; line-height: 1.24; letter-spacing: -0.02em; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
h3 { margin: 20px 0 8px; font-size: 15px; font-weight: 650; color: var(--text-2); }
.lede { margin: 0; color: var(--text-2); font-size: 15px; }
.fineprint { margin: 12px 4px 0; font-size: 13px; color: var(--text-2); text-align: center; }

/* ── 카드 ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.card.privacy { background: var(--surface-2); box-shadow: none; }
.card p { margin: 0 0 8px; font-size: 15px; }
.card p:last-child { margin-bottom: 0; }

.checklist { margin: 0; padding-left: 18px; font-size: 14.5px; color: var(--text-2); }
.checklist li { margin-bottom: 7px; }
.checklist li:last-child { margin-bottom: 0; }
.checklist b { color: var(--text); }

/* ── 모드 선택 ──────────────────────────────────────────────────────────── */

.mode {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  margin-bottom: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.mode:last-child { margin-bottom: 0; }
.mode:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.mode input { margin-top: 4px; accent-color: var(--accent); flex: none; }
.mode-body { display: flex; flex-direction: column; gap: 4px; }
.mode-title { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mode-desc { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }

.badge {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge-a { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge-b { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge-c { background: color-mix(in srgb, var(--crit) 18%, transparent); color: var(--crit); }

/* ── 버튼 ───────────────────────────────────────────────────────────────── */

button {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  padding: 15px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.06s;
}
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.4; cursor: default; }
.primary { background: var(--accent); color: #fff; margin-top: 8px; }
.ghost { background: transparent; color: var(--text-2); margin-top: 6px; }

/* ── 촬영 화면 ──────────────────────────────────────────────────────────── */

.stage { position: relative; margin: 8px 0 12px; }
.mirror {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  transform: scaleX(-1);
}
#video, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 안내 문구는 위쪽에 둔다 — 아래는 기준면(흰 종이) 가이드 박스 자리다. */
.hint {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 제작자 표기 — 화면 밖(main 끝)에 한 번만. 측정 흐름을 방해하지 않게 조용히. */
.credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 10px;
  padding-bottom: env(safe-area-inset-bottom);
  font-size: 12.5px;
  color: var(--text-2);
}
.credit img { border-radius: 5px; opacity: 0.9; }
.credit b { color: var(--text-1); font-weight: 600; }

.hint.ok { background: rgba(29, 138, 78, 0.85); }
.hint.bad { background: rgba(199, 44, 32, 0.9); }

/* 정확도 경고 — 무엇이 문제이고 어떻게 바꾸면 되는지. 촬영을 막지는 않는다. */
.live-guide {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.10);
  border: 1px solid rgba(255, 69, 58, 0.32);
  font-size: 13px;
  line-height: 1.45;
}
.live-guide b { color: var(--crit, #c72c20); font-weight: 650; }
.live-guide span { color: var(--text-2); }

/* 경고를 무시하고 찍는 버튼 — 눌러도 된다는 건 알리되 기본 동작처럼 보이진 않게. */
button.primary.override {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid rgba(255, 69, 58, 0.45);
}

/* 자세 수치 — 가이드선 아래에서 조용히 확인만 시켜준다(안내 문구를 가리지 않게 하단). */
.pose-readout {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  padding: 5px 12px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  pointer-events: none;
}

.live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.live-meta span {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ── 진행 ───────────────────────────────────────────────────────────────── */

.spinner {
  width: 34px; height: 34px;
  margin: 60px auto 18px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status { text-align: center; color: var(--text-2); font-size: 15px; }

/* ── 결과 ───────────────────────────────────────────────────────────────── */

.verdict {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.verdict .season-name { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 4px; }
.verdict .tagline { color: var(--text-2); font-size: 14.5px; margin: 0 0 16px; }
.verdict .conf-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
}
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.crit { background: color-mix(in srgb, var(--crit) 16%, transparent); color: var(--crit); }

.axis-row { margin-bottom: 16px; }
.axis-row:last-child { margin-bottom: 0; }
.axis-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.axis-label b { color: var(--text); font-weight: 650; }
.axis-track {
  position: relative;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
}
.axis-track::after {
  content: '';
  position: absolute; left: 50%; top: -3px; bottom: -3px;
  width: 1px; background: var(--line);
}
.axis-ci {
  position: absolute; top: 2px; height: 6px;
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px;
}
.axis-dot {
  position: absolute; top: -2px;
  width: 14px; height: 14px; margin-left: -7px;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
}
.axis-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); margin-top: 5px; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 68px 1fr 48px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-row .val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.swatch { text-align: center; }
.swatch i {
  display: block;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: 5px;
}
.swatch span { font-size: 11.5px; color: var(--text-2); display: block; line-height: 1.35; }

.measure-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.measure-table th, .measure-table td {
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line);
}
.measure-table th { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.measure-table td { font-variant-numeric: tabular-nums; }
.measure-table tr:last-child td { border-bottom: none; }
.dot {
  display: inline-block; width: 13px; height: 13px;
  border-radius: 4px; border: 1px solid var(--line);
  vertical-align: -2px; margin-right: 7px;
}

.qc-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.qc-item:last-child { border-bottom: none; }
.qc-item .mark { flex: none; font-weight: 700; width: 16px; }
.qc-item .mark.ok { color: var(--ok); }
.qc-item .mark.no { color: var(--crit); }
.qc-item .body b { display: block; font-weight: 600; }
.qc-item .body span { color: var(--text-2); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 기술 정보는 기본으로 접어 둔다 — 측정값 표·품질 체크·원시 데이터.
   대부분의 사용자에게는 소음이지만, 궁금한 사람은 한 번에 다 볼 수 있어야 한다. */
details.raw { margin-top: 10px; }
details.raw summary { cursor: pointer; font-size: 13.5px; color: var(--text-2); }
details.raw[open] {
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
details.raw h3 { margin: 18px 0 8px; font-size: 14.5px; }
details.raw > summary + h3 { margin-top: 14px; }
details.raw pre {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  font-size: 11.5px;
  line-height: 1.5;
}
