:root {
  --brand-green: #00bf63;
  --ink: #0a0f0c;
  --page-bg: #ffffff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --art-w: 3240;
  --art-h: 5760;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page-bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

.page {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) 0 var(--safe-bottom);
  /* Prefer one screen; allow a light scroll on very short devices. */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scaled 9:16 frame locked to the art. Overlays use % of this box. */
.stage {
  position: relative;
  width: min(100vw, calc(100dvh * (var(--art-w) / var(--art-h))));
  max-width: 100vw;
  aspect-ratio: var(--art-w) / var(--art-h);
  max-height: 100dvh;
  max-height: 100svh;
  flex-shrink: 0;
  background: #fff;
}

.stage__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Middle white band of the art (measured ~12%–51% of 1080×1920). */
.stage__video-slot {
  position: absolute;
  left: 6%;
  width: 88%;
  top: 13.2%;
  height: 36.5%;
  border-radius: clamp(12px, 2.4vw, 22px);
  overflow: hidden;
  background: #0b1210;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.stage__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0b1210;
}

.stage__video[hidden],
.video-placeholder[hidden] {
  display: none !important;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(0, 191, 99, 0.22), rgba(10, 15, 12, 0.92));
  color: #fff;
}

.video-placeholder__title {
  margin: 0;
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 700;
}

.video-placeholder__body {
  margin: 0;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1.35;
  opacity: 0.82;
  max-width: 28ch;
}

.video-placeholder code {
  font-size: 0.92em;
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Bottom-left gap under the how-to steps (clear of “2. Share it”). */
.stage__cta {
  position: absolute;
  left: 4.5%;
  top: 87.8%;
  width: 52%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(4px, 1.1vw, 8px);
}

.cta-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(32px, 7.2vw, 40px);
  padding: 0.4em 0.75em;
  border-radius: 999px;
  background: var(--brand-green);
  color: #fff;
  font-weight: 800;
  font-size: clamp(12px, 3.2vw, 15px);
  letter-spacing: -0.01em;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 191, 99, 0.3);
  transition: transform 0.15s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.cta-primary:active {
  transform: scale(0.98);
  filter: brightness(0.96);
}

.store-badges {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(4px, 1.2vw, 8px);
  width: 100%;
}

.store-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  height: clamp(34px, 8.2vw, 42px);
  line-height: 0;
  overflow: visible;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.store-badge:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.store-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* Play badge PNG has extra transparent padding — scale up to match App Store. */
.store-badge--play {
  /* Give Play a touch more horizontal room so the scale doesn’t feel cramped. */
  flex: 1.08 1 0;
}

.store-badge--play img {
  transform: scale(1.36);
  transform-origin: center center;
}

/* Instagram / in-app browser escape sheet */
.inapp-escape-help {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(92vw, 360px);
  z-index: 40;
  background: #111;
  color: #fff;
  border-radius: 16px;
  padding: 14px 14px 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.inapp-escape-help[hidden] {
  display: none !important;
}

.inapp-escape-help__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.inapp-escape-help__body {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
}

.inapp-escape-help__copy {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--brand-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* Very short landscape / short height: allow stage to shrink and page to scroll lightly */
@media (max-height: 620px) {
  .page {
    align-items: flex-start;
  }

  .stage {
    max-height: none;
    width: min(100vw, 420px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .page {
    align-items: flex-start;
    padding: 8px 0;
  }

  .stage {
    width: min(100vw, calc(92dvh * (var(--art-w) / var(--art-h))));
    max-height: none;
  }
}
