@font-face { font-family: "Agbalumo"; src: url("/static/fonts/Agbalumo-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alexandria"; src: url("/static/fonts/Alexandria-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alexandria"; src: url("/static/fonts/Alexandria-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Alexandria"; src: url("/static/fonts/Alexandria-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Alexandria"; src: url("/static/fonts/Alexandria-ExtraBold.ttf") format("truetype"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Alexandria"; src: url("/static/fonts/Alexandria-Black.ttf") format("truetype"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Alkatra"; src: url("/static/fonts/Alkatra-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alkatra"; src: url("/static/fonts/Alkatra-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --pink: #ff4f9b;
  --pink-soft: #ffc6e4;
  --blue: #4d83e9;
  --blue-soft: #a8d6ff;
  --orange: #ff7755;
  --purple: #8851d8;
  --wine: #97105c;
  --paper: #fde0f0;
  --ink: #8f0d55;
  --stage-scale: 1;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #11020c;
  font-family: "Alexandria", sans-serif;
}

body { cursor: none; }

.public-start[hidden] { display:none; }
.public-start { position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:32px;color:#8f0d55;background:radial-gradient(circle at 50% 35%,rgba(255,255,255,.93),rgba(251,211,235,.98));cursor:auto; }
.public-start-card { width:min(720px,92vw);padding:clamp(32px,7vw,72px);text-align:center;border:4px solid #a90068;border-radius:36px;background:rgba(255,250,253,.96);box-shadow:0 30px 90px rgba(91,0,54,.22); }
.public-start-card span { font:800 clamp(16px,2vw,22px)/1 Alexandria,sans-serif;letter-spacing:2px; }
.public-start-card h2 { margin:20px 0 10px;font:400 clamp(48px,9vw,86px)/1 Agbalumo,cursive; }
.public-start-card p { margin:0 auto 26px;max-width:560px;font:600 clamp(20px,3vw,28px)/1.35 Alexandria,sans-serif; }
.public-start-card div { min-height:28px;margin-bottom:14px;font:700 16px/1.2 Alexandria,sans-serif;color:#b1367e; }
#publicStartButton,.public-command { border:3px solid #a90068;border-radius:999px;color:#fff;background:linear-gradient(135deg,#b40070,#ed3f99);font:800 30px/1 Alexandria,sans-serif;box-shadow:0 12px 28px rgba(156,0,93,.25); }
#publicStartButton { min-width:min(430px,100%);padding:24px 34px; }
#publicStartButton:disabled { opacity:.6;cursor:wait; }
.public-command { display:none;position:absolute;left:50%;bottom:126px;z-index:115;min-width:330px;padding:22px 34px;transform:translateX(-50%);cursor:pointer; }
#stage[data-state="consent"] .public-command { display:block; }
html[data-mirror-mode="true"] [data-public-control] { display:none !important; }
html:not([data-mirror-mode="true"]) body { cursor:auto; }

html[data-mirror-mode="true"] body { background:#000; }
html[data-mirror-mode="true"] #stage {
  filter:brightness(var(--display-exposure,1.08)) contrast(var(--display-contrast,1.12)) saturate(var(--display-colour,1.06));
}

.mirror-calibration[hidden] { display:none; }
.mirror-calibration {
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  grid-template-rows:auto minmax(220px,1fr) auto auto auto;
  gap:22px;
  min-height:100dvh;
  padding:max(42px,env(safe-area-inset-top)) 42px max(42px,env(safe-area-inset-bottom));
  color:#fff;
  background:#000;
  cursor:auto;
}
.calibration-copy { max-width:900px; }
.calibration-copy span { color:#ff72b6;font:800 26px/1 Alexandria,sans-serif;letter-spacing:2px; }
.calibration-copy h2 { margin:18px 0 10px;font:400 clamp(54px,8vw,96px)/.95 Agbalumo,cursive; }
.calibration-copy p { margin:0;max-width:880px;font:600 clamp(25px,3vw,38px)/1.25 Alexandria,sans-serif; }
.calibration-scale { display:grid;grid-template-columns:repeat(6,1fr);min-height:28vh;border:4px solid #fff; }
.calibration-scale i { display:flex;align-items:flex-end;justify-content:center;padding:18px 6px;background:var(--tone);font-style:normal; }
.calibration-scale b { color:#fff;font:800 clamp(16px,2.2vw,28px)/1 Alexandria,sans-serif;text-shadow:0 2px 6px #000;writing-mode:vertical-rl; }
.display-controls { display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) auto;gap:16px;align-items:end; }
.display-controls label { display:grid;gap:10px;color:#fff;font:750 clamp(17px,2vw,23px)/1 Alexandria,sans-serif; }
.display-controls label span { display:flex;justify-content:space-between;gap:12px; }
.display-controls output { color:#ff8ec4;font-variant-numeric:tabular-nums; }
.display-controls input { width:100%;accent-color:#ff5ca8; }
.display-controls button { min-height:58px;padding:12px 18px;border:2px solid #ff9dcb;border-radius:15px;color:#ffb3d7;background:#250017;font:800 17px/1 Alexandria,sans-serif; }
.calibration-status { margin:0;color:#ffd0e7;font:750 clamp(18px,2.4vw,26px)/1.25 Alexandria,sans-serif;letter-spacing:.4px; }
.runtime-loader { display:flex;align-items:center;gap:18px;min-height:66px;padding:12px 18px;border:2px solid rgba(255,121,185,.45);border-radius:18px;color:#ffb6d9;background:#250017;opacity:.45;font:800 clamp(18px,2.6vw,28px)/1 Alexandria,sans-serif;letter-spacing:1px;transition:opacity .25s,border-color .25s,box-shadow .25s; }
.runtime-loader i { width:34px;height:34px;flex:none;border:5px solid rgba(255,255,255,.22);border-top-color:#ff79b9;border-right-color:#79b8ff;border-radius:50%; }
.runtime-loader[data-active="true"] { opacity:1;border-color:#ff79b9;box-shadow:0 0 30px rgba(255,92,168,.22); }
.runtime-loader[data-active="true"] i { animation:runtime-loader-spin .8s linear infinite; }
@keyframes runtime-loader-spin { to { transform:rotate(360deg); } }
#finishCalibration { min-height:90px;padding:20px;color:#79004a;border:4px solid #fff;border-radius:24px;background:#ff79b9;font:800 clamp(30px,4vw,48px)/1 Alexandria,sans-serif;box-shadow:0 0 40px rgba(255,92,168,.42); }
#finishCalibration:disabled { opacity:.58;cursor:wait; }
.ipad-fullscreen-guide { display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 18px;border:2px solid #ff7fba;border-radius:15px;color:#ffd4e9;background:#250017;font:750 clamp(15px,2vw,21px)/1.2 Alexandria,sans-serif; }
.ipad-fullscreen-guide strong { color:#ff79b9;white-space:nowrap; }
.ipad-fullscreen-guide p { margin:0;text-align:right; }
.ipad-fullscreen-guide[data-ready="true"] { border-color:#79b8ff;color:#d6e8ff; }

#stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 106, 177, .23), transparent 27%),
    radial-gradient(circle at 88% 73%, rgba(81, 150, 239, .25), transparent 28%),
    linear-gradient(180deg, #ffe0f1 0%, #f7ddec 42%, #c7e1ff 100%);
  transform: translate(-50%, -50%) scale(var(--stage-scale));
  transform-origin: center;
  isolation: isolate;
}

.paper-grid {
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image:
    linear-gradient(rgba(241, 133, 190, .32) 2px, transparent 2px),
    linear-gradient(90deg, rgba(241, 133, 190, .32) 2px, transparent 2px);
  background-size: 64px 64px;
  z-index: -3;
}

.masthead {
  position: absolute;
  top: 66px;
  left: 98px;
  width: 884px;
  height: 155px;
  text-align: center;
  z-index: 30;
}

.masthead h1 {
  margin: 40px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(255,255,255,.55);
}

.masthead h1 span { color: var(--blue); font-size: 35px; vertical-align: top; }

.step-badge {
  position: absolute;
  top: -25px;
  left: 50%;
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  color: var(--wine);
  background: #fff6fb;
  border: 3px solid var(--wine);
  font-family: Georgia, serif;
  font-size: 29px;
  font-style: italic;
  font-weight: 800;
  clip-path: polygon(50% 0, 64% 23%, 89% 14%, 80% 40%, 100% 56%, 73% 62%, 75% 91%, 51% 76%, 27% 96%, 28% 65%, 0 55%, 23% 40%, 12% 13%, 38% 23%);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity .3s ease;
}

.section-tag {
  position: absolute;
  left: -4px;
  bottom: -8px;
  padding: 9px 17px;
  background: #fff9fd;
  border: 2px solid var(--wine);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1.5px;
  transform: rotate(-3deg);
  opacity: 0;
  transition: opacity .3s ease;
}

#stage:not([data-state="idle"]):not([data-state="seen"]):not([data-state="animal"]):not([data-state="consent"]) .step-badge,
#stage:not([data-state="idle"]):not([data-state="seen"]):not([data-state="animal"]):not([data-state="consent"]) .section-tag { opacity: 1; }

.mirror {
  position: absolute;
  top: 232px;
  left: 96px;
  width: 888px;
  height: 1335px;
  overflow: hidden;
  border: 13px solid var(--wine);
  border-radius: 54px;
  background: #e6e5e7;
  box-shadow: 0 18px 0 rgba(105, 9, 64, .1), inset 0 0 0 4px rgba(255,255,255,.45);
  z-index: 10;
}

.mirror::before {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: 36px;
  box-shadow: inset 0 0 70px rgba(119, 15, 78, .18);
  pointer-events: none;
  z-index: 50;
}

.mirror-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 25%, rgba(255, 171, 216, .75), transparent 32%),
    radial-gradient(circle at 77% 40%, rgba(152, 211, 255, .7), transparent 36%),
    linear-gradient(145deg, #ffe3f3, #d4e7ff);
  z-index: 0;
}

video,
.camera-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

video {
  background: #d4d2d5;
  transform: scaleX(-1) scale(var(--camera-zoom, 1));
  z-index: 2;
  transition: opacity .8s ease, filter .8s ease;
}

.silhouette-canvas {
  z-index: 6;
  opacity: 0;
  transform: scaleX(-1) scale(var(--camera-zoom, 1));
  filter: saturate(1.2) drop-shadow(0 0 35px rgba(255, 132, 199, .65));
  transition: opacity .8s ease;
}

.frozen-frame {
  display: block;
  z-index: 4;
  opacity: 0;
  transform: scaleX(-1) scale(var(--camera-zoom, 1));
  transition: opacity .6s ease, filter .6s ease, transform .8s ease;
}

.effects-canvas {
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}

.frost-layer {
  position: absolute;
  inset: -60px;
  z-index: 5;
  overflow: hidden;
  opacity: .32;
  background: rgba(255, 222, 241, .13);
  backdrop-filter: blur(14px) saturate(1.25);
  transition: opacity .7s ease;
  animation: frost-drift 8s ease-in-out infinite alternate;
}

.frost-layer::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(125deg, rgba(255,255,255,.1), rgba(255,113,183,.16), rgba(92,168,255,.15));
  mix-blend-mode: screen;
}

.frost-orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(18px);
}

.orb-a { width: 380px; height: 380px; left: 40px; top: 180px; background: #ff9ed1; }
.orb-b { width: 450px; height: 450px; right: -80px; top: 430px; background: #89caff; }
.orb-c { width: 360px; height: 360px; left: 210px; bottom: 50px; background: #ffd58d; }
.frost-flower { position: absolute; right: 120px; top: 210px; color: #93d6ff; font-size: 170px; filter: blur(5px); }

.face-guide {
  position: absolute;
  top: 33%;
  left: 50%;
  width: 350px;
  height: 440px;
  border: 5px dashed var(--wine);
  border-radius: 48% 48% 45% 45%;
  opacity: 0;
  transform: translate(-50%, -50%);
  z-index: 15;
  transition: opacity .35s ease, border-color .25s ease, box-shadow .25s ease;
}

.face-guide.is-aligned { border-style: solid; border-color: #ff4f9b; box-shadow: 0 0 35px rgba(255,79,155,.55); }
.guide-dot { position: absolute; left: 50%; top: 59%; width: 18px; height: 18px; background: var(--wine); border-radius: 50%; transform: translate(-50%,-50%); }

.corner { position: absolute; width: 46px; height: 46px; border-color: var(--wine); border-style: solid; }
.corner-a { left: -13px; top: -13px; border-width: 7px 0 0 7px; }
.corner-b { right: -13px; top: -13px; border-width: 7px 7px 0 0; }
.corner-c { left: -13px; bottom: -13px; border-width: 0 0 7px 7px; }
.corner-d { right: -13px; bottom: -13px; border-width: 0 7px 7px 0; }

.animal-panel {
  position: absolute;
  inset: 50px 80px 75px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .65s ease, transform .65s ease;
}

.animal-art { width: 620px; height: 860px; overflow: visible; }
[data-animal-art] { display: none; }
[data-animal-art].is-active { display: block; animation: animal-arrive 1s cubic-bezier(.2,.9,.2,1) both; }
.animal-name { margin-top: -40px; padding: 14px 36px; color: white; background: var(--wine); border-radius: 999px; font-size: 39px; font-weight: 900; letter-spacing: 4px; }
.animal-line { width: 650px; margin: 24px auto 0; color: var(--wine); font: italic 27px/1.35 Georgia, serif; text-align: center; }

.consent-panel {
  position: absolute;
  top: 175px;
  left: 112px;
  width: 640px;
  min-height: 830px;
  z-index: 22;
  padding: 48px 52px;
  color: var(--ink);
  background: rgba(255, 249, 253, .93);
  border: 7px solid var(--wine);
  border-radius: 28px;
  box-shadow: 15px 20px 0 rgba(110, 15, 70, .18);
  opacity: 0;
  transform: translateY(25px) scale(.96);
  transition: opacity .5s ease, transform .5s ease;
}

.system-check { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 3px solid var(--wine); font-size: 16px; font-weight: 900; letter-spacing: 2px; }
.system-check span { color: var(--blue); }
.consent-panel h2 { margin: 35px 0 28px; font-size: 43px; line-height: 1.02; letter-spacing: 1px; }
.consent-panel p { margin: 0 0 24px; font-family: Arial, sans-serif; font-size: 22px; line-height: 1.43; }
.consent-command { margin-top: 36px; padding: 20px; border: 4px solid var(--wine); background: #ffe8f4; font-size: 22px; font-weight: 900; text-align: center; letter-spacing: 1px; }

.result-panel {
  position: absolute;
  inset: 52px;
  z-index: 25;
  padding: 54px 42px 44px;
  background: rgba(255, 249, 253, .96);
  border: 5px solid var(--wine);
  border-radius: 34px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .6s ease, transform .6s ease;
}

.result-heading { margin-bottom: 35px; font: italic 44px/1 Georgia, serif; font-weight: 800; letter-spacing: -1px; }
.result-grid { display: grid; grid-template-columns: 310px 1fr; gap: 35px; }
.portrait-window { height: 440px; overflow: hidden; border: 5px solid var(--wine); border-radius: 24px; background: #eadfe8; }
.portrait-window img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.profile-copy { padding-top: 14px; }
.profile-title { font-size: 39px; font-weight: 900; line-height: 1.04; }
.profile-copy p { min-height: 124px; font: 24px/1.45 Georgia, serif; }
.score-row { display: flex; align-items: baseline; gap: 9px; color: var(--wine); }
.score-row span { font-size: 105px; font-weight: 900; line-height: 1; }
.score-row small { font-size: 30px; font-weight: 800; }
.percentile-value { margin-top: 15px; padding: 11px 14px; color: white; background: var(--blue); font-size: 19px; font-weight: 900; letter-spacing: 1px; }
.advice-card { margin-top: 42px; padding: 30px 34px; border: 4px solid var(--wine); border-radius: 22px; background: linear-gradient(135deg,#ffe0ef,#d9eaff); }
.advice-card strong { font-size: 25px; letter-spacing: 2px; }
.advice-card p { margin: 16px 0 0; font: 27px/1.35 Georgia, serif; }
.retry-command { margin: 40px auto 0; width: max-content; max-width: 100%; padding: 17px 32px; color: white; background: var(--wine); border-radius: 999px; font-size: 27px; font-weight: 900; letter-spacing: 2px; }

.error-panel {
  position: absolute;
  top: 350px;
  left: 120px;
  width: 620px;
  z-index: 40;
  padding: 60px 50px;
  background: rgba(255,249,253,.96);
  border: 6px solid var(--wine);
  border-radius: 30px;
  text-align: center;
  opacity: 0;
  transform: scale(.95);
  transition: opacity .35s ease, transform .35s ease;
}

.error-symbol { display: grid; width: 78px; height: 78px; margin: 0 auto 24px; place-items: center; color: white; background: var(--wine); border-radius: 50%; font-size: 50px; font-weight: 900; }
.error-panel h2 { margin: 0 0 20px; font-size: 42px; }
.error-panel p { margin: 0; font: 25px/1.4 Georgia,serif; }

.scan-beam {
  position: absolute;
  left: 8%;
  top: 5%;
  width: 84%;
  height: 7px;
  z-index: 14;
  opacity: 0;
  background: linear-gradient(90deg,transparent,#ff3d91,white,#4d83e9,transparent);
  box-shadow: 0 0 24px #ff5da8;
}

.colour-bloom { position: absolute; z-index: 11; opacity: 0; border-radius: 50%; filter: blur(1px); mix-blend-mode: multiply; transition: opacity .5s ease; }
.bloom-a { left: 110px; top: 260px; width: 230px; height: 320px; background: rgba(255,74,155,.34); }
.bloom-b { right: 100px; top: 330px; width: 240px; height: 340px; background: rgba(68,132,234,.34); }
.bloom-c { left: 280px; bottom: 190px; width: 300px; height: 300px; background: rgba(133,77,215,.3); }

.status-area {
  position: absolute;
  top: 1608px;
  left: 90px;
  width: 900px;
  text-align: center;
  z-index: 30;
}

.status-pill {
  display: inline-block;
  min-width: 430px;
  padding: 16px 36px 14px;
  color: var(--wine);
  background: rgba(255,251,253,.93);
  border: 4px solid var(--wine);
  border-radius: 22px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1.4px;
  box-shadow: 0 8px 0 rgba(103,14,64,.12);
  transition: opacity .18s ease, transform .18s ease;
}

.status-detail { height: 60px; margin: 18px 0 0; font: 22px/1.35 Georgia, serif; }

.voice-dock {
  position: absolute;
  left: 235px;
  bottom: 58px;
  display: flex;
  width: 610px;
  height: 68px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 60;
  color: #fff;
  background: rgba(111, 11, 67, .88);
  border: 2px solid rgba(255,255,255,.65);
  border-radius: 999px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1.5px;
  backdrop-filter: blur(12px);
  transition: opacity .35s ease, transform .35s ease;
  padding: 0 18px;
  pointer-events: none;
}

.voice-dock[data-mode="quiet"] { opacity: .72; transform: scale(.96); }
.voice-dock[data-mode="listening"] { background: rgba(54, 102, 203, .92); }
.voice-dock[data-mode="speaking"] { background: rgba(216, 50, 126, .93); }
.voice-dock[data-mode="ready"] { opacity:1;background:rgba(173,20,102,.94); }
.voice-dock[data-mode="paused"] { opacity:1;background:rgba(123,17,74,.96);box-shadow:0 0 0 5px rgba(255,255,255,.24); }
.mic-icon { width: 17px; height: 17px; color: transparent; background: #fff; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,255,255,.18); }
.voice-waves { display: flex; height: 28px; align-items: center; gap: 4px; }
.voice-waves i { width: 3px; height: 8px; background: white; border-radius: 3px; }
.voice-dock[data-mode="listening"] .voice-waves i,
.voice-dock[data-mode="speaking"] .voice-waves i { animation: voice-wave .7s ease-in-out infinite alternate; }
.voice-waves i:nth-child(2) { animation-delay: .12s !important; }
.voice-waves i:nth-child(3) { animation-delay: .24s !important; }
.voice-waves i:nth-child(4) { animation-delay: .36s !important; }

.decor { position: absolute; z-index: 25; pointer-events: none; }
.decor-heart { color: #ff617f; font-family: Georgia,serif; font-size: 68px; }
.heart-one { left: 45px; top: 875px; transform: rotate(-9deg); }
.heart-two { right: 43px; top: 1010px; transform: rotate(10deg); }
.sparkle { color: #274fa8; font-size: 70px; }
.sparkle-one { left: 38px; top: 345px; }
.sparkle-two { right: 28px; top: 150px; font-size: 45px; }
.blue-ribbon { right: -80px; top: 730px; width: 190px; height: 340px; border: 30px solid rgba(80,144,226,.5); border-left: 0; border-radius: 0 170px 170px 0; }
.checker { width: 180px; height: 42px; background-image: conic-gradient(#151515 25%,white 0 50%,#151515 0 75%,white 0); background-size: 42px 42px; }
.checker-top { left: 28px; top: 240px; transform: rotate(16deg); }
.checker-bottom { right: 23px; top: 1535px; transform: rotate(12deg); }

.operator-status { position: absolute; top: 8px; left: 8px; z-index: 100; max-width: 950px; padding: 8px 12px; color: #fff; background: rgba(0,0,0,.65); font: 14px monospace; opacity: 0; pointer-events: none; }
body.debug .operator-status { opacity: 1; }

/* State visibility */
#stage[data-state="idle"] video { opacity: .86; filter: saturate(.92) contrast(.98); }
#stage[data-state="idle"] .frost-layer { opacity: .31; }

#stage[data-state="seen"] video { opacity: .10; filter: blur(12px) saturate(.7); }
#stage[data-state="seen"] .silhouette-canvas { opacity: 1; }
#stage[data-state="seen"] .frost-layer { opacity: .18; }

#stage[data-state="animal"] video { opacity: .08; filter: blur(18px); }
#stage[data-state="animal"] .frost-layer { opacity: .58; }
#stage[data-state="animal"] .animal-panel { opacity: 1; transform: scale(1); }

#stage[data-state="consent"] video { opacity: .22; filter: blur(18px) saturate(.7); }
#stage[data-state="consent"] .frost-layer { opacity: .52; }
#stage[data-state="consent"] .consent-panel { opacity: 1; transform: translateY(0) scale(1); }

#stage[data-state="align"] video,
#stage[data-state="noFace"] video,
#stage[data-state="locked"] video { opacity: 1; filter: none; }
#stage[data-state="align"] .frost-layer,
#stage[data-state="noFace"] .frost-layer,
#stage[data-state="locked"] .frost-layer { opacity: 0; }
#stage[data-state="align"] .face-guide,
#stage[data-state="noFace"] .face-guide,
#stage[data-state="locked"] .face-guide { opacity: 1; }
#stage[data-state="locked"] .face-guide { border-style: solid; box-shadow: 0 0 45px rgba(255,79,155,.68); }

#stage[data-state="scanning"] video,
#stage[data-state="analysing"] video,
#stage[data-state="mapping"] video,
#stage[data-state="distorting"] video,
#stage[data-state="separating"] video,
#stage[data-state="rebuilding"] video,
#stage[data-state="calculating"] video { opacity: 0; }

#stage[data-state="scanning"] .frozen-frame,
#stage[data-state="analysing"] .frozen-frame,
#stage[data-state="mapping"] .frozen-frame,
#stage[data-state="distorting"] .frozen-frame,
#stage[data-state="separating"] .frozen-frame,
#stage[data-state="rebuilding"] .frozen-frame,
#stage[data-state="calculating"] .frozen-frame { opacity: .94; }

#stage[data-state="scanning"] .effects-canvas,
#stage[data-state="analysing"] .effects-canvas,
#stage[data-state="mapping"] .effects-canvas,
#stage[data-state="distorting"] .effects-canvas,
#stage[data-state="separating"] .effects-canvas,
#stage[data-state="rebuilding"] .effects-canvas,
#stage[data-state="calculating"] .effects-canvas { opacity: 1; }

#stage[data-state="scanning"] .scan-beam,
#stage[data-state="analysing"] .scan-beam { opacity: 1; animation: scan-down 4.2s ease-in-out infinite; }
#stage[data-state="analysing"] .frozen-frame { filter: grayscale(.85) contrast(1.2); }
#stage[data-state="mapping"] .frozen-frame { filter: grayscale(.25) contrast(1.05); }
#stage[data-state="distorting"] .frozen-frame { opacity: .35; filter: saturate(1.5); }
#stage[data-state="separating"] .frozen-frame { opacity: .18; filter: blur(3px); }
#stage[data-state="rebuilding"] .frozen-frame { opacity: .72; filter: grayscale(.25) contrast(1.12); }
#stage[data-state="rebuilding"] .colour-bloom,
#stage[data-state="calculating"] .colour-bloom { opacity: 1; }
#stage[data-state="calculating"] .frozen-frame { opacity: .12; filter: blur(10px); }

#stage[data-state="result"] video,
#stage[data-state="result"] .frozen-frame,
#stage[data-state="result"] .frost-layer { opacity: 0; }
#stage[data-state="result"] .result-panel { opacity: 1; transform: translateY(0); }

#stage[data-state="error"] video { opacity: .12; filter: blur(16px); }
#stage[data-state="error"] .frost-layer { opacity: .5; }
#stage[data-state="error"] .error-panel { opacity: 1; transform: scale(1); }

@keyframes frost-drift { from { transform: translate3d(-20px,-10px,0) scale(1.03); } to { transform: translate3d(20px,18px,0) scale(1.08); } }
@keyframes animal-arrive { from { opacity: 0; transform: scale(.82) rotate(-3deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes scan-down { 0% { transform: translateY(30px); } 50% { transform: translateY(1120px); } 100% { transform: translateY(30px); } }
@keyframes voice-wave { from { height: 6px; } to { height: 27px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Reference-matched 9:16 art direction. The functional camera layers remain unchanged. */
#stage {
  background:
    radial-gradient(circle at 17% 20%, rgba(255, 126, 190, .18), transparent 25%),
    radial-gradient(circle at 87% 72%, rgba(89, 154, 238, .22), transparent 27%),
    linear-gradient(180deg, #ffdcee 0%, #f8ddeb 45%, #bddcff 100%);
}

.paper-grid {
  opacity: .46;
  background-size: 55px 55px;
  background-image:
    linear-gradient(rgba(238, 137, 190, .30) 2px, transparent 2px),
    linear-gradient(90deg, rgba(238, 137, 190, .30) 2px, transparent 2px);
}

.masthead {
  top: 82px;
  left: 90px;
  width: 900px;
  height: 154px;
}

.masthead h1 {
  margin: 13px 0 0;
  font-family: "Agbalumo", cursive;
  font-size: 66px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: -2.5px;
  line-height: 1;
  text-shadow: none;
}

.masthead h1 span { font-family: "Alexandria", sans-serif; font-size: 29px; }

.step-badge {
  top: -35px;
  width: 92px;
  height: 92px;
  border-width: 2px;
  font-family: "Alkatra", cursive;
  font-size: 31px;
  font-style: normal;
}

.section-tag {
  left: 6px;
  bottom: -12px;
  padding: 8px 15px 7px;
  font-family: "Alexandria", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .7px;
}

.mirror {
  top: 250px;
  left: 105px;
  width: 870px;
  height: 1505px;
  border: 12px solid var(--wine);
  border-radius: 49px;
  box-shadow: 0 14px 0 rgba(105, 9, 64, .08), inset 0 0 0 3px rgba(255,255,255,.42);
}

.mirror::before { border-radius: 34px; box-shadow: inset 0 0 55px rgba(119, 15, 78, .15); }

.mirror-wash {
  background:
    radial-gradient(ellipse at 12% 22%, rgba(255, 161, 211, .88), transparent 30%),
    radial-gradient(ellipse at 79% 22%, rgba(140, 216, 255, .88), transparent 30%),
    radial-gradient(ellipse at 53% 76%, rgba(255, 225, 142, .78), transparent 27%),
    linear-gradient(145deg, #f9d4e9, #cae1ff);
}

.frost-layer {
  inset: -45px;
  background: rgba(255, 225, 242, .22);
  backdrop-filter: blur(18px) saturate(1.22);
}

.frost-layer::after {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 145, 203, .52), transparent 31%),
    radial-gradient(ellipse at 79% 38%, rgba(111, 195, 255, .50), transparent 34%),
    linear-gradient(125deg, rgba(255,255,255,.20), rgba(255,113,183,.24), rgba(92,168,255,.22));
}

.orb-a { width: 420px; height: 430px; left: -15px; top: 130px; background: #ff91c8; filter: blur(34px); }
.orb-b { width: 480px; height: 500px; right: -90px; top: 415px; background: #78c5ff; filter: blur(38px); }
.orb-c { width: 440px; height: 430px; left: 190px; bottom: 80px; background: #ffd486; filter: blur(40px); }
.frost-flower { right: 105px; top: 185px; font-size: 155px; opacity: .82; filter: blur(8px); }

.face-guide {
  top: 43%;
  width: 285px;
  height: 340px;
  border-width: 0;
  border-radius: 50%;
}

.face-guide::before,
.face-guide::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 92px;
  content: "";
  border: 13px dotted var(--wine);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.face-guide::after { width: 24px; height: 24px; border-width: 0; background: var(--wine); }
.corner { display: none; }
.guide-dot { display: none; }

.sensor-cluster { position: absolute; inset: 0; z-index: 14; display: none; pointer-events: none; }
.sensor {
  position: absolute;
  display: grid;
  width: 92px;
  height: 64px;
  place-items: center;
  color: #fff;
  border-radius: 50% 42% 48% 38%;
  font-family: "Alkatra", cursive;
  font-size: 18px;
  font-style: normal;
  box-shadow: 15px 10px 0 rgba(144, 41, 112, .12), 25px 18px 0 rgba(144, 41, 112, .06);
}
.sensor::after { position: absolute; width: 180px; content: ""; border-top: 3px dashed currentColor; opacity: .65; transform-origin: left center; }
.sensor-pink { left: 90px; top: 210px; background: var(--pink); color: var(--pink); }
.sensor-blue { right: 90px; top: 210px; background: var(--blue); color: var(--blue); }
.sensor-purple { left: 92px; bottom: 240px; background: var(--purple); color: var(--purple); }
.sensor-orange { right: 92px; bottom: 240px; background: var(--orange); color: var(--orange); }
.sensor-pink::after { left: 68px; top: 57px; transform: rotate(31deg); }
.sensor-blue::after { right: 68px; top: 57px; transform: rotate(149deg); }
.sensor-purple::after { left: 68px; bottom: 57px; transform: rotate(-31deg); }
.sensor-orange::after { right: 68px; bottom: 57px; transform: rotate(211deg); }
.sensor-cluster .sensor { color: #fff; }

.animal-panel { inset: 55px 62px 70px; }
.animal-art { width: 600px; height: 1030px; }
.animal-name { margin-top: -74px; padding: 11px 31px; font-family: "Alexandria", sans-serif; font-size: 30px; letter-spacing: 2px; }
.animal-line { width: 590px; margin-top: 17px; font: 600 21px/1.35 "Alexandria", sans-serif; }

.consent-panel {
  top: 370px;
  left: 160px;
  width: 526px;
  min-height: 0;
  padding: 30px 34px 28px;
  border-width: 6px;
  border-radius: 22px;
  box-shadow: 11px 14px 0 rgba(110, 15, 70, .16);
}
.system-check { padding-bottom: 9px; border-bottom-width: 2px; font-size: 12px; letter-spacing: 1px; }
.consent-panel h2 { margin: 23px 0 18px; font: 800 31px/1.02 "Alexandria", sans-serif; letter-spacing: 0; }
.consent-panel p { margin: 0 0 14px; font: 400 15px/1.42 "Alexandria", sans-serif; }
.consent-command { margin-top: 22px; padding: 13px; border-width: 3px; font: 800 15px/1.2 "Alexandria", sans-serif; letter-spacing: .4px; }

.status-area {
  top: 1630px;
  left: 105px;
  width: 870px;
}
.status-pill {
  min-width: 430px;
  padding: 10px 28px 9px;
  border-width: 3px;
  border-radius: 17px;
  font: 800 22px/1.2 "Alexandria", sans-serif;
  letter-spacing: .6px;
  box-shadow: 0 6px 0 rgba(103,14,64,.10);
}
.status-detail { display: none; }

.voice-dock {
  left: auto;
  right: 22px;
  bottom: 18px;
  width: 300px;
  height: 38px;
  gap: 10px;
  border-width: 1px;
  font: 700 12px/1 "Alexandria", sans-serif;
  letter-spacing: .5px;
}
.voice-dock[data-mode="quiet"] { opacity: .58; transform: none; }
.mic-icon { width: 10px; height: 10px; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.voice-waves { height: 18px; gap: 2px; }
.voice-waves i { width: 2px; height: 5px; }

.decor-heart { font-family: "Agbalumo", cursive; font-size: 52px; }
.heart-one { left: 44px; top: 874px; }
.heart-two { right: 31px; top: 1040px; }
.sparkle { font-size: 55px; }
.sparkle-one { left: 42px; top: 420px; }
.sparkle-two { right: 34px; top: 142px; font-size: 36px; }
.blue-ribbon { right: -98px; top: 710px; width: 185px; height: 335px; border-width: 26px; }
.checker-top { display: none; left: -28px; top: 245px; width: 190px; height: 36px; transform: rotate(13deg); }
.checker-bottom { right: -4px; top: 1720px; width: 175px; height: 34px; transform: rotate(13deg); }
.checker { background-size: 34px 34px; }

.tulip { right: 62px; top: 210px; width: 92px; height: 86px; z-index: 35; }
.tulip i { position: absolute; top: 12px; width: 40px; height: 64px; background: #ff78a4; border-radius: 14px 14px 31px 31px; }
.tulip i:nth-child(1) { left: 9px; transform: rotate(-24deg); }
.tulip i:nth-child(2) { left: 27px; top: 2px; height: 70px; }
.tulip i:nth-child(3) { right: 5px; transform: rotate(24deg); }

.result-panel {
  inset: 34px;
  padding: 72px 36px 34px;
  border-width: 4px;
  border-radius: 29px;
}
.result-meter { position: absolute; left: 34px; right: 34px; top: 22px; height: 26px; overflow: hidden; border: 3px solid var(--wine); border-radius: 999px; background: #fff; }
.result-meter i { display: block; width: 72%; height: 100%; background: linear-gradient(90deg,#ffd07e,#ff8fbe,#8dccff); border-radius: inherit; }
.result-heading { margin: 0 0 26px; font: 400 41px/1 "Agbalumo", cursive; letter-spacing: -1px; }
.result-grid { grid-template-columns: 360px 1fr; gap: 30px; }
.portrait-window { height: 485px; border-width: 4px; border-radius: 20px; }
.profile-copy { position: relative; padding-top: 6px; }
.profile-title { font: 800 32px/1.08 "Alexandria", sans-serif; }
.profile-copy p { min-height: 118px; margin: 18px 0 10px; font: 400 18px/1.42 "Alexandria", sans-serif; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 14px; }
.feature-list span { padding: 7px 8px; border: 2px solid rgba(151,16,92,.58); border-radius: 8px; font: 700 11px/1 "Alexandria", sans-serif; }
.score-row span { font: 700 82px/1 "Alkatra", cursive; }
.score-row small { font: 700 24px/1 "Alkatra", cursive; }
.percentile-value { margin-top: 9px; padding: 9px 11px; font: 800 15px/1.2 "Alexandria", sans-serif; letter-spacing: .4px; }
.advice-card { margin-top: 32px; padding: 24px 28px; border-width: 3px; border-radius: 18px; }
.advice-card strong { font: 700 19px/1 "Alexandria", sans-serif; letter-spacing: 1px; }
.advice-card p { margin: 12px 0 0; font: 400 20px/1.38 "Alexandria", sans-serif; }
.retry-command { margin-top: 30px; padding: 14px 28px; font: 800 21px/1.2 "Alexandria", sans-serif; letter-spacing: 1px; }

.error-panel h2 { font-family: "Alexandria", sans-serif; }
.error-panel p { font-family: "Alexandria", sans-serif; }

/* The welcome mirror is colourful enough to match the mock-up while the live camera remains visible. */
#stage[data-state="idle"] video { opacity: .78; filter: saturate(.90) contrast(.92) brightness(1.05); }
#stage[data-state="idle"] .frost-layer { opacity: .58; }

#stage[data-state="seen"] video { opacity: .16; filter: blur(8px) saturate(.72); }
#stage[data-state="seen"] .silhouette-canvas { opacity: .96; }
#stage[data-state="seen"] .frost-layer { opacity: .37; }

#stage[data-state="animal"] video { opacity: .05; }
#stage[data-state="animal"] .frost-layer { opacity: .66; }

#stage[data-state="consent"] video { opacity: .18; }
#stage[data-state="consent"] .frost-layer { opacity: .68; }

#stage[data-state="align"] .sensor-cluster,
#stage[data-state="noFace"] .sensor-cluster,
#stage[data-state="locked"] .sensor-cluster,
#stage[data-state="scanning"] .sensor-cluster,
#stage[data-state="analysing"] .sensor-cluster { display: block; }

#stage[data-state="align"] video,
#stage[data-state="noFace"] video,
#stage[data-state="locked"] video { opacity: .18; filter: grayscale(.78) contrast(.78) blur(2px); }
#stage[data-state="align"] .mirror-wash,
#stage[data-state="noFace"] .mirror-wash,
#stage[data-state="locked"] .mirror-wash,
#stage[data-state="scanning"] .mirror-wash,
#stage[data-state="analysing"] .mirror-wash { background: #e8e8e8; }

#stage[data-state="scanning"] .frozen-frame,
#stage[data-state="analysing"] .frozen-frame { opacity: 0; }
#stage[data-state="mapping"] .frozen-frame,
#stage[data-state="distorting"] .frozen-frame,
#stage[data-state="separating"] .frozen-frame,
#stage[data-state="rebuilding"] .frozen-frame { opacity: .94; }

#stage:not([data-state="idle"]):not([data-state="seen"]):not([data-state="animal"]):not([data-state="consent"]):not([data-state="result"]) .checker-top { display: block; }
#stage[data-state="result"] .tulip { display: none; }
#stage[data-state="result"] .masthead h1 { transform: translateY(10px); }

/* First-row sequence. The numbered artwork supplies the exact colour and
   ornament skin; the mirror remains a live camera surface above it. */
.first-row-skins {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.reference-skin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.018);
  transition:
    opacity .9s cubic-bezier(.22, .8, .22, 1),
    transform 1.15s cubic-bezier(.22, .8, .22, 1);
  will-change: opacity, transform;
}

.reference-skin.is-framed-source,
.reference-welcome,
.reference-seen {
  width: auto;
  height: 112.35%;
  max-width: none;
  object-fit: contain;
}

#stage[data-state="idle"] .reference-welcome,
#stage[data-state="seen"] .reference-seen,
#stage[data-state="animal"] .reference-animal,
#stage[data-state="consent"] .reference-consent {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#stage[data-state="animal"] .reference-animal,
#stage[data-state="consent"] .reference-consent { z-index: 80; }

#stage:is([data-state="idle"], [data-state="seen"], [data-state="animal"], [data-state="consent"]) :is(
  .paper-grid,
  .decor,
  .checker,
  .masthead,
  .blue-ribbon,
  .tulip,
  .section-tag,
  .step-badge
) { visibility: hidden; }

#stage:is([data-state="idle"], [data-state="seen"]) .mirror {
  z-index: 20;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transition:
    opacity .8s cubic-bezier(.22, .8, .22, 1),
    transform 1.05s cubic-bezier(.22, .8, .22, 1),
    filter .8s ease,
    background-color .8s ease;
}

#stage:is([data-state="idle"], [data-state="seen"]) .mirror::before,
#stage:is([data-state="idle"], [data-state="seen"]) .mirror-wash { opacity: 0; }

#stage:is([data-state="idle"], [data-state="seen"], [data-state="animal"]) .voice-dock { opacity: 0; pointer-events: none; }

#stage:is([data-state="idle"], [data-state="seen"], [data-state="animal"]) .status-area { visibility: hidden; }

#stage[data-state="idle"] video {
  opacity: .78;
  filter: saturate(.82) contrast(.9) brightness(1.08);
}

#stage[data-state="idle"] .frost-layer {
  opacity: .58;
  backdrop-filter: blur(11px) saturate(1.12);
}
#stage[data-state="idle"] .orb-c { opacity: 0; }

#stage[data-state="seen"] .mirror { background: rgba(248, 235, 246, .97); }
#stage[data-state="seen"] video { opacity: .09; filter: blur(8px) saturate(.72) brightness(1.12); }
#stage[data-state="seen"] .silhouette-canvas { opacity: .8; filter: blur(8px) saturate(1.14) drop-shadow(0 0 30px rgba(255, 119, 188, .52)); }
#stage[data-state="seen"] .frost-layer { opacity: .12; }
#stage[data-state="animal"] .mirror,
#stage[data-state="animal"] .status-area { visibility: hidden; }

#stage[data-state="consent"] .mirror,
#stage[data-state="consent"] .status-area { visibility: hidden; }
#stage[data-state="consent"] .consent-panel { opacity: 0; pointer-events: none; }
#stage[data-state="consent"] .voice-dock { z-index: 90; }

@media (prefers-reduced-motion: reduce) {
  .reference-skin,
  #stage:is([data-state="idle"], [data-state="seen"]) .mirror { transition-duration: .01ms; }
}

/* iPad Pro 11 unified 1668 x 2388 stage. The artwork shell never changes;
   only the clipped inner artwork buffers and live scene content transition. */
#stage {
  width: 1668px;
  height: 2388px;
}

.artwork-buffers,
.artwork-buffer,
.fixed-shell {
  position: absolute;
  inset: 0;
  width: 1668px;
  height: 2388px;
  pointer-events: none;
}

.artwork-buffers { z-index: 2; }
.artwork-buffer {
  z-index: 2;
  object-fit: fill;
  opacity: 0;
  clip-path: inset(457px 226px 179px 241px round 72px);
  transform: scale(1.012);
  transition: opacity .78s cubic-bezier(.22,.8,.22,1), transform .78s cubic-bezier(.22,.8,.22,1);
  will-change: opacity, transform;
}
.artwork-buffer.is-current { opacity: 1; transform: scale(1); }
.artwork-buffer.is-leaving { opacity: 0; transform: scale(.994); }
#stage:is([data-state="animal"],[data-state="consent"]) .artwork-buffer { z-index: 80; }
#stage:not([data-state="animal"]):not([data-state="consent"]) .artwork-buffer { z-index: 2; }

.fixed-shell {
  z-index: 90;
  object-fit: fill;
  image-rendering: auto;
}

#stage :is(.paper-grid,.decor,.checker,.masthead,.blue-ribbon,.tulip) { visibility: hidden; }

.mirror {
  left: 244px;
  top: 460px;
  width: 1195px;
  height: 1746px;
  box-sizing: border-box;
  border: 0;
  border-radius: 72px;
  box-shadow: none;
}
.mirror::before { border-radius: 68px; }

.status-area {
  left: 244px;
  top: 2020px;
  z-index: 96;
  width: 1195px;
}
.status-pill {
  min-width: 620px;
  padding: 16px 40px 14px;
  border-radius: 24px;
  font-size: 32px;
}
#stage:is([data-state="idle"],[data-state="seen"]) .status-area { visibility: visible; }
#stage:is([data-state="animal"],[data-state="consent"]) .status-area { visibility: hidden; }

.voice-dock {
  right: 30px;
  bottom: 24px;
  z-index: 110 !important;
  width: 430px;
  height: 54px;
  font-size: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .artwork-buffer { transition-duration: .01ms; }
}

.checker { position: absolute; }
