:root {
  color-scheme: light; /* the page is light-only — opt out of forced dark mode */
  --warm-1: #ffe8d6;
  --warm-2: #ffd0a8;
  --warm-3: #ffb37a;
  --ink: #3a2a23;
  --ink-soft: #6b5347;
  --ring-track: rgba(255, 255, 255, 0.45);
  --ring-fill: #ff8a4c;
  --accent: #ff7a3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 120% at 50% 0%, var(--warm-1) 0%, var(--warm-2) 55%, var(--warm-3) 100%);
  background-attachment: fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ---- screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px) scale(0.99);
  pointer-events: none;
}
/* Animate screen changes only after first paint — the initial screen shows solid, never mid-fade. */
.ready .screen {
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.screen.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---- intro ---- */
.mark {
  width: clamp(72px, 18vw, 96px);
  height: auto;
  filter: drop-shadow(0 12px 26px rgba(255, 122, 60, 0.35));
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.wordmark {
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark span { color: var(--accent); }
.tagline {
  font-size: clamp(1.05rem, 3.6vw, 1.4rem);
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 22ch;
}
.fineprint {
  font-size: 0.82rem;
  color: var(--ink-soft);
  opacity: 0.75;
  max-width: 30ch;
  line-height: 1.5;
}

/* ---- buttons ---- */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 16px 38px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 30px rgba(58, 42, 35, 0.28);
}
.btn-primary:hover { box-shadow: 0 14px 38px rgba(58, 42, 35, 0.36); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 14px 28px;
}
.btn-ghost:hover { color: var(--ink); }

/* ---- mirror / camera ---- */
.mirror {
  position: relative;
  width: min(78vw, 360px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(58, 42, 35, 0.25), inset 0 0 0 1px rgba(255,255,255,0.4);
}
#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror */
  display: block;
}
.ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  transform: rotate(-90deg);
  pointer-events: none;
}
.ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.ring-track { stroke: var(--ring-track); }
.ring-fill {
  stroke: var(--ring-fill);
  stroke-dasharray: 295.3;        /* 2 * PI * 47 */
  stroke-dashoffset: 295.3;
  transition: stroke-dashoffset 0.12s linear;
  filter: drop-shadow(0 0 6px rgba(255, 138, 76, 0.7));
}
.glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0 rgba(255, 200, 130, 0);
  transition: box-shadow 0.2s ease;
  pointer-events: none;
}

.coach {
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  color: var(--ink-soft);
  min-height: 1.6em;
  transition: opacity 0.25s ease;
  max-width: 26ch;
  line-height: 1.4;
}

/* ---- result keepsake ---- */
.keepsake {
  width: min(74vw, 320px);
  aspect-ratio: 1;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(58, 42, 35, 0.3);
  background: #fff;
  padding: 10px;
  animation: pop 0.6s cubic-bezier(0.18, 0.9, 0.3, 1.2);
}
.keepsake img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}
.result-line {
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-weight: 700;
}
.actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- status overlay ---- */
.status[hidden] { display: none; } /* respect the hidden attribute (author rules beat the UA [hidden] rule) */
.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  background: rgba(255, 232, 214, 0.85);
  backdrop-filter: blur(4px);
  font-size: 1.05rem;
  color: var(--ink-soft);
  line-height: 1.5;
  z-index: 10;
}

/* gentle full-screen warmth flash on capture */
.flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.9), rgba(255,200,140,0));
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}
.flash.go { animation: flash 0.7s ease-out; }
@keyframes flash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}
