:root {
  --landing-bg: linear-gradient(180deg, #1c1c1c 0%, #54081b 100%);
  --landing-text: #fff;
  --landing-card: #fff;
  --landing-card-text: #010101;
  --landing-no: #e2aba7;
  --landing-accent: #dc143c;
  --landing-radius: 6px;
  --landing-button-radius: 100px;
  --landing-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background: var(--landing-bg);
  color: var(--landing-text);
  font-family: var(--landing-font);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  overflow-x: hidden;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.landing-flow { min-height: 100vh; }

.landing-step {
  min-height: 100vh;
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.landing-step.is-active {
  display: flex;
  animation: landing-appearance .8s ease both;
}

.step-header {
  width: min(100%, 760px);
  padding: 40px 16px 0;
  text-align: center;
  position: relative;
  z-index: 2;
}

.step-header h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  line-height: 1.3;
  text-transform: uppercase;
}

.step-header p { margin: 16px auto 0; max-width: 680px; }

.step-header--question h1,
.step-header--choice h1 { font-size: 20px; line-height: 1.2; }

.step-header--choice { font-size: 16px; font-weight: 400; line-height: 1.15; }
.step-header--choice p { margin-top: 12px; font-style: italic; }

.media-advance {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.media-advance,
.media-gallery {
  height: calc(100vh - 340px);
  min-height: 250px;
  width: calc(100% - 32px);
  position: relative;
}

.media-advance .media-gallery { height: 100%; width: 100%; }

.media-gallery { display: grid; gap: 10px; overflow: hidden; border-radius: var(--landing-radius); }
.media-gallery--single { grid-template-columns: 1fr; }
.media-gallery--collage { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.media-gallery__item { min-height: 0; overflow: hidden; border-radius: var(--landing-radius); }
.media-gallery__image { display: block; width: 100%; height: 100%; object-fit: cover; }

.step-actions {
  width: calc(100% - 32px);
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 3;
}

.landing-button {
  appearance: none;
  min-height: 60px;
  width: 100%;
  max-width: 400px;
  border: 0;
  border-radius: var(--landing-button-radius);
  background: #fff;
  color: #2d161c;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  font-size: 24px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}

.landing-button:active:not(:disabled) { transform: scale(.98); }
.landing-button:focus-visible, .choice-card:focus-visible, .media-advance:focus-visible { outline: 3px solid #ffcfda; outline-offset: 3px; }
.landing-button:disabled { background: #a6a6a6; color: #fff; cursor: not-allowed; opacity: .82; }
.landing-button--no { border: 2px solid var(--landing-no); background: transparent; color: #fff; }
.landing-button--skip { margin-top: -16px; background: transparent; color: #bdbdbd; box-shadow: none; }

.landing-step--hero .step-actions .landing-button,
.landing-button--download { position: relative; padding-right: 64px; }
.landing-step--hero .step-actions .landing-button::after,
.landing-button--download::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  background: linear-gradient(145deg, #800000 15%, #dc143c 92%);
  color: #fff;
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
}

.question-media {
  appearance: none;
  border: 0;
  padding: 0;
  position: absolute;
  inset: 0 0 auto;
  height: calc(100vh - 304px);
  background: #fff;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 4px;
}

button.question-media { cursor: pointer; }

.question-media--count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.question-media--count-3,
.question-media--count-4,
.question-media--count-5,
.question-media--count-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.question-media__item { display: block; min-width: 0; min-height: 0; overflow: hidden; }
.question-media__image { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }

/*
 * The source template lets a single portrait keep its intrinsic ratio, then
 * clips the naturally over-tall image at the viewport edge.  Keeping this
 * separate from the collage rules avoids stretching the classic background
 * while preserving the backend's multi-media layout variant.
 */
.question-media--count-1 .question-media__item { position: absolute; inset: 0; }
.question-media--count-1 .question-media__image {
  width: 100%;
  height: auto;
  min-height: 100%;
  position: absolute;
  inset: 0 auto auto 0;
}

.question-panel {
  width: 100%;
  margin-top: auto;
  padding: 0;
  border-radius: 20px 20px 0 0;
  background: var(--landing-bg);
  box-shadow: 0 -30px 50px rgb(23 23 23 / 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
  position: relative;
  z-index: 2;
}

.question-panel .step-header { width: 100%; padding: 40px 16px 0; }
.question-panel .step-header p { font-size: 20px; line-height: 24px; }
.binary-options {
  width: calc(100% - 32px);
  padding: 0 16px 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.binary-options .landing-button { max-width: none; }

.choice-area {
  width: calc(100% - 32px);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.choice-options { width: 100%; min-height: 0; display: grid; gap: 10px 14px; }
.choice-area--image-grid .choice-options { height: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(112px, 1fr); }
.choice-area--image-grid.choice-count-5 .choice-card:nth-child(3) { grid-column: 1 / -1; width: calc(50% - 7px); justify-self: center; }

.choice-card {
  appearance: none;
  border: 0;
  border-radius: var(--landing-radius);
  background: var(--landing-card);
  color: var(--landing-card-text);
  padding: 0;
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgb(140 140 140 / 30%);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.choice-card__image { width: 100%; height: calc(100% - 36px); min-height: 0; object-fit: cover; display: block; }
.choice-card__label { padding: 6px 8px; font-size: 20px; line-height: 24px; text-align: center; }
.choice-card__outline { position: absolute; inset: 0; border: 0 solid var(--landing-accent); border-radius: var(--landing-radius); pointer-events: none; transition: border-width .2s ease; }
.choice-card.is-selected .choice-card__outline { border-width: 4px; }

.choice-area--text-list .choice-feature-media { width: 100%; flex: 1 1 auto; min-height: 100px; overflow: hidden; border-radius: var(--landing-radius); }
.choice-feature-media { appearance: none; border: 0; background: transparent; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
button.choice-feature-media { cursor: pointer; }
.choice-feature-media__image { width: 100%; height: 100%; min-width: 0; max-height: 35vh; object-fit: cover; display: block; border-radius: var(--landing-radius); }
.choice-area--text-list .choice-options { flex: 0 0 auto; grid-template-columns: 1fr; gap: 8px; }
.choice-area--text-list .choice-card { width: 100%; border: 1px solid #b3b3b3; box-shadow: none; }
.choice-area--text-list .choice-card__label { padding: 10px 16px; font-size: 18px; }

.download-background { position: absolute; inset: 0 0 auto; height: calc(100vh - 390px); }
.download-background__image { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.download-panel {
  width: calc(100% - 32px);
  margin-top: auto;
  padding: 32px 16px 24px;
  border-radius: 20px 20px 0 0;
  background: var(--landing-bg);
  box-shadow: 0 -30px 50px rgb(23 23 23 / 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  position: relative;
  z-index: 2;
}
.download-panel .step-header { padding: 0; }
.download-panel .step-header h1 { font-size: 24px; line-height: 1; }
.download-panel .step-header p { font-size: 18px; line-height: 22px; }

.browser-mask { position: fixed; inset: 0; z-index: 99999; display: grid; place-items: center; padding: 20px; }
.browser-mask__backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgb(0 0 0 / 75%); cursor: pointer; }
.browser-mask__panel { width: min(100%, 440px); border-radius: 18px; background: #fff; color: #2d161c; padding: 28px 20px 22px; position: relative; box-shadow: 0 22px 60px rgb(0 0 0 / 35%); }
.browser-mask__panel h2 { margin: 0 0 12px; font-size: 24px; }
.browser-mask__panel p { margin: 0; font-size: 16px; line-height: 1.6; }
.browser-mask__close { position: absolute; top: 6px; right: 10px; border: 0; background: transparent; color: #666; font-size: 32px; cursor: pointer; }
.browser-mask__divider { margin: 22px 0 14px; display: flex; align-items: center; gap: 10px; color: #999; font-size: 13px; }
.browser-mask__divider::before, .browser-mask__divider::after { content: ""; height: 1px; flex: 1; background: #ddd; }
.browser-mask__copy { display: flex; gap: 8px; }
.browser-mask__copy input { min-width: 0; flex: 1; height: 44px; border: 1px solid #ddd; border-radius: 8px; padding: 0 10px; color: #555; }
.browser-mask__copy button { flex: 0 0 auto; border: 0; border-radius: 8px; background: #54081b; color: #fff; padding: 0 16px; cursor: pointer; }

.download-message { min-height: 100vh; padding: 24px; display: grid; place-items: center; text-align: center; }
.download-message section { width: min(100%, 520px); }
.download-message h1 { font-size: 30px; margin: 0 0 16px; }
.download-message p { line-height: 1.6; margin: 0 0 32px; }

@keyframes landing-appearance {
  from { transform: scale(0); opacity: .25; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-height: 720px) {
  body { font-size: 17px; }
  .step-header { padding-top: 20px; }
  .step-header h1 { font-size: 22px; }
  .media-advance, .media-gallery { height: calc(100vh - 260px); }
  .question-panel { gap: 60px; }
  .question-panel .step-header { padding-top: 20px; }
  .choice-card__label { font-size: 16px; line-height: 18px; padding: 5px; }
  .choice-area--text-list .choice-card__label { padding: 6px 12px; font-size: 15px; }
  .step-actions { gap: 12px; padding-bottom: 14px; }
}

@media (min-width: 881px) {
  .landing-step { height: 100vh; flex-wrap: wrap; justify-content: space-around; gap: 0; }
  .step-header { order: 2; width: 45vw; max-width: 720px; padding-top: 0; }
  .media-advance, .media-gallery { order: 1; height: calc(100vh - 32px); width: calc(50vw - 32px); max-width: 50vw; margin: 16px; }
  .step-actions { order: 3; width: 45vw; max-width: 720px; padding-bottom: 32px; }

  .landing-step--binary { flex-wrap: wrap; align-items: center; }
  .question-media { width: 100%; height: 100vh; }
  .question-panel {
    width: 100%;
    max-width: 45vw;
    margin-top: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -30px 50px rgb(23 23 23 / 50%);
  }
  .question-panel .step-header { order: initial; }

  .landing-step--choice { display: none; flex-wrap: wrap; }
  .landing-step--choice.is-active { display: flex; }
  .landing-step--choice .step-header { order: 2; }
  .choice-area { order: 1; width: calc(50vw - 32px); height: calc(100vh - 40px); max-width: 720px; flex: 0 0 auto; margin: 20px 16px; justify-content: center; }
  .landing-step--choice .step-actions { order: 3; }
  .choice-area--text-list .choice-feature-media { max-height: 38vh; }
  .choice-area--text-list .choice-options { grid-template-columns: 1fr; }

  .landing-step--download { align-items: center; flex-wrap: wrap; }
  .download-background { width: 100%; height: 100vh; }
  .download-panel {
    width: calc(100% - 32px);
    max-width: 45vw;
    margin-top: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -30px 50px rgb(23 23 23 / 50%);
  }
  .download-panel .step-header { order: initial; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .landing-step.is-active { animation-duration: .01ms; }
  .landing-button, .choice-card__outline { transition: none; }
}
