* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', monospace;
  color: #d7e3f4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The hero image is sized + translated by JS so the character's face center
   (image-space (721, 413) on a 1536x1024 canvas) lands at exact viewport center.
   cover-scale math lives in overlays.js so it stays in lockstep with eye placement. */
.hero-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  z-index: 1;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
  z-index: 2;
}

.eye-glow {
  position: absolute;
  width: clamp(38px, 5.5vmin, 72px);
  height: clamp(16px, 2.3vmin, 30px);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 120, 120, 0.55) 0%, rgba(255, 80, 80, 0.22) 40%, transparent 75%);
  filter: blur(clamp(4px, 0.7vmin, 8px));
  z-index: 3;
  animation: eyePulse 3.2s ease-in-out infinite;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@keyframes eyePulse {
  0%, 100% { opacity: 0.55; filter: blur(6px) brightness(1); }
  50%      { opacity: 0.9;  filter: blur(5px) brightness(1.3); }
}

.pixel-heart {
  position: absolute;
  width: clamp(12px, 1.8vmin, 22px);
  height: clamp(12px, 1.8vmin, 22px);
  z-index: 5;
  opacity: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(255, 40, 60, 0.9));
  transform-origin: center center;
}

.pixel-heart.w1 { animation: heartCycle 3.2s cubic-bezier(0.4, 0, 0.6, 1) 0.4s infinite; }
.pixel-heart.w2 { animation: heartCycle 3.2s cubic-bezier(0.4, 0, 0.6, 1) 1.2s infinite; }
.pixel-heart.w3 { animation: heartCycle 3.2s cubic-bezier(0.4, 0, 0.6, 1) 2.0s infinite; }

@keyframes heartCycle {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.15); filter: brightness(2.2) drop-shadow(0 0 10px rgba(255, 40, 60, 1)); }
  12%  { opacity: 1;   transform: translate(-50%, -50%) scale(0.7);  filter: brightness(1.9) drop-shadow(0 0 12px rgba(255, 50, 70, 1)); }
  40%  { opacity: 1;   transform: translate(-50%, -50%) scale(2.4);  filter: brightness(1.4) drop-shadow(0 0 16px rgba(255, 60, 80, 0.85)); }
  55%  { opacity: 1;   transform: translate(-50%, -50%) scale(2.4);  filter: brightness(1.4) drop-shadow(0 0 16px rgba(255, 60, 80, 0.85)); }
  85%  { opacity: 0.9; transform: translate(-50%, -50%) scale(0.6);  filter: brightness(1.7) drop-shadow(0 0 10px rgba(255, 40, 60, 0.9)); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(0.15); filter: brightness(2.2) drop-shadow(0 0 8px rgba(255, 40, 60, 0.8)); }
}

.ripple {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  z-index: 4;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(180, 210, 255, 0.04) 0px,
      rgba(180, 210, 255, 0.04) 1px,
      transparent 2px,
      transparent 7px
    );
  mix-blend-mode: screen;
  opacity: 0.6;
  animation: rippleShift 8s linear infinite;
}

@keyframes rippleShift {
  0%   { background-position-y: 0px; }
  100% { background-position-y: 14px; }
}

.frame {
  position: absolute;
  inset: clamp(14px, 2.5vmin, 28px);
  border: 1px solid rgba(137, 168, 214, 0.22);
  z-index: 10;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}

.cta-row {
  position: absolute;
  left: 50%;
  bottom: clamp(60px, 10vh, 120px);
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(420px, 82vw);
  opacity: 0;
  animation: ctaAppear 1.2s cubic-bezier(0.22, 1, 0.36, 1) 3.6s forwards;
}

.cta {
  display: grid;
  place-items: center;
  height: clamp(52px, 8vh, 72px);
  border: 1px solid rgba(170, 205, 245, 0.35);
  background: linear-gradient(180deg, rgba(20, 32, 52, 0.58), rgba(6, 12, 22, 0.78));
  color: rgba(235, 244, 255, 0.96);
  text-decoration: none;
  font-size: clamp(16px, 2.2vmin, 22px);
  font-weight: 700;
  letter-spacing: 0.3em;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(210, 225, 255, 0.05),
    0 0 30px rgba(160, 195, 240, 0.1);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  font-family: 'Courier New', monospace;
  padding-left: 0.3em;
  -webkit-tap-highlight-color: transparent;
}

.cta:hover {
  background: linear-gradient(180deg, rgba(36, 56, 88, 0.72), rgba(12, 22, 38, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(210, 225, 255, 0.12),
    0 0 50px rgba(170, 210, 255, 0.28);
  transform: scale(1.02);
}

.cta:active { transform: scale(0.98); }

.cta-deep {
  height: clamp(44px, 6.5vh, 58px);
  font-size: clamp(13px, 1.9vmin, 18px);
  letter-spacing: 0.42em;
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.68), rgba(4, 8, 14, 0.82));
  border-color: rgba(170, 205, 245, 0.22);
  color: rgba(200, 220, 250, 0.82);
}

.cta-deep:hover {
  border-color: rgba(170, 210, 255, 0.55);
  color: rgba(235, 244, 255, 0.96);
  background: linear-gradient(180deg, rgba(24, 42, 68, 0.85), rgba(8, 14, 26, 0.95));
}

@keyframes ctaAppear {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  60%  { opacity: 1; transform: translateX(-50%) translateY(-2px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (orientation: portrait), (max-width: 640px) {
  .cta-row { bottom: clamp(36px, 6vh, 80px); }
}

@media (max-height: 480px) {
  .cta-row { bottom: 18px; }
  .cta { height: 42px; font-size: 14px; }
  .cta-deep { height: 34px; font-size: 12px; }
  .frame { inset: 10px; }
}

@supports (padding: max(0px)) {
  .cta-row { bottom: max(clamp(60px, 10vh, 120px), env(safe-area-inset-bottom, 0px)); }
}

.debug-hint {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.15em;
  font-family: 'Courier New', monospace;
}

#debug-layer {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 99;
  pointer-events: none;
}

#debug-layer .dbg-eye {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border: 2px solid #00ff88;
  border-radius: 50%;
  box-shadow: 0 0 10px #00ff88;
}

#debug-layer .dbg-center {
  position: absolute;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  background: #ffaa00;
  border-radius: 50%;
  box-shadow: 0 0 10px #ffaa00;
}
