/* Booth UI: dark gala room, gold accents, everything sized for a finger at arm's length.
   Works as an installed app on the iPad and on guests' phones. */
:root {
  --bg: #0b0b0d; --panel: #16161b; --panel-2: #1d1d24; --ink: #f4efe4; --muted: #a9a49a;
  --gold: #e3c06f; --gold-2: #f6dc8f; --gold-ink: #1b1608; --royal: #2f49d1; --hair: rgba(244,239,228,.12);
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-spring: cubic-bezier(.32, .72, 0, 1);
  --display: Limelight, "Playfair Display", Georgia, serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad-x: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; height: 100%; }
body { margin: 0; height: 100dvh; overflow: hidden; background: var(--bg); color: var(--ink); font: clamp(17px, 2.2vw, 20px)/1.4 var(--body); touch-action: manipulation; }
button, a, label, .tile, .chip { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; font-size: 16px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* camera: the video element feeds WebGL; #live is what people see */
#cam { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
.live { position: fixed; inset: 0; width: 100vw; height: 100dvh; object-fit: cover; object-position: 50% 35%; background: #000; z-index: 0; transition: opacity .35s var(--ease-out); pointer-events: none; }
#propsLayer { background: transparent; z-index: 1; }
body.mirror .live { transform: scaleX(-1); }
body:not([data-screen="attract"]):not([data-screen="gate"]):not([data-screen="shoot"]) .live { opacity: 0; }
body[data-screen="shoot"] .live { border-radius: 18px; }

main { position: relative; z-index: 2; height: 100%; }
.screen {
  position: absolute; inset: 0; display: none; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) var(--pad-x);
}
body[data-screen="gate"] #gate, body[data-screen="attract"] #attract, body[data-screen="choose"] #choose,
body[data-screen="backdrop"] #backdrop, body[data-screen="shoot"] #shoot, body[data-screen="review"] #review,
body[data-screen="boom"] #boom, body[data-screen="sign"] #sign, body[data-screen="audio"] #audio { display: grid; animation: enter .45s var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }

.kicker { margin: 0; font: 700 clamp(13px, 1.8vw, 18px)/1 var(--body); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-2); }
h1 {
  margin: 0; font: 400 clamp(52px, 12vw, 128px)/.95 var(--display); text-wrap: balance; text-align: center;
  background: linear-gradient(100deg, #9b7526, #f8e3a0 35%, #c39a3d 55%, #fff1c2 75%, #9b7526);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(0,0,0,.6));
}
h2 { margin: 0; font: 400 clamp(32px, 6.5vw, 64px)/1.05 var(--display); color: var(--gold-2); text-align: center; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); text-align: center; max-width: 34ch; justify-self: center; }
.muted { color: var(--muted); }

.cta {
  border: 0; border-radius: 999px; padding: clamp(18px, 2.4vw, 24px) clamp(34px, 5vw, 56px); font-weight: 700; font-size: clamp(20px, 2.8vw, 26px); color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 10px 30px -10px rgba(227,192,111,.6), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .12s var(--ease-out), opacity .2s;
}
.cta.small { padding: 12px 26px; font-size: 17px; }
.ghost { border: 0; border-radius: 999px; padding: 16px 30px; font-weight: 700; background: transparent; box-shadow: inset 0 0 0 2px var(--hair); transition: transform .12s var(--ease-out); }
.link { border: 0; background: none; color: var(--muted); font-size: 17px; padding: 12px; text-decoration: underline; text-underline-offset: 4px; justify-self: center; }
.cta:active, .ghost:active, .tile:active, .chip:active, .copies button:active, .bd:active { transform: scale(.96); }
.cta:disabled, .ghost:disabled, .copies button:disabled { opacity: .45; }
.pulse { animation: pulse 2.2s var(--ease-spring) infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 16px; background: rgba(29,29,36,.92); box-shadow: inset 0 0 0 1px var(--hair); transition: transform .12s var(--ease-out); }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); box-shadow: none; }
.chip i { width: 16px; height: 16px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.chip.ghosty { background: transparent; }
.chiprow { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.actions { display: grid; gap: 12px; justify-items: center; }
.actions.row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
.actions.end { justify-content: flex-end; }
.status { margin: 0; min-height: 1.4em; color: var(--gold-2); text-align: center; max-width: 34ch; justify-self: center; }

/* gate */
#gate { place-items: center; background: linear-gradient(180deg, rgba(11,11,13,.6), rgba(11,11,13,.9)); }
.center-card { display: grid; gap: 22px; justify-items: center; text-align: center; max-width: 560px; }
#gateForm { display: grid; gap: 16px; width: min(100%, 380px); }
.field { display: grid; gap: 6px; text-align: left; font-size: 15px; color: var(--muted); }
.field input { color: var(--ink); background: var(--panel); border: 0; border-radius: 14px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--hair); }

/* attract */
#attract { place-items: end center; background: linear-gradient(180deg, rgba(11,11,13,.55), rgba(11,11,13,.1) 40%, rgba(11,11,13,.85)); }
.attract-inner { display: grid; justify-items: center; gap: 20px; text-align: center; padding-bottom: 6dvh; }
.wave { margin: 0; color: var(--muted); }
.install { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); left: 50%; transform: translateX(-50%); width: min(92vw, 560px); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; border-radius: 18px; background: rgba(22,22,27,.92); box-shadow: inset 0 0 0 1px var(--hair); font-size: 16px; text-align: center; }
.install p { margin: 0; flex: 1 1 260px; }

/* choose */
#choose, #backdrop { align-content: center; justify-items: center; gap: 28px; background: radial-gradient(circle at 50% 30%, #241d10, var(--bg) 70%); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 250px)); gap: 16px; width: min(100%, 520px); }
.tile { display: grid; justify-items: center; align-content: center; gap: 8px; padding: 20px 14px; border: 0; border-radius: 24px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); transition: transform .12s var(--ease-out); }
.tile.wide { grid-column: 1 / -1; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; justify-content: center; text-align: left; padding: 16px; }
.tile.wide svg { grid-row: 1 / 3; width: 46px; height: 46px; fill: none; stroke: var(--gold-2); stroke-width: 2.4; stroke-linecap: round; }
.tile b { font-size: clamp(19px, 2.6vw, 24px); }
.tile small { color: var(--muted); font-size: 15px; }
.lay { display: grid; width: clamp(64px, 9vw, 92px); aspect-ratio: 3 / 4; padding: 6px; gap: 5px; background: #faf8f2; border-radius: 4px; }
.lay i { background: linear-gradient(160deg, #d9b764, #8a6a22); border-radius: 2px; }
.l2 { grid-template-rows: 1fr 1fr; }
.l3 { grid-template: 1.4fr 1fr / 1fr 1fr; } .l3 i:first-child { grid-column: 1 / -1; }
.l4 { grid-template: 1fr 1fr / 1fr 1fr; }
.lay.plain { padding: 0; background: none; border-radius: 6px; overflow: hidden; } /* guest phones: plain photos, not a print */

/* backdrop picker */
.bd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; width: min(100%, 760px); }
.bd { position: relative; border: 0; padding: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); transition: transform .12s var(--ease-out); }
.bd img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd span { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 8px; font-size: 14px; font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.bd.none { display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.bd.none span { position: static; background: none; padding: 8px; }

/* shoot */
#shoot { grid-template-rows: auto 1fr auto auto auto; justify-items: center; align-items: center; gap: 12px; }
.pill { font-weight: 700; font-size: 19px; padding: 11px 22px; border-radius: 999px; background: rgba(22,22,27,.88); box-shadow: inset 0 0 0 1px var(--hair); }
.viewbox { position: relative; width: 300px; height: 400px; border-radius: 18px; }
.corner { position: absolute; width: 44px; height: 44px; border: 5px solid var(--gold-2); z-index: 2; }
.tl { top: -10px; left: -10px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.tr { top: -10px; right: -10px; border-left: 0; border-bottom: 0; border-top-right-radius: 22px; }
.bl { bottom: -10px; left: -10px; border-right: 0; border-top: 0; border-bottom-left-radius: 22px; }
.br { bottom: -10px; right: -10px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.count { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; font: 400 clamp(130px, 30vw, 300px)/1 var(--display); color: #fff; text-shadow: 0 6px 40px rgba(0,0,0,.7); }
.count span { animation: tick .9s var(--ease-out) both; }
@keyframes tick { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: .9; } }
.rec { position: absolute; top: 14px; right: 14px; z-index: 3; font-weight: 700; font-size: 15px; padding: 6px 12px; border-radius: 999px; background: #c0182c; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }
.ready { display: grid; gap: 12px; justify-items: center; width: min(100%, 720px); }
.hint { margin: 0; font-weight: 700; font-size: 20px; padding: 11px 22px; border-radius: 999px; background: rgba(22,22,27,.88); }
.thumbs { display: flex; gap: 10px; min-height: 64px; }
.thumbs canvas { height: 64px; width: auto; border-radius: 6px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); }

/* review screens */
#review, #boom { grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 22px; background: radial-gradient(circle at 50% 30%, #241d10, var(--bg) 70%); }
.review-film { width: min(52vw, 34dvh); }
.film { background: linear-gradient(160deg, #fff, #f1f1ec); padding: 11.1% 7.4% 33.3%; border-radius: 6px; box-shadow: 0 2px 3px rgba(0,0,0,.3), 0 30px 60px -20px rgba(0,0,0,.8); transform: rotate(-1.5deg); }
.shot { position: relative; overflow: hidden; }
.shot canvas, .shot img { display: block; width: 100%; height: auto; aspect-ratio: 46 / 62; object-fit: cover; }
.shot img { position: absolute; inset: 0; height: 100%; }
.shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(118deg, rgba(255,255,255,.24), rgba(255,255,255,0) 40%); pointer-events: none; }
/* guest phones see the plain full-size photo instead of a print on film */
#review.plain .film { padding: 0; background: none; transform: none; border-radius: 16px; overflow: hidden; }
#review.plain .shot canvas, #review.plain .shot img { aspect-ratio: 3 / 4; }
.picks { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.picks button { padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: none; box-shadow: 0 0 0 2px var(--hair); transition: transform .12s var(--ease-out); }
.picks button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--gold); }
.picks button:active { transform: scale(.95); }
.picks canvas { display: block; width: 48px; height: 64px; }
.code { margin: 0; display: grid; justify-items: center; gap: 2px; padding: 12px 22px; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); }
.code span { font-size: 15px; color: var(--muted); }
.code b { font: 600 clamp(34px, 6vw, 44px)/1.1 "IBM Plex Mono", monospace; letter-spacing: .12em; color: var(--gold-2); }
.review-side { display: grid; justify-items: center; gap: 14px; }
.copies { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.copies button { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); font-size: 26px; transition: transform .12s var(--ease-out); }
.copies output { min-width: 2ch; text-align: center; font-size: 26px; }
.qr { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); max-width: 360px; }
.qr canvas { width: 104px; height: 104px; border-radius: 8px; background: #fff; image-rendering: pixelated; }

/* guestbook */
#sign, #audio { align-content: center; justify-items: center; gap: 18px; background: radial-gradient(circle at 50% 30%, #241d10, var(--bg) 70%); }
.pad-wrap { width: min(100%, 760px); border-radius: 18px; overflow: hidden; background: #fbf8f1; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); }
#signPad { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }

/* voice message */
.recbtn { width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: inset 0 0 0 4px var(--hair); display: grid; place-items: center; }
.recbtn span { width: 54px; height: 54px; border-radius: 50%; background: #c0182c; transition: border-radius .2s var(--ease-out), transform .2s var(--ease-out); }
.recbtn.on span { border-radius: 10px; transform: scale(.8); }
.meter { width: min(80vw, 360px); height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .08s linear; }
.timer { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); }

/* flash, toast, settings */
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; }
#flash.on { animation: flash .45s var(--ease-out); }
@keyframes flash { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%); z-index: 30; padding: 14px 22px; border-radius: 14px; background: rgba(22,22,27,.95); box-shadow: inset 0 0 0 1px var(--hair); font-size: 17px; opacity: 0; transition: opacity .3s var(--ease-out); pointer-events: none; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; }
#hotspot { position: fixed; top: 0; left: 0; width: 80px; height: 80px; border: 0; background: transparent; z-index: 40; }
dialog { border: 0; border-radius: 24px; padding: 0; background: var(--panel); color: var(--ink); width: min(560px, 94vw); max-height: 92dvh; box-shadow: 0 40px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form { display: grid; gap: 16px; padding: 26px; overflow-y: auto; overscroll-behavior: contain; max-height: 92dvh; }
dialog h2 { text-align: left; font-size: 38px; }
dialog p { margin: 0; font-size: 15px; }
.checks { display: grid; gap: 10px; }
.checks label { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.checks input { width: 22px; height: 22px; accent-color: var(--gold); }

/* phones and landscape */
@supports (align-content: safe center) {
  #choose, #backdrop, #review, #boom, #sign, #audio { align-content: safe center; }
}
@media (max-width: 600px) {
  #backdrop { align-content: start; }
  #shoot { gap: 8px; }
  .chiprow { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; width: 100%; padding: 2px 4px; scrollbar-width: none; }
  .chiprow::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .tiles { gap: 12px; }
  .tile { padding: 16px 10px; border-radius: 20px; }
  .bd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .review-film { width: min(64vw, 40dvh); }
  .count { font-size: 34vw; }
}
@media (orientation: landscape) and (min-width: 700px) {
  #review, #boom { grid-template-columns: auto auto; gap: 56px; }
  .review-film { width: min(34vw, 62dvh); }
  .bd-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (hover: hover) and (pointer: fine) {
  .tile:hover, .bd:hover { box-shadow: inset 0 0 0 2px var(--gold); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .count span, #flash.on, .rec { animation: none; }
  body[data-screen] .screen { animation: none; }
}
