/* Guest camera. Deliberately dark-only: it's a darkroom, and it's used at night parties.
   System fonts only so it loads instantly on cheap phones over 4G. */
:root {
  --bg: #0b0b0e;
  --panel: #17161c;
  --ink: #f3f1ec;
  --muted: #a19dab;
  --line: #2e2c35;
  --safe: #ff5b47;
  --ok: #6fd9a4;
  --warn: #f3b35a;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); line-height: 1.05; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
p { margin: 0; }
b { color: var(--ink); }
.app { min-height: 100%; }
.loading { padding: 48px 20px; text-align: center; color: var(--muted); }
.fine { font-size: 14px; color: var(--muted); }
.eyebrow { font: 600 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--safe); }
:focus-visible { outline: 2px solid var(--safe); outline-offset: 2px; }

/* ---------- panels (join, messages, roll done) ---------- */
.panel {
  max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding: calc(40px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
           calc(32px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
.panel > p { color: #d8d5de; }
form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
label { font-weight: 600; font-size: 15px; margin-top: 10px; }
label span { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="tel"] {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 17px; /* 16px+ stops iOS from zooming in */
}
.btn {
  display: block; width: 100%; text-align: center; border: 0; border-radius: 14px; padding: 16px;
  background: var(--safe); color: #fff; font-weight: 700; font-size: 17px; cursor: pointer; margin-top: 10px;
}
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.error { color: var(--warn); font-size: 14px; }
.done .status { background: var(--panel); border-radius: 12px; padding: 14px 16px; font-size: 15px; color: var(--ink); }

/* ---------- camera ---------- */
.cam { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam video.mirror { transform: scaleX(-1); }
.cam-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(0, 0, 0, 0.65), transparent); font-size: 14px;
}
.cam-ev { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 7px 10px; border-radius: 999px;
  background: rgba(111, 217, 164, 0.18); color: var(--ok); white-space: nowrap;
}
.pill.warn { background: rgba(243, 179, 90, 0.2); color: var(--warn); }
.hud { position: absolute; left: 0; right: 0; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); text-align: center; pointer-events: none; }
.count {
  font: 600 64px/1 var(--mono); color: var(--safe); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255, 91, 71, 0.55), 0 2px 8px rgba(0, 0, 0, 0.6);
}
.count-l { font-size: 13px; color: #e6e3ea; text-shadow: 0 1px 4px #000; }
.cam-controls {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center;
  padding: 28px max(24px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}
.shutter {
  width: 84px; height: 84px; border-radius: 50%; border: 5px solid #fff; background: transparent; padding: 0;
  display: grid; place-items: center; cursor: pointer; transition: transform 0.1s;
}
.shutter span { width: 62px; height: 62px; border-radius: 50%; background: var(--safe); }
.shutter:active { transform: scale(0.92); }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, 0.16); display: grid; place-items: center; cursor: pointer; }
.round svg { width: 24px; height: 24px; }
.round[data-off] { visibility: hidden; }
.round[aria-pressed="true"] { background: var(--warn); color: #000; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 0.35s ease-out; }
@keyframes flash { from { opacity: 0.9; } to { opacity: 0; } }
.blocked {
  position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; justify-content: center; gap: 12px;
  padding: 24px max(24px, env(safe-area-inset-right, 0px)) 24px max(24px, env(safe-area-inset-left, 0px));
}
.blocked[hidden] { display: none; }
.blocked p { color: var(--muted); }

/* ---------- album ---------- */
.album {
  max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding: calc(32px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
           calc(32px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
.album header { display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ph { margin: 0; position: relative; border-radius: 6px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.ph img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: brightness(0.08) sepia(1) saturate(4) hue-rotate(-25deg);
  transition: filter 2.6s ease-out var(--d, 0ms);
}
.grid.on .ph img { filter: none; }
.ph figcaption { position: absolute; left: 6px; bottom: 6px; font: 600 11px/1 var(--mono); background: rgba(0, 0, 0, 0.6); color: #fff; padding: 5px 7px; border-radius: 5px; }
.ph.mine figcaption { background: var(--safe); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  background: #fff; color: #111; padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ph img { transition: none; filter: none; }
  .flash.go { animation: none; }
}
