/* 관상경 — 애플 스타일. 넓은 여백, 큰 타이포, 반투명 내비, 라이트와 다크 양쪽. */

:root {
  color-scheme: light;
  --bg: #fbfbfd;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hair: rgba(0, 0, 0, .10);
  --nav-bg: rgba(251, 251, 253, .72);
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 113, 227, .10);
  --good: #1d8a4e;
  --warn: #9a5b00;
  --stage: #0b0b0d;
  --shadow: 0 2px 10px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .06);
  --r-card: 20px;
  --r-stage: 28px;
  --maxw: 1024px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro KR', 'Apple SD Gothic Neo', system-ui, 'Noto Sans KR', sans-serif;
  --sj-1: #5ac8fa;
  --sj-2: #34c759;
  --sj-3: #ff9f0a;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --bg-alt: #0a0a0c;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #8e8e93;
    --hair: rgba(255, 255, 255, .14);
    --nav-bg: rgba(0, 0, 0, .70);
    --accent: #2997ff;
    --accent-ink: #00122b;
    --accent-soft: rgba(41, 151, 255, .16);
    --good: #30d158;
    --warn: #ffd60a;
    --stage: #000000;
    --shadow: none;
    --sj-1: #64d2ff;
    --sj-2: #30d158;
    --sj-3: #ffd60a;
  }
}

* { box-sizing: border-box; }
section[id], #measure, #reading { scroll-margin-top: 64px; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  word-break: keep-all;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -.025em; line-height: 1.12; font-weight: 700; }
img, canvas, video, svg { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(22px, env(safe-area-inset-left, 0px));
  padding-right: max(22px, env(safe-area-inset-right, 0px));
}
.container-wide { max-width: 1120px; }
.container.narrow { max-width: 720px; }

/* ---------- 내비게이션 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
  padding-top: env(safe-area-inset-top, 0px);
}
.nav.scrolled { border-bottom-color: var(--hair); }
.nav-in {
  max-width: var(--maxw); margin-inline: auto; min-height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding-left: max(22px, env(safe-area-inset-left, 0px));
  padding-right: max(22px, env(safe-area-inset-right, 0px));
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 26px; margin-left: auto; }
.nav-links a { font-size: 13px; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav .btn-sm { margin-left: 22px; }
@media (max-width: 720px) { .nav-links { display: none; } .nav .btn-sm { margin-left: auto; } }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 23px;
  border: 0; border-radius: 980px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-size: 16px; font-weight: 500; letter-spacing: -.01em;
  transition: filter .2s ease, transform .2s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; filter: none; }
.btn-sm { min-height: 32px; padding: 5px 15px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 12px 30px; font-size: 18px; }
.btn-light { background: #fff; color: #1d1d1f; }
.textlink {
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  color: var(--accent); font-size: 16px;
}
.textlink::after { content: ' ›'; }
.textlink:hover { text-decoration: underline; }

/* ---------- 히어로 ---------- */
.hero { padding-block: clamp(48px, 9vw, 96px) clamp(40px, 7vw, 80px); text-align: center; }
.eyebrow { font-size: 19px; font-weight: 600; color: var(--accent); letter-spacing: -.01em; }
.hero h1 { font-size: clamp(40px, 8.4vw, 76px); margin-top: 8px; }
.lede { font-size: clamp(18px, 2.4vw, 23px); color: var(--ink-2); max-width: 36ch; margin: 18px auto 0; line-height: 1.42; }
.cta { display: flex; flex-wrap: wrap; gap: 14px 26px; justify-content: center; align-items: center; margin-top: 30px; }

/* ---------- 측정 무대 ---------- */
.stage {
  position: relative; margin-top: clamp(32px, 5vw, 56px);
  background: var(--stage); border-radius: var(--r-stage); overflow: hidden;
  aspect-ratio: 4 / 3; max-height: 72vh;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
@media (max-width: 560px) { .stage { aspect-ratio: 3 / 4; } }

.poster, .live, .result { position: absolute; inset: 0; display: none; }
.stage[data-state="idle"] .poster,
.stage[data-state="loading"] .poster,
.stage[data-state="error"] .poster { display: grid; }
.stage[data-state="live"] .live,
.stage[data-state="measuring"] .live { display: block; }
.stage[data-state="result"] .result { display: block; }

.poster {
  place-items: center; align-content: center; gap: 14px; text-align: center;
  padding: 28px max(22px, env(safe-area-inset-left, 0px));
  background: radial-gradient(120% 90% at 50% 0%, #1c1c22 0%, #0b0b0d 62%);
  color: #fff;
}
.poster-face { width: clamp(104px, 17vw, 150px); height: auto; }
.poster-title { font-size: clamp(21px, 3vw, 27px); font-weight: 600; letter-spacing: -.02em; }
.poster-sub { font-size: 15px; color: rgba(255, 255, 255, .66); max-width: 34ch; line-height: 1.5; }
.poster .btn { margin-top: 6px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.mirror { position: relative; width: 100%; height: 100%; transform: scaleX(-1); }
.mirror video, .mirror canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.result .mirror { transform: none; }
.result .mirror.flip { transform: scaleX(-1); }

/* 얼굴 맞춤 타원: 준비되면 초록으로 그려진다 */
.guide { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.guide svg { width: 50%; height: 84%; overflow: visible; }
@media (max-width: 560px) { .guide svg { width: 74%; height: 62%; } }
.guide ellipse {
  fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.2;
  stroke-dasharray: 3 3; transition: stroke .3s ease, stroke-width .3s ease;
}
.guide[data-s="ok"] ellipse { stroke: var(--sj-2); stroke-width: 1.8; stroke-dasharray: none; }
.guide[data-s="measuring"] ellipse {
  stroke: var(--sj-2); stroke-width: 2.4; stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--prog, 0) * 1);
  transition: stroke-dashoffset .15s linear;
}

.pill {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: none; align-items: center; gap: 8px;
  max-width: min(92%, 440px);
  padding: 9px 16px; border-radius: 980px;
  background: rgba(0, 0, 0, .58); color: #fff; font-size: 14px; line-height: 1.35;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.stage[data-state="live"] .pill, .stage[data-state="measuring"] .pill, .stage[data-state="error"] .pill { display: flex; }
.stage[data-state="live"] .pill, .stage[data-state="measuring"] .pill { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #ffd60a; flex: none; }
.pill[data-tone="ok"] .dot { background: #30d158; }
.pill[data-tone="bad"] .dot { background: #ff453a; }

.shutter {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: none; width: 60px; height: 60px; padding: 0;
  border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9); background: transparent; cursor: pointer;
}
.stage[data-state="live"] .shutter, .stage[data-state="measuring"] .shutter { display: block; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transform: scale(.86); transition: transform .2s ease, background .2s ease; }
.shutter:hover span { transform: scale(.92); }
.shutter:disabled { cursor: default; opacity: .45; }
.shutter:disabled span { transform: scale(.78); }
.stage[data-state="measuring"] .shutter span { background: #ff453a; transform: scale(.5); border-radius: 10px; }

.closebtn {
  position: absolute; display: none; padding: 0; cursor: pointer;
  top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px));
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .5); color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  place-items: center;
}
.stage[data-state="live"] .closebtn, .stage[data-state="measuring"] .closebtn { display: grid; }

.result .chips {
  position: absolute; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding-inline: 16px;
}
.chip {
  padding: 7px 14px; border-radius: 980px; font-size: 13px; font-weight: 500; color: #fff;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font-variant-numeric: tabular-nums;
}
.chip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; font-style: normal; }
@media (max-width: 480px) { .chip { padding: 6px 10px; font-size: 12px; } .chip i { width: 7px; height: 7px; margin-right: 5px; } .result .chips { gap: 6px; } }

.under { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: center; align-items: center; margin-top: 18px; min-height: 30px; }
.under .msg { color: var(--warn); font-size: 15px; }

/* ---------- 섹션 공통 ---------- */
.section { padding-block: clamp(56px, 9vw, 108px); }
.section.alt { background: var(--bg-alt); }
.section-title { font-size: clamp(30px, 5vw, 48px); text-align: center; }
.section-h { font-size: clamp(24px, 3.4vw, 32px); margin-top: clamp(44px, 6vw, 68px); }
.section-sub { color: var(--ink-2); margin-top: 6px; }
.prose { color: var(--ink-2); font-size: 19px; line-height: 1.6; margin-top: 20px; }
.prose + .prose { margin-top: 14px; }

.reveal { opacity: 1; transform: none; }
.js-reveal .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.js-reveal .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js-reveal .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- 결과: 판정 ---------- */
.verdict { text-align: center; }
.badge {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 26px;
  display: grid; place-items: center;
  font-size: 40px; font-weight: 700; color: #fff; line-height: 1;
  background: linear-gradient(160deg, #636366, #3a3a3c);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}
.badge[data-type="wood"] { background: linear-gradient(160deg, #34c759, #1c7a38); }
.badge[data-type="fire"] { background: linear-gradient(160deg, #ff6b4a, #c0341a); }
.badge[data-type="earth"] { background: linear-gradient(160deg, #e0a15c, #9a6420); }
.badge[data-type="metal"] { background: linear-gradient(160deg, #aeaeb2, #5f5f63); }
.badge[data-type="water"] { background: linear-gradient(160deg, #5ac8fa, #0a6ca8); }
.verdict h2 { font-size: clamp(32px, 5.6vw, 54px); margin-top: 8px; }
.tagline { font-size: 19px; color: var(--ink-2); margin-top: 10px; }
.verdict-text { font-size: 18px; color: var(--ink-2); max-width: 60ch; margin: 20px auto 0; line-height: 1.6; }

/* ---------- 결과: 카드 ---------- */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: clamp(36px, 5vw, 56px); }
.card {
  background: var(--surface); border-radius: var(--r-card); padding: clamp(22px, 3vw, 30px);
  box-shadow: var(--shadow); min-width: 0;
}
.span-12 { grid-column: span 12; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
@media (max-width: 760px) { .span-7, .span-5 { grid-column: span 12; } }
.card h3 { font-size: 22px; }
.card-sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }

.sj-bar { display: flex; gap: 3px; height: 14px; margin-top: 20px; }
.sj-bar i { display: block; height: 100%; border-radius: 3px; transition: flex-grow .7s cubic-bezier(.2,.7,.3,1); }
.sj-bar i:nth-child(1) { background: var(--sj-1); }
.sj-bar i:nth-child(2) { background: var(--sj-2); }
.sj-bar i:nth-child(3) { background: var(--sj-3); }
.sj-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 20px; }
@media (max-width: 680px) { .sj-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; } }
.sj-col h4 { font-size: 17px; display: flex; align-items: baseline; gap: 8px; }
.sj-col h4 b { font-variant-numeric: tabular-nums; }
.sj-col h4 span { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.sj-col p { font-size: 15px; color: var(--ink-2); margin-top: 6px; line-height: 1.55; }
.sj-col .key { width: 26px; height: 4px; border-radius: 2px; display: block; margin-bottom: 10px; }
.sj-col:nth-child(1) .key { background: var(--sj-1); }
.sj-col:nth-child(2) .key { background: var(--sj-2); }
.sj-col:nth-child(3) .key { background: var(--sj-3); }

.axes { display: grid; gap: 18px; margin-top: 20px; }
.axis { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) 2.1rem; align-items: center; gap: 4px 14px; }
.axis .nm { font-size: 15px; font-weight: 500; }
.axis .ds { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
.track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.fill { height: 100%; border-radius: 4px; background: var(--accent); width: 0; transition: width .8s cubic-bezier(.2,.7,.3,1); }
.axis .val { text-align: right; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .fill, .sj-bar i { transition: none; } }

.stats { display: grid; gap: 14px; margin-top: 20px; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--hair); }
.stat:last-child { border-bottom: 0; padding-bottom: 0; }
.stat .k { font-size: 14px; color: var(--ink-2); }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 6px; }

/* ---------- 결과: 부위별 ---------- */
.parts { margin-top: 24px; border-top: 1px solid var(--hair); }
.part { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 6px 28px; padding-block: 24px; border-bottom: 1px solid var(--hair); }
@media (max-width: 680px) { .part { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.part h4 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.part h4 span { display: block; font-size: 13px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.part p { font-size: 17px; color: var(--ink-2); line-height: 1.6; max-width: 62ch; }
.part p + p { margin-top: 6px; }
.part .meas { font-size: 13px; color: var(--ink-3); margin-top: 10px; font-variant-numeric: tabular-nums; }

.dark-card { background: var(--surface-2); margin-top: clamp(36px, 5vw, 52px); }
.dark-card p { color: var(--ink-2); margin-top: 8px; max-width: 54ch; }
.dark-card .row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 20px; }
.dark-card .btn-light { background: var(--accent); color: var(--accent-ink); }
.note { font-size: 14px; color: var(--good); }

.table-card { margin-top: 16px; padding: 0; }
.table-card summary { padding: 20px clamp(22px, 3vw, 30px); cursor: pointer; font-size: 17px; font-weight: 500; list-style: none; }
.table-card summary::-webkit-details-marker { display: none; }
.table-card summary::after { content: '＋'; float: right; color: var(--ink-3); }
.table-card[open] summary::after { content: '－'; }
.tbl { overflow-x: auto; padding: 0 clamp(22px, 3vw, 30px) 24px; }
.mt { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.mt th, .mt td { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.mt thead th { font-size: 12px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.mt tbody th { font-weight: 500; white-space: nowrap; }
.mt td:last-child { color: var(--ink-3); min-width: 15rem; }

.disclaimer { margin-top: 36px; font-size: 13px; color: var(--ink-3); line-height: 1.6; max-width: 72ch; }

/* ---------- 작동 방식 ---------- */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: clamp(36px, 5vw, 56px); }
@media (max-width: 760px) { .how { grid-template-columns: minmax(0, 1fr); } }
.how-item { background: var(--surface); border-radius: var(--r-card); padding: clamp(24px, 3vw, 32px); box-shadow: var(--shadow); }
.how-k { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.how-item h3 { font-size: 22px; margin-top: 10px; }
.how-item p { font-size: 16px; color: var(--ink-2); margin-top: 10px; line-height: 1.6; }

/* ---------- 바닥 ---------- */
.footer { background: var(--bg-alt); border-top: 1px solid var(--hair); padding-block: 32px calc(32px + env(safe-area-inset-bottom, 0px)); }
.footer p { font-size: 13px; color: var(--ink-3); }
.footer p + p { margin-top: 6px; }
