[hidden] { display: none !important; }

/* 관리자가 고친 문구를 불러오는 동안 잠깐 숨김. 스크립트가 실패해도 1.5초 뒤엔 보이게 */
.t-wait body { visibility: hidden; animation: t-reveal 0s linear 1.5s forwards; }
@keyframes t-reveal { to { visibility: visible; } }

/* 디자인 기준: DESIGN.md(공개 사이트 관찰값) — 흰 캔버스, 헤어라인, 그림자 없음, 필 버튼, 파랑은 글자/테두리에만 */
:root {
  --canvas: #ffffff;
  --surface: #f2f4f6;      /* muted surface */
  --text: #191f28;         /* strong foreground */
  --text-body: #212529;    /* foreground */
  --text-2: #4e5968;       /* secondary */
  --muted: #6b7684;
  --border: #d1d6db;
  --hairline: #e5e8eb;
  --brand: #084cc4;        /* 로고 블루 */
  --brand-press: #063d9e;
  --blue: #084cc4;
  --pill-bg: #fdfdfe;
  /* 앱 고유: 심각도 표시 */
  --ok: #3f8f5f;
  --mild: #b7862a;
  --moderate: #d06a2e;
  --severe: #d4443b;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-body);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
}
.wrap { max-width: 800px; margin: 0 auto; padding: 0 16px; }

.top { padding: 40px 0 28px; }
.top h1 { margin: 0; line-height: 0; }
.top .logo { height: 44px; width: auto; }
.top .tagline { margin: 16px 0 0; color: var(--text); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.top p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }

h2 { color: var(--text); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; }
h3 { color: var(--text); font-size: 16px; font-weight: 700; margin: 0; }
.muted { color: var(--muted); margin: -8px 0 16px; font-size: 15px; }

.card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 12px;
}
.guide-list { margin: 0; padding-left: 20px; color: var(--text-2); }
.guide-list li { margin: 8px 0; }
.guide-list b { color: var(--text); }

/* 업로드 */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 32px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.drop.over { border-color: var(--blue); }
.drop small { color: var(--muted); font-size: 13px; }
.drop-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.drop-buttons { width: 100%; max-width: 360px; flex-wrap: nowrap; }
.drop-buttons .btn { flex: 1 1 0; }
.privacy { margin: 16px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.privacy li { margin: 2px 0; }

/* 버튼: 기본은 회색 면, 강조는 로고 블루 면 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 20px; border: 0; border-radius: 12px;
  font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; cursor: pointer;
  background: var(--surface); color: var(--text-2);
}
.btn:active { background: var(--hairline); }
.btn.primary { background: var(--brand); color: #ffffff; }
.btn.primary:active { background: var(--brand-press); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.drop .btn { background: var(--canvas); border: 1px solid var(--hairline); }
.drop .btn.primary { background: var(--brand); border-color: var(--brand); }

.stage { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface); }
.stage canvas { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; }
.stage-status {
  position: absolute; left: 12px; bottom: 12px; right: 12px;
  color: var(--text-body); font-size: 14px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--hairline);
  padding: 8px 12px; border-radius: 8px;
}
.stage-status:empty { display: none; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* 측정값 */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.metric {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--surface); border-radius: 12px; padding: 16px;
}
.metric .value { color: var(--text); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.metric .label { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.metric .detail { margin: 2px 0 12px; font-size: 13px; color: var(--muted); }
.metric .badge { margin-top: auto; } /* 카드 높이가 달라도 태그는 맨 아래 정렬 */

.sev-정상 { --sev: var(--ok); }
.sev-경미 { --sev: var(--mild); }
.sev-중등도 { --sev: var(--moderate); }
.sev-심함 { --sev: var(--severe); }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 0 8px; border-radius: 40px; line-height: 20px;
  color: var(--sev); border: 1px solid var(--sev);
}

/* 결과 */
.score-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.score {
  width: 88px; height: 88px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--hairline) 0);
}
.score span {
  width: 76px; height: 76px; border-radius: 50%; background: var(--canvas);
  display: grid; place-items: center; color: var(--text); font-size: 28px; font-weight: 700;
}
.score-text { flex: 1; min-width: 220px; }
.grade { color: var(--text); font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.score-text p:last-child { margin: 0; color: var(--text-2); }

.warn {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px 24px; margin-bottom: 12px; font-size: 14px; color: var(--text-2);
}
.warn b { color: var(--text); }
.warn ul { margin: 4px 0 0; padding-left: 18px; }

.finding { border-top: 1px solid var(--hairline); padding: 16px 0; }
.finding:first-of-type { border-top: 0; padding-top: 0; }
.finding:last-child { padding-bottom: 0; }
.finding-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.region { font-size: 13px; color: var(--muted); }
.finding p { margin: 4px 0; color: var(--text-2); }
.evidence { color: var(--muted) !important; font-size: 14px; }
.causes { font-size: 14px; }
.normal-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 14px; color: var(--text-2); border: 1px solid var(--border); border-radius: 40px; padding: 4px 12px; }

.guide ol { margin: 0; padding-left: 20px; color: var(--text-2); }
.guide li { margin: 8px 0; }
.guide li b { color: var(--text); margin-right: 8px; }
.guide .pro { margin: 16px 0 0; font-size: 14px; color: var(--muted); }

.loading { display: flex; gap: 16px; align-items: center; }
.loading b { color: var(--text); }
.loading p { margin: 0; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  border: 3px solid var(--hairline); border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.error { color: var(--severe); font-weight: 600; margin: 0; }
.disclaimer { color: var(--muted); font-size: 13px; text-align: center; margin: 32px 0 48px; }

/* 카메라 (촬영 화면은 어두운 배경 유지) */
.camera {
  width: min(560px, 100vw); max-width: 100vw; max-height: 100dvh;
  padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: #191f28; color: #ffffff;
}
.camera::backdrop { background: rgba(25, 31, 40, .6); }
.cam-view { position: relative; background: #000; }
.cam-view video { display: block; width: 100%; max-height: 72dvh; object-fit: contain; }
.cam-view video.mirror { transform: scaleX(-1); }
.cam-guide { position: absolute; inset: 0; pointer-events: none; }
.cam-guide .line { position: absolute; left: 8%; right: 8%; border-top: 1px dashed rgba(255, 255, 255, .7); }
.cam-guide .top { top: 6%; }
.cam-guide .bottom { bottom: 6%; }
.cam-guide .hint {
  position: absolute; top: 8%; left: 0; right: 0; text-align: center;
  font-size: 13px; color: rgba(255, 255, 255, .85);
}
.cam-count {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 96px; font-weight: 700; color: #ffffff;
}
.cam-bar { display: flex; align-items: center; gap: 8px; padding: 12px; flex-wrap: wrap; justify-content: space-between; }
.cam-bar .btn { height: 40px; padding: 0 16px; background: rgba(255, 255, 255, .12); color: #ffffff; }
.timer { display: flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 100px; padding: 3px; }
.timer button {
  border: 0; background: transparent; color: #ffffff; font: inherit; font-size: 13px;
  padding: 4px 12px; border-radius: 100px; cursor: pointer;
}
.timer button.on { background: #ffffff; color: #191f28; font-weight: 600; }
.snap {
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  background: #ffffff; border: 4px solid rgba(255, 255, 255, .35); background-clip: padding-box;
}

/* 사진을 올린 뒤에는 업로드 안내 숨김, 모바일에서 버튼 나란히 */
.drop[hidden] + .privacy { display: none; }
.actions .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
@media (min-width: 600px) { .actions .btn { flex: 0 0 auto; min-width: 128px; } }

.save-row { display: flex; margin: 4px 0 12px; }
.save-row .btn { flex: 1; }

/* 내 기록 */
.history-head { display: flex; justify-content: space-between; align-items: baseline; }
.history-head h2 { margin-bottom: 8px; }
.link { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { display: flex; align-items: center; border-top: 1px solid var(--hairline); }
.history-list li:first-child { border-top: 0; }
.history-item {
  flex: 1; display: flex; align-items: center; gap: 16px; padding: 14px 0;
  border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: inherit;
}
.h-score { width: 52px; font-size: 24px; font-weight: 700; color: var(--brand); }
.h-body { display: flex; flex-direction: column; }
.h-grade { font-weight: 600; color: var(--text); }
.h-date { font-size: 13px; color: var(--muted); }
.trend { margin-left: 6px; font-size: 13px; font-weight: 600; }
.trend.up { color: var(--ok); }
.trend.down { color: var(--severe); }
.h-del { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 12px; cursor: pointer; }
.record-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 14px 20px; margin-bottom: 12px; font-weight: 600; color: var(--text);
}
.record-bar .link { color: var(--brand); font-weight: 600; }

/* 개인정보처리방침 */
.policy p, .policy li { color: var(--text-2); font-size: 15px; }
.policy ol, .policy ul { padding-left: 20px; margin: 0; }
.policy li { margin: 6px 0; }
.policy a { color: var(--brand); }
.table-wrap { overflow-x: auto; margin: 12px 0; }
.policy table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.policy th, .policy td { text-align: left; vertical-align: top; padding: 10px 8px; border-top: 1px solid var(--hairline); color: var(--text-2); }
.policy th { color: var(--text); font-weight: 600; background: var(--surface); }
.disclaimer a { color: var(--muted); }
