:root {
  --bg-top: #1b1719;
  --bg-bottom: #580a21;
  --surface: rgba(32, 20, 25, .96);
  --text: #fff;
  --muted: #dbcbd0;
  --accent: #dc143c;
  --accent-dark: #780019;
  --outline: #e2aba7;
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: Montserrat, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .92);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.progress {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.08);
}

.progress span {
  display: block;
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, #fff, #ff4d6d);
  box-shadow: 0 0 14px rgba(255,77,109,.8);
  transition: width .45s ease;
}

.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  animation: screenIn .55s cubic-bezier(.2,.78,.25,1) both;
}

.screen[hidden] {
  display: none !important;
}

.header {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 36px 20px 0;
  text-align: center;
}

.header h1,
.header h2,
.header h3 {
  text-wrap: balance;
}

.header h1 {
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1.12;
  text-transform: uppercase;
}

.header h2 {
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1;
  text-transform: uppercase;
}

.header h3 {
  font-size: clamp(21px, 5.6vw, 28px);
  line-height: 1.18;
}

.header > p:not(.eyebrow):not(.question-number) {
  max-width: 34rem;
  color: var(--muted);
}

.eyebrow,
.question-number {
  color: #ff9aaa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.collage {
  width: calc(100% - 32px);
  max-width: 540px;
  height: min(58vh, 590px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.collage img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
}

.actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px calc(20px + var(--safe-bottom));
}

.button {
  width: 100%;
  max-width: 430px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.button:active {
  transform: scale(.97);
}

.button--primary {
  position: relative;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.24);
  color: #2d161c;
}

.button--primary > i {
  position: absolute;
  right: 7px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-dark), var(--accent));
  color: #fff;
  font-size: 24px;
  font-style: normal;
}

.button--outline {
  border: 2px solid var(--outline);
  background: transparent;
  color: #fff;
}

.button--skip {
  min-height: 38px;
  background: transparent;
  color: #b8a6ac;
  font-size: 14px;
}

.button:disabled {
  background: #7e7477;
  box-shadow: none;
  color: #d7d3d4;
  cursor: not-allowed;
  opacity: .75;
}

.button:disabled > i {
  background: #686164;
}

.hero-card {
  width: calc(100% - 32px);
  max-width: 540px;
  height: min(61vh, 650px);
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0,0,0,.3);
}

.hero-card img,
.question-photo img,
.final-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen--question {
  justify-content: flex-end;
  position: relative;
}

.question-photo {
  position: absolute;
  inset: 0 0 280px;
}

.question-photo::after,
.final-photo::after {
  position: absolute;
  content: "";
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(23,12,17,.62) 100%);
}

.question-panel {
  z-index: 2;
  width: 100%;
  min-height: 315px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding: 0 16px calc(24px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(35,26,30,.97), rgba(83,7,28,.99));
  box-shadow: 0 -28px 52px rgba(0,0,0,.42);
}

.header--question {
  gap: 11px;
  padding: 22px 0 0;
}

.header--question h3 {
  max-width: 660px;
  font-size: clamp(18px, 4.8vw, 25px);
}

.answer-grid {
  width: 100%;
  max-width: 660px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 auto;
}

.header--compact {
  gap: 7px;
  padding-top: 25px;
}

.header--compact > p:last-child {
  font-size: 14px;
  font-style: italic;
}

.choice-grid {
  width: min(calc(100% - 32px), 540px);
  height: min(60vh, 630px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.choice-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 9px 22px rgba(0,0,0,.24);
  color: #160d10;
  cursor: pointer;
}

.choice-card--wide {
  width: calc(50% - 5px);
  justify-self: center;
  grid-column: 1 / -1;
}

.choice-card img {
  width: 100%;
  height: calc(100% - 34px);
  display: block;
  object-fit: cover;
}

.choice-card span {
  height: 34px;
  display: grid;
  place-items: center;
  padding: 2px 5px;
  font-size: 14px;
  font-weight: 700;
}

.choice-card::after {
  position: absolute;
  content: "✓";
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 3px 12px rgba(0,0,0,.35);
  opacity: 0;
  transform: scale(.65);
  transition: .2s ease;
}

.choice-card.is-selected {
  box-shadow: 0 0 0 4px var(--accent), 0 12px 28px rgba(0,0,0,.28);
}

.choice-card.is-selected::after {
  opacity: 1;
  transform: scale(1);
}

.actions--choice {
  gap: 4px;
  padding-top: 2px;
}

.distance-content {
  width: min(calc(100% - 32px), 540px);
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.distance-photo {
  width: min(56%, 270px);
  min-height: 135px;
  flex: 1;
  object-fit: cover;
  border-radius: var(--radius);
}

.distance-list {
  width: 100%;
  display: grid;
  gap: 8px;
}

.distance-option {
  width: 100%;
  min-height: 46px;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 5px 14px rgba(0,0,0,.17);
  color: #211418;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.distance-option.is-selected {
  border-color: #fff;
  background: var(--accent);
  color: #fff;
}

.screen--final {
  position: relative;
  justify-content: flex-end;
}

.final-photo {
  position: absolute;
  inset: 0 0 365px;
}

.final-panel {
  position: relative;
  z-index: 2;
  width: calc(100% - 32px);
  max-width: 650px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: calc(16px + var(--safe-bottom));
  padding: 30px 16px 22px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(35,26,30,.98), rgba(85,6,29,.98));
  box-shadow: 0 -25px 55px rgba(0,0,0,.42);
}

.success-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 7px rgba(255,255,255,.12);
  color: var(--accent);
  font-size: 30px;
  font-weight: 900;
}

.header--final {
  gap: 12px;
  padding: 0;
}

.header--final h2 {
  font-size: clamp(23px, 6vw, 34px);
  line-height: 1.1;
}

.header--final > p:last-child {
  font-size: 16px;
  line-height: 1.45;
}

.button--download {
  animation: pulse 2s ease-in-out infinite;
}

.privacy-note {
  color: #cbbac0;
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  max-width: calc(100% - 32px);
  padding: 13px 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
  color: #211418;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: .25s ease;
}

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

@keyframes screenIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(0,0,0,.24); }
  50% { box-shadow: 0 0 0 8px rgba(255,255,255,.1), 0 16px 34px rgba(0,0,0,.32); }
}

@media (max-height: 720px) {
  body { font-size: 16px; }
  .header { padding-top: 20px; gap: 7px; }
  .collage { height: min(55vh, 470px); }
  .hero-card { height: min(57vh, 520px); }
  .question-photo { bottom: 245px; }
  .question-panel { min-height: 270px; gap: 18px; }
  .choice-grid { height: min(56vh, 510px); }
  .choice-card img { height: calc(100% - 30px); }
  .choice-card span { height: 30px; font-size: 12px; }
  .button { min-height: 52px; font-size: 16px; }
  .button--primary > i { width: 40px; height: 40px; }
  .distance-option { min-height: 38px; padding: 5px 12px; font-size: 14px; }
  .final-photo { bottom: 325px; }
  .final-panel { gap: 12px; padding-top: 20px; }
}

@media (min-width: 881px) {
  .screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 0;
    padding: 0;
  }

  .screen > .header {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    padding-top: 50px;
  }

  .collage,
  .hero-card {
    grid-column: 1;
    grid-row: 1 / 4;
    width: calc(100% - 32px);
    max-width: none;
    height: calc(100vh - 32px);
    margin: 16px;
  }

  .screen > .actions {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    padding-bottom: 50px;
  }

  .screen--question,
  .screen--final {
    display: flex;
  }

  .question-photo,
  .final-photo {
    inset: 0 50% 0 0;
  }

  .question-panel,
  .final-panel {
    width: 50%;
    min-height: 100vh;
    margin: 0 0 0 auto;
    justify-content: center;
    border-radius: 0;
    padding: 50px;
  }

  .screen--choices,
  .screen--distance {
    grid-template-rows: auto 1fr auto;
  }

  .screen--choices > .header,
  .screen--distance > .header {
    grid-column: 2;
  }

  .choice-grid,
  .distance-content {
    grid-column: 1;
    grid-row: 1 / 4;
    width: calc(100% - 40px);
    max-width: 650px;
    height: calc(100vh - 40px);
    margin: 20px;
  }

  .distance-content {
    justify-self: center;
  }

  .screen--choices > .actions,
  .screen--distance > .actions {
    grid-column: 2;
    grid-row: 3;
  }

  .final-panel {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
