

:root {
  --color-top: #140426;
  --color-bottom: #4c087c;
  --text-primary: #f0dcf7;
  --text-muted: #c69cd6;
  --accent: #a257fc;
  --font-display: "Times New Roman", Times, serif;
  --font-body: "Roboto", Arial, sans-serif;

  /* Safe-area support for iPhone home indicator and notch. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Visual sizing varies smoothly with the viewport, not the device name. */
  --screen-padding: clamp(16px, 5.4vw, 25px);
  --button-bottom: calc(26px + var(--safe-bottom));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

html {
  background: var(--color-top);
}

body {
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-body);
  background: linear-gradient(165deg, var(--color-top), var(--color-bottom));
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid #f6d7a6;
  outline-offset: 3px;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
position: absolute;
    top: 0;
    z-index: 100;
  background:
    radial-gradient(
      ellipse 90% 46% at 50% 92%,
      #7209b2 0%,
      transparent 72%
    ),
    linear-gradient(
      170deg,
      #130425 4%,
      #290744 52%,
      #470875 100%
    );
}
.app {
  position: relative;
  width: 100%;
  /*max-width: 430px;*/
  height: 100vh;      /* Fallback for older Safari. */
  height: 100dvh;     /* Dynamic viewport, respects browser chrome. */
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
      z-index: 2000;
    top: 0;
    background:
/*      radial-gradient(ellipse 90% 46% at 50% 92%, #7209b2 0%, transparent 72%),
      linear-gradient(170deg, #130425 4%, #290744 52%, #470875 100%);*/
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  /*overflow: hidden;*/
  width: 100%;
  height: 100%;
}

.screen.is-active {
  display: block;
  animation: screen-enter 180ms ease both;
}

@keyframes screen-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

.primary-button {
    display: block;
    width: min(100%, 250px);
    min-height: 55px;
    margin: 0 auto;
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    color: white;
    /* background: linear-gradient(180deg, #a55aff, #6d30e0); */
    box-shadow: 0 0 11px 8px #9552ff90, inset 0 1px 0 #fbf9ff;
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    position: relative;
    background-color: #784ceb;
}

.primary-button:active {
  transform: scale(.98);
}

/* ----- First screen: large art may extend beyond screen width ----- */

.cover-header {
  position: absolute;
  top: calc(var(--safe-top) + clamp(25px, 4.8dvh, 46px));
  left: 0;
  z-index: 2;
  width: 100%;
  text-align: center;
}

.brand-logo {
  display: block;
  width: clamp(106px, 31vw, 132px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.brand-cross {
  margin-top: 7px;
  color: #eedcf0;
  font-size: 12px;
}

.brand-hogwarts {
  margin-top: 5px;
  color: #f7e6fc;
  font-family: var(--font-display);
  font-size: clamp(17px, 5vw, 21px);
  letter-spacing: .50em;
}

.brand-line {
    width: 230px;
    height: 164px;
    margin: 8px auto 0;

}
.bt_area{
    height: 125px;
    width: 125px;
    background-color: white;
    filter: blur(21px);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translate(-50%, -20px);
    opacity: 0.5;
}
.cover-art {
position: absolute;
    top: 27%;
    left: 50%;
    width: 125%;
    height: min(59dvh, 520px);
    object-fit: contain;
    transform: translateX(-50%) scale(0.9);
    pointer-events: none;
    z-index: 1;
}

.cover-footer {
  position: absolute;
  right: var(--screen-padding);
  bottom: var(--button-bottom);
  left: var(--screen-padding);
  z-index: 3;
  text-align: center;
}

.cover-heading {
  margin: 0 0 clamp(20px, 3dvh, 27px);
  font-family: var(--font-display);
  font-size: clamp(19px, 5.4vw, 23px);
  font-weight: normal;
  line-height: 1.12;
  text-transform: uppercase;
}

/* ----- Second screen: floating hat + fixed CTA ----- */

.intro-header {
  position: absolute;
  top: calc(var(--safe-top) + clamp(30px, 6dvh, 58px));
  right: 12px;
  left: 12px;
  z-index: 2;
  text-align: center;
}

.intro-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(23px, 6.4vw, 29px);
  font-weight: normal;
  line-height: 1.06;
  text-transform: uppercase;
}

.intro-description {
  margin: clamp(15px, 2.5dvh, 23px) 0 0;
  color: #cba2d2;
  font-size: clamp(14px, 2.7vw, 12px);
  line-height: 1.34;
  text-transform: uppercase;
}

.intro-art {
position: absolute;
    top: 34%;
    left: 24%;
    width: 148%;
    height: min(59dvh, 540px);
    object-fit: contain;
    transform: translateX(-50%) scale(1.1);
    pointer-events: none;
}

.intro-footer {
  position: absolute;
  right: var(--screen-padding);
  bottom: var(--button-bottom);
  left: var(--screen-padding);
  z-index: 3;
}

/* ----- Question screen: fixed outer height; internal answer scrolling ----- */

.quiz {
  padding:
    calc(var(--safe-top) + 13px)
    var(--screen-padding)
    calc(var(--safe-bottom) + 13px);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  row-gap: clamp(8px, 1.3dvh, 13px);
}

.quiz.is-active {
  display: grid;
}

.quiz-header {
  min-height: 49px;
}

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
}

.back-button {
  padding: 7px 8px 7px 0;
  border: 0;
  background: transparent;
  color: #d8b2e6;
  font-size: 12px;
}

.quiz-counter {
  color: #d8b2e6;
  font-size: 12px;
}

.progress {
  display: flex;
  gap: 4px;
  height: 4px;
  margin-top: 11px;
}

.progress-segment {
  flex: 1;
  border-radius: 99px;
  background: #67358c;
}

.progress-segment.is-done {
  background: #cb8afc;
}

.quiz-art-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.quiz-art {
  display: block;
  width: 100%;
  max-height: clamp(158px, 29dvh, 248px);
  aspect-ratio: 381 / 277;
  object-fit: contain; /* Never crop supplied picture. */
  border-radius: 15px;
}

.quiz-prompt {
  text-align: center;
}

.question-number {
  margin: 0 0 8px;
  color: #d9afe8;
  font-family: var(--font-display);
  font-size: clamp(18px, 5.2vw, 22px);
}

.question-title {
  max-width: 360px;
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: clamp(17px, 4.7vw, 20px);
  font-weight: normal;
  line-height: 1.13;
  text-transform: uppercase;
}

.answers-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #8e47b3 transparent;
  -webkit-overflow-scrolling: touch;
}

.answers-list {
  display: grid;
  gap: clamp(7px, 1dvh, 10px);
  padding: 3px 2px calc(10px + var(--safe-bottom));
}

.answer-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    padding: 11px 12px;
    border: 2px solid #8644a4a6;
    border-radius: 19px;
    background: #54137e;
    color: #f2dff8;
    font-size: clamp(11px, 3.85vw, 14px);
    line-height: 1.34;
    text-align: left;
}

.answer-button:active {
  background: #bc4bffd6;
}

.answer-radio {
  flex: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid #aa76c4;
  border-radius: 50%;
}

/* ----- Results: same viewport height; scroll only inner content ----- */

.result {
  padding: calc(var(--safe-top) + 15px) 20px 0;
  background: radial-gradient(ellipse 115% 64% at 50% 29%, #754081 0%, transparent 73%);
}

.result-scroll {
  height: calc(100% - 92px - var(--safe-bottom));
  overflow-y: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

.result-crest {
  display: block;
  width: clamp(130px, 45vw, 205px);
  height: clamp(155px, 27dvh, 235px);
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px #14001877);
}

.result-heading {
  margin: 0 0 17px;
  font-family: var(--font-display);
  font-size: clamp(23px, 6vw, 27px);
  font-weight: normal;
}

.result-description {
  max-width: 310px;
  margin: 0 auto 21px;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.3;
  text-transform: uppercase;
}

.product-label {
  margin: 0;
  font-size: 11px;
}

.product-name {
  margin: 5px auto 18px;
  color: #ffe200;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.promo-heading {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 5px;
  background: #fff;
  color: #24102d;
  font-size: 11px;
  font-weight: 900;
}

.promo-code {
  display: block;
  min-width: 220px;
  margin: 13px auto;
  padding: 13px 18px;
  border: 2px dashed #e5c3f4;
  border-radius: 11px;
  background: #ffffff08;
  color: white;
  font-size: 19px;
  font-weight: 900;
}

.discount {
  margin: 18px 0;
  color: #ffe400;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.08;
}

.disclaimer {
  max-width: 290px;
  margin: 0 auto 15px;
  color: #bb9ccd;
  font-size: 10px;
  line-height: 1.4;
}

.result-footer {
  position: absolute;
  right: 20px;
  bottom: var(--button-bottom);
  left: 20px;
  z-index: 2;
}

.toast {
  position: fixed;
  z-index: 20;
  top: calc(18px + env(safe-area-inset-top, 0px));
  left: 50%;
  padding: 12px 22px;
  border-radius: 12px;
  background: #f4e8fc;
  color: #421b62;
  box-shadow: 0 12px 28px #0006;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity 180ms, transform 180ms;
}

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

/* ----- Other iPhones: adaptive by viewport width AND usable height ----- */

@media (max-width: 375px) {
  .cover-art { top: 25%; width: 132%; height: 57dvh; transform: translateX(-50%) scale(1.1); }
  .intro-art { top: 36%; width: 156%; height: 56dvh; }
  .question-title { font-size: 17px; }
  .answer-button { padding: 9px 10px; }
}

@media (min-width: 414px) {
  .cover-art { width: 123%; }
  .intro-art { width: 143%; }
}

@media (max-height: 760px) {
  :root { --button-bottom: calc(15px + var(--safe-bottom)); }
  .cover-header { top: calc(16px + var(--safe-top)); }
  .cover-art { top: 22%; height: 57dvh; }
  .intro-header { top: calc(17px + var(--safe-top)); }
  .intro-heading { font-size: 23px; }
  .intro-description { margin-top: 12px; }
  .intro-art { top: 32%; height: 56dvh; }
  .quiz { row-gap: 6px; padding-top: calc(6px + var(--safe-top)); }
  .quiz-header { min-height: 42px; }
  .quiz-art { max-height: 24dvh; }
  .question-title { font-size: 16px; }
  .answer-button { min-height: 46px; }
  .result-crest { height: 23dvh; }
}

@media (max-height: 640px) {
  .intro-art { top: 34%; height: 51dvh; }
  .cover-art { top: 25%; height: 49dvh; }
  .cover-heading { font-size: 17px; margin-bottom: 12px; }
  .quiz-art { max-height: 19dvh; }
  .question-title { font-size: 15px; }
  .question-number { margin-bottom: 4px; }
}

@media (min-width: 431px) {
  body { background: #0b0319; }
  .app { box-shadow: 0 0 70px #000b; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active,
  .toast { animation: none; transition: none; }
}

/* ============================================================
   MAGICAL MOTION — mobile-first screen & question transitions
   ============================================================ */

:root {
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-soft: cubic-bezier(.16, 1, .3, 1);
}

/* Keep the outgoing screen on top of the star field until it fades away. */
.screen {
  display: none;
  opacity: 0;
  transform-origin: 50% 48%;
  backface-visibility: hidden;
}

.screen.is-active,
.screen.is-leaving {
  display: block;
}

.quiz,
.quiz.is-active,
.quiz.is-leaving {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.quiz.is-active,
.quiz.is-leaving {
  display: grid;
}

.screen.is-active {
  z-index: 2;
  pointer-events: auto;
  animation: magic-screen-in 680ms var(--motion-ease) both;
}

.screen.is-leaving {
  z-index: 1;
  pointer-events: none;
  animation: magic-screen-out 560ms ease-in both;
}

.screen.is-active[data-direction="back"] {
  animation-name: magic-screen-in-back;
}

.screen.is-leaving[data-direction="back"] {
  animation-name: magic-screen-out-back;
}

@keyframes magic-screen-in {
  0% {
    opacity: 0;
    transform: translate3d(31px, 0, 0) scale(.974);
    filter: blur(7px);
  }
  60% { opacity: 1; }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes magic-screen-out {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translate3d(-23px, 0, 0) scale(.978);
    filter: blur(4px);
  }
}

@keyframes magic-screen-in-back {
  0% {
    opacity: 0;
    transform: translate3d(-31px, 0, 0) scale(.974);
    filter: blur(7px);
  }
  60% { opacity: 1; }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes magic-screen-out-back {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translate3d(23px, 0, 0) scale(.978);
    filter: blur(4px);
  }
}

/* A little glow connects consecutive scenes without covering the controls. */
.app::after {
  position: absolute;
  z-index: 6;
  inset: 0;
  background: radial-gradient(ellipse 75% 58% at 50% 48%,
    rgba(225, 172, 255, .23) 0%,
    rgba(156, 76, 234, .10) 38%,
    transparent 77%);
  content: "";
  opacity: 0;
  pointer-events: none;
}

.app.is-portal-flashing::after {
  animation: portal-flash 750ms ease-out both;
}

@keyframes portal-flash {
  0% { opacity: 0; }
  27% { opacity: 1; }
  100% { opacity: 0; }
}

/* Staggered landing on the cover and intro. */
.cover.is-active .cover-header {
  animation: magic-rise 750ms var(--motion-ease) 90ms both;
}

.cover.is-active .cover-heading {
  animation: magic-rise 720ms var(--motion-ease) 290ms both;
}

.cover.is-active .cover-footer .primary-button {
  animation: magic-rise 680ms var(--motion-ease) 440ms both;
}

.intro.is-active .intro-heading {
  animation: magic-rise 720ms var(--motion-ease) 180ms both;
}

.intro.is-active .intro-description {
  animation: magic-rise 760ms var(--motion-ease) 350ms both;
}

.intro.is-active .intro-footer .primary-button {
  animation: magic-rise 720ms var(--motion-ease) 500ms both;
}

.cover.is-active .cover-art,
.intro.is-active .intro-art {
  animation:
    art-appear 950ms var(--motion-ease) 100ms both,
    art-float 5.7s ease-in-out 1050ms infinite;
}

@keyframes magic-rise {
  from {
    opacity: 0;
    translate: 0 19px;
    filter: blur(3px);
  }
  to {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
  }
}

@keyframes art-appear {
  from {
    opacity: 0;
    translate: 0 33px;
    filter: brightness(1.30) blur(6px);
  }
  to {
    opacity: 1;
    translate: 0 0;
    filter: brightness(1) blur(0);
  }
}

@keyframes art-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}

/* Button feedback and a soft moving highlight. */
.primary-button {
  isolation: isolate;
  transition:
    transform 210ms var(--motion-ease),
    box-shadow 280ms ease,
    filter 280ms ease;
}

.primary-button::after {
  position: absolute;
  z-index: 2;
  inset: -65% auto -65% -75%;
  width: 46%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, .28),
    transparent);
  content: "";
  pointer-events: none;
  transform: rotate(24deg);
  animation: cta-shimmer 5.4s ease-in-out 1.8s infinite;
}

.primary-button:active {
  transform: scale(.955);
  filter: brightness(1.12);
  box-shadow: 0 0 18px 11px #9552ff8c, inset 0 1px 0 #fbf9ff;
}

.bt_area {
  pointer-events: none;
}

@keyframes cta-shimmer {
  0%, 70% { left: -75%; }
  87%, 100% { left: 150%; }
}

/* The quiz's header appears first; answer cards follow one by one. */
.quiz.is-active .quiz-header {
  animation: magic-rise 520ms var(--motion-ease) 95ms both;
}

.quiz.is-active:not(.is-question-exiting) .quiz-art-wrap {
  animation: question-arrive 540ms var(--motion-ease) 85ms both;
}

.quiz.is-active:not(.is-question-exiting) .quiz-prompt {
  animation: question-arrive 550ms var(--motion-ease) 155ms both;
}

.quiz.is-active:not(.is-question-exiting) .answers-scroll {
  animation: question-arrive 560ms var(--motion-ease) 205ms both;
}

@keyframes question-arrive {
  from {
    opacity: 0;
    transform: translate3d(20px, 9px, 0) scale(.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

.quiz[data-question-direction="back"]:is(.is-active, .is-question-entering):not(.is-question-exiting) .quiz-art-wrap,
.quiz[data-question-direction="back"]:is(.is-active, .is-question-entering):not(.is-question-exiting) .quiz-prompt,
.quiz[data-question-direction="back"]:is(.is-active, .is-question-entering):not(.is-question-exiting) .answers-scroll {
  animation-name: question-arrive-back;
}

@keyframes question-arrive-back {
  from {
    opacity: 0;
    transform: translate3d(-20px, 9px, 0) scale(.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

.quiz.is-question-exiting .quiz-art-wrap,
.quiz.is-question-exiting .quiz-prompt,
.quiz.is-question-exiting .answers-scroll {
  animation: question-depart 225ms ease-in both;
  pointer-events: none;
}

.quiz.is-question-exiting[data-question-direction="back"] .quiz-art-wrap,
.quiz.is-question-exiting[data-question-direction="back"] .quiz-prompt,
.quiz.is-question-exiting[data-question-direction="back"] .answers-scroll {
  animation-name: question-depart-back;
}

@keyframes question-depart {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translate3d(-19px, -6px, 0);
    filter: blur(3px);
  }
}

@keyframes question-depart-back {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translate3d(19px, -6px, 0);
    filter: blur(3px);
  }
}

.answer-button {
  position: relative;
  transition:
    transform 200ms var(--motion-ease),
    border-color 220ms ease,
    background-color 220ms ease,
    box-shadow 220ms ease;
}

.quiz.is-active .answer-button {
  animation: answer-reveal 440ms var(--motion-ease) both;
  animation-delay: var(--answer-delay, 260ms);
}

@keyframes answer-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 15px, 0) scale(.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.answer-button:not(:disabled):active {
  transform: scale(.985);
  background: #74339c;
}

.answer-button.is-selected,
.answer-button.is-selected:disabled {
  border-color: #efd0ff;
  background: #8742bd;
  box-shadow: 0 0 0 1px rgba(227, 179, 255, .4), 0 0 24px rgba(164, 77, 247, .35);
  transform: scale(.985);
}

.answer-radio {
  display: grid;
  place-items: center;
  transition: border-color 220ms ease, background-color 220ms ease;
}

.answer-radio::after {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transform: scale(0);
  transition: transform 200ms var(--motion-ease);
}

.answer-button.is-selected .answer-radio {
  border-color: #fff;
  background: #a765e0;
}

.answer-button.is-selected .answer-radio::after {
  transform: scale(1);
}

.progress-segment {
  position: relative;
  overflow: hidden;
}

.progress-segment.is-done {
  background: #67358c;
}

.progress-segment::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #9a63ff 0%, #e4b3ff 100%);
  content: "";
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 420ms var(--motion-soft);
}

.progress-segment.is-done::before {
  transform: scaleX(1);
}

/* Result screen: crest, glowing burst, then the result details. */
.result::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 23%, rgba(232, 167, 255, .33), transparent 44%);
  content: "";
  opacity: 0;
  pointer-events: none;
      border-radius: 50%;
    height: 100vw;
    width: 100vw;
}

.result.is-active::before {
  animation: result-halo 1650ms ease-out both;
}

@keyframes result-halo {
  0% { opacity: 0; transform: scale(.65); }
  36% { opacity: 1; }
  100% { opacity: .3; transform: scale(1.3); }
}

.result.is-active .result-crest {
  animation: crest-arrive 960ms var(--motion-ease) 190ms both;
}

@keyframes crest-arrive {
  0% {
    opacity: 0;
    transform: translate3d(0, 40px, 0) scale(.58) rotate(-9deg);
    filter: drop-shadow(0 0 20px rgba(242, 198, 255, .7));
  }
  64% {
    opacity: 1;
    filter: drop-shadow(0 0 28px rgba(242, 198, 255, .6));
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0);
    filter: drop-shadow(0 8px 12px #14001877);
  }
}

.result.is-active .result-heading {
  animation: magic-rise 650ms var(--motion-ease) 525ms both;
}

.result.is-active .result-description {
  animation: magic-rise 660ms var(--motion-ease) 640ms both;
}

.result.is-active .product-label,
.result.is-active .product-name {
  animation: magic-rise 650ms var(--motion-ease) 740ms both;
}

.result.is-active .promo-heading,
.result.is-active .promo-code,
.result.is-active .discount,
.result.is-active .disclaimer {
  animation: magic-rise 620ms var(--motion-ease) 825ms both;
}

.result.is-active .result-footer .primary-button {
  animation: magic-rise 650ms var(--motion-ease) 910ms both;
}

.result-sparkles {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.result-sparkles span {
  position: absolute;
  top: 24%;
  left: 50%;
  width: var(--spark-size, 6px);
  height: var(--spark-size, 6px);
  background: #f8d7ff;
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
  opacity: 0;
  filter: drop-shadow(0 0 5px #e3acff);
}

.result.is-active .result-sparkles span {
  animation: result-spark 1350ms ease-out both;
  animation-delay: calc(150ms + var(--spark-delay, 0ms));
}

@keyframes result-spark {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(.2) rotate(0);
  }
  25% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate3d(var(--spark-x, 0px), var(--spark-y, 0px), 0) scale(.3) rotate(125deg);
  }
}

.promo-code {
  transition: background-color 210ms ease, border-color 210ms ease, box-shadow 210ms ease;
}

.promo-code:active {
  background: #a657fa2b;
  border-color: #fff;
}

.promo-code.is-copied {
  animation: promo-bounce 420ms var(--motion-ease) both;
}

@keyframes promo-bounce {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.06); }
}

/* Reduce blur and eliminate animations for people who request less motion. */
@media (prefers-reduced-motion: reduce) {
  .screen.is-active,
  .screen.is-leaving,
  .cover.is-active .cover-header,
  .cover.is-active .cover-heading,
  .cover.is-active .cover-footer .primary-button,
  .intro.is-active .intro-heading,
  .intro.is-active .intro-description,
  .intro.is-active .intro-footer .primary-button,
  .cover.is-active .cover-art,
  .intro.is-active .intro-art,
  .quiz.is-active .quiz-header,
  .quiz.is-active .quiz-art-wrap,
  .quiz.is-active .quiz-prompt,
  .quiz.is-active .answers-scroll,
  .quiz.is-question-exiting .quiz-art-wrap,
  .quiz.is-question-exiting .quiz-prompt,
  .quiz.is-question-exiting .answers-scroll,
  .quiz.is-active .answer-button,
  .result.is-active::before,
  .result.is-active .result-crest,
  .result.is-active .result-heading,
  .result.is-active .result-description,
  .result.is-active .product-label,
  .result.is-active .product-name,
  .result.is-active .promo-heading,
  .result.is-active .promo-code,
  .result.is-active .discount,
  .result.is-active .disclaimer,
  .result.is-active .result-footer .primary-button,
  .result.is-active .result-sparkles span,
  .primary-button::after,
  .app.is-portal-flashing::after,
  .promo-code.is-copied {
    animation: none !important;
  }

  .screen.is-active { opacity: 1; transform: none; filter: none; }
  .screen.is-leaving { display: none; }

  .answer-button,
  .primary-button,
  .answer-radio,
  .answer-radio::after,
  .progress-segment::before,
  .promo-code {
    transition: none !important;
  }
}

/* Selected and copied states take priority over their entrance animations. */
.quiz.is-active .answer-button.is-selected {
  animation: none;
}

.result.is-active .promo-code.is-copied {
  animation: promo-bounce 420ms var(--motion-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .result.is-active .promo-code.is-copied { animation: none !important; }
}


/* Targeted fixes: intro back navigation + toast above the app. */
.intro-back-button {
  position: absolute;
  z-index: 5;
  top: calc(var(--safe-top) + 8px);
  left: var(--screen-padding);
}

/* The app's stacking context is z-index: 2000; keep the toast above it. */
.toast {
  z-index: 3000;
}



/* ============================================================
   RESPONSIVE V2: mobile -> tablet -> desktop.
   Edit each device section separately. No clamp() needed here.
   ============================================================ */

/* One continuous background, without side bars or shadowed frame. */
html, body { background: #160527; }
.app { max-width: none; box-shadow: none; }
.cover-copy, .intro-copy { display: contents; }
.desktop-brand-logo { display: none; }

/* Medium-width phones and portrait tablets: keep content stacked.
   Do not switch to two columns until there is enough real width. */
@media (min-width: 540px) and (max-width: 959px) {
  .cover-header { top: 4%; }
  .cover-header .brand-logo { width: 132px; }
  .cover-header .brand-line { display: block; width: 225px; height: auto; margin: 6px auto 0; }
  .cover-art {
    top: 35%; left: 50%; width: 90%; height: 44%;
    transform: translateX(-50%); object-fit: contain;
  }
  .cover-footer { bottom: 4%; left: 18px; right: 18px; text-align: center; }
  .cover-heading { font-size: 24px; margin-bottom: 22px; }
  .intro-header { top: 8%; left: 20px; right: 20px; }
  .intro-heading { font-size: 32px; }
  .intro-description { font-size: 15px; margin-top: 23px; }
  .intro-art {
    top: 34%; left: 50%; width: 100%; height: 50%;
    transform: translateX(-50%); object-fit: contain;
  }
  .intro-footer { bottom: 4%; }
  .intro-back-button { top: 16px; left: 22px; }
  .quiz { padding-left: 8%; padding-right: 8%; }
  .quiz-art { max-height: 29vh; }
  .question-title { max-width: 610px; font-size: 23px; }
  .answer-button { font-size: 16px; }
  .result-crest { width: 210px; height: 26vh; }
  .result-description { max-width: 520px; font-size: 16px; }
}

/* At this width the hero can sit next to the text safely.
   The entire left-hand content is one centered, compact group. */
@media (min-width: 960px) {
  :root { --desktop-left: 8%; }
  .desktop-brand-logo {
    display: block;
    position: absolute;
    z-index: 5;
    top: 6%;
    left: var(--desktop-left);
    width: 170px;
    height: auto;
    object-fit: contain;
    pointer-events: none;
  }
  .cover-header .brand-logo { display: none; }
  .primary-button {
    width: max-content; min-width: 165px; min-height: 50px;
    padding: 12px 28px; margin: 0; font-size: 15px;
  }
  .cover-copy, .intro-copy {
    position: absolute;
    z-index: 3;
    top: 19%; bottom: 12%; left: var(--desktop-left);
    width: 39%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }
  .cover-header, .cover-footer, .intro-header, .intro-footer {
    position: static;
    top: auto; left: auto; right: auto; bottom: auto;
    width: 100%;
    text-align: left;
  }
  .cover-header .brand-line {
    display: block; width: 78%; max-width: 355px;
    height: auto; margin: 0 0 28px 0;
  }
  .cover-heading {
    color: #d9a1e5; font-size: 28px; line-height: 1.1;
    font-weight: 700; margin: 0 0 30px;
  }
  .cover-art {
    top: 50%; left: 73%; width: 55%; height: 94%;
    max-width: none; max-height: none;
    transform: translate(-50%, -50%); object-fit: contain;
  }
  .intro-copy { top: 17%; bottom: 12%; }
  .intro-heading { font-size: 42px; line-height: 1.12; color: #d99be5; }
  .intro-description {
    margin: 35px 0 32px; font-size: 20px;
    line-height: 1.25; color: #d4a3de;
  }
  .intro-art {
    top: 50%; left: 73%; width: 56%; height: 91%;
    max-width: none; max-height: none;
    transform: translate(-50%, -50%); object-fit: contain;
  }
  .intro-back-button {
    top: 17%; left: var(--desktop-left);
    z-index: 7; padding: 9px 10px; font-size: 14px;
    background: #2a0a42bd; border-radius: 7px;
  }
  /* Quiz: separate artwork column and answer column. */
  .quiz.is-active, .quiz.is-leaving { display: block; }
  .quiz { padding: 0; }
  .quiz-header {
    display: flex; align-items: center; gap: 12px;
    position: absolute; top: 17%; left: 50%; right: 8%;
    width: auto; min-height: 0;
  }
  .quiz-nav { display: contents; }
  .quiz-counter { order: 3; white-space: nowrap; }
  .quiz-header .progress { order: 2; flex: 1; margin: 0; }
  .quiz-header .back-button { white-space: nowrap; font-size: 13px; }
  .quiz-art-wrap {
    position: absolute; top: 22%; bottom: 24%;
    left: 7%; width: 38%; height: auto; min-height: 0;
  }
  .quiz-art { width: 100%; height: 100%; max-height: none; border-radius: 20px; }
  .quiz-prompt { position: static; }
  .question-number {
    position: absolute; bottom: 13%; left: 7%; width: 38%;
    text-align: center; margin: 0; font-size: 39px;
  }
  .question-title {
    position: absolute; top: 24%; left: 50%; right: 8%;
    max-width: none; margin: 0; font-family: var(--font-body);
    font-size: 27px; line-height: 1.15; text-align: left;
  }
  .answers-scroll {
    position: absolute; top: 39%; bottom: 8%;
    left: 50%; right: 8%; min-height: 0; overflow-y: auto;
  }
  .answers-list { gap: 12px; padding: 2px 3px 10px; }
  .answer-button {
    min-height: 59px; padding: 12px 14px; border-radius: 15px;
    background: #54137e24; font-size: 16px; line-height: 1.25;
  }
  .answer-radio { width: 24px; height: 24px; }
  /* Result: emblem left, details right. */
  .result { padding: 0; background: transparent; }
  .result-scroll {
    position: absolute; top: 17%; bottom: 13%; left: 7%; right: 8%;
    width: auto; height: auto; overflow-y: auto;
    display: grid; grid-template-columns: 47% 53%;
    grid-auto-rows: min-content; align-content: center;
    text-align: left;
  }
  .result-crest {
    grid-column: 1; grid-row: 1 / span 9; align-self: center;
    justify-self: center; width: 83%; height: 65vh;
    max-width: none; margin: 0;
  }
  .result-scroll > :not(.result-crest) { grid-column: 2; justify-self: start; }
  .result-heading { margin: 0 0 16px; font-size: 43px; }
  .result-description { max-width: 600px; margin: 0 0 23px; font-size: 17px; line-height: 1.2; }
  .product-label { margin: 0 0 11px; font-size: 16px; font-weight: bold; }
  .product-name { margin: 0 0 20px; font-size: 17px; }
  .promo-heading { font-size: 13px; }
  .promo-code { min-width: 0; margin: 9px 0 20px; padding: 12px 14px; font-size: 25px; }
  .discount { margin: 0 0 15px; font-size: 29px; }
  .disclaimer { max-width: 440px; margin: 0; font-size: 10px; text-align: left; }
  .result-footer { position: absolute; left: 50%; bottom: 6%; right: 8%; width: auto; }
}

/* Smaller desktop widths: keep the copy group compact and art separate. */
@media (min-width: 960px) and (max-width: 1250px) {
  :root { --desktop-left: 6%; }
  .desktop-brand-logo { width: 135px; }
  .cover-copy, .intro-copy { width: 39%; top: 23%; bottom: 12%; }
  .cover-header .brand-line { max-width: 265px; margin-bottom: 23px; }
  .cover-heading { font-size: 22px; margin-bottom: 22px; }
  .cover-art { left: 73%; width: 57%; height: 83%; }
  .intro-heading { font-size: 31px; }
  .intro-description { font-size: 15px; margin: 24px 0 26px; }
  .intro-art { left: 73%; width: 54%; height: 79%; }
  .intro-back-button { top: 17%; }
  .question-title { font-size: 22px; }
  .answer-button { font-size: 13px; min-height: 54px; }
  .result-heading { font-size: 34px; }
  .result-description { font-size: 14px; }
  .result-crest { height: 60vh; }
}

/* Short desktop windows: the copy stays grouped, never spread vertically. */
@media (min-width: 960px) and (max-height: 700px) {
  .cover-copy, .intro-copy { top: 19%; bottom: 5%; }
  .cover-header .brand-line { max-width: 240px; margin-bottom: 12px; }
  .cover-heading { margin-bottom: 16px; }
  .intro-heading { font-size: 31px; }
  .intro-description { margin: 18px 0 20px; font-size: 15px; }
  .cover-art, .intro-art { height: 90%; }
  .quiz-header { top: 13%; }
  .question-title { top: 21%; }
  .answers-scroll { top: 39%; bottom: 5%; }
  .result-scroll { top: 13%; bottom: 11%; }
  .result-footer { bottom: 3%; }
}


/* ============================================================
   V3: precise desktop layout corrections (mobile base unchanged)
   ============================================================ */
/* The result button now lives inside the scrolling results body.
   On phones/tablets keep its original anchored position. */
@media (max-width: 959px) {
  .result-footer {
    position: absolute;
    right: 20px;
    left: 20px;
    bottom: var(--button-bottom);
    z-index: 2;
  }
}

@media (min-width: 960px) {
  /* Hero pictures are siblings of the text blocks. Their percentages
     now refer to the FULL screen, not the narrow text column. */
  .cover-art, .intro-art {
    position: absolute;
    left: auto;
    top: 50%;
    max-width: none;
    max-height: none;
    transform: translateY(-50%);
    object-fit: contain;
    pointer-events: none;
  }
  .cover-art { right: 1%; width: 61%; height: 96%; }
  .intro-art { right: 2%; width: 64%; height: 94%; }

  /* The question heading is positioned relative to a FULL-SCREEN
     wrapper, not an auto-height wrapper (which caused it to jump
     above the viewport during entrance animations). */
  .quiz-prompt {
    position: absolute;
    inset: 0;
    margin: 0;
    pointer-events: none;
  }
  .question-title {
    position: absolute;
    top: 24%;
    left: 50%;
    right: 8%;
    max-width: none;
  }
  .question-number { position: absolute; bottom: 13%; left: 7%; width: 38%; }

  /* The CTA follows the disclaimer, in the SAME right-hand column. */
  .result-scroll { grid-template-rows: repeat(10, min-content); }
  .result-crest { grid-row: 1 / span 10; }
  .result-scroll > .result-footer {
    position: static;
    width: auto;
    margin: 20px 0 0;
    padding: 0;
    justify-self: start;
    grid-column: 2;
  }
  .result-scroll > .result-footer .primary-button { margin: 0; }
}

@media (min-width: 960px) and (max-width: 1250px) {
  .cover-art { right: 0; width: 59%; height: 87%; }
  .intro-art { right: 1%; width: 59%; height: 85%; }
}

@media (min-width: 960px) and (max-height: 700px) {
  .cover-art { height: 94%; }
  .intro-art { height: 91%; }
  .question-title { top: 21%; }
  .result-scroll > .result-footer { margin-top: 12px; }
}

/* Keep the mobile result button visible outside the inner scrolling area. */
@media (max-width: 959px) {
  .result-scroll > .result-footer {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: var(--button-bottom);
    width: auto;
    z-index: 4;
  }
}


/* ============================================================
   V4 — compact portrait phones + LANDSCAPE phones.
   The desktop rules above remain unchanged. These rules are
   deliberately explicit so the layout is easy to adjust.
   ============================================================ */

/* Small portrait phones: prevent the hero from touching the title. */
@media (orientation: portrait) and (max-width: 400px) and (max-height: 740px) {
  .cover-header { top: calc(var(--safe-top) + 12px); }
  .cover-header .brand-logo { width: 96px; }
  .cover-header .brand-line { display: block; width: 178px; height: auto; margin: 2px auto 0; }
  .cover-art {
    top: 40%; left: 50%; width: 112%; height: 38%;
    transform: translateX(-50%); object-fit: contain;
  }
  .cover-footer { bottom: calc(13px + var(--safe-bottom)); }
  .cover-heading { font-size: 17px; margin-bottom: 15px; }
  .cover-footer .primary-button { min-height: 48px; }
  .intro-header { top: calc(var(--safe-top) + 32px); }
  .intro-heading { font-size: 21px; }
  .intro-description { font-size: 11px; margin-top: 10px; }
  .intro-art { top: 35%; left: 30%; width: 140%; height: 48%; transform: translateX(-50%); }
  .intro-footer { bottom: calc(12px + var(--safe-bottom)); }
  .intro-footer .primary-button { min-height: 48px; }
}

/* Very short portrait devices, including older 320x568 iPhones. */
@media (orientation: portrait) and (max-width: 360px) and (max-height: 630px) {
  .cover-header .brand-logo { width: 82px; }
  .cover-header .brand-line { width: 153px; }
  .cover-art { top: 39%; height: 36%; width: 108%; }
  .cover-heading { font-size: 15px; margin-bottom: 11px; }
  .cover-footer .primary-button { min-height: 43px; font-size: 13px; }
  .intro-heading { font-size: 19px; }
  .intro-description { font-size: 10px; }
  .intro-art { top: 36%; height: 43%; }
  .intro-footer .primary-button { min-height: 43px; }
  .quiz-art { max-height: 20dvh; }
  .quiz { row-gap: 4px; }
  .question-title { font-size: 14px; }
  .answer-button { font-size: 11px; min-height: 43px; padding: 8px; }
}

/* Phone rotated horizontally: use a miniature desktop layout.
   This is separate from the portrait/tablet/desktop breakpoints. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 959px) and (max-height: 500px) {
  .app { height: 100dvh; width: 100%; }
  .desktop-brand-logo {
    display: block; position: absolute; z-index: 6;
    top: 10px; left: 5%; width: 82px; height: auto;
    object-fit: contain; pointer-events: none;
  }
  .cover-copy, .intro-copy {
    display: flex; flex-direction: column; align-items: flex-start;
    justify-content: center; position: absolute; z-index: 3;
    top: 15%; bottom: 3%; left: 5%; width: 42%;
  }
  .cover-header, .cover-footer, .intro-header, .intro-footer {
    position: static; top: auto; bottom: auto; left: auto; right: auto;
    width: 100%; text-align: left;
  }
  .cover-header .brand-logo { display: none; }
  .cover-header .brand-line {
    display: block; width: 150px; height: auto;
    margin: 22px 0 9px;
  }
  .cover-heading {
    margin: 0 0 11px; font-size: 14px; line-height: 1.1;
    font-weight: 700;
  }
  .primary-button {
    width: max-content; max-width: 100%; min-width: 128px;
    min-height: 35px; padding: 7px 13px; margin: 0;
    font-size: 11px;
  }
  .cover-art, .intro-art {
    position: absolute; top: 50%; left: auto; right: 1%;
    width: 51%; height: 94%; max-width: none; max-height: none;
    transform: translateY(-50%); object-fit: contain;
  }
  .intro-copy { top: 15%; bottom: 4%; }
  .intro-heading { font-size: 19px; line-height: 1.06; }
  .intro-description {
    margin: 12px 0 14px; font-size: 10px;
    line-height: 1.22; text-transform: uppercase;
  }
  .intro-art { right: 0; width: 53%; height: 94%; }
  .intro-back-button {
    position: absolute; top: 42px; left: 5%; z-index: 7;
    padding: 4px 6px; background: #2b0b40b8;
    border-radius: 5px; font-size: 10px;
  }

  /* Quiz: illustration left; prompt, progress and scrollable answers right. */
  .quiz, .quiz.is-active, .quiz.is-leaving { padding: 0; }
  .quiz.is-active, .quiz.is-leaving { display: block; }
  .quiz-header {
    display: flex; align-items: center; gap: 7px;
    position: absolute; z-index: 5; top: 9%; left: 48%; right: 4%;
    width: auto; min-height: 0; height: 22px;
  }
  .quiz-nav { display: contents; }
  .quiz-counter { order: 3; font-size: 10px; white-space: nowrap; }
  .quiz-header .back-button { order: 1; font-size: 10px; padding: 2px; white-space: nowrap; }
  .quiz-header .progress { order: 2; flex: 1; height: 3px; margin: 0; gap: 2px; }
  .quiz-art-wrap {
    position: absolute; top: 21%; bottom: 19%; left: 4%;
    width: 40%; height: auto; min-height: 0;
  }
  .quiz-art { width: 100%; height: 100%; max-height: none; border-radius: 9px; }
  .quiz-prompt { position: absolute; inset: 0; margin: 0; pointer-events: none; }
  .question-number {
    position: absolute; bottom: 7%; left: 4%; width: 40%;
    text-align: center; margin: 0; font-size: 19px;
  }
  .question-title {
    position: absolute; top: 21%; left: 48%; right: 4%;
    max-width: none; margin: 0; font-family: var(--font-body);
    font-size: 12px; line-height: 1.16; text-align: left;
  }
  .answers-scroll {
    position: absolute; top: 43%; bottom: 5%; left: 48%; right: 4%;
    min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  }
  .answers-list { gap: 5px; padding: 2px 3px 8px; }
  .answer-button {
    min-height: 38px; padding: 6px 7px; border-width: 1px;
    border-radius: 9px; background: #54137e58;
    font-size: 10px; line-height: 1.18;
  }
  .answer-radio { width: 13px; height: 13px; }

  /* Result: a crest in the left column, all details and CTA on right.
     Scroll the details if a phone is only ~320px tall. */
  .result { padding: 0; background: transparent; }
  .result-scroll {
    position: absolute; top: 11%; bottom: 3%; left: 5%; right: 4%;
    width: auto; height: auto; overflow-y: auto;
    display: grid; grid-template-columns: 43% 57%;
    grid-auto-rows: min-content; align-content: start;
    text-align: left;
  }
  .result-crest {
    position: sticky; top: 18px; grid-column: 1;
    grid-row: 1 / span 10; align-self: start; justify-self: center;
    width: 85%; height: 73dvh; max-width: none; margin: 0;
    object-fit: contain;
  }
  .result-scroll > :not(.result-crest) { grid-column: 2; justify-self: start; }
  .result-heading { margin: 0 0 6px; font-size: 22px; }
  .result-description { max-width: 100%; margin: 0 0 8px; font-size: 10px; line-height: 1.18; }
  .product-label { margin: 0 0 3px; font-size: 9px; font-weight: 700; }
  .product-name { margin: 0 0 8px; font-size: 10px; }
  .promo-heading { font-size: 8px; padding: 3px 5px; }
  .promo-code { min-width: 0; margin: 5px 0 7px; padding: 5px 7px; font-size: 14px; }
  .discount { margin: 0 0 5px; font-size: 15px; }
  .disclaimer { max-width: 100%; margin: 0; font-size: 8px; text-align: left; }
  .result-scroll > .result-footer {
    position: static; left: auto; right: auto; bottom: auto;
    margin: 9px 0 8px; padding: 0; width: auto; z-index: auto;
    grid-column: 2; justify-self: start;
  }
  .result-footer .primary-button { margin: 0; }
}

/* Landscape on the smallest classic iPhones (e.g. 568x320). */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 650px) and (max-height: 500px) {
  .desktop-brand-logo { width: 67px; top: 6px; }
  .cover-header .brand-line { width: 115px; margin-top: 17px; margin-bottom: 7px; }
  .cover-heading { font-size: 12px; margin-bottom: 8px; }
  .cover-art { width: 49%; }
  .intro-heading { font-size: 15px; }
  .intro-description { font-size: 9px; margin: 8px 0 10px; }
  .intro-back-button { top: 32px; }
  .question-title { font-size: 11px; }
  .answers-scroll { top: 46%; }
  .answer-button { font-size: 9px; }
}


/* ============================================================
   V5 — HORIZONTAL PHONES: balanced breathing room.
   Changes ONLY to landscape phones. Portrait + desktop untouched.
   ============================================================ */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 959px) and (max-height: 500px) {
  /* Same inset at left and top: no logo glued to the edge. */
  .desktop-brand-logo {
    top: 19px; left: 6%; width: 88px;
  }
  /* A single group for text and button, with predictable gaps. */
  .cover-copy, .intro-copy {
    top: 22%; bottom: 4%; left: 6%; width: 39%;
    justify-content: center;
  }
  .cover-header .brand-line { width: 155px; margin: 8px 0 13px; }
  .cover-heading { margin: 0 0 13px; line-height: 1.18; }
  .cover-art { right: 2%; width: 51%; height: 90%; }
  .intro-copy { top: 24%; bottom: 4%; }
  .intro-heading { font-size: 19px; line-height: 1.12; }
  .intro-description { margin: 13px 0 14px; line-height: 1.28; }
  .intro-art { right: 1%; width: 52%; height: 91%; }
  /* Back is below the logo, not tucked up against it. */
  .intro-back-button {
    top: 85px; left: 6%; padding: 4px 7px; font-size: 10px;
  }

  /* Quiz gets the same outside margins as the other screens. */
  .quiz-header { top: 14%; left: 48%; right: 6%; }
  .quiz-art-wrap { top: 24%; bottom: 15%; left: 6%; width: 38%; }
  .question-number { left: 6%; width: 38%; bottom: 6%; }
  .question-title { top: 27%; left: 48%; right: 6%; line-height: 1.22; }
  .answers-scroll { top: 47%; bottom: 6%; left: 48%; right: 6%; }
  .answers-list { gap: 6px; }
  .answer-button { padding: 7px 8px; }

  /* More air in the result's right column; allow inner scrolling
     on short devices instead of squeezing everything together. */
  .result-scroll { top: 17%; bottom: 6%; left: 6%; right: 6%; grid-template-columns: 43% 57%; }
  .result-crest { height: 70dvh; }
  .result-heading { margin-bottom: 11px; font-size: 23px; }
  .result-description { margin-bottom: 11px; line-height: 1.3; font-size: 10px; }
  .product-label { margin-bottom: 5px; }
  .product-name { margin-bottom: 11px; line-height: 1.3; }
  .promo-code { margin: 8px 0 11px; padding: 7px 9px; }
  .discount { margin-bottom: 8px; line-height: 1.15; }
  .disclaimer { line-height: 1.3; }
  .result-scroll > .result-footer { margin-top: 13px; margin-bottom: 10px; }
}

/* Classic iPhones in landscape have just 320px of vertical space. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 650px) and (max-height: 500px) {
  .desktop-brand-logo { top: 13px; left: 5%; width: 71px; }
  .cover-copy, .intro-copy { left: 5%; width: 43%; top: 19%; bottom: 2%; }
  .cover-header .brand-line { width: 116px; margin: 7px 0 8px; }
  .cover-heading { margin-bottom: 9px; font-size: 12px; }
  .intro-back-button { top: 65px; left: 5%; }
  .intro-copy { top: 23%; bottom: 2%; }
  .intro-heading { font-size: 15px; }
  .intro-description { margin: 8px 0 9px; font-size: 9px; }
  .quiz-header { top: 12%; }
  .question-title { top: 25%; font-size: 11px; }
  .answers-scroll { top: 47%; }
  .result-scroll { top: 16%; left: 5%; right: 5%; }
  .result-heading { font-size: 19px; margin-bottom: 7px; }
  .result-description { margin-bottom: 7px; font-size: 9px; }
  .product-name { margin-bottom: 7px; }
  .promo-code { margin: 5px 0 7px; }
  .result-scroll > .result-footer { margin-top: 9px; }
}


/* ============================================================
   V6 — targeted corrections from device screenshots.
   These rules only adjust the cover/header geometry. The quiz,
   results, JavaScript and the intro on Galaxy A55 stay unchanged.
   ============================================================ */

/* iPhone SE 375 x 667: move the logo/title group away from the
   top edge without pushing the artwork into the footer. */
@media (orientation: portrait) and (min-width: 361px) and (max-width: 390px) and (max-height: 700px) {
  .cover-header { top: calc(var(--safe-top) + 34px); }
  .cover-art { top: 43%; height: 36%; }
}

/* Galaxy A55 and similar taller, narrow portrait phones:
   keep the ninja fully above the heading and action button. */
@media (orientation: portrait) and (min-width: 340px) and (max-width: 390px) and (min-height: 741px) {
  .cover-art {
    top: 38%;
    left: 50%;
    width: 112%;
    height: 44%;
    transform: translateX(-50%);
    object-fit: contain;
  }
  .cover-header .brand-line { width: 205px; height: auto; }
  .cover-heading { margin-bottom: 16px; }
}

/* On rotated phones, center the whole LEFT group against the
   illustration. Do not move only the button or only the title. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 959px) and (max-height: 500px) {
  .cover-copy, .intro-copy {
    top: 0;
    bottom: 0;
    justify-content: center;
    transform: translateY(-15px);
  }
  .cover-header .brand-line { margin-top: 0; }
}

/* Classic 568 x 320 phones need less vertical offset. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 650px) and (max-height: 360px) {
  .cover-copy, .intro-copy { transform: translateY(-5px); }
}

/* Large desktops and 2K monitors: scale the TEXT column with
   the available space. The illustration already scales well. */
@media (min-width: 1600px) and (min-height: 701px) {
  .desktop-brand-logo { width: 190px; }
  .cover-header .brand-line {
    width: 440px;
    max-width: 100%;
    margin-bottom: 32px;
  }
  .cover-heading { font-size: 37px; margin-bottom: 35px; }
  .intro-heading { font-size: 55px; }
  .intro-description { font-size: 25px; line-height: 1.3; margin: 38px 0 36px; }
  .cover-footer .primary-button,
  .intro-footer .primary-button {
    font-size: 18px;
    min-height: 56px;
    min-width: 225px;
    padding: 14px 30px;
  }
}

/* Extra-wide monitors benefit from a larger left-hand title,
   but never allow the artwork to collide with that column. */
@media (min-width: 2200px) and (min-height: 850px) {
  .cover-header .brand-line { width: 490px; }
  .cover-heading { font-size: 42px; }
  .intro-heading { font-size: 62px; }
  .intro-description { font-size: 28px; }
}


/* ============================================================
   V7 — landscape-phone spacing fixes.
   Scope: ONLY horizontally rotated phones. Portrait, tablets,
   desktop, quiz and result layouts are unchanged.
   ============================================================ */
@media (orientation: landscape) and (min-width: 651px) and (max-width: 959px) and (max-height: 500px) {
  /* Shift the whole cover text/button group down without moving
     its individual parts or the large ninja illustration. */
  .cover-copy {
    transform: translateY(24px);
  }

  /* The back button is an independent navigation control: keep
     it in the gap BELOW the logo and ABOVE the heading. */
  .intro-back-button {
    top: 71px;
    left: 6%;
  }
  .intro-copy {
    transform: translateY(23px);
  }
}

/* Small landscape iPhones: less height, so use a gentler offset. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 650px) and (max-height: 500px) {
  .cover-copy { transform: translateY(13px); }
  .intro-back-button { top: 58px; left: 5%; }
  .intro-copy { transform: translateY(15px); }
}

/* Very low landscape viewports: preserve button and headline room. */
@media (orientation: landscape) and (min-width: 480px) and (max-width: 959px) and (max-height: 350px) {
  .cover-copy { transform: translateY(9px); }
  .intro-copy { transform: translateY(10px); }
}


/* ============================================================
   V8 — iPhone SE portrait (375 × 667) only.
   Add breathing room between Ninja Pizza logo and the decorative
   “Узнай свой факультет” image. No other layout changes.
   ============================================================ */
@media (orientation: portrait) and (min-width: 361px) and (max-width: 390px) and (max-height: 700px) {
  .cover-header .brand-line {
    margin-top: 20px; /* was 2px; title goes 18px lower */
  }
}
