:root {
  --paper: #fbfbfd;
  --paper-2: #f3f4f8;
  --panel: #ffffff;
  --ink: #0b0d12;
  --ink-2: #2c313b;
  --muted: #5a6270;
  --faint: #98a0ad;
  --line: #e7e9ef;
  --line-2: #d7dbe3;
  --brand: #2ba6e0;
  --brand-ink: #147bb0;
  --brand-soft: #e6f4fc;
  --good: #15803d;
  --ok: #0fa968;
  --danger: #dc2626;
  --warn: #b45309;
  --warn-bg: #fef6e7;
  --warn-line: #f3d9a4;
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sh-sm: 0 1px 2px rgba(11,13,18,.05);
  --sh-md: 0 12px 30px -14px rgba(11,13,18,.20);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
.app {
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px 32px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.is-hidden { display: none !important; }

/* ---- header / brand ---- */
.head { text-align: center; padding-top: 4px; margin-bottom: 18px; }
.brand-mark { display: block; height: 34px; width: auto; margin: 0 auto 12px; }
.head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em; font-size: 23px; color: var(--ink); }
.sub { margin: 6px auto 0; color: var(--muted); font-size: 14px; max-width: 34ch; }

/* ---- account chip ---- */
.account { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.plan-chip {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line-2); padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.plan-chip.is-low { color: var(--danger); border-color: #f3c6c6; background: #fdf1f1; }
.link-btn {
  background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13.5px; padding: 4px;
}
.link-btn:active, .link-btn:hover { color: var(--ink); }

/* ---- status ---- */
.status { text-align: center; font-size: 14px; color: var(--muted); margin: 14px 0; min-height: 20px; }
.status.ok { color: var(--good); font-weight: 600; }
.status.err { color: var(--danger); }
.status.warn { color: var(--warn); font-weight: 600; }

/* ---- camera / scan ---- */
.video-wrap {
  position: relative; width: 100%; aspect-ratio: 3 / 2;
  background: #0b0d12; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--sh-md);
}
video { width: 100%; height: 100%; object-fit: cover; }
.frame {
  position: absolute; inset: 9% 7%; border: 2.5px solid rgba(255,255,255,.9);
  border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 100vmax rgba(5,7,13,.35);
}

/* ---- banners / camera help ---- */
.banner { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px;
  color: var(--warn); font-size: 13.5px; line-height: 1.4; font-weight: 500; }
.banner b { color: var(--warn); }
.banner.danger { color: #991b1b; background: #fee2e2; border-color: #fca5a5; }
.cam-help { margin: 12px 0 0; padding: 14px 16px; border-radius: 12px; text-align: left;
  background: var(--warn-bg); border: 1px solid var(--warn-line); }
.cam-help-title { margin: 0 0 8px; font-weight: 600; font-size: 14px; color: var(--warn); }
.cam-help-steps { margin: 0; padding-left: 20px; color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.cam-help-steps li { margin: 2px 0; }

/* ---- buttons ---- */
.btn {
  display: block; width: 100%; font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); cursor: pointer; margin-top: 12px; box-shadow: var(--sh-sm);
}
.btn.solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.solid:active { background: var(--brand-ink); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: none;
}
.btn-google:active { background: var(--paper-2); }
.g-icon {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  -webkit-mask: radial-gradient(circle 4.5px at center, transparent 98%, #000 100%);
          mask: radial-gradient(circle 4.5px at center, transparent 98%, #000 100%);
}

/* ---- auth + limit gates ---- */
#auth-view, #limit-view {
  display: flex; flex-direction: column; gap: 14px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 22px; box-shadow: var(--sh-md);
}
#auth-view .btn, #limit-view .btn { margin-top: 0; }
.gate-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%; padding: 14px 13px; border-radius: 11px; font: inherit; font-size: 16px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
}
.auth-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-hint { color: var(--muted); font-size: 13px; margin: -2px 0 0; }
.auth-links { display: flex; flex-direction: column; gap: 6px; }
.limit-icon { font-size: 40px; }

/* ---- review: captured checklist ---- */
.captured { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); box-shadow: var(--sh-sm); }
.cap-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: 15px; color: var(--ink); }
.cap-row + .cap-row { border-top: 1px solid var(--line); }
.cap-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: var(--paper); border: 1px solid var(--line); color: var(--faint); flex: none; }
.cap-row.on { font-weight: 600; }
.cap-row.on .cap-mark { background: var(--good); border-color: var(--good); color: #fff; }
.cap-sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }

/* ---- done / delivery ---- */
.done { text-align: center; padding: 24px 0; }
.done .check { width: 60px; height: 60px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px; }
.done .check.warn { background: var(--warn); }
.done .check.wait { background: var(--line); color: var(--muted); }
.again { margin-top: 8px; padding: 16px 18px; background: #fef8ec; border: 1px solid #f3e3bd; border-radius: 14px; }
.again strong { display: block; color: var(--ink); font-size: 15px; }
.again p { font-size: 13.5px; color: var(--muted); margin: 4px 0 10px; }
.again ol { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.again ol li { margin: 5px 0; }

.foot { text-align: center; font-size: 12px; color: var(--faint); margin-top: auto; padding-top: 18px; }
