:root {
  --bg: #0a0a0a;
  --grey: #262626;
  --accent: #0d5ae6;
  --text: #ffffff;
  --muted: #bdbdbd;
  --bg-grad: linear-gradient(180deg, #0a0a0a 0%, #141414 55%, #262626 100%);
  --glow: rgba(255,255,255,.16);
  --grid: rgba(255,255,255,.07);
  --btn-light-bg: #fff;
  --btn-light-text: #000;
  --ghost: rgba(255,255,255,.55);
  --spin-track: rgba(255,255,255,.18);
  --spin-head: #fff;
  --heading-font: inherit;
  --accent-grad: var(--accent);
  --logo-w: min(62vmin, 80vw);
}
/* United Parks & Resorts look: deep ocean navy, blue and green accents, serif headings. */
body[data-brand="united-parks"] {
  --bg: #04122a;
  --accent: #2f8ed4;
  --accent-grad: linear-gradient(95deg, #4f9d3a 0%, #2a9ad9 100%);
  --text: #ffffff;
  --muted: #9fbdd6;
  --bg-grad: linear-gradient(180deg, #030a1c 0%, #072447 55%, #0a4a73 100%);
  --glow: rgba(60,170,220,.28);
  --grid: rgba(120,190,230,.05);
  --btn-light-bg: rgba(255,255,255,.14);
  --btn-light-text: #ffffff;
  --ghost: rgba(255,255,255,.5);
  --spin-track: rgba(255,255,255,.16);
  --spin-head: #6fc4ee;
  --heading-font: Baskerville, "Baskerville Old Face", Georgia, "Times New Roman", serif;
  --logo-w: min(74vmin, 88vw);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#app {
  position: fixed; inset: 0; isolation: isolate;
  background: radial-gradient(ellipse 80% 55% at 50% 100%, var(--glow), transparent 70%), var(--bg-grad);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 100%, #000, transparent 80%);
  mask-image: radial-gradient(ellipse 85% 80% at 50% 100%, #000, transparent 80%);
}
.screen {
  display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.4vmin; padding: 3vmin; text-align: center;
}
#app[data-screen="start"] #screen-start,
#app[data-screen="camera"] #screen-camera,
#app[data-screen="review"] #screen-review,
#app[data-screen="scenes"] #screen-scenes,
#app[data-screen="working"] #screen-working,
#app[data-screen="result"] #screen-result { display: flex; animation: fadein .35s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(1.2vmin); } to { opacity: 1; transform: none; } }

.logo { width: var(--logo-w); height: auto; margin-bottom: 4vmin; }
h1, h2 { font-family: var(--heading-font); }
h1 { font-size: 7.4vmin; line-height: 1.05; margin: 0; font-weight: 400; letter-spacing: -.015em; max-width: 14ch; }
h2 { font-size: 5vmin; margin: 0; font-weight: 400; letter-spacing: -.01em; }
.tagline { font-size: 3vmin; margin: 0 0 3vmin; color: var(--muted); }

.btn {
  appearance: none; border: 0; border-radius: 6px; padding: 2.3vmin 4.6vmin; font: inherit; font-size: 3vmin; font-weight: 600;
  color: #000; background: #fff; cursor: pointer; transition: transform .15s ease, opacity .2s ease;
}
.btn.primary { background: var(--accent-grad); color: #fff; }
.btn.light { background: var(--btn-light-bg); color: var(--btn-light-text); }
.btn.ghost { background: transparent; color: var(--text); border: 0.35vmin solid var(--ghost); }
.btn.link { background: transparent; color: var(--muted); text-decoration: underline; padding: 1vmin 2vmin; font-weight: 500; }
.btn.big { font-size: 3.8vmin; padding: 2.8vmin 9vmin; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.row { display: flex; flex-wrap: wrap; gap: 2.4vmin; align-items: center; justify-content: center; }
.note { font-size: 2.4vmin; color: var(--muted); max-width: 76vmin; margin: 0; }
.note.error { color: #ff8f8f; }

/* Photo area: 4:5 portrait */
.frame {
  position: relative; aspect-ratio: 4 / 5; height: min(70vh, 125vw); max-width: 94vw; background: #000;
  border-radius: 10px; overflow: hidden; box-shadow: 0 2vmin 6vmin rgba(0,0,0,.6);
}
.frame video, .frame canvas, .frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame video { transform: scaleX(-1); }
.frame video.demo { transform: none; object-position: 50% 10%; }
.frame canvas { pointer-events: none; }

#countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); }
#count-num { color: #fff; font-size: 34vmin; font-weight: 300; text-shadow: 0 0 4vmin rgba(0,0,0,.6); animation: pop 1s ease-out infinite; }
@keyframes pop { 0% { transform: scale(1.25); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(.9); opacity: .85; } }
#flash { position: absolute; inset: 0; background: #fff; animation: flash .45s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* Scene picker */
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2vmin; width: min(86vmin, 92vw); }
.scene {
  appearance: none; border: 0; border-radius: 10px; text-align: left; color: #fff; padding: 2.4vmin; min-height: 17vmin;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .6vmin; cursor: pointer; font: inherit;
  background: linear-gradient(160deg, var(--from), var(--to));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 1vmin 3vmin rgba(0,0,0,.4);
}
.scene:active { transform: scale(.98); }
.scene b { font-size: 3.2vmin; font-weight: 600; }
.scene span { font-size: 2.1vmin; color: rgba(255,255,255,.8); }

/* Working */
.spinner { width: 14vmin; height: 14vmin; border-radius: 50%; border: 1vmin solid var(--spin-track); border-top-color: var(--spin-head); animation: spin 1s linear infinite; margin-bottom: 2vmin; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Demo settings panel and mode label */
#demo-panel { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 4vmin; }
#demo-panel[hidden] { display: none !important; }
.panel-card { background: #161616; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 4vmin; width: min(86vmin, 92vw); display: flex; flex-direction: column; gap: 2vmin; text-align: left; }
.panel-card h3 { margin: 0; font-size: 4.2vmin; font-weight: 500; }
.opt { display: flex; align-items: center; gap: 1.6vmin; font-size: 3vmin; }
.opt input { width: 3.2vmin; height: 3.2vmin; accent-color: var(--accent); }
#clip-select { margin: 1vmin 0 0 5vmin; font: inherit; font-size: 2.8vmin; padding: 1.4vmin; border-radius: 6px; background: #000; color: #fff; border: 1px solid rgba(255,255,255,.3); width: calc(100% - 5vmin); }
#clip-select:disabled { opacity: .4; }
#mode-badge { position: fixed; left: 2vmin; bottom: 1.6vmin; z-index: 5; font-size: 1.9vmin; color: rgba(255,255,255,.55); background: rgba(0,0,0,.45); padding: .6vmin 1.6vmin; border-radius: 999px; pointer-events: none; }

/* Brand toggle (start screen only) */
#brand-toggle { position: absolute; top: 2.4vmin; left: 50%; transform: translateX(-50%); display: flex; padding: .5vmin; gap: .4vmin; border-radius: 999px; border: 1px solid var(--ghost); background: rgba(128,128,128,.12); }
#brand-toggle button { appearance: none; border: 0; border-radius: 999px; padding: 1.1vmin 2.6vmin; font: inherit; font-size: 2.1vmin; font-weight: 600; background: transparent; color: var(--muted); cursor: pointer; }
#brand-toggle button[aria-pressed="true"] { background: var(--accent-grad); color: #fff; }

/* ---- United Parks: aquatic extras (hidden in other looks) ---- */
#ocean, .parks-plate, .scene i { display: none; }
body[data-brand="united-parks"] #ocean { display: block; position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
body[data-brand="united-parks"] #ocean::before {   /* soft light rays from above */
  content: ""; position: absolute; top: -20%; left: -10%; width: 120%; height: 80%;
  background: repeating-linear-gradient(105deg, rgba(120,200,240,.0) 0 9vmin, rgba(120,200,240,.07) 11vmin 15vmin, rgba(120,200,240,0) 17vmin 26vmin);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%);
  animation: rays 14s ease-in-out infinite alternate;
}
@keyframes rays { from { transform: translateX(-3vmin); opacity: .7; } to { transform: translateX(3vmin); opacity: 1; } }
body[data-brand="united-parks"] #ocean::after {   /* waves along the bottom */
  content: ""; position: absolute; left: -50%; bottom: 0; width: 200%; height: 16vmin; opacity: .9;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'><path d='M0 60 Q150 20 300 60 T600 60 T900 60 T1200 60 V120 H0Z' fill='%23123f66' fill-opacity='.55'/><path d='M0 80 Q150 45 300 80 T600 80 T900 80 T1200 80 V120 H0Z' fill='%230a2c4d' fill-opacity='.8'/></svg>") repeat-x bottom / 50% 100%;
  animation: drift 22s linear infinite;
}
@keyframes drift { to { transform: translateX(-25%); } }
.bubble { position: absolute; bottom: -6vmin; border-radius: 50%; border: 1px solid rgba(190,230,250,.45); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,.04) 60%); animation: rise linear infinite; }
@keyframes rise { to { transform: translateY(-115vh) translateX(var(--sway, 3vmin)); opacity: 0; } }

body[data-brand="united-parks"] h1 { font-size: 5.6vmin; letter-spacing: .06em; text-transform: uppercase; max-width: 20ch; font-weight: 400; }
body[data-brand="united-parks"] .tagline { letter-spacing: .02em; }
body[data-brand="united-parks"] .logo { margin-bottom: 2vmin; filter: drop-shadow(0 .6vmin 2vmin rgba(0,0,0,.35)); }
body[data-brand="united-parks"] .parks-plate { display: block; margin-top: 3.5vmin; background: #fff; border-radius: 2.2vmin; padding: 1.8vmin 3.4vmin; width: min(80vmin, 92vw); box-shadow: 0 1.2vmin 4vmin rgba(0,0,0,.4); }
.parks-plate img { display: block; width: 100%; height: auto; }
body[data-brand="united-parks"] .btn.primary { box-shadow: 0 1vmin 3vmin rgba(42,154,217,.35); border-radius: 999px; }
body[data-brand="united-parks"] .btn { border-radius: 999px; }
body[data-brand="united-parks"] .frame { border-radius: 2vmin; box-shadow: 0 2vmin 6vmin rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.14); }

/* United Parks scene picker */
body[data-brand="united-parks"] #screen-scenes h2 { font-size: 4.6vmin; letter-spacing: .1em; text-transform: uppercase; }
body[data-brand="united-parks"] #screen-scenes h2::after { content: ""; display: block; width: 26vmin; height: 1.1vmin; margin: 1.8vmin auto 0; border-radius: 50%; background: linear-gradient(90deg, #6fbe44, #2a9ad9); }
body[data-brand="united-parks"] .scene-grid { gap: 2.4vmin; width: min(88vmin, 94vw); }
body[data-brand="united-parks"] .scene {
  min-height: 24vmin; padding: 3vmin; flex-direction: row; align-items: center; justify-content: flex-start; gap: 2.4vmin; text-align: left;
  border-radius: 2.4vmin; background: linear-gradient(160deg, color-mix(in srgb, var(--from) 38%, #08203c), #061a33 85%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 1.4vmin 4vmin rgba(0,0,0,.4); backdrop-filter: blur(6px);
}
body[data-brand="united-parks"] .scene i { display: flex; align-items: center; justify-content: center; flex: none; width: 13vmin; height: 13vmin; border-radius: 50%; font-style: normal; font-size: 7.4vmin;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.28), rgba(255,255,255,.06)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
body[data-brand="united-parks"] .scene .txt { display: flex; flex-direction: column; gap: .8vmin; }
body[data-brand="united-parks"] .scene b { font-family: var(--heading-font); font-size: 3.5vmin; font-weight: 400; letter-spacing: .01em; }
body[data-brand="united-parks"] .scene span { font-size: 2.2vmin; color: var(--muted); }
.scene .txt { display: flex; flex-direction: column; gap: .6vmin; }
body[data-brand="united-parks"] h1 { text-wrap: balance; max-width: 22ch; }

/* ---- Demo polish: working screen, reveal, QR, attract ---- */
.working-frame { height: min(46vh, 100vw); }
.working-frame img { filter: blur(7px) saturate(1.15); transform: scale(1.06); }
.shimmer { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.38) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 1.8s linear infinite; mix-blend-mode: soft-light; }
@keyframes shimmer { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.working-scene { margin: 0; font-size: 2.3vmin; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#screen-working .spinner { width: 6vmin; height: 6vmin; border-width: .6vmin; margin-bottom: 0; }
#working-title.swap { animation: fadein .5s ease both; }
.frame img#result-before { z-index: 0; }
.frame img#result-img { z-index: 1; }
img#result-img.reveal { animation: wipe 1.5s cubic-bezier(.6,.05,.25,1) both; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.sweep { position: absolute; top: 0; bottom: 0; width: 7%; z-index: 2; left: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent); filter: blur(2px); animation: sweep 1.5s cubic-bezier(.6,.05,.25,1) both; pointer-events: none; }
@keyframes sweep { from { left: -7%; } to { left: 100%; } }
#screen-review .btn, #screen-result .btn:not(.link) { padding: 2.7vmin 5vmin; font-size: 3.2vmin; }
.qr-card { align-items: center; text-align: center; }
.qr-card img { width: min(44vmin, 70vw); height: auto; background: #fff; padding: 2vmin; border-radius: 1.4vmin; }
#qr-panel { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 4vmin; }
#qr-panel[hidden] { display: none !important; }
#attract { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4vmin; background: var(--bg-grad); animation: fadein .6s ease both; }
#attract[hidden] { display: none !important; }
#attract .frame { height: min(62vh, 110vw); }
#att-after { opacity: 0; transition: opacity 1.4s ease; }
#att-after.on { opacity: 1; }
#att-frame { z-index: 1; object-fit: fill; }
#att-caption { margin: 0; font-size: 3.4vmin; font-family: var(--heading-font); letter-spacing: .06em; }
.att-tap { margin: 0; font-size: 2.4vmin; color: var(--muted); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
