:root {
  color-scheme: light;
  --bg-top: #ffffff;
  --bg-bottom: #eef0f4;
  --ink: #1c1c1e;
  --muted: #8a8a8e;
  --muted-strong: #636367;
  --line: rgba(60, 60, 67, 0.13);
  --blue: #007aff;
  --blue-press: #0067df;
  --card: #ffffff;
  --field: #f2f2f7;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--bg-bottom);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

/* ---- App shell: a phone-sized canvas, full-bleed on mobile ---- */
.app {
  position: relative;
  width: min(100%, 440px);
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

@media (min-width: 600px) {
  body {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(1200px 600px at 50% -10%, #f6f3ff 0%, transparent 60%),
      #e9eaef;
  }

  .app {
    height: min(900px, calc(100dvh - 48px));
    border-radius: 44px;
    box-shadow: 0 40px 90px -30px rgba(20, 20, 40, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.04);
  }
}

/* ---- Top bar ---- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 8px;
  flex: 0 0 auto;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.12);
  color: var(--ink);
  flex: 0 0 auto;
}

.iconbtn:active {
  background: rgba(120, 120, 128, 0.22);
}

.iconbtn[hidden] {
  display: none;
}

.progress {
  display: flex;
  gap: 6px;
  flex: 1 1 auto;
}

.seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.35s ease;
}

.seg.is-filled {
  background: var(--blue);
}

/* ---- Deck + sliding screens ---- */
.deck {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.52s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.4s ease;
  will-change: transform, opacity;
}

.screen.is-prev {
  transform: translateX(-26%) scale(0.96);
  opacity: 0;
}

.screen.is-active {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.screen__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 28px 26px 12px;
}

/* Page 1 fits the viewport: the photo flexes to fill the leftover space */
.screen__scroll--intro {
  display: flex;
  flex-direction: column;
}

.screen__foot {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 12px 22px max(20px, env(safe-area-inset-bottom));
}

/* Lively entrance for the active screen's content */
.screen.is-active .hero {
  animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.screen.is-active .wordmark,
.screen.is-active .photo,
.screen.is-active .screen__eyebrow,
.screen.is-active .screen__title,
.screen.is-active .screen__body,
.screen.is-active .picker,
.screen.is-active .note,
.screen.is-active .thread {
  animation: rise 0.5s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.screen.is-active .photo {
  animation-delay: 0.04s;
}

.screen.is-active .screen__title {
  animation-delay: 0.04s;
}
.screen.is-active .screen__body {
  animation-delay: 0.08s;
}
.screen.is-active .picker,
.screen.is-active .note,
.screen.is-active .thread {
  animation-delay: 0.12s;
}

@keyframes pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}

@keyframes rise {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .screen.is-active *,
  .fs,
  .fs .btn {
    transition-duration: 0.001s;
    animation: none;
  }
}

/* ---- Hero squircle ---- */
.hero {
  width: 96px;
  height: 96px;
  margin: 18px 0 22px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 14px 28px -10px rgba(0, 0, 0, 0.25);
}

/* Swap-in point for real artwork: replace the SVGs in assets/heroes/.
   Centered icon-style art uses `contain`; for a full-bleed illustration
   set width/height to 100% and object-fit: cover on .hero__img. */
.hero__img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.12));
}

.hero--lemon {
  background: linear-gradient(160deg, #ffe27a, #ffc83d);
}
.hero--violet {
  background: linear-gradient(160deg, #c4a9ff, #8a6bff);
}
.hero--mint {
  background: linear-gradient(160deg, #9af0c9, #34d39b);
}
.hero--sky {
  background: linear-gradient(160deg, #9cd4ff, #4aa8ff);
}
.hero--rose {
  background: linear-gradient(160deg, #ffb0c8, #ff6f9c);
}

/* ---- Wordmark logo (step 1) ---- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0 18px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.wordmark__mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(160deg, #ffe27a, #ffc83d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 4px 10px -4px rgba(0, 0, 0, 0.3);
}

/* ---- Page 1 photo ---- */
.photo {
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px 0 22px;
  border-radius: 24px;
  overflow: hidden;
  background: #2a2a2e;
  box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.5);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Typography ---- */
.screen__eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
}

.screen__title {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.screen__body {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted-strong);
}

.screen__body b {
  color: var(--ink);
}

/* ---- Note callout ---- */
.note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--field);
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted-strong);
}

.note b {
  color: var(--ink);
}

.note__icon {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  color: var(--blue);
}

/* ---- Photo picker ---- */
.picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 14px 14px;
  border-radius: 16px;
  background: var(--field);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.picker:active {
  background: #e9e9ee;
}

.picker.is-set {
  border-color: rgba(0, 122, 255, 0.35);
}

.picker__plus {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  flex: 0 0 auto;
}

.picker__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}

.picker__chev {
  color: var(--muted);
  flex: 0 0 auto;
}

.picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- Phone preview frame ---- */
.phone {
  position: relative;
  margin: 22px auto 4px;
  width: 188px;
  aspect-ratio: 9 / 19.5;
  border-radius: 34px;
  padding: 7px;
  background: #0b0b0d;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.phone[hidden] {
  display: none;
}

.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 27px;
  display: block;
  background: #1c1c1e;
}

.phone__notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 17px;
  border-radius: 10px;
  background: #0b0b0d;
}

.turnstile {
  display: grid;
  place-items: center;
  margin-top: 14px;
}

.turnstile[hidden] {
  display: none;
}

/* ---- iMessage thread preview ---- */
.thread {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.bubble {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 21px 21px 6px 21px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(0, 122, 255, 0.5);
}

.bubble__text {
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.thread__thumb {
  width: 120px;
  border-radius: 16px;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.4);
  display: block;
}

.thread__thumb[hidden] {
  display: none;
}

/* ---- Buttons ---- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.12s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: scale(0.975);
}

.btn--primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 22px -10px rgba(0, 122, 255, 0.7);
}

.btn--primary:active {
  background: var(--blue-press);
}

.btn--primary:disabled {
  background: #c5c5cc;
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.btn--ghost {
  background: transparent;
  color: var(--blue);
  min-height: 44px;
}

.btn--ghost:active {
  opacity: 0.5;
}

.btn--soft {
  background: rgba(120, 120, 128, 0.16);
  color: var(--blue);
}

.btn--soft:active {
  background: rgba(120, 120, 128, 0.28);
}

.btn--ghostlight {
  background: transparent;
  color: #fff;
  min-height: 46px;
}

.btn--ghostlight:active {
  opacity: 0.55;
}

/* ---- Full-screen overlays (preview + camera), clipped to the app frame ---- */
.fs {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #0b0b0d;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.fs[hidden] {
  display: none;
}

.fs.is-open {
  opacity: 1;
  transform: none;
}

.fs__img,
.fs__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mirror the live selfie preview so it feels like a mirror */
.fs__video {
  transform: scaleX(-1);
}

.fs__scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
}

.fs__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 8px;
  padding: 16px 22px max(22px, env(safe-area-inset-bottom));
}

.fs__controls--cam {
  justify-items: center;
}

.fs__close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  backdrop-filter: blur(6px);
}

.shutter {
  width: 74px;
  height: 74px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.1s ease;
}

.shutter:active {
  transform: scale(0.92);
}

/* Button loading state (step 4 upload) */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__label {
  opacity: 0.7;
}

.btn.is-loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Subtle attention pulse on the primary CTA that's ready to be pressed
   (the active step's button, and the full-screen Continue once a photo is set).
   Pauses while loading/disabled and on press. */
@keyframes cta-pulse {
  0% {
    box-shadow: 0 10px 22px -10px rgba(0, 122, 255, 0.7), 0 0 0 0 rgba(0, 122, 255, 0.42);
  }
  70% {
    box-shadow: 0 10px 22px -10px rgba(0, 122, 255, 0.7), 0 0 0 13px rgba(0, 122, 255, 0);
  }
  100% {
    box-shadow: 0 10px 22px -10px rgba(0, 122, 255, 0.7), 0 0 0 0 rgba(0, 122, 255, 0);
  }
}

.screen.is-active .screen__foot .btn--primary:not(:disabled):not(.is-loading),
.fs.is-open .fs__controls .btn--primary:not(:disabled):not(.is-loading) {
  animation: cta-pulse 2.1s ease-out 0.7s infinite;
}

.btn--primary:active {
  animation: none;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: min(92vw, 380px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}

.toast[hidden] {
  display: none;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}
