@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #0F1210;
  --bg-surface: #171C19;
  --bg-card: #1D2420;
  --bg-card-alt: #222A26;
  --input-bg: #161D19;
  --border: #252E29;
  --border-mid: #2E3A34;
  --text: #E8EDE9;
  --text-mid: #A8B8AC;
  --text-muted: #6E8075;
  --text-faint: #4A5C52;
  --green: #4A7C5F;
  --green-dark: #3A6048;
  --green-light-bg: #1A2E22;
  --green-light-bdr: #2E5040;
  --error: #E05555;
  --olive: #909350;
  --olive-hover: #7A7D44;
  --nav-bg: #525F58;
  --eyebrow: #DAECD3;
  --metric: #6DBF8A;
  --ok: #6DBF8A;
  --bad: #E05555;
  --r: 4px;
  --r-md: 8px;
  --hdr-h: 72px;
  --gap: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  min-height: 100dvh; width: 100vw;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* NAV */
header {
  height: var(--hdr-h);
  flex-shrink: 0;
  background: var(--nav-bg);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 40px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none;
}
.brand-logo {
  height: 44px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-link {
  color: #fff; text-decoration: none;
  font: 600 15px/1 'Public Sans', sans-serif;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.35);
  padding: 10px 16px;
  border-radius: var(--r);
}
.nav-link:hover { background: rgba(255,255,255,.22); }
.icon-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: #fff; padding: 8px 12px; border-radius: var(--r);
  font: 500 14px 'Public Sans', sans-serif; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.08); }

main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 40px;
  position: relative;
}

.screen {
  display: none;
  width: 100%; max-width: 1180px;
  flex-direction: column; align-items: center; justify-content: center;
  gap: var(--gap);
  text-align: center;
}
.screen.active { display: flex; }

/* TYPOGRAPHY */
.eyebrow {
  color: var(--eyebrow);
  font: 600 16px/1 'Public Sans', sans-serif;
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
}
.eyebrow::before { content: '/ '; }
.eyebrow.hero {
  font-size: 22px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.eyebrow.hero::before { content: '/ '; letter-spacing: 0; }
h1.hero {
  font: 300 clamp(40px, 5.5vw, 68px)/1.05 'Public Sans', sans-serif;
  letter-spacing: -.03em;
  margin: 8px 0 16px;
  color: var(--text);
  max-width: 820px;
}
.subtitle {
  font: 400 17px/1.65 'Public Sans', sans-serif;
  color: var(--text-mid);
  max-width: 640px;
  margin: 0 0 8px;
}
.hint { font: 400 12px/1.5 'Public Sans', sans-serif; color: var(--text-muted); }

/* BUTTONS */
button {
  font: 500 15px/1 'Public Sans', sans-serif;
  cursor: pointer;
  border-radius: var(--r);
  border: none;
  padding: 13px 24px;
  transition: background .15s, opacity .15s, transform .08s;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary {
  background: var(--olive);
  color: #fff;
  display: inline-flex; align-items: center; gap: 10px;
}
.primary:hover { background: var(--olive-hover); }
.primary.big { font-size: 16px; padding: 15px 28px; }
.primary .arrow-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: rgba(255,255,255,.15);
  border-radius: 3px;
  font-size: 14px; line-height: 1;
}
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-mid);
}
.ghost:hover { opacity: .7; }

.score {
  color: var(--metric);
  font: 600 15px 'Public Sans', sans-serif;
  margin: 8px 0 0;
  min-height: 1em;
}

/* LANDING */
#screen-landing { padding: 24px 0; }

/* BOOTH */
.booth-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  max-height: min(70vh, 720px);
  max-width: 100%;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
#cam { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; display: block; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.fire { animation: flash 240ms ease-out; }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: .95; } 100% { opacity: 0; } }
.countdown {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font: 300 140px/1 'Public Sans', sans-serif;
  color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.7);
  pointer-events: none; opacity: 0;
}
.countdown.show { opacity: 1; }

.thumbs { display: flex; gap: 10px; flex-shrink: 0; }
.thumb {
  width: 56px; height: 74px; border-radius: var(--r);
  background: var(--bg-card); border: 1px dashed var(--border-mid);
  background-size: cover; background-position: center;
  transition: border .2s, transform .2s;
  flex-shrink: 0;
}
.thumb.filled { border: 1px solid var(--green); transform: scale(1.04); }

/* GRID */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  aspect-ratio: 2 / 3;
  max-height: min(70vh, 720px);
  max-width: 100%;
  height: auto; width: auto;
}
.grid .cell, .grid .dev-cell {
  aspect-ratio: 2 / 3;
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  background: #0b0e0c;
}
.dev-cell::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* DEVELOPING + FORM GATE */
#screen-developing {
  padding: 16px 0;
  gap: 16px;
  justify-content: flex-start;
}
.develop-status {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
}
.film-spin {
  font-size: 36px;
  line-height: 1;
  animation: spin 2.4s linear infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
  user-select: none;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.developing-label {
  font: 400 15px/1 'Public Sans', sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin: 0;
}
.dots span { animation: dot 1.2s infinite; opacity: 0; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

.gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  text-align: left;
  display: flex; flex-direction: column; gap: 10px;
}

.gate-heading {
  font: 300 24px/1.2 'Public Sans', sans-serif;
  letter-spacing: -.02em;
  margin: 2px 0 0;
  color: var(--text);
}
.gate-sub {
  font: 400 13.5px/1.5 'Public Sans', sans-serif;
  color: var(--text-mid);
  margin: 0;
}
#boothForm {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 6px;
}
#boothForm label {
  display: flex; flex-direction: column; gap: 6px;
  font: 500 12px 'Public Sans', sans-serif;
  color: var(--text-mid);
  letter-spacing: 0;
  text-transform: none;
  flex: 1;
}
#boothForm .req { color: var(--error); margin-left: 2px; }
#boothForm input {
  background: var(--input-bg);
  border: 1px solid var(--border-mid);
  color: var(--text);
  border-radius: var(--r);
  padding: 11px 12px;
  font: 400 15px 'Public Sans', sans-serif;
}
#boothForm input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,95,.18);
}
#boothForm input::placeholder { color: var(--text-faint); }
#boothForm .form-row { display: flex; gap: 12px; }
#boothForm .form-row label { flex: 1 1 0; min-width: 0; }
#boothForm button[type="submit"] { align-self: flex-start; margin-top: 2px; }
.form-error {
  color: var(--error);
  font: 400 12.5px 'Public Sans', sans-serif;
  margin: 0;
  min-height: 1em;
}
.form-thanks {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.form-thanks .thanks-check {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--green-light-bg);
  border: 1px solid var(--green-light-bdr);
  color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  font: 600 24px/1 'Public Sans', sans-serif;
}
.form-thanks h3 {
  font: 500 17px/1.3 'Public Sans', sans-serif;
  color: var(--text);
  margin: 6px 0 0;
}
.form-thanks p {
  font: 400 13.5px/1.5 'Public Sans', sans-serif;
  color: var(--text-mid);
  margin: 0;
}
.gate-card.submitted > .eyebrow,
.gate-card.submitted > .gate-heading,
.gate-card.submitted > .gate-sub,
.gate-card.submitted > #boothForm,
.gate-card.submitted > #skipBtn { display: none; }
.gate-card.submitted > #boothFormThanks { display: flex; }
.gate-skip {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font: 400 11.5px 'Public Sans', sans-serif;
  letter-spacing: 0;
  padding: 6px 8px;
  margin-top: 4px;
  align-self: flex-end;
  cursor: pointer;
}
.gate-skip:hover { color: var(--text-faint); opacity: .85; }

/* REVEAL */
.grid-reveal .cell {
  cursor: pointer;
  outline: 3px solid transparent;
  transition: outline-color .15s, transform .15s;
}
.grid-reveal .cell:hover { transform: scale(1.02); }
.grid-reveal .cell.guess-correct { outline-color: var(--ok); }
.grid-reveal .cell.guess-wrong { outline-color: var(--bad); }
.grid-reveal .cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  user-select: none; -webkit-user-drag: element;
}
.grid-reveal .cell .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7); color: #fff;
  font: 600 11px 'Public Sans', sans-serif;
  padding: 3px 9px; border-radius: var(--r);
  letter-spacing: .04em;
}
.grid-reveal .cell.real .badge { background: var(--ok); color: #0F1210; }
.grid-reveal .cell.fake .badge { background: var(--bad); color: #fff; }

.reveal-result {
  font: 500 17px 'Public Sans', sans-serif;
  min-height: 1.3em; text-align: center; margin: 0;
}
.reveal-result.win { color: var(--ok); }
.reveal-result.lose { color: var(--bad); }

/* ERROR */
#errorBox {
  background: var(--bg-card); padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--border);
  color: #ff9aa5; max-width: 90vw; white-space: pre-wrap; word-break: break-word;
  font: 400 13px/1.5 'Public Sans', sans-serif;
  max-height: 40vh; overflow: auto;
  text-align: left;
}

/* MODAL */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 36px; border-radius: var(--r-md);
  width: min(540px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.modal-card h2 {
  font: 300 24px/1.2 'Public Sans', sans-serif;
  letter-spacing: -.02em;
  margin: 0;
}
.modal-card label {
  display: flex; flex-direction: column; gap: 6px;
  font: 500 13px 'Public Sans', sans-serif;
  color: var(--text-mid);
  text-align: left;
}
.modal-card .hint {
  font: 400 11.5px 'Public Sans', sans-serif;
  color: var(--text-muted);
}
.modal-card select,
.modal-card input,
.modal-card textarea {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-mid);
  border-radius: var(--r);
  padding: 11px 12px;
  font: 400 15px 'Public Sans', sans-serif;
  resize: vertical;
}
.modal-card select:focus,
.modal-card input:focus,
.modal-card textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,95,.18);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
  header { padding: 0 20px; height: 60px; }
  :root { --hdr-h: 60px; }
  .brand-logo { height: 30px; }
  .nav-link { font-size: 13px; }
  main { padding: 20px; }
  .gate-card { padding: 24px; }
  h1.hero { font-size: 36px; }
  .subtitle { font-size: 15px; }
  .countdown { font-size: 90px; }
  .thumb { width: 44px; height: 58px; }
}
