/* Intro / gate — full-screen tactical map (map-grid / terrain / scan).
   No radar (no concentric rings, sweep wedge, spokes). No runners.
   Motion: transform + opacity only (no left/top animation). */

.boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #050505;
  pointer-events: none;
}

.boot.is-done {
  display: none !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.boot.is-miss-end {
  display: block;
  visibility: visible;
  opacity: 1;
  background: #050505;
}

/* —— Full-viewport tactical map —— */
.tactical {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.45s ease, transform 0.8s ease;
}

.tactical.is-on {
  opacity: 1;
  transform: none;
}

.tactical.is-fly {
  transform: translateY(-118%) rotate(-4deg) scale(1.08);
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.55, 0.05, 0.75, 0.2), opacity 0.55s ease 0.15s;
}

/* is-fade removed from miss path — it made the miss map look different from win */

.map {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(40, 48, 40, 0.35), transparent 55%),
    linear-gradient(180deg, #070807 0%, #050505 100%);
}

.map-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(244, 244, 241, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 244, 241, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, #000 35%, transparent 78%);
}

.map-terrain {
  position: absolute;
  inset: 8% 4%;
  background:
    radial-gradient(ellipse 55% 30% at 28% 62%, rgba(120, 140, 110, 0.12), transparent 70%),
    radial-gradient(ellipse 40% 25% at 72% 38%, rgba(90, 110, 95, 0.1), transparent 70%),
    repeating-linear-gradient(
      -18deg,
      transparent 0 18px,
      rgba(244, 244, 241, 0.035) 18px 19px
    );
  opacity: 0.9;
}

.map-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 28%;
  top: -30%;
  background: linear-gradient(180deg, transparent, rgba(244, 244, 241, 0.05), transparent);
  transform: translate3d(0, 0, 0);
  /* Start only when tactical is visible — Safari often freezes anims under opacity:0 parents */
  animation: none;
  will-change: transform;
  pointer-events: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tactical.is-on .map-scan {
  animation: map-scan-y 2.4s linear infinite;
}

@keyframes map-scan-y {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, 420%, 0); }
}

/* Stop continuous scan once map leaves / miss title is up */
.tactical.is-fly .map-scan,
.boot.is-miss-end .map-scan {
  animation: none;
  opacity: 0;
  will-change: auto;
}

.tactical.is-fly .target .pulse,
.boot.is-miss-end .target .pulse {
  animation: none;
}

/* Target marker */
.target {
  position: absolute;
  left: 58%;
  top: 44%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  opacity: 0;
  transform: scale(0.4);
  z-index: 2;
}

.target.is-on {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.target::before,
.target::after {
  content: "";
  position: absolute;
  background: #f4f4f1;
}

.target::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
}

.target::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%);
}

.target .pulse {
  position: absolute;
  inset: -12px;
  border: 1.5px solid rgba(244, 244, 241, 0.75);
  border-radius: 50%;
  animation: target-pulse 1.1s ease-out infinite;
}

@keyframes target-pulse {
  from { transform: scale(0.55); opacity: 0.95; }
  to { transform: scale(1.7); opacity: 0; }
}

/* Crosshair — continuous translate3d sweep (vw/vh). % of self was the top-left bug. */
.crosshair {
  position: absolute;
  left: 0;
  top: 0;
  width: 78px;
  height: 78px;
  transform: translate3d(14vw, 78vh, 0) translate(-50%, -50%);
  opacity: 0;
  z-index: 3;
  will-change: transform, opacity;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.crosshair.is-on {
  opacity: 1;
}

/* Win: CSS stops 1–3 (2.5s), stop 3 FAR from marker; JS glides stop 4 onto #target (~750ms) */
.crosshair.is-search-win {
  animation: ch-search-win 2.5s cubic-bezier(0.45, 0.05, 0.25, 1) forwards;
}

/* Miss: 4 stops, 5s, 4th away from marker */
.crosshair.is-search-miss {
  animation: ch-search-miss 5s cubic-bezier(0.45, 0.05, 0.25, 1) forwards;
}

.crosshair.is-locked {
  animation: none;
  /* transform set in JS from #target rect */
}

.crosshair.is-locked .ch-ring {
  border-color: rgba(244, 244, 241, 0.95);
  transform: scale(0.92);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.crosshair.is-missed .ch {
  border-color: #e23a3a;
}

.crosshair.is-missed .ch-dot {
  background: #e23a3a;
}

.crosshair.is-missed .ch-ring {
  border-color: rgba(226, 58, 58, 0.95);
  transform: scale(1.06);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

/*
  Win CSS = stops 1–3 only. Stop 3 is far from marker (~58vw/44vh)
  so the JS lock leg is a long visible glide, not a snap.
*/
@keyframes ch-search-win {
  0%   { transform: translate3d(14vw, 78vh, 0) translate(-50%, -50%); }
  50%  { transform: translate3d(82vw, 18vh, 0) translate(-50%, -50%); }
  100% { transform: translate3d(12vw, 22vh, 0) translate(-50%, -50%); }
}

@keyframes ch-search-miss {
  0%   { transform: translate3d(14vw, 78vh, 0) translate(-50%, -50%); }
  33%  { transform: translate3d(82vw, 18vh, 0) translate(-50%, -50%); }
  66%  { transform: translate3d(18vw, 36vh, 0) translate(-50%, -50%); }
  100% { transform: translate3d(82vw, 68vh, 0) translate(-50%, -50%); }
}

.ch {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--aim, rgba(244, 244, 241, 0.95));
  border-style: solid;
  transition: border-color 0.25s ease;
}

.ch-tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.ch-tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.ch-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.ch-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.ch-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  background: var(--aim, rgba(244, 244, 241, 0.95));
  border-radius: 50%;
  transition: background 0.25s ease;
}

.ch-ring {
  position: absolute;
  inset: 11px;
  border: 1.5px solid rgba(244, 244, 241, 0.45);
  border-radius: 50%;
}

/*
  Title at TRUE viewport center. Prize ~20px under title.
  Never use h1 rect for this beat.
*/
.boot-copy {
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.boot-copy.is-show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease;
}

/* Keep title + prize as a centered pair with ~20px gap, no overlap */
.boot-copy.is-show .boot-title {
  /* already absolute at 50%/50% */
}

.boot-copy.is-show .boot-lead {
  /* sits under title via top calc + 20px gap in .boot-lead */
}

.boot-copy.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.boot-title {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  width: min(92vw, 520px);
  font-size: clamp(42px, 13vw, 68px);
  line-height: 0.9;
  font-weight: 600;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-align: center;
  color: #f4f4f1;
  opacity: 0;
  transform: translate3d(-50%, -46%, 0) scale(0.94);
  will-change: transform, opacity;
}

.boot-title.is-show {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1);
  transition: opacity 0.6s ease-out, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Flight clone: opacity + transform only (no left/top/font-size) */
.boot-title-fly {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  width: min(92vw, 520px);
  font-size: clamp(42px, 13vw, 68px);
  line-height: 0.9;
  font-weight: 600;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-align: center;
  color: #f4f4f1;
  z-index: 42;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0) translate(-50%, -50%) scale(1);
  will-change: transform, opacity;
  transition: transform 0.8s cubic-bezier(0.22, 0.85, 0.25, 1),
              opacity 0.35s ease 0.45s;
}

.boot-title-fly.is-on { opacity: 1; }
.boot-title-fly.is-gone { opacity: 0; }

.boot-lead {
  position: absolute;
  left: 50%;
  top: calc(50% + 0.95 * clamp(42px, 13vw, 68px) + 20px);
  margin: 0;
  width: min(92vw, 28em);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
  color: #d7d7d1;
  opacity: 0;
  transform: translate3d(-50%, 12px, 0);
  will-change: transform, opacity;
}

.boot-lead.is-show {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
  transition: opacity 0.6s ease-out, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hidden until finishBootMiss — also use [hidden] in HTML */
.miss-title {
  position: fixed;
  left: 50%;
  top: 50%;
  margin: 0;
  width: min(92vw, 420px);
  text-align: center;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: #e23a3a;
  opacity: 0;
  visibility: hidden;
  z-index: 42;
  pointer-events: none;
  transform: translate3d(-50%, calc(-50% + 16px), 0) scale(0.96);
  will-change: transform, opacity;
}

.miss-title.is-show {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, -50%, 0) scale(1);
  transition: opacity 0.55s ease-out, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.miss-title[hidden] {
  display: none !important;
}

/* Hide page chrome while map / centered title play */
body.is-opening .top,
body.is-opening .intro,
body.is-opening .cta {
  opacity: 0;
  pointer-events: none;
}

body.is-opening .page {
  padding-top: max(8vh, 24px);
}

@media (min-width: 900px) {
  .boot-title,
  .boot-title-fly { font-size: 72px; width: min(92vw, 880px); }
  .boot-lead { top: calc(50% + 0.95 * 72px + 22px); width: min(92vw, 34em); }
}

@media (prefers-reduced-motion: reduce) {
  /* Keep map scan + text eases — only drop heavy layout transitions on chrome */
  .tactical,
  .target {
    transition: none !important;
  }

  /* Do NOT kill .map-scan — phones with Reduce Motion were getting a static grid */
  .target .pulse { animation: none; border-color: rgba(244, 244, 241, 0.55); }
  .crosshair { transition: none !important; }
}
