:root {
  --bg: #111317;
  --panel: #1b1e24;
  --text: #e8e9ec;
  --muted: #8b909a;
  --keep: #3ecf8e;
  --reject: #f0596b;
  --accent: #6f9cff;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overscroll-behavior: none; }
main { height: 100%; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
section { height: 100%; display: flex; flex-direction: column; gap: 12px; }
section[hidden] { display: none; }
#pair, #pin-set, #unlock { justify-content: center; max-width: 420px; margin: 0 auto; }
h1 { margin: 0; font-size: 1.5rem; } h2 { margin: 0; font-size: 1.1rem; }
.hint, .muted { color: var(--muted); } .hint { margin: 0; }
.error { color: var(--reject); min-height: 1.2em; margin: 0; }
input[type=password] { font-size: 1.4rem; letter-spacing: .3em; text-align: center; padding: 12px;
  border-radius: 10px; border: 1px solid #333843; background: var(--panel); color: var(--text); }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button.primary { background: var(--accent); color: #0b0d12; padding: 12px; border-radius: 10px; font-weight: 600; }
button.danger { background: transparent; color: var(--reject); border: 1px solid var(--reject); padding: 10px; border-radius: 10px; }
button.link { background: none; color: var(--muted); text-decoration: underline; }
button.icon { background: none; font-size: 1.3rem; width: 40px; height: 40px; }
button:disabled { opacity: .35; }

.scanner { position: relative; aspect-ratio: 1; background: #000; border-radius: 14px; overflow: hidden; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 2px solid rgba(255,255,255,.6); border-radius: 12px; }

.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.spacer { flex: 1; }

#stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.card { position: absolute; inset: 0; border-radius: 16px; background: var(--panel); overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.card.animating { transition: transform .25s ease-out, opacity .25s ease-out; }
#media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#media img, #media video { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.stamp { position: absolute; top: 24px; padding: 4px 12px; border: 3px solid; border-radius: 8px;
  font-weight: 800; font-size: 1.6rem; opacity: 0; transform: rotate(-12deg); }
.stamp.keep { left: 20px; color: var(--keep); }
.stamp.reject { right: 20px; color: var(--reject); transform: rotate(12deg); }

.caption { margin: 0; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.controls { display: flex; justify-content: center; align-items: center; gap: 28px; padding-bottom: 8px; }
.round { width: 64px; height: 64px; border-radius: 50%; background: var(--panel); font-size: 1.6rem; }
.round.small { width: 46px; height: 46px; font-size: 1.2rem; }
.round.keep { color: var(--keep); } .round.reject { color: var(--reject); }

#stats-table { width: 100%; border-collapse: collapse; }
#stats-table th, #stats-table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid #262a33; }
#stats-table td { font-variant-numeric: tabular-nums; }

/* Covers everything whenever the app is not in the foreground (best effort for the app switcher). */
#veil { position: fixed; inset: 0; background: var(--bg); display: none; z-index: 10; }
body.veiled #veil { display: block; }
body.veiled main { visibility: hidden; }
