/* ══════════════════════════════════════
   CINEMATIC ENGINE CSS
   Full-screen immersive visual novel UI
   ══════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ══════════════════════════
   GATE (countdown/passcode)
   ══════════════════════════ */
.cinema-gate {
  align-items: center;
  background: linear-gradient(180deg, #050711 0%, #0a0e1a 40%, #0d1225 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.lock-sky {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.lock-moon {
  background: radial-gradient(circle, rgba(255,248,220,0.95) 0%, rgba(255,248,220,0.4) 40%, transparent 70%);
  border-radius: 50%;
  height: 80px;
  left: 65%;
  position: absolute;
  top: 12%;
  width: 80px;
}

.lock-peak {
  background: linear-gradient(180deg, #1a2040 0%, #0d1225 100%);
  bottom: 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  position: absolute;
}
.lock-peak-a { height: 45%; left: -10%; width: 60%; }
.lock-peak-b { height: 55%; right: -5%; width: 50%; }

.lock-gate {
  background: linear-gradient(0deg, rgba(5,7,17,0.9), transparent);
  bottom: 0;
  height: 40%;
  position: absolute;
  width: 100%;
}

.lock-copy {
  position: relative;
  text-align: center;
  z-index: 2;
  padding: 20px;
}

.scene-kicker {
  color: rgba(255,248,220,0.5);
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  font-style: italic;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.lock-copy h1 {
  color: rgba(255,248,220,0.9);
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 400;
  line-height: 1.4;
  margin: 12px 0 20px;
}

#gate-message {
  color: rgba(255,248,220,0.6);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.permit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.permit-form label {
  color: rgba(255,248,220,0.4);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.permit-form div {
  display: flex;
  gap: 8px;
}

.permit-form input {
  background: rgba(255,248,220,0.08);
  border: 1px solid rgba(255,248,220,0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  padding: 10px 16px;
  text-align: center;
  width: 120px;
}

.permit-form button {
  background: rgba(255,248,220,0.12);
  border: 1px solid rgba(255,248,220,0.25);
  border-radius: 8px;
  color: rgba(255,248,220,0.9);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 10px 20px;
  transition: all 0.3s;
}
.permit-form button:hover {
  background: rgba(255,248,220,0.2);
}

/* ══════════════════════════
   CINEMA SHELL
   ══════════════════════════ */
.cinema-shell {
  height: 100vh;
  height: 100dvh;
  position: relative;
  width: 100vw;
  overflow: hidden;
  background: #000;
}

/* ── Progress Bar ── */
.cinema-progress {
  background: rgba(255,255,255,0.06);
  height: 3px;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 100;
}

.cinema-progress-fill {
  background: linear-gradient(90deg, rgba(255,200,100,0.6), rgba(255,220,150,0.8));
  height: 100%;
  transition: width 0.6s ease;
  width: 0%;
}

/* ── Stage ── */
.cinema-stage {
  height: 100%;
  position: relative;
  width: 100%;
}

/* ── Frame ── */
.cinema-frame {
  height: 100%;
  position: relative;
  width: 100%;
  animation: cinema-fade-in 0.4s ease both;
}

.cinema-fade-out {
  animation: cinema-fade-out 0.25s ease both !important;
}

.cinema-slide-out {
  animation: cinema-slide-out 0.4s ease both !important;
}

@keyframes cinema-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cinema-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes cinema-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-8%); }
}

/* ── Background Image ── */
.cinema-bg {
  height: 100%;
  object-fit: cover;
  object-position: center;
  position: absolute;
  width: 100%;
  inset: 0;
}

/* ── Vignette ── */
.cinema-vignette {
  background:
    radial-gradient(ellipse at 50% 50%, transparent 0%, transparent 50%, rgba(0,0,0,0.5) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.15) 0%, transparent 20%, transparent 65%, rgba(0,0,0,0.7) 100%);
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 5;
}

/* ══════════════════════════
   CINEMATIC SUBTITLES
   Movie-style dialogue at bottom
   ══════════════════════════ */
.cinema-subtitle {
  bottom: 0;
  left: 0;
  padding: clamp(20px, 5vh, 40px) clamp(16px, 4vw, 60px);
  position: absolute;
  right: 0;
  z-index: 20;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.cinema-subtitle.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cinema-speaker {
  color: rgba(255,200,120,0.9);
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.cinema-dialogue {
  color: rgba(255,255,255,0.95);
  font-family: 'Playfair Display', serif;
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 400;
  line-height: 1.5;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}

/* ══════════════════════════
   SWIPE HINT
   ══════════════════════════ */
.cinema-swipe-hint {
  align-items: center;
  animation: swipe-hint-pulse 2s ease-in-out infinite;
  bottom: clamp(20px, 5vh, 40px);
  display: flex;
  gap: 8px;
  position: absolute;
  right: clamp(16px, 4vw, 40px);
  z-index: 25;
}

.swipe-arrow {
  color: rgba(255,255,255,0.5);
  font-size: 1.4rem;
  animation: swipe-arrow-move 1.5s ease-in-out infinite;
}

.swipe-text {
  color: rgba(255,255,255,0.35);
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

@keyframes swipe-hint-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes swipe-arrow-move {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
}

/* ══════════════════════════
   DISCOVERY INTERACTIONS
   Fireflies, butterflies, flowers, lilies
   ══════════════════════════ */
.cinema-discover-layer {
  inset: 0;
  position: absolute;
  z-index: 15;
}

.cinema-discovery {
  background: transparent;
  border: none;
  cursor: pointer;
  height: 50px;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 50px;
  z-index: 16;
  padding: 0;
}

.cinema-discovery .discover-glow {
  animation: discover-pulse 2.5s ease-in-out infinite;
  border-radius: 50%;
  display: block;
  height: 100%;
  width: 100%;
}

/* Firefly */
.discover-firefly .discover-glow {
  background: radial-gradient(circle, rgba(255,220,100,0.7) 0%, rgba(255,200,80,0.3) 40%, transparent 70%);
  box-shadow: 0 0 20px rgba(255,200,80,0.5);
}

/* Butterfly */
.discover-butterfly .discover-glow {
  background: radial-gradient(circle, rgba(180,140,255,0.7) 0%, rgba(150,100,255,0.3) 40%, transparent 70%);
  box-shadow: 0 0 20px rgba(150,100,255,0.5);
}

/* Flower */
.discover-flower .discover-glow {
  background: radial-gradient(circle, rgba(100,220,255,0.7) 0%, rgba(80,200,255,0.3) 40%, transparent 70%);
  box-shadow: 0 0 20px rgba(80,200,255,0.5);
}

/* Lily */
.discover-lily .discover-glow {
  background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,240,220,0.3) 40%, transparent 70%);
  box-shadow: 0 0 25px rgba(255,240,220,0.6);
}

.cinema-discovery.is-found {
  pointer-events: none;
}

.cinema-discovery.is-found .discover-glow {
  animation: discover-burst 0.6s ease both;
}

@keyframes discover-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
}

@keyframes discover-burst {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(2.5); opacity: 0.8; }
  100% { transform: scale(3); opacity: 0; }
}

/* Discovery message */
.cinema-discover-message {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  bottom: clamp(20px, 6vh, 50px);
  left: 50%;
  max-width: 80vw;
  opacity: 0;
  padding: 16px 24px;
  position: absolute;
  transform: translate(-50%, 10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  z-index: 30;
}

.cinema-discover-message.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cinema-discover-message p {
  color: rgba(255,248,220,0.95);
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.95rem, 2.5vw, 1.3rem);
  font-style: italic;
  line-height: 1.5;
  text-align: center;
}

/* ══════════════════════════
   TAP TARGET
   Subtle pulsing glow for specific taps
   ══════════════════════════ */
.cinema-tap-target {
  background: transparent;
  border: none;
  cursor: pointer;
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 16;
  padding: 0;
}

.tap-target-pulse {
  animation: tap-target-glow 2s ease-in-out infinite;
  border: 2px solid rgba(255,220,150,0.3);
  border-radius: 50%;
  display: block;
  height: 100%;
  width: 100%;
}

@keyframes tap-target-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255,200,100,0.2), inset 0 0 10px rgba(255,200,100,0.1);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255,200,100,0.4), inset 0 0 20px rgba(255,200,100,0.2);
    transform: scale(1.1);
  }
}

/* ══════════════════════════
   REFLECT (Lake Message)
   ══════════════════════════ */
.cinema-reflect-target {
  background: transparent;
  border: none;
  bottom: 20%;
  cursor: pointer;
  height: 40%;
  left: 15%;
  position: absolute;
  width: 70%;
  z-index: 16;
  padding: 0;
}

.reflect-pulse {
  animation: reflect-shimmer 3s ease-in-out infinite;
  border-radius: 50%;
  display: block;
  height: 100%;
  width: 100%;
}

@keyframes reflect-shimmer {
  0%, 100% { box-shadow: 0 0 20px rgba(200,220,255,0.1); }
  50% { box-shadow: 0 0 40px rgba(200,220,255,0.25); }
}

.cinema-reflect-message {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translateY(10px);
  transition: opacity 1.5s ease, transform 1.5s ease;
  z-index: 25;
}

.cinema-reflect-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cinema-reflect-message p {
  color: rgba(255,248,240,0.95);
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-style: italic;
  font-weight: 400;
  text-align: center;
  text-shadow:
    0 0 30px rgba(200,220,255,0.5),
    0 0 60px rgba(200,220,255,0.3),
    0 2px 10px rgba(0,0,0,0.8);
}

/* ══════════════════════════
   LETTER
   ══════════════════════════ */
.cinema-letter-overlay {
  align-items: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  inset: 0;
  justify-content: center;
  position: absolute;
  z-index: 30;
}

.cinema-letter {
  background: rgba(20,15,10,0.9);
  border: 1px solid rgba(255,240,200,0.15);
  border-radius: 12px;
  max-height: 80vh;
  max-width: 90vw;
  overflow-y: auto;
  padding: clamp(24px, 5vw, 48px);
  width: 520px;
}

.letter-content {
  color: rgba(255,248,232,0.9);
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  line-height: 1.8;
}

/* ══════════════════════════
   SCREEN SHAKE
   ══════════════════════════ */
.cinema-shake {
  animation: screen-shake 0.5s ease-in-out;
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, 4px); }
  20% { transform: translate(6px, -6px); }
  30% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  50% { transform: translate(-2px, 4px); }
  60% { transform: translate(2px, -2px); }
  70% { transform: translate(-1px, 1px); }
}

/* ══════════════════════════
   RESET BUTTON
   ══════════════════════════ */
.cinema-reset {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  bottom: 12px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 0.7rem;
  left: 12px;
  padding: 6px 12px;
  position: absolute;
  z-index: 50;
}

/* ══════════════════════════
   MOBILE REFINEMENTS
   ══════════════════════════ */
@media (max-width: 600px) {
  .cinema-discovery {
    height: 60px;
    width: 60px;
  }

  .cinema-dialogue {
    font-size: 1rem;
  }
}

@media (min-width: 1200px) {
  .cinema-bg {
    object-fit: contain;
    background: #000;
  }
}

/* ══════════════════════════
   REDUCED MOTION
   ══════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cinema-frame { animation: none; }
  .cinema-discovery .discover-glow { animation: none; }
  .tap-target-pulse { animation: none; }
  .swipe-arrow { animation: none; }
  .cinema-swipe-hint { animation: none; }
}
