/* ---------- reset & base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #07050a;
  font-family: 'Nunito', sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; padding: 0; }

/* block iOS's long-press "Save Image" / callout */
img, .phone, .phone * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

:root {
  --ink: #07050a;
  --ink-2: #140c10;
  --cream: #fbf1dc;
  --cream-dim: #e6d6b8;
  --gold: #d6b066;
  --gold-bright: #f5dfa3;
  --gold-deep: #9a6b27;
  --ruby: #9e1b32;
  --emerald: #0e3a2c;
  --serif: 'Playfair Display', Georgia, serif;
  --caps: 'Cinzel', 'Playfair Display', serif;
  --gold-text: linear-gradient(180deg, #fff4cf 0%, #f0cf82 38%, #c8953f 70%, #f4d993 100%);
}

.gold {
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- phone frame ---------- */
.phone {
  position: relative;
  overflow: hidden;
  background: #000;
  container-type: inline-size;
  container-name: phone;
}
html.frame-desktop body {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 20%, #2a1a14 0%, #120a0c 60%, #050305 100%);
}
html.frame-desktop .phone {
  width: min(430px, 88vh);
  aspect-ratio: 9 / 16;
  border-radius: 46px;
  border: 12px solid #16100c;
  box-shadow: 0 40px 90px rgba(0,0,0,.6), 0 0 0 1px rgba(214,176,102,.25);
}
html.frame-mobile .phone { width: 100vw; height: 100vh; height: 100dvh; }

/* ---------- loading ---------- */
.loading-screen {
  position: absolute; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5cqw;
  background: radial-gradient(circle at 50% 42%, #2b1a12 0%, #120a0b 60%, #050304 100%);
  transition: opacity .45s ease;
}
.loading-screen.hide { opacity: 0; pointer-events: none; }
.loading-mask {
  width: 10cqw; aspect-ratio: 1 / 2;
  background: url('assets/opt/parts/bang.webp') center / contain no-repeat;
  filter: drop-shadow(0 6px 18px rgba(214,176,102,.35));
}
.loading-chip .kicker-text { font-size: 4.4cqw; color: var(--gold-bright); letter-spacing: .12em; }
.loading-bar-track { width: 40%; height: 2px; background: rgba(214,176,102,.2); border-radius: 999px; overflow: hidden; }
.loading-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); transition: width .25s ease; }

.stage { position: absolute; inset: 0; overflow: hidden; }

/* ---------- background ---------- */
.bg {
  position: absolute; inset: 0;
  background: url('assets/opt/backdrop-court.webp') center 30% / cover no-repeat;
}
.bg-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% 55%, rgba(0,0,0,0) 40%, rgba(0,0,0,.45) 100%),
    linear-gradient(to bottom, rgba(5,3,4,.62) 0%, rgba(5,3,4,.1) 26%, rgba(5,3,4,0) 45%, rgba(5,3,4,.18) 70%, rgba(5,3,4,.78) 100%);
}

/* ---------- chips ---------- */
.kicker, .sound-toggle {
  position: absolute; z-index: 40;
  top: max(10px, 3cqw);
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(20,12,14,.72), rgba(7,5,8,.72));
  border: 1px solid rgba(214,176,102,.6);
  box-shadow: 0 4px 14px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 999px;
}
.kicker { left: max(10px, 3cqw); display: flex; align-items: center; gap: .45em; padding: .45em 1.1em .45em .85em; }
.kicker-chevron { font-size: 4cqw; line-height: 1; }
.kicker-text { font-family: var(--caps); font-weight: 600; font-size: 2.9cqw; letter-spacing: .1em; }
.sound-toggle {
  right: max(10px, 3cqw);
  width: 9cqw; height: 9cqw; min-width: 34px; min-height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.sound-note { font-size: 4cqw; line-height: 1; position: relative; }
.sound-slash {
  position: absolute; left: 50%; top: 50%;
  width: 60%; height: 1.6px; background: var(--gold-bright);
  transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
  transition: transform .15s ease;
}
.sound-toggle.muted .sound-slash { transform: translate(-50%, -50%) rotate(-45deg) scaleX(1); }

/* ---------- play rig ----------
   .world = the plate's own 2:3 box (height 100 %, centred, sides cropped),
   so every sprite, cone and hit-test works in PLATE percentages.
   Gate measured off the plate: x 36-64 %, y 0-23 %. */
.play { position: absolute; inset: 0; z-index: 10; transition: opacity .3s ease; touch-action: none; }
.play.hidden { opacity: 0; pointer-events: none; }
.world {
  position: absolute; top: 0; left: 50%; height: 100%; aspect-ratio: 2 / 3;
  transform: translateX(-50%);
  background: url('assets/opt/backdrop-court.webp') center / 100% 100% no-repeat;
  z-index: 1;
}
.world-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(to bottom, rgba(5,3,4,.55) 0%, rgba(5,3,4,0) 20%, rgba(5,3,4,0) 80%, rgba(5,3,4,.6) 100%); }

/* every sprite: positioned by its FEET (left/top = feet point), GSAP centres it */
.sp { position: absolute; background-size: contain; background-position: bottom center; background-repeat: no-repeat; pointer-events: none; }
.shadow { position: absolute; width: 11%; height: 2.4%; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.6) 0%, rgba(0,0,0,0) 70%); }
.groom { height: 15%; filter: drop-shadow(0 8px 8px rgba(0,0,0,.5)); }
.pillar { height: 24%; aspect-ratio: var(--ar); background-image: url('assets/opt/parts/pillar.webp'); filter: drop-shadow(0 10px 10px rgba(0,0,0,.5)); }
.urn { height: 9%; aspect-ratio: var(--ar); background-image: url('assets/opt/parts/urn.webp'); }
.aunty { height: 17%; aspect-ratio: var(--ar); filter: drop-shadow(0 8px 8px rgba(0,0,0,.5)); }
.bride-gate { height: 20%; aspect-ratio: var(--ar); background-image: url('assets/opt/parts/bride-cross.webp'); opacity: 0; filter: drop-shadow(0 0 18px rgba(245,223,163,.5)); }

/* lantern light: a soft golden wedge; origin at its left-middle = the lantern */
.cone { position: absolute; height: 0; transform-origin: 0 50%; pointer-events: none; }
.cone::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1 / .62; transform: translateY(-50%);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  background: radial-gradient(ellipse at 0% 50%, rgba(255,222,140,.55) 0%, rgba(255,210,120,.28) 45%, rgba(255,200,110,0) 100%); }
.cone.alert::before { background: radial-gradient(ellipse at 0% 50%, rgba(255,120,90,.6) 0%, rgba(255,110,80,.3) 45%, rgba(255,100,70,0) 100%); }

.bang { position: absolute; width: 7%; aspect-ratio: var(--ar); background-image: url('assets/opt/parts/bang.webp'); opacity: 0; z-index: 900; }
.dust { position: absolute; width: 10%; aspect-ratio: var(--ar); background-image: url('assets/opt/parts/dust.webp'); opacity: 0; z-index: 800; }
.target-ring { position: absolute; width: 9%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--gold-bright); opacity: 0; pointer-events: none; z-index: 5;
  box-shadow: 0 0 14px rgba(245,223,163,.55), inset 0 0 10px rgba(245,223,163,.35); }

.callout {
  position: absolute; left: 50%; top: 42%; z-index: 22; opacity: 0; pointer-events: none;
  white-space: nowrap;
  padding: .12em .6em .16em; border-radius: 12px;
  background: linear-gradient(180deg, rgba(20,12,14,.92), rgba(5,3,5,.92));
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(5,3,5,.7), 0 0 0 4.5px rgba(214,176,102,.5), 0 12px 26px rgba(0,0,0,.55), 0 0 36px rgba(245,223,163,.25);
}
.callout span {
  display: block; font-family: var(--caps); font-weight: 700; font-size: 7cqw; letter-spacing: .06em; line-height: 1.1;
  background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.drag-cue { position: absolute; left: 50%; bottom: 29%; translate: -50% 0; z-index: 30; display: flex; flex-direction: column-reverse; align-items: center; gap: 2cqw; transition: opacity .3s ease; pointer-events: none; }
.drag-cue.hide { opacity: 0; }
.drag-hand { width: 13cqw; aspect-ratio: 1; background: url('assets/opt/guest-hand.webp') center / contain no-repeat; animation: dragHand 1.8s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
@keyframes dragHand { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(3cqw, -14cqw); opacity: 1; } 100% { transform: translate(3cqw, -14cqw); opacity: 0; } }

/* ---------- headline ---------- */
.headline {
  position: absolute; left: 0; right: 0; top: max(50px, 13cqw);
  z-index: 25; text-align: center; padding: 0 7%; pointer-events: none;
}
.headline::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 125%; height: 220%; transform: translate(-50%, -50%); z-index: -1;
  background: radial-gradient(ellipse at center, rgba(5,3,4,.6) 0%, rgba(5,3,4,.28) 45%, rgba(5,3,4,0) 75%);
}
.h-name {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: 10.5cqw; line-height: 1.08; overflow-wrap: break-word;
  background: var(--gold-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.6));
}
.h-sub {
  font-family: var(--serif); font-weight: 600;
  font-size: 5.4cqw; color: var(--cream); margin-top: .3em;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}

.cue-pill {
  font-family: var(--caps); font-weight: 600; font-size: 3cqw; letter-spacing: .1em;
  color: var(--gold-bright);
  padding: .45em 1em; border-radius: 999px;
  background: rgba(7,5,8,.7); border: 1px solid rgba(214,176,102,.5);
}

/* bottom band: freedom meter during play, swipe cue before it */
.hud { position: absolute; left: 8%; right: 8%; bottom: 5.5%; z-index: 30; opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.hud.show { opacity: 1; }
.hud-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.4cqw; }
.hud-label { font-family: var(--caps); font-weight: 700; font-size: 2.8cqw; letter-spacing: .2em; color: var(--gold-bright); }
.hud-pct { font-family: var(--caps); font-weight: 700; font-size: 3.2cqw; color: var(--cream); }
.meter { height: 2.6cqw; min-height: 9px; border-radius: 999px; background: rgba(7,5,8,.75); border: 1px solid rgba(214,176,102,.6); overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.meter-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #9a6b27, #f0cf82 60%, #fff4cf); transition: width .35s ease; }

.swipe-cue { position: absolute; left: 50%; bottom: 4%; translate: -50% 0; z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 2.4cqw; transition: opacity .3s ease; pointer-events: none; }
.swipe-cue.hide { opacity: 0; }
.swipe-arrows { display: flex; align-items: center; gap: 12cqw; }
.swipe-arrow { font-size: 7cqw; line-height: 1; color: var(--gold-bright); text-shadow: 0 0 12px rgba(245,223,163,.5); }
.swipe-arrow.l { animation: nudgeL 1.2s ease-in-out infinite; }
.swipe-arrow.r { animation: nudgeR 1.2s ease-in-out infinite; }
.swipe-hand { width: 12cqw; aspect-ratio: 1; background: url('assets/opt/guest-hand.webp') center / contain no-repeat; animation: swipeHand 1.6s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
@keyframes swipeHand { 0%,100% { transform: translateX(-7cqw) rotate(-8deg); } 50% { transform: translateX(7cqw) rotate(8deg); } }
@keyframes nudgeL { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
@keyframes nudgeR { 0%,100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; z-index: 15; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.screen.show { opacity: 1; pointer-events: auto; }

/* ---------- reveal ---------- */
.sparkle-layer { position: absolute; inset: 0; z-index: 16; pointer-events: none; overflow: hidden; }
.sparkle-piece {
  position: absolute; left: 50%; top: 45%; width: 9%;
  aspect-ratio: 258 / 303;
  background: url('assets/opt/parts/sparkle.webp') center / contain no-repeat;
  opacity: 0; will-change: transform;
}
.reveal-headline { position: absolute; left: 0; right: 0; top: 11%; text-align: center; padding: 0 6%; z-index: 20; }
.rh-line1 {
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 8.4cqw;
  background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.6));
}
.rh-line2 { font-family: var(--caps); font-weight: 600; font-size: 4.6cqw; letter-spacing: .14em; color: var(--cream); margin-top: .35em; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
.reveal-actor {
  position: absolute; left: 50%; bottom: 20%;
  width: 92%; height: 56%;
  translate: -50% 0;
  background: url('assets/opt/parts/couple-ear.webp') bottom center / contain no-repeat;
  z-index: 18; filter: drop-shadow(0 18px 20px rgba(0,0,0,.5));
}
.reveal-sub {
  position: absolute; left: 0; right: 0; bottom: 11%;
  text-align: center; padding: 0 8%; z-index: 20;
  font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 4.3cqw;
  color: var(--cream); text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.tap-hint {
  position: absolute; left: 50%; bottom: 4.5%; translate: -50% 0; z-index: 20;
  font-family: var(--caps); font-weight: 600; font-size: 2.8cqw; letter-spacing: .14em;
  color: var(--gold-bright); animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: .45; } 50% { opacity: .95; } }

/* ---------- confirm ---------- */
.screen-confirm { background: radial-gradient(ellipse at 50% 30%, rgba(10,6,8,.55), rgba(3,2,3,.86)); }
.confirm-scroll {
  position: absolute; inset: 0; z-index: 10; overflow-y: auto; touch-action: pan-y;
  display: flex; flex-direction: column; align-items: center;
  padding: 17cqw 6cqw 5cqw; gap: 1cqw;
}
.confirm-scroll * { touch-action: pan-y; }
.confirm-eyebrow { font-family: var(--caps); font-weight: 600; font-size: 2.7cqw; letter-spacing: .32em; text-transform: uppercase; color: var(--cream-dim); }
.confirm-title {
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 12cqw; line-height: 1.05; margin: .05em 0 0;
  background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.6));
}
.gold-divider { display: flex; align-items: center; justify-content: center; gap: .6em; width: 46%; margin: .2em 0; }
.gold-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent); }
.divider-dot { font-size: 2.8cqw; color: var(--gold-bright); flex-shrink: 0; }

.card { position: relative; filter: drop-shadow(0 24px 32px rgba(0,0,0,.65)); }
.card > img { width: 100%; display: block; aspect-ratio: 976 / 1472; }
/* card-lux's empty velvet panel, measured off the pixels:
   9.3-90.3 % x, 25.5-94.7 % y (the arch crown sits above 25 %). */
.card-confirm { width: 80%; flex-shrink: 0; margin-top: 2cqw; }
.card-text {
  position: absolute; left: 15%; right: 15%; top: 29%; bottom: 10%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5em; text-align: center; color: var(--cream);
}
.card-text > div { max-width: 100%; }
.ct-eyebrow { font-family: var(--caps); font-weight: 600; font-size: 2.3cqw; letter-spacing: .3em; text-transform: uppercase; color: var(--cream-dim); }
.ct-names {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: 8cqw; line-height: 1.12; white-space: nowrap;
  background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ct-names .amp { display: block; font-size: .62em; font-weight: 500; }
.ct-rule { display: flex; align-items: center; gap: .5em; width: 70%; }
.ct-date { font-family: var(--caps); font-weight: 700; font-size: 4.6cqw; letter-spacing: .14em; color: var(--gold-bright); white-space: nowrap; }
.ct-city { font-family: var(--caps); font-weight: 600; font-size: 3cqw; letter-spacing: .32em; text-transform: uppercase; color: var(--cream); }
.ct-tag { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 2.7cqw; line-height: 1.5; color: var(--cream-dim); margin-top: .6em; opacity: .9; }

.btn-calendar {
  width: 88%; margin-top: 3cqw; padding: 3.8cqw 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; gap: .55em;
  font-size: 4.2cqw; color: var(--ink);
  background: linear-gradient(180deg, #fbe7b0 0%, #e2b865 45%, #b88636 100%);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0,0,0,.55), 0 0 0 1px rgba(255,244,207,.6) inset, 0 0 24px rgba(214,176,102,.25);
}
.btn-calendar:active { transform: scale(.97); }
.btn-cal-icon { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.btn-cal-label { font-family: var(--caps); font-weight: 700; letter-spacing: .08em; }
.btn-cal-chevron { font-size: 1.3em; line-height: 1; }

.share-row {
  width: 92%; margin-top: 3cqw; flex-shrink: 0;
  display: flex; align-items: center; gap: 3cqw;
  padding: 2.8cqw 3cqw;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(28,18,20,.92), rgba(8,5,8,.95));
  border: 1px solid rgba(214,176,102,.6);
  box-shadow: 0 10px 22px rgba(0,0,0,.45);
}
.share-avatar {
  width: 17cqw; height: 17cqw; flex-shrink: 0; border-radius: 50%;
  background: #1b1013 url('assets/opt/parts/couple-ear.webp') center 4% / 140% auto no-repeat;
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px rgba(7,5,8,.9), 0 0 0 5px rgba(214,176,102,.4);
}
.share-text { flex: 1; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 3.7cqw; line-height: 1.3; color: var(--cream); }
.share-btns { display: flex; flex-direction: column; gap: 2cqw; }
.btn-icon-circle {
  width: 9cqw; height: 9cqw; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 4cqw; color: var(--ink);
  background: radial-gradient(circle at 35% 30%, #fbe7b0, #c8953f);
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
}
.btn-icon-circle:active { transform: scale(.92); }

.confirm-footer { display: flex; flex-direction: column; align-items: center; gap: .5em; margin-top: 2.5cqw; padding-bottom: 2cqw; }
.footer-text { font-family: var(--caps); font-weight: 600; font-size: 2.7cqw; letter-spacing: .26em; text-transform: uppercase; color: var(--cream-dim); }

.toast {
  position: absolute; left: 50%; bottom: 6%;
  transform: translate(-50%, 20px);
  background: rgba(7,5,8,.92); color: var(--gold-bright);
  border: 1px solid rgba(214,176,102,.5);
  font-family: var(--caps); font-weight: 600; font-size: 3cqw; letter-spacing: .06em;
  padding: .7em 1.3em; border-radius: 999px;
  z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .sparkle-piece { display: none; }
  .cue-hand, .tap-hint { animation: none; }
}

/* this level's goal (the gate) is at the TOP, so the headline lives at the
   bottom here, over the plain floor, and the callout sits mid-screen */
.play .headline { top: auto; bottom: max(64px, 17cqw); }
.play .headline::before { background: radial-gradient(ellipse at center, rgba(5,3,4,.72) 0%, rgba(5,3,4,.35) 45%, rgba(5,3,4,0) 75%); }
.play .h-name { font-size: 9cqw; }
.play .h-sub { font-size: 4.8cqw; }
.callout { top: 50%; }
