:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --line: #d9dde3;
  --accent: #1f5fd1;
  --accent-text: #ffffff;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --good: #1a6b3c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --card: #1b1e24;
    --text: #eceef2;
    --muted: #a0a7b3;
    --line: #333842;
    --accent: #6ea0ff;
    --accent-text: #0b1220;
    --bad: #ffb4ab;
    --bad-bg: #3a1614;
    --good: #7fd6a2;
  }
}
* { box-sizing: border-box; }
/* 속성 선택자가 없으면 아래 display 지정이 hidden을 이긴다. */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
label:first-of-type { margin-top: 0; }
/* 16px 미만이면 iOS가 입력란에 초점이 갈 때 화면을 확대한다. */
input[type="text"], select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
button, .file-label {
  min-height: 48px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
button.primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}
button:disabled { opacity: 0.5; cursor: default; }
button.link {
  display: block;
  margin: 16px auto 0;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
  text-decoration: underline;
}
form button.primary, #shutter { width: 100%; margin-top: 16px; }
.row { display: flex; gap: 8px; margin-top: 16px; }
.row > * { flex: 1; }
.list { list-style: none; margin: 0; padding: 0; }
.list button {
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
  font-weight: 400;
  /* 이름은 누구나 만든다 — 긴 이름이 줄을 밀어내지 않게. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notice, .field-error {
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.notice p { margin: 0 0 8px; }
.who { margin: 0 0 12px; overflow-wrap: anywhere; }
.who span { color: var(--muted); }
.frame {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  /* 메타데이터가 오기 전에도 자리를 잡아 둔다 (오면 비디오의 실제 비율을 따른다). */
  min-height: 240px;
  /* 높이를 묶은 비디오가 틀보다 좁을 때 가운데에 오게. */
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 폰 전면 카메라는 세로로 긴 그림을 준다. 폭에 맞추면 틀이 화면보다 길어져 찍기 버튼이 스크롤 아래로 밀린다.
   그래서 높이를 "화면 − 나머지 요소(제목·이름·안내·버튼 ≈ 270px)"로 묶고 폭은 비율대로 줄인다.
   자르지 않는다(object-fit: cover 금지) — 보이는 그림과 올라가는 그림이 같아야 한다. */
.frame video, .frame img {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: max(240px, calc(100vh - 270px));
  max-height: max(240px, calc(100dvh - 270px));
}
/* 거울처럼 보이게 하는 것은 화면에서만. 올리는 그림은 뒤집지 않는다. */
.mirror { transform: scaleX(-1); }
/* 타원은 틀의 가운데 62%×80% 칸 안에 3:4 비율을 지킨 채 들어간다 (background-size: contain).
   폭이나 높이 하나로만 잡으면 세로로 긴 폰 화면이나 가로로 긴 노트북 화면 중 한쪽에서 틀을 넘거나 찌그러진다. */
.guide {
  position: absolute;
  inset: 10% 19%;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 400'%3E%3Cellipse cx='150' cy='200' rx='144' ry='194' fill='none' stroke='%23000' stroke-opacity='.35' stroke-width='9'/%3E%3Cellipse cx='150' cy='200' rx='144' ry='194' fill='none' stroke='%23fff' stroke-opacity='.9' stroke-width='4'/%3E%3C/svg%3E");
  pointer-events: none;
}
.hint { margin: 8px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.file-label { display: flex; align-items: center; justify-content: center; margin: 0 0 8px; color: var(--text); }
#file { width: 100%; }
.result { font-size: 18px; font-weight: 600; margin: 24px 0 8px; overflow-wrap: anywhere; }
.result.good { color: var(--good); }
.result.bad { color: var(--bad); }
