:root {
  --bg: #111;
  --fg: #f2f2f2;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --card: #1b1b1b;
  --accent: #ffd34d;
  --danger: #ff6b6b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 24px 0 8px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.privacy { margin-top: 24px; text-align: center; }

button, .btn { font: inherit; color: inherit; cursor: pointer; }
.btn {
  display: block; text-align: center; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); margin: 10px 0;
}
.block { width: 100%; }
.btn.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.btn:disabled { opacity: .6; }
.ghost { background: none; border: 0; padding: 12px 4px; color: var(--accent); }
.danger { color: var(--danger); }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: block; margin: 16px 0 6px; }
input[type=password] {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font: inherit;
}

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.thumb { padding: 0; border: 0; background: var(--card); aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: var(--card); display: block; margin: 4px 0 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.card dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.card dd { margin: 0; }
.card ul { margin: 0; padding-left: 18px; }

/* Shoot: full-bleed camera with controls floating on top. */
.view.shoot { max-width: none; padding: 0; position: fixed; inset: 0; background: #000; overflow: hidden; }
.stage {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  /* --ar = video width/height, set from JS so the stage fits the screen at the camera's aspect. */
  width: min(100vw, calc(100dvh * var(--ar, 0.75))); aspect-ratio: var(--ar, 0.75);
}
.stage video, .stage #ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage #ghost { pointer-events: none; }
.thirds {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.shoot-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; flex-wrap: wrap;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
}
.pill {
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font-size: 14px;
}
.pill[aria-pressed=false] { opacity: .55; }
.shoot-card {
  position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 60px);
  max-height: 40dvh; overflow: auto; font-size: 14px;
}
.shoot-card .card, .shoot-card p { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.15); margin: 0; padding: 10px 12px; border-radius: 12px; }
.shoot-card .card dd { font-size: 14px; }
.shoot-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 16px); background: linear-gradient(transparent, rgba(0,0,0,.6));
}
.opacity { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; flex: 1; }
.opacity input { flex: 1; accent-color: var(--accent); }
.shutter {
  width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.85);
  box-shadow: 0 0 0 3px rgba(0,0,0,.4); flex: none;
}
.shutter:active { transform: scale(.94); }
.cam-error { position: absolute; left: 16px; right: 16px; top: 40%; text-align: center; background: var(--card); padding: 16px; border-radius: 12px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare figure { margin: 0; }
.compare img { width: 100%; max-height: 65vh; object-fit: contain; background: var(--card); border-radius: 8px; display: block; }
.compare figcaption { text-align: center; font-size: 13px; color: var(--muted); padding-top: 4px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 10;
  background: #333; color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center; margin: 0;
}
