@font-face {
  font-family: "MF YanSong";
  src: local("MF YanSong"), local("MFYanSong"), local("MFYanSong-Regular"), local("造字工房研宋");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  --scene-top: #cf1e25;
  --homepage-bottom: #fdc83e;
  --submission-bottom: #e58e25;
  --loading-bottom: #e0781f;
  --reward-bottom: #e17a20;
  --scene-bottom: var(--homepage-bottom);
  background: linear-gradient(to bottom, var(--scene-top), var(--scene-bottom));
  --slide-duration: 1100ms;
  --slide-easing: cubic-bezier(0.76, 0, 0.24, 1);
}

:root:has(.experience.is-revealing) {
  --scene-bottom: var(--submission-bottom);
}

:root:has(.experience[data-scene="loading"]) {
  --scene-bottom: var(--loading-bottom);
}

:root:has(.experience[data-scene="reward"]) {
  --scene-bottom: var(--reward-bottom);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.experience {
  position: relative;
  width: min(100vw, 56.25vh);
  width: min(100vw, 56.25dvh);
  aspect-ratio: 9 / 16;
  /* Keep the artwork width while letting the homepage exit at the viewport top. */
  overflow: visible;
  clip-path: inset(calc(50% - 50vh) 0);
  clip-path: inset(calc(50% - 50dvh) 0);
  isolation: isolate;
  background: linear-gradient(to bottom, var(--scene-top), var(--scene-bottom));
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--scene-top), var(--scene-bottom));
}

.scene-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* The SVG viewBox removes the supplied logo's transparent outer padding. */
.brand-link {
  position: absolute;
  z-index: 1;
  top: 4.4%;
  left: 8%;
  width: 17%;
  aspect-ratio: 1597 / 1111;
  display: block;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.brand-link svg { display: block; width: 100%; height: 100%; }
.brand-link::before { content: ""; position: absolute; inset: -4px; }
.brand-link:focus-visible { outline: 2px solid #fff4c9; outline-offset: 4px; border-radius: 4px; }
.submission-media > .brand-link { top: 5.75%; }
.reward > .brand-link { top: 4.65%; }

.submission {
  z-index: 0;
  --scene-bottom: var(--submission-bottom);
}

.loading {
  z-index: 2;
  inset: -1px;
  --scene-bottom: var(--loading-bottom);
  outline: none;
}

.reward {
  z-index: 3;
  inset: -1px;
  --scene-bottom: var(--reward-bottom);
  outline: none;
  container-type: inline-size;
}

/* Coordinates share the 1080 × 1920 reward artwork's coordinate system. */
.result-content { position: absolute; inset: 0; pointer-events: none; }
.result-content[hidden], .result-content [hidden] { display: none; }

.result-character {
  position: absolute;
  left: 24%;
  bottom: 59.8%;
  width: 52%;
  aspect-ratio: 1;
}

.result-character img, .result-character video,
.result-character canvas, .result-score img, .result-score video, .result-score canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-character, .result-score { contain: layout paint; }
.alpha-source { opacity: 0; }

.result-cloud-art {
  position: absolute;
  left: 11%;
  bottom: 59.3%;
  width: 78%;
  aspect-ratio: 1000 / 308;
}

.result-cloud-art img { display: block; width: 100%; height: auto; }

.result-title, .result-identity, .result-summary {
  font-family: "MF YanSong", "MFYanSong", "Times New Roman", "Songti SC", "SimSun", serif;
  font-weight: 700;
}

.result-title {
  position: absolute;
  top: 35%;
  left: 20%;
  width: 60%;
  margin: 0;
  color: #fff7d5;
  font-size: 5.6cqw;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  -webkit-text-stroke: 0.7cqw #d52b25;
  paint-order: stroke fill;
  text-shadow: 0 0.7cqw 0 #a92b21;
}

.result-identity {
  position: absolute;
  top: 39.05%;
  left: 26%;
  width: 48%;
  height: 5.55%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #fff5d4;
  font-size: 3.3cqw;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 0.2cqw 0 #e88540;
}

.result-summary {
  position: absolute;
  top: 46.4%;
  left: 24%;
  width: 52%;
  color: #a5352b;
}

.result-score { position: relative; width: 100%; aspect-ratio: 720 / 280; }
.result-copy {
  max-width: 88%;
  margin: 1cqw auto 0;
  font-size: 2.2cqw;
  line-height: 1.35;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}
.result-fortune { position: absolute; top: 67.5%; left: 24%; width: 52%; }
.result-ratings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5cqw 1.8cqw; margin: 0; font-size: 2.65cqw; line-height: 1.2; }
.result-rating {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5cqw;
  aspect-ratio: 2.2;
  padding: 1.1cqw;
  border: 0.35cqw solid #f0cd5b;
  border-radius: 1.4cqw;
  background: #fff;
  color: #cf3930;
  white-space: nowrap;
}
.result-rating dt, .result-rating dd { margin: 0; }
.result-rating svg { display: block; width: 100%; height: auto; }
.result-stars { color: #dd5728; letter-spacing: -0.15cqw; }
.result-stars-empty { color: #e8d8bd; }

.result-reveal-item { opacity: 0; visibility: hidden; transform-origin: center; }
.result-reveal-item.is-entering { visibility: visible; }
.result-reveal-item.is-revealed { opacity: 1; visibility: visible; transform: none; }

.result-actions {
  position: absolute;
  top: 84%;
  left: 26%;
  width: 48%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqw;
  pointer-events: auto;
}

.result-action {
  position: relative;
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
  opacity: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.result-action img { display: block; width: 100%; height: auto; user-select: none; }
.result-action:disabled { cursor: default; }
.result-action:not(:disabled)::before { content: ""; position: absolute; inset: -4px; }
.result-action:focus-visible { outline: 2px solid #b72920; outline-offset: 4px; }
.result-action:active:not(:disabled) { filter: brightness(0.95); }
.result-action-coupon { width: 64.583333%; }
.result-action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.4cqw; width: 120%; }
.result-action-retry { width: 31.25%; margin-top: 1cqw; }
.result-action-retry:not(:disabled)::before { inset: -6px -12px; }

.result-feedback {
  position: fixed; z-index: 10; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); width: max-content; max-width: 86vw; margin: 0;
  padding: 10px 16px; border: 1px solid #e7bd4c; border-radius: 12px;
  background: #fff7dc; color: #8b3021; font-size: 14px; text-align: center;
}
.result-share-dialog { width: min(88vw, 390px); padding: 24px; border: 2px solid #edc347; border-radius: 20px; background: #fff8e4; color: #8b3021; }
.result-share-dialog::backdrop { background: rgb(58 15 0 / 55%); }
.result-share-dialog h2 { margin: 0 0 18px; font-size: 21px; }
.result-share-dialog label { display: block; font-size: 14px; }
.result-share-dialog input { box-sizing: border-box; width: 100%; margin-top: 12px; padding: 10px; border: 1px solid #e7bd4c; border-radius: 8px; font-size: 14px; }
.result-share-dialog p { min-height: 1.5em; font-size: 13px; }
.result-share-dialog div { display: flex; gap: 10px; }
.result-share-dialog button { flex: 1; padding: 10px 8px; border: 0; border-radius: 8px; background: #cc2028; color: #fff5d4; font: inherit; cursor: pointer; }
.experience.is-resetting .homepage { transition: none; }

.coupon-dialog {
  position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  overflow: hidden; background: transparent;
}
.coupon-dialog[open] { display: grid; place-items: center; }
.coupon-dialog::backdrop { background: rgb(0 0 0 / 75%); }
.coupon-dialog [hidden] { display: none; }
.coupon-stage { position: relative; width: min(100%, 56.25vh); width: min(100%, 56.25dvh); aspect-ratio: 9 / 16; container-type: inline-size; pointer-events: none; }
.coupon-media, .coupon-stage > canvas { position: absolute; inset-block: 0; left: 50%; display: block; width: 177.777778%; height: 100%; transform: translateX(-50%); object-fit: contain; pointer-events: none; }
.coupon-panel-hitarea { position: absolute; left: 9.2%; top: 20.8%; width: 81.5%; height: 48%; pointer-events: auto; }
/* The finished artwork is in the movie; this transparent link follows its button. */
.coupon-shop { position: absolute; top: 75.75%; left: 22.6%; width: 52.4%; height: 5.3%; padding: 0; border: 0; border-radius: 2cqw; background: transparent; cursor: pointer; touch-action: manipulation; pointer-events: auto; }
.coupon-shop-fallback { display: none; }
.coupon-shop::before { content: ""; position: absolute; inset: -5px; }
.coupon-shop:active { filter: brightness(0.94); }
.coupon-shop:focus-visible, .coupon-close:focus-visible { outline: 3px solid #ffd04a; outline-offset: 4px; }
.coupon-close { position: absolute; top: 14.9%; right: 19.5%; transform: translate(50%, -50%); display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #f4d5b4; border-radius: 50%; background: #fff8e4; color: #ad2526; cursor: pointer; pointer-events: auto; }
.coupon-close svg { display: block; width: 22px; height: 22px; pointer-events: none; }
.coupon-static { position: absolute; top: 45.2%; left: 9.2%; width: 81.5%; height: 23.4%; border-radius: 3cqw 3cqw 15cqw 15cqw; background: #bd1a00; color: #fff; text-align: center; }
.coupon-static strong { display: block; margin-top: 6cqw; font-size: 7cqw; }
.coupon-static span { display: block; margin-top: 5cqw; font: 700 8cqw sans-serif; }
.coupon-static:not([hidden]) ~ .coupon-shop { display: grid; place-items: center; background: #e43730; color: #fff; text-decoration: none; font: 700 5cqw/1.2 "Microsoft YaHei", "PingFang SC", sans-serif; }
.coupon-static:not([hidden]) ~ .coupon-shop .coupon-shop-fallback { display: block; }

.cloud-transition {
  position: absolute;
  z-index: 4;
  inset: -1px;
  overflow: hidden;
  pointer-events: none;
}

.cloud-transition video,
.cloud-transition img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cloud-transition[hidden],
.cloud-transition [hidden] { display: none; }
.cloud-transition canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.experience[data-scene="loading"] .submission,
.experience[data-scene="reward"] .submission {
  visibility: hidden;
}

.submission-media {
  position: absolute;
  container-type: inline-size;
  inset-inline: 0;
  inset-block: 0;
  aspect-ratio: 9 / 20;
}

.submission-form {
  position: absolute;
  top: 41%;
  left: 15%;
  width: 70%;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  color: #7f3326;
  font-family: "MF YanSong", "MFYanSong", "Times New Roman", "Songti SC", "SimSun", serif;
  font-size: 3.15cqw;
  font-weight: 700;
  line-height: 1.3;
}

.form-field {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-field + .form-field { margin-top: 6cqw; }
.gender-field + .form-field { margin-top: 4.5cqw; }

.form-field > label,
.form-field > legend {
  display: block;
  width: 100%;
  margin: 0 0 1.2cqw;
  padding: 0 0 0 0.7cqw;
  font: inherit;
}

.form-field > input {
  display: block;
  width: 100%;
  height: 10cqw;
  min-width: 0;
  padding: 0 5cqw;
  border: max(1px, 0.45cqw) solid #eaddaf;
  border-radius: 2.1cqw;
  outline: none;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: max(16px, 3.5cqw);
  font-weight: 600;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-field > input::placeholder { color: #948b80; font-size: 3.1cqw; opacity: 1; }
.form-field > input:focus { border-color: #e5ac3b; box-shadow: 0 0 0 0.6cqw rgb(255 177 63 / 18%); }
.form-field > input[aria-invalid="true"] { border-color: #d2232a; }

.gender-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3cqw;
  padding-inline: 1cqw;
}

.gender-option { position: relative; cursor: pointer; }

.gender-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.gender-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 10cqw;
  border: 1px solid #f1e8cd;
  border-radius: 1.8cqw;
  background: #fff;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.gender-option input:checked + span {
  border-color: #d56c5b;
  background: #d56c5b;
  color: #fff;
  box-shadow: 0 0.7cqw 0 #bb5245;
}

.gender-option input:focus-visible + span { outline: 2px solid #7f3326; outline-offset: 3px; }

.unlock-button {
  display: grid;
  place-items: center;
  align-self: center;
  width: 60%;
  min-height: 44px;
  margin: 4cqw 0 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease;
}

.unlock-button img { display: block; width: 100%; height: auto; user-select: none; }
.unlock-button:active { transform: scale(0.97); }
.unlock-button:focus-visible { outline: 2px solid #7f3326; outline-offset: 3px; }
.unlock-button:disabled { cursor: default; }

.field-error {
  position: absolute;
  top: calc(100% + 0.5cqw);
  left: 0.7cqw;
  color: #b21722;
  font-size: 2.65cqw;
  line-height: 1.3;
}

.form-status {
  position: absolute;
  top: 100%;
  width: 100%;
  margin: 1cqw 0 0;
  font-size: 2.8cqw;
  text-align: center;
}

.sound-button {
  position: absolute;
  top: 3%;
  right: 4%;
  width: 12%;
  min-width: 44px;
  max-width: 56px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease;
}

.sound-button img {
  display: block;
  width: 72%;
  height: auto;
  margin: auto;
  user-select: none;
}

/* Both supplied PNGs currently contain the same speaker artwork. */
.sound-button::after {
  content: "";
  position: absolute;
  top: 15.5%;
  left: 48%;
  width: 3px;
  height: 69%;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--scene-top);
  transform: rotate(45deg) scaleY(0);
  transition: transform 180ms ease;
}

.sound-button[aria-pressed="true"]::after { transform: rotate(45deg) scaleY(1); }
.sound-button:active { transform: scale(0.92); }
.sound-button:focus-visible { outline: 3px solid #fff4c9; outline-offset: 4px; }
.result-sound-button { z-index: 2; top: 4.65%; }
.home-sound-button { z-index: 1; top: 6.8%; right: 20%; translate: 0 -50%; }

.homepage {
  z-index: 1;
  /* Cover fractional-pixel edges so the orange layer cannot show through. */
  inset: -1px;
  --scene-bottom: var(--homepage-bottom);
  background: linear-gradient(to bottom, var(--home-edge-top, #d02026) 0 50%, var(--home-edge-bottom, #ffc93f) 50% 100%);
  transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  transition: transform var(--slide-duration) var(--slide-easing);
}

.homepage-media { position: absolute; inset: 0; }

.experience.is-revealing .homepage {
  transform: translate3d(0, calc(-50% - 50vh - 2px), 0);
  transform: translate3d(0, calc(-50% - 50dvh - 2px), 0);
  pointer-events: none;
}

.experience[data-scene="submission"] .homepage,
.experience[data-scene="loading"] .homepage,
.experience[data-scene="reward"] .homepage {
  visibility: hidden;
}

.cta-position {
  position: absolute;
  inset-inline: 0;
  bottom: max(7.2%, env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
}

.cta-entrance {
  width: 40%;
  opacity: 0;
  transform: translate3d(0, 38px, 0) scale(0.88);
}

.experience.is-ready .cta-entrance {
  animation: button-pop-in 880ms cubic-bezier(0.22, 1, 0.36, 1) 220ms both;
}

.calculate-button {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 220ms ease, filter 220ms ease;
}

.calculate-button img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

@media (hover: hover) {
  .calculate-button:hover:enabled {
    transform: translateY(-3px) scale(1.025);
    filter: drop-shadow(0 5px 8px rgb(95 23 0 / 22%));
  }
}

.calculate-button:active:enabled { transform: translateY(1px) scale(0.97); }
.calculate-button:focus-visible { outline: 3px solid #fff4c9; outline-offset: 6px; }
.calculate-button:disabled { cursor: default; }

.playback-message {
  position: absolute;
  z-index: 2;
  inset-inline: 8%;
  bottom: 2%;
  margin: 0;
  color: #fff3ce;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes button-pop-in {
  0% { opacity: 0; transform: translate3d(0, 38px, 0) scale(0.88); }
  62% { opacity: 1; transform: translate3d(0, -5px, 0) scale(1.025); }
  82% { opacity: 1; transform: translate3d(0, 2px, 0) scale(0.995); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* A phone's artwork stays full width even when Safari's toolbars reduce its height. */
@media (min-width: 768px) {
  /* Let flying coins fade out at the square movie's sides on wide screens. */
  .coupon-media, .coupon-stage > canvas {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 3.5%, #000 96.5%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 3.5%, #000 96.5%, transparent);
  }
  html { overflow-x: hidden; overflow-y: auto; }
  body { display: flex; flex-direction: column; align-items: center; overflow: visible; }
  .experience {
    flex: 0 0 auto;
    margin-block: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    clip-path: inset(0);
  }
  .submission-media { inset: 0; aspect-ratio: auto; transform: none; }
  .experience.is-revealing .homepage { transform: translate3d(0, calc(-100% - 2px), 0); }
  .homepage .brand-link, .submission-media > .brand-link, .reward > .brand-link { top: 4%; left: 3.5%; width: 8%; max-width: none; }
  .homepage .cta-position { z-index: 1; inset-inline: auto; top: 60.7%; left: 43.5%; right: auto; bottom: auto; width: 13%; }
  .homepage .cta-entrance { width: 100%; }
  .homepage .calculate-button { min-height: 0; }
  .experience.is-ready .homepage .cta-entrance { animation-name: desktop-button-pop-in; }

  /* Align the same form controls to the horizontal master's cream panel. */
  .submission-form { top: 31%; left: 35%; width: 30%; font-size: 1.3cqw; }
  .form-field + .form-field { margin-top: 2.2cqw; }
  .gender-field + .form-field { margin-top: 1.6cqw; }
  .form-field > label, .form-field > legend { margin-bottom: 0.6cqw; padding-left: 0.2cqw; }
  .form-field > input { height: 3.7cqw; padding-inline: 1.6cqw; border-width: max(1px, 0.15cqw); border-radius: 0.7cqw; font-size: max(16px, 1.3cqw); }
  .form-field > input::placeholder { font-size: 1.3cqw; }
  .form-field > input:focus { box-shadow: 0 0 0 0.2cqw rgb(255 177 63 / 18%); }
  .gender-options { gap: 0.8cqw; padding-inline: 0.3cqw; }
  .gender-option span { height: 3.7cqw; border-radius: 0.6cqw; }
  .gender-option input:checked + span { box-shadow: 0 0.25cqw 0 #bb5245; }
  .unlock-button { width: 60%; margin-top: 2.2cqw; }
  .field-error { top: calc(100% + 0.2cqw); left: 0.2cqw; font-size: 1cqw; }
  .form-status { margin-top: 0.5cqw; font-size: 1.1cqw; }
  .sound-button { top: 4%; right: 3.5%; width: 4%; }
  .home-sound-button { top: 10.5%; right: 10%; }

  /* Match the horizontal reference: centered score/copy, four cards in a row. */
  .reward { background-image: url("./media/scenes/reward-desktop-poster.webp"); background-size: 100% 100%; background-repeat: no-repeat; }
  .result-character { left: 41%; bottom: 58.2%; width: 18%; }
  .result-cloud-art { left: 36%; bottom: 57%; width: 28%; }
  .result-identity { top: 41.85%; left: 39%; width: 22%; height: 7.5%; font-size: 1.5cqw; text-shadow: none; }
  .result-summary { top: 49.5%; left: 25.5%; width: 49%; }
  .result-score { width: 49%; margin-inline: auto; }
  .result-copy { max-width: 96%; margin-top: 0.4cqw; font-size: 0.95cqw; }
  .result-fortune { top: 74%; left: 25.5%; width: 49%; }
  .result-ratings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1cqw; font-size: 1.2cqw; }
  .result-rating { aspect-ratio: 2.6; gap: 0.2cqw; padding: 0.5cqw; border-width: 0.18cqw; border-radius: 0.7cqw; }
  .result-actions { top: 82.2%; left: 27.5%; width: 45%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-items: center; gap: 0.15cqw 0.8cqw; }
  .result-action-coupon, .result-action-row > .result-action { width: 78%; }
  .result-action-row { display: contents; }
  .result-action-retry { grid-column: 1 / -1; justify-self: center; width: 13.333333%; margin-top: 0.7cqw; }

  @keyframes desktop-button-pop-in {
    0% { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.88); }
    62% { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.025); }
    82% { opacity: 1; transform: translate3d(0, 1px, 0) scale(0.995); }
    100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  }
}

@media (max-width: 767px) {
  html { overflow-x: hidden; overflow-y: auto; }

  body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
  }

  .experience {
    flex: 0 0 auto;
    width: 100%;
    margin-block: auto;
    clip-path: inset(min(0px, calc(50% - 50vh)) 0);
    clip-path: inset(min(0px, calc(50% - 50dvh)) 0);
  }

  .scene-video { object-fit: cover; }

  /* The curtain includes both full-screen color extensions; the art stays 9:16. */
  .homepage {
    inset-inline: 0;
    top: min(-1px, calc(50% - 50vh));
    bottom: min(-1px, calc(50% - 50vh));
    top: min(-1px, calc(50% - 50dvh));
    bottom: min(-1px, calc(50% - 50dvh));
  }
  .homepage-media { inset-block: auto; top: 50%; aspect-ratio: 9 / 16; transform: translateY(-50%); }

  /* Only the form uses the longer V4 artwork; keep every other scene at 9:16. */
  .experience[data-scene="revealing"],
  .experience[data-scene="submission"] {
    aspect-ratio: 9 / 20;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Freeze the departing home at its original size while the form grows below. */
  .experience[data-scene="revealing"] .homepage {
    top: var(--home-exit-top, -1px);
    bottom: auto;
    height: var(--home-exit-height);
  }

  .experience.is-revealing .homepage {
    transform: translate3d(0, calc(-100% - max(0px, var(--home-exit-top, 0px)) - 2px), 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --slide-duration: 1ms; }
  .experience.is-ready .cta-entrance { animation-duration: 1ms; animation-delay: 0ms; }
  .calculate-button, .sound-button, .sound-button::after,
  .form-field > input, .gender-option span, .unlock-button { transition: none; }
}
