/* Compatibility and legibility fixes; the puzzle, artwork and reveal motion stay unchanged. */
:root {
  color-scheme: only light;
  --viewport-height: 100vh;
}

@supports (height: 100dvh) {
  :root { --viewport-height: 100dvh; }
}

/* Older Android WebViews ignore dvh. A measured pixel value can override this variable. */
.experience {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: var(--viewport-height, 100vh);
  max-height: 100vh;
  max-height: var(--viewport-height, 100vh);
}

#experience-content {
  min-height: 100%;
}

#experience-content > .recipient-stage {
  min-height: 100vh;
  min-height: var(--viewport-height, 100vh);
}

/* This adjacent selector also works in WebViews that do not support :has(). */
#experience-content > .experience-topbar + .recipient-stage {
  min-height: calc(100vh - 44px);
  min-height: calc(var(--viewport-height, 100vh) - 44px);
}

body[data-stage="cover"],
body[data-stage="puzzle"],
body[data-stage="reveal"],
body[data-stage="final"] {
  overflow: hidden;
}

.puzzle-scene {
  width: 100%;
  max-width: 600px;
  width: min(600px, calc(68vh * var(--image-aspect, 1.333333)), calc(100vw - 52px));
  width: min(600px, calc(var(--viewport-height, 100vh) * .68 * var(--image-aspect, 1.333333)), calc(100vw - 52px));
}

/* Keep the existing transparent card and warm palette, with readable text on every pastel. */
.reveal-title h1 {
  color: #49362e;
}

.final-message {
  color: #49362e;
  font-size: 17px;
  line-height: 2;
}

.final-sender {
  color: #49362e;
  font-size: 18px;
  line-height: 1.9;
}

.final-tools .text-button,
.final-tools .final-motion {
  color: #584438;
  font-size: 12px;
}

@media (max-width: 720px) {
  .reveal-title h1 {
    font-size: 24px;
    line-height: 1.65;
  }
}
