:root {
  --teal: #1a4243;
  --teal-2: #2d7a7b;
  --cyan: #3ddad7;
  --coral: #ef6f5e;
  --red: #c1272d;
  --cream: #f7f3eb;
  --ink: #1d2626;
  --muted: #5b6767;
  --line: #e3ddd2;
  --pass: #11795a;
  --pass-bg: #e6f6ef;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --fail: #b3261e;
  --fail-bg: #fdecea;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--teal-2); }
img { max-width: 100%; height: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { max-width: 640px; margin: 0 auto; padding: 18px 18px 6px; text-align: center; }
.brand img { width: 220px; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 6px 0 6px; color: var(--teal); letter-spacing: -0.01em; }
.lede { margin: 0 auto 10px; color: var(--muted); max-width: 32em; }
.privacy-badge { display: inline-flex; gap: 8px; align-items: flex-start; text-align: left; background: #fff; border: 1px solid var(--line); color: var(--teal); padding: 8px 12px; border-radius: 999px; font-size: 0.9rem; margin: 4px 0 0; }
.privacy-badge svg { flex: none; margin-top: 2px; }

main { max-width: 640px; margin: 0 auto; padding: 8px 14px 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 14px 0; box-shadow: 0 1px 2px rgba(26, 66, 67, 0.05); }
.card h2 { font-size: 1.2rem; margin: 0 0 12px; color: var(--teal); display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 0.95rem; flex: none; }

.doc-list { display: grid; gap: 8px; }
.doc-option { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; color: inherit; }
.doc-option:hover { border-color: #cfc6b6; }
.doc-option[aria-checked="true"] { border-color: var(--teal-2); background: #f0f7f7; }
.doc-option .dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #9aa7a7; margin-top: 2px; }
.doc-option[aria-checked="true"] .dot { border: 6px solid var(--teal-2); }
.doc-option .t { font-weight: 650; display: block; }
.doc-option .s { color: var(--muted); font-size: 0.9rem; display: block; }
.doc-option .tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--cream); color: var(--teal); margin-left: 6px; vertical-align: 1px; }

.spec-card { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; font-size: 0.95rem; }
.spec-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; }
.spec-card dt { color: var(--muted); }
.spec-card dd { margin: 0; font-weight: 550; }
.spec-card ul { margin: 6px 0 8px; padding-left: 20px; }
.spec-card .src { font-size: 0.85rem; color: var(--muted); }

.tips { margin: 0 0 14px; padding-left: 20px; }
.tips li { margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px; font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; border: 2px solid transparent; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: #a71f24; }
.btn.secondary { background: #fff; color: var(--teal); border-color: var(--teal-2); }
.btn.secondary:hover { background: #f0f7f7; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn.block { width: 100%; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }
.link-btn { background: none; border: 0; color: var(--teal-2); text-decoration: underline; font: inherit; cursor: pointer; padding: 4px; }
.inline-check { display: inline-flex; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--muted); }

.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.banner.pass { background: var(--pass-bg); color: var(--pass); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.fail { background: var(--fail-bg); color: var(--fail); }
.banner p { margin: 4px 0 0; font-weight: 400; color: var(--ink); }

.result-grid { display: grid; gap: 14px; }
@media (min-width: 600px) { .result-grid { grid-template-columns: 220px 1fr; align-items: start; } }
.preview-wrap { margin: 0; text-align: center; }
.preview-wrap canvas { width: 100%; max-width: 260px; height: auto; border-radius: 6px; border: 1px solid var(--line); background: #eee; }
.preview-wrap figcaption { margin-top: 6px; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 9px 10px; border-radius: 10px; background: #fafafa; border: 1px solid #eee; }
.check-list .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 0.8rem; font-weight: 700; margin-top: 1px; }
.check-list li.pass .ic { background: var(--pass); }
.check-list li.warn .ic { background: #c98a00; }
.check-list li.fail .ic { background: var(--fail); }
.check-list li.fail { background: var(--fail-bg); border-color: #f5c6c2; }
.check-list li.warn { background: var(--warn-bg); border-color: #f2dca8; }
.check-list .lbl { font-weight: 650; }
.check-list .det { font-size: 0.92rem; }
.check-list .adv { font-size: 0.9rem; color: var(--ink); margin-top: 2px; }

.manual { margin-top: 16px; }
.manual h3, .downloads h3, .next-help h3 { font-size: 1rem; margin: 0 0 8px; color: var(--teal); }
.manual label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.manual input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--teal-2); }
.downloads { margin-top: 16px; display: grid; gap: 10px; }
.downloads .note { font-size: 0.9rem; color: var(--muted); margin: 0; }
.downloads .note.ok { color: var(--pass, #1d7a46); font-weight: 600; }
.downloads .note.bad { color: var(--fail, #b3261e); font-weight: 600; }
.next-help { margin-top: 14px; font-size: 0.95rem; }
.next-help ol, .next-help ul { padding-left: 20px; margin: 6px 0; }

.cta { background: var(--teal); color: #fff; border: 0; }
.cta h2 { color: #fff; }
.cta p { color: #d9ecec; }

.foot { max-width: 640px; margin: 0 auto; padding: 0 18px 32px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Camera */
.camera { position: fixed; inset: 0; background: #0d1414; z-index: 50; display: flex; flex-direction: column; color: #fff; }
.camera[hidden] { display: none; }
.camera-stage { position: relative; flex: 1; overflow: hidden; }
.camera-stage video, .camera-stage .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.camera-stage video { object-fit: contain; background: #000; }
.camera-stage.mirror video { transform: scaleX(-1); }
.live-hint { margin: 0; padding: 10px 16px; text-align: center; font-weight: 650; min-height: 2.6em; background: rgba(0, 0, 0, 0.55); }
.live-hint.good { color: #7cf0c4; }
.live-hint.adjust { color: #ffd479; }
.camera-bar { display: flex; justify-content: space-around; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #000; }
.icon-btn { background: rgba(255, 255, 255, 0.12); border: 0; color: #fff; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--coral); cursor: pointer; }
.shutter:active { transform: scale(0.95); }
.timer-toggle { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; background: rgba(0, 0, 0, 0.55); padding: 6px 10px; border-radius: 999px; font-size: 0.85rem; display: flex; gap: 6px; align-items: center; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 6rem; font-weight: 800; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }

.busy { position: fixed; inset: 0; background: rgba(247, 243, 235, 0.92); z-index: 60; display: grid; place-content: center; text-align: center; color: var(--teal); font-weight: 600; }
.busy[hidden] { display: none; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #cfe3e3; border-top-color: var(--teal-2); margin: 0 auto 12px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
