/* ==========================================================================
   Grand Finale: Pure-Black Cinema Fade -> Landscape Detection -> Seamless Video
   Handles BOTH:
     1. Auto-rotate ON  (native landscape viewport: w > h)
     2. Auto-rotate OFF (locked portrait viewport: CSS full-screen ±90deg rotation)
   ========================================================================== */

.scene--video {
  position: fixed;
  inset: 0;
  z-index: 94;
  background-color: #000000;
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: opacity;
}

.scene--video.is-active {
  visibility: visible;
  pointer-events: auto;
}

/* Video wrapper: native full-screen by default, or exact swapped-axis full-screen when locked portrait */
.video-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  background-color: #000000;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Locked-portrait phone turned counter-clockwise (top on LEFT) -> rotate video +90deg CW */
.video-stage.is-rotated-cw {
  width: var(--app-h);
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Locked-portrait phone turned clockwise (top on RIGHT) -> rotate video -90deg CCW */
.video-stage.is-rotated-ccw {
  width: var(--app-h);
  height: 100vw;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.finale-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background-color: #000000;
  display: block;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.finale-video.is-ready {
  opacity: 1;
}

/* Elegant minimalist "Please rotate phone" prompt over pure #000000 */
.video-rotate-prompt {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: rgba(248, 240, 226, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.55s ease;
}

.video-rotate-prompt.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.rotate-phone-glyph {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

.rotate-phone-body {
  width: 30px;
  height: 52px;
  border-radius: 6px;
  border: 1.8px solid rgba(246, 232, 206, 0.85);
  box-shadow: 0 0 18px rgba(244, 224, 188, 0.18);
  position: relative;
  animation: rotatePhoneHint 2.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.rotate-phone-notch {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: rgba(246, 232, 206, 0.7);
}

@keyframes rotatePhoneHint {
  0%, 16% {
    transform: rotate(0deg);
  }
  48%, 74% {
    transform: rotate(-90deg);
  }
  92%, 100% {
    transform: rotate(0deg);
  }
}

.rotate-prompt-title {
  margin: 0;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  color: #FAF3E6;
}

.rotate-prompt-sub {
  margin: 10px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: rgba(226, 218, 204, 0.62);
}

.rotate-prompt-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rotate-btn {
  min-height: 44px;
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  transition: transform 0.22s ease, opacity 0.22s ease, background-color 0.22s ease;
}

.rotate-btn:active {
  transform: scale(0.96);
}

.rotate-btn--primary {
  color: #FAF2E4;
  background: rgba(248, 232, 204, 0.14);
  border: 1px solid rgba(244, 224, 190, 0.45);
}

.rotate-btn--ghost {
  font-size: 12px;
  color: rgba(214, 208, 198, 0.56);
  padding: 8px 18px;
}

/* Subtle direction flip helper shown only when paused in CSS-rotated landscape mode */
.video-flip-btn {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  z-index: 8;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(248, 240, 226, 0.86);
  background: rgba(255, 250, 240, 0.14);
  border: 1px solid rgba(244, 228, 200, 0.36);
}

/* Fallback subtle tap-to-play prompt (only shown if a strict browser blocks unmuted autoplay) */
.video-play-fallback {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 6;
  width: 132px;
  height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(248, 240, 226, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.video-play-fallback.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.video-play-fallback__ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 250, 240, 0.1);
  border: 1px solid rgba(244, 228, 200, 0.45);
  box-shadow: 0 0 24px rgba(244, 228, 200, 0.18);
}

.video-play-fallback__icon {
  width: 22px;
  height: 22px;
  margin-left: 3px;
}

.video-play-fallback__label {
  font-size: 13px;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
}
