/* The Pop-Up Social photo booth */
:root {
  --navy: #0a1f3f;
  --navy-2: #2b3d5c;
  --pink: #f65cf0;
  --purple: #6b2bf5;
  --blue: #2a9df0;
  --cyan: #08e5e8;
  --bg: #fbf8ff;
  --card: #ffffff;
  --line: rgba(10, 31, 63, 0.1);
  --muted: #5d6b84;
  --grad: linear-gradient(100deg, var(--pink) 0%, var(--purple) 48%, var(--blue) 78%, var(--cyan) 100%);
  --shadow: 0 10px 30px rgba(43, 26, 110, 0.12), 0 2px 6px rgba(43, 26, 110, 0.08);
  --radius: 22px;
  --bar-h: clamp(52px, 8vmin, 76px);
  --gap: clamp(10px, 2vmin, 22px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--navy);
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: currentColor; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.45; animation: drift 18s ease-in-out infinite alternate; }
.b1 { width: 55vmax; height: 55vmax; background: #ffc6fb; left: -18vmax; top: -20vmax; }
.b2 { width: 50vmax; height: 50vmax; background: #b9fbff; right: -20vmax; bottom: -22vmax; animation-delay: -6s; }
.b3 { width: 38vmax; height: 38vmax; background: #d6c8ff; left: 40%; top: 45%; animation-delay: -12s; }
@keyframes drift { to { transform: translate(6vmax, -4vmax) scale(1.08); } }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + var(--gap)) calc(var(--safe-b) + var(--gap)) calc(var(--safe-l) + var(--gap));
  opacity: 0; visibility: hidden; transform: scale(0.985);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.screen.show { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease, transform 0.35s ease; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 26px;
  font-weight: 600; font-size: clamp(17px, 2.2vmin, 22px); letter-spacing: 0.2px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s;
  min-height: 52px;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn svg { width: 1.25em; height: 1.25em; }
.btn.primary { background: var(--grad); background-size: 140% 100%; color: #fff; box-shadow: 0 8px 22px rgba(107, 43, 245, 0.32); }
.btn.secondary { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 2px var(--line), 0 2px 8px rgba(10, 31, 63, 0.06); }
.btn.ghost { background: rgba(255, 255, 255, 0.7); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); backdrop-filter: blur(8px); }
.btn.small { min-height: 42px; padding: 10px 18px; font-size: 16px; }
.btn.huge { font-size: clamp(24px, 4.2vmin, 40px); padding: clamp(18px, 2.6vmin, 28px) clamp(34px, 5vmin, 60px); }
.btn.huge svg { width: 1.1em; height: 1.1em; }
.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(107, 43, 245, 0.32), 0 0 0 0 rgba(246, 92, 240, 0.45); }
  50% { box-shadow: 0 8px 22px rgba(107, 43, 245, 0.32), 0 0 0 22px rgba(246, 92, 240, 0); }
}
.linkBtn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 15px; padding: 6px; align-self: center; }

/* ---------- top bar ---------- */
.bar {
  height: var(--bar-h); flex: 0 0 auto;
  display: grid; grid-template-columns: minmax(90px, 1fr) auto minmax(90px, 1fr); align-items: center; gap: 10px;
  margin-bottom: calc(var(--gap) * 0.6);
}
.barTitle { margin: 0; text-align: center; font-weight: 700; font-size: clamp(20px, 3.4vmin, 36px); line-height: 1.1; }
.barSpacer { display: block; }
.barEnd { justify-self: end; }
.doneTop { display: none; }
.back { justify-self: start; min-height: 46px; padding: 10px 18px 10px 12px; font-size: clamp(16px, 2vmin, 19px); }
.modeBadge {
  justify-self: end; font-weight: 600; font-size: clamp(14px, 1.8vmin, 17px);
  background: #fff; border-radius: 999px; padding: 8px 14px; box-shadow: inset 0 0 0 1.5px var(--line);
  white-space: nowrap;
}

/* ---------- start screen ---------- */
#screenAttract { align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.attractVideo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(26px) saturate(1.25); opacity: 0; transform: scale(1.15); transition: opacity 0.8s;
}
.attractVideo.on { opacity: 0.35; }
.attractVideo.mirror { transform: scale(-1.15, 1.15); }
.attractInner { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 2.4vmin, 26px); max-width: 92vw; }
.attractLogo { width: min(68vw, 62vh, 760px); height: auto; filter: drop-shadow(0 10px 30px rgba(107, 43, 245, 0.18)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-0.6deg); } }
.attractHead { margin: 0; font-size: clamp(26px, 5vmin, 54px); font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.attractSub { margin: 0; font-size: clamp(16px, 2.4vmin, 24px); color: var(--navy-2); font-weight: 500; }
.sparkles i {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); background: var(--c);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: twinkle 3s ease-in-out infinite; animation-delay: var(--d);
}
@keyframes twinkle { 0%, 100% { transform: scale(0.6) rotate(0); opacity: 0.5; } 50% { transform: scale(1.1) rotate(20deg); opacity: 1; } }

/* ---------- mode grid ---------- */
.modeGrid {
  flex: 1 1 auto; min-height: 0;
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols, 2), 1fr);
  max-width: 1200px; width: 100%; margin: auto;
}
.modeTile {
  position: relative; border: 0; border-radius: 28px; background: #fff;
  box-shadow: var(--shadow), inset 0 0 0 2px var(--line);
  padding: clamp(14px, 3vmin, 34px) clamp(12px, 2vmin, 24px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 1.4vmin, 14px);
  text-align: center; min-height: 0; overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s;
  animation: tileIn 0.45s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 70ms);
}
@keyframes tileIn { from { opacity: 0; transform: translateY(18px) scale(0.96); } }
.modeTile:active { transform: scale(0.97); }
.modeTile::before { content: ""; position: absolute; inset: 0; background: var(--tint); opacity: 0.12; }
.modeIcon {
  position: relative; width: clamp(64px, 13vmin, 130px); height: clamp(64px, 13vmin, 130px); border-radius: 30%;
  display: grid; place-items: center; background: var(--tint); color: #fff; box-shadow: 0 10px 24px rgba(10, 31, 63, 0.15);
}
.modeIcon svg { width: 56%; height: 56%; }
.modeName { position: relative; font-weight: 700; font-size: clamp(22px, 4vmin, 40px); }
.modeDesc { position: relative; font-size: clamp(15px, 2.2vmin, 22px); color: var(--navy-2); }

/* ---------- shoot layout ---------- */
.shootLayout, .resultLayout { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap); }
.stageWrap { flex: 1; min-height: 0; min-width: 0; display: grid; place-items: center; position: relative; }
.stage {
  position: relative; overflow: hidden; border-radius: clamp(14px, 2vmin, 24px);
  background: #10162a; box-shadow: 0 18px 50px rgba(43, 26, 110, 0.25), 0 0 0 4px #fff;
  width: 320px; height: 240px; touch-action: pan-y;
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage.mirror video { transform: scaleX(-1); }
.frameOverlay, .freeze { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.frameOverlay { transition: opacity 0.18s ease; }
.frameOverlay.swap { opacity: 0; }
.freeze { opacity: 0; object-fit: cover; transition: opacity 0.2s; }
.freeze.show { opacity: 1; }

.navArrow {
  position: absolute; top: 50%; width: clamp(44px, 7vmin, 64px); height: clamp(44px, 7vmin, 64px); margin-top: calc(clamp(44px, 7vmin, 64px) / -2);
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.85); color: var(--navy);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); transition: opacity 0.2s, transform 0.12s;
}
.navArrow:active { transform: scale(0.92); }
.navArrow svg { width: 55%; height: 55%; }
.navArrow.left { left: 12px; }
.navArrow.right { right: 12px; }
.busy .navArrow, .single-frame .navArrow { opacity: 0; pointer-events: none; }

.shotDots { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.shotDots i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 2px rgba(10, 31, 63, 0.25); transition: background 0.2s, transform 0.2s; }
.shotDots i.done { background: var(--pink); transform: scale(1.15); }
.shotDots i.now { background: #fff; animation: dotPulse 0.8s ease-in-out infinite alternate; }
@keyframes dotPulse { to { transform: scale(1.3); } }

.recPill {
  position: absolute; top: 14px; right: 14px; display: none; align-items: center; gap: 8px;
  background: rgba(10, 31, 63, 0.75); color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 16px;
}
.recPill span { width: 12px; height: 12px; border-radius: 50%; background: #ff3b5c; animation: blink 0.8s steps(2) infinite; }
.recPill.show { display: flex; }
@keyframes blink { 50% { opacity: 0.2; } }

.prompt {
  position: absolute; left: 50%; bottom: 7%; transform: translate(-50%, 20px); opacity: 0;
  background: #fff; color: var(--navy); border-radius: 999px; padding: 10px 26px;
  font-weight: 700; font-size: clamp(18px, 3.6vmin, 36px); white-space: nowrap; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(.2, .9, .3, 1.3);
}
.prompt.show { opacity: 1; transform: translate(-50%, 0); }

.countdown {
  position: absolute; left: 50%; top: 50%; width: clamp(120px, 26vmin, 240px); aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.6); opacity: 0; display: grid; place-items: center;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(.2, .9, .3, 1.4);
}
.countdown.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.countdown svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.cdTrack { fill: rgba(255, 255, 255, 0.88); stroke: rgba(255, 255, 255, 0.5); stroke-width: 8; }
.cdRing { fill: none; stroke: url(#cdGrad); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 0; }
#cdNum { position: relative; font-weight: 700; font-size: clamp(64px, 15vmin, 140px); line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown.bump #cdNum { animation: bump 0.35s ease; }
@keyframes bump { from { transform: scale(1.4); } }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

.camError { position: absolute; inset: 0; display: none; place-items: center; background: rgba(251, 248, 255, 0.96); text-align: center; padding: 24px; }
.camError.show { display: grid; }
.camError strong { font-size: 24px; display: block; margin-bottom: 8px; }
.camError p { margin: 0 0 16px; color: var(--navy-2); max-width: 420px; font-size: 17px; }

/* shoot panel (portrait default) */
.shootPanel { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: calc(var(--gap) * 0.8); min-width: 0; }
.panelLabel { font-weight: 600; color: var(--navy-2); font-size: 16px; align-self: stretch; text-align: center; }
.frameRail {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 6px 4px 10px; max-width: 100%; align-self: stretch;
  scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.frameThumb {
  flex: 0 0 auto; width: clamp(96px, 16vmin, 150px); aspect-ratio: var(--ar, 4/3); border-radius: 14px; border: 0; padding: 0;
  background: linear-gradient(135deg, #e9e2ff, #d5f9ff); position: relative; overflow: hidden; scroll-snap-align: center;
  box-shadow: inset 0 0 0 2px var(--line); transition: transform 0.15s, box-shadow 0.15s;
}
.frameThumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.frameThumb.sel { box-shadow: 0 0 0 4px var(--purple), 0 8px 18px rgba(107, 43, 245, 0.35); transform: scale(1.04); }
.frameThumb.sel::after {
  content: ""; position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--purple) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/70% no-repeat;
}
.busy .frameRail, .busy .panelLabel { opacity: 0.35; pointer-events: none; }

.shutter { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.shutterRing {
  width: clamp(84px, 14vmin, 128px); aspect-ratio: 1; border-radius: 50%; padding: 7px; background: var(--grad);
  box-shadow: 0 10px 30px rgba(107, 43, 245, 0.4); animation: pulse 2.2s ease-in-out infinite; transition: transform 0.12s;
}
.shutter:active .shutterRing { transform: scale(0.93); }
.shutterCore { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--purple); }
.shutterCore svg { width: 46%; height: 46%; }
.shutterLabel { font-weight: 700; font-size: clamp(18px, 2.6vmin, 26px); }
.busy .shutter { opacity: 0.35; pointer-events: none; }
.busy .shutterRing { animation: none; }
.busy .bar .back { opacity: 0.35; pointer-events: none; }

/* ---------- result ---------- */
.previewWrap { flex: 1; min-height: 0; min-width: 0; position: relative; padding: 6px; }
.previewCard { position: absolute; inset: 6px; }
.previewCard img, .previewCard video {
  display: none; position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border-radius: 16px; box-shadow: 0 18px 50px rgba(43, 26, 110, 0.25), 0 0 0 4px #fff; background: #fff;
  animation: popIn 0.5s cubic-bezier(.2, .9, .3, 1.25);
}
.previewCard img.show, .previewCard video.show { display: block; }
@keyframes popIn { from { opacity: 0; transform: scale(0.85) rotate(-2deg); } }

.resultPanel { flex: 0 0 auto; display: flex; flex-direction: column; gap: calc(var(--gap) * 0.8); overflow-y: auto; min-height: 0; padding: 4px; -webkit-overflow-scrolling: touch; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(12px, 2vmin, 20px); }
.cardTitle { display: block; font-weight: 700; font-size: clamp(18px, 2.4vmin, 22px); margin-bottom: 10px; }
.qrCard { display: flex; align-items: center; gap: 16px; }
.qrBox { flex: 0 0 auto; width: clamp(120px, 20vmin, 190px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; background: #f3f0fb; overflow: hidden; }
.qrBox svg, .qrBox img { width: 100%; height: 100%; display: block; }
.qrText { display: flex; flex-direction: column; gap: 4px; font-size: clamp(15px, 2vmin, 18px); color: var(--navy-2); }
.qrText strong { color: var(--navy); font-size: clamp(19px, 2.8vmin, 26px); }
.qrCard.off { display: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #dcd3fb; border-top-color: var(--purple); display: block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.emailRow { display: flex; gap: 8px; }
.emailRow input {
  flex: 1; min-width: 0; height: 54px; border-radius: 14px; border: 2px solid var(--line); padding: 0 16px; font-size: 19px; color: var(--navy); background: #fbfaff;
}
.emailRow input:focus { outline: none; border-color: var(--purple); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.chips button { border: 0; background: #f1ecff; color: var(--purple); border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: 15px; }
.chips button:active { transform: scale(0.95); }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--navy-2); padding: 6px 0; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--purple); flex: 0 0 auto; }
.emailMsg { min-height: 0; font-weight: 600; font-size: 16px; }
.emailMsg.ok { color: #138a5e; }
.emailMsg.bad { color: #c62a4a; }
.resultActions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.idleNote { text-align: center; color: var(--muted); font-size: 15px; min-height: 18px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(251, 248, 255, 0.88); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0s linear 0.3s;
}
.overlay.show { opacity: 1; visibility: visible; transition: opacity 0.3s; }
.procInner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px; }
.procText { font-size: clamp(24px, 4.6vmin, 44px); font-weight: 700; }
.procSpark { position: relative; width: 120px; height: 120px; }
.procSpark i {
  position: absolute; inset: 0; margin: auto; width: 70px; height: 70px; background: var(--pink);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: procSpin 1.6s ease-in-out infinite;
}
.procSpark i:nth-child(2) { background: var(--cyan); width: 44px; height: 44px; left: 70px; top: -50px; animation-delay: -0.5s; }
.procSpark i:nth-child(3) { background: var(--purple); width: 34px; height: 34px; right: 74px; bottom: -56px; animation-delay: -1s; }
@keyframes procSpin { 50% { transform: rotate(90deg) scale(0.6); } 100% { transform: rotate(180deg) scale(1); } }
.thanksLogo { width: min(60vw, 46vh, 560px); }
.thanksSub { font-size: clamp(18px, 3vmin, 28px); color: var(--navy-2); font-weight: 500; }

.modalOverlay { background: rgba(10, 31, 63, 0.45); z-index: 60; }
.modal { background: #fff; border-radius: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); max-height: calc(100dvh - 32px); width: min(94vw, 760px); }
.pinModal { width: min(92vw, 340px); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pinDots { display: flex; gap: 14px; }
.pinDots i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--purple); }
.pinDots i.on { background: var(--purple); }
.pinDots.shake { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.pinPad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.pinPad button { height: 64px; border-radius: 18px; border: 0; background: #f1ecff; font-size: 26px; font-weight: 600; }
.pinPad button:active { background: #e0d6ff; }

.settingsModal { display: flex; flex-direction: column; overflow: hidden; }
.settingsHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 22px; }
.settingsBody { overflow-y: auto; padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field > span { font-weight: 600; font-size: 15px; color: var(--navy-2); }
.field input, .field select { height: 48px; border-radius: 12px; border: 2px solid var(--line); padding: 0 12px; font-size: 17px; background: #fbfaff; color: var(--navy); min-width: 0; }
.fieldRow { display: flex; gap: 14px; flex-wrap: wrap; }
.checkRow { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.frameToggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.frameToggles .frameThumb { width: 100%; }
.frameToggles .frameThumb.off { opacity: 0.3; filter: grayscale(1); }
.queueRow { display: flex; align-items: center; gap: 12px; height: 48px; font-size: 20px; }
.settingsBtns { display: flex; flex-wrap: wrap; gap: 10px; }
.stats { background: #f6f2ff; border-radius: 14px; padding: 12px 16px; font-size: 16px; color: var(--navy-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); z-index: 80; transform: translate(-50%, 30px); opacity: 0;
  background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 17px;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- landscape: side panels ---------- */
@media (min-aspect-ratio: 5/4) {
  .shootLayout, .resultLayout { flex-direction: row; }
  .shootPanel { width: clamp(190px, 24vw, 330px); height: 100%; justify-content: space-between; }
  .frameRail {
    flex: 1; min-height: 0; flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: center;
    overflow-y: auto; overflow-x: hidden; scroll-snap-type: y proximity; padding: 8px;
  }
  .frameThumb { width: calc(50% - 8px); }
  .resultPanel { width: clamp(300px, 34vw, 460px); height: 100%; }
  .resultPanel > :first-child { margin-top: auto; }
  .resultPanel > :last-child { margin-bottom: auto; }
}

/* short landscape screens (phones turned sideways) */
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
  :root { --bar-h: 46px; --gap: 8px; }
  .screen { padding-top: calc(var(--safe-t) + 4px); }
  .barTitle { font-size: 20px; }
  .back span { display: none; }
  .back { padding: 8px 12px; min-height: 40px; }
  .modeBadge { padding: 6px 10px; font-size: 13px; }
  .panelLabel { display: none; }
  .frameThumb { width: calc(50% - 8px); border-radius: 10px; }
  .shutterRing { width: 68px; padding: 5px; }
  .shutterLabel { font-size: 16px; }
  .attractLogo { width: min(50vw, 48vh); }
  .attractInner { gap: 6px; }
  .btn.huge { font-size: 22px; padding: 14px 30px; }
  .qrBox { width: 96px; }
  .qrText strong { font-size: 18px; }
  .card { padding: 10px 12px; }
  .chips { margin: 6px 0 2px; }
  .chips button { padding: 6px 10px; font-size: 13px; }
  .check { padding: 2px 0; font-size: 14px; }
  .emailRow input { height: 46px; font-size: 17px; }
  .btn { min-height: 44px; padding: 10px 18px; font-size: 16px; }
  .doneTop { display: inline-flex; min-height: 38px; padding: 6px 16px; }
}

/* small portrait phones */
@media (max-aspect-ratio: 5/4) and (max-width: 520px) {
  .barTitle { font-size: 21px; }
  .back span { display: none; }
  .back { padding: 10px 12px; }
  .modeGrid { gap: 12px; }
  .modeDesc { font-size: 14px; }
  .resultPanel { max-height: 58%; }
  .doneTop { display: inline-flex; }
  .qrBox { width: 112px; }
}

/* portrait tablets: keep panel area modest so the preview stays big */
@media (max-aspect-ratio: 5/4) {
  .resultPanel { max-height: 52%; width: 100%; max-width: 760px; align-self: center; }
  .shootPanel { max-width: 900px; width: 100%; align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- still there popup ---------- */
.stillThere { z-index: 70; background: rgba(10, 31, 63, 0.4); }
.stillCard {
  background: #fff; border-radius: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); padding: clamp(22px, 4vmin, 40px) clamp(26px, 5vmin, 56px);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 92vw;
}
.stillThere.show .stillCard { animation: popIn 0.35s cubic-bezier(.2, .9, .3, 1.3); }
.stillTitle { font-size: clamp(28px, 5vmin, 46px); font-weight: 700; }
.stillSub { font-size: clamp(17px, 2.6vmin, 22px); color: var(--navy-2); }
.stillRing {
  width: clamp(110px, 20vmin, 170px); aspect-ratio: 1; border-radius: 50%; padding: 8px; background: var(--grad);
  display: grid; place-items: center;
}
.stillRing span {
  width: 100%; height: 100%; border-radius: 50%; background: #fff; display: grid; place-items: center;
  font-size: clamp(60px, 11vmin, 96px); font-weight: 700; color: var(--purple);
}
