/*
  ❤️ Romantic 3D Universe — Full WebGL / Three.js ❤️
*/

@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Quicksand:wght@400;500;600;700&display=swap');

/* ── Reset & Lock ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
html, body {
  width: 100%; height: 100%;
  overflow: hidden; position: fixed;
  top: 0; left: 0;
  touch-action: none;
  overscroll-behavior: none;
  background: #08030f;
  font-family: 'Quicksand', sans-serif;
  color: #fff;
}

/* ── WebGL Canvas ───────────────────────────────────────────────────────── */
#webgl-canvas {
  position: fixed;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  display: block;
  cursor: grab;
}
#webgl-canvas:active { cursor: grabbing; }

/* ── Intro Screen ───────────────────────────────────────────────────────── */
#intro-screen {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity 1.1s cubic-bezier(0.25, 1, 0.5, 1), visibility 1.1s ease;
  background: radial-gradient(circle at center, #1b0a2a 0%, #05020a 100%);
  overflow: hidden;
}
#intro-screen::before {
  content: '';
  position: absolute;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, rgba(255, 42, 141, 0.08) 0%, transparent 60%);
  animation: slowpulse 12s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes slowpulse {
  0% { transform: scale(1) translate(-5%, -5%); }
  100% { transform: scale(1.15) translate(5%, 5%); }
}

#intro-screen.fade-out {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.intro-inner {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 36px;
  padding: 54px 40px;
  text-align: center;
  max-width: 400px; width: 100%;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 100px rgba(255, 42, 141, 0.15), 0 0 120px rgba(0, 240, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.intro-inner::before {
  content: '';
  position: absolute;
  top: 0; left: -150%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.04), transparent);
  transform: skewX(-25deg);
  animation: shine-sweep 6s ease-in-out infinite;
}
@keyframes shine-sweep {
  0% { left: -150%; }
  50% { left: 150%; }
  100% { left: 150%; }
}

.intro-heart-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-heart-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 42, 141, 0.2);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.intro-heart-icon {
  font-size: 58px;
  z-index: 2;
  animation: hbeat 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 15px rgba(255, 42, 141, 0.65));
}
@keyframes hbeat {
  0%,100% { transform: scale(1); }
  14%     { transform: scale(1.25); }
  28%     { transform: scale(1); }
  42%     { transform: scale(1.18); }
}

.intro-title {
  font-family: 'Great Vibes', cursive;
  font-size: 48px; font-weight: 400;
  background: linear-gradient(135deg, #ff7eb3 10%, #ff2a8d 50%, #ffd700 90%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px; line-height: 1.15;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.intro-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
  width: 120px;
}
.intro-divider span {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.25), transparent);
}
.intro-divider::after {
  content: '✦';
  font-size: 9px;
  color: #ffd700;
  margin: 0 8px;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.6);
}

.intro-sub {
  font-size: 13.5px; color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
  margin-bottom: 34px; line-height: 1.6;
  letter-spacing: 0.5px;
}

#open-btn {
  width: 100%; padding: 17px 0;
  background: linear-gradient(135deg, #ff2a8d, #ff7eb3);
  color: #fff; border: none; border-radius: 50px;
  font-size: 17px; font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(255, 42, 141, 0.5), 0 0 20px rgba(255, 126, 179, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

#open-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: 0.5s;
}

#open-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px rgba(255, 42, 141, 0.6), 0 0 30px rgba(255, 126, 179, 0.4);
}

#open-btn:hover::after {
  left: 100%;
}

#open-btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 4px 15px rgba(255, 42, 141, 0.4);
}

/* ── HUD ────────────────────────────────────────────────────────────────── */
#universe { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#universe.hidden { display: none; }

.drag-hint {
  position: absolute; bottom: 94px; left: 0; right: 0;
  text-align: center;
  font-size: 12.5px; color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  animation: hintFade 4.5s ease-in-out 2s forwards;
}
@keyframes hintFade {
  0%   { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}

/* ── Expandable Music HUD ────────────────────────────────────────────────── */
#music-widget {
  position: absolute;
  bottom: 28px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: auto;
  gap: 0;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#music-widget.expanded {
  gap: 12px;
}

/* Collapsed Trigger Button */
#music-cycle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 42, 141, 0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  transform: rotate(0deg);
}

#music-cycle-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2a8d, #00f0ff);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
}

#music-cycle-btn:hover {
  transform: scale(1.08);
  border-color: rgba(255, 42, 141, 0.5);
  box-shadow: 0 8px 32px rgba(255, 42, 141, 0.4), 0 0 25px rgba(255, 42, 141, 0.4);
}

#music-cycle-btn:active {
  transform: scale(0.92);
}

.music-note-icon {
  width: 18px;
  height: 18px;
  color: #fff;
  transition: transform 0.3s;
  display: block;
}

#music-widget.playing #music-cycle-btn {
  background: rgba(255, 42, 141, 0.18);
  border-color: rgba(255, 42, 141, 0.6);
  box-shadow: 0 8px 32px rgba(255, 42, 141, 0.45), 0 0 30px rgba(255, 42, 141, 0.5);
}

#music-widget.playing #music-cycle-btn::after {
  opacity: 0.15;
}

#music-widget.playing .music-note-icon {
  animation: spinCD 3.5s linear infinite;
}

@keyframes spinCD {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.music-active-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}
.music-active-wave span {
  width: 3px;
  height: 100%;
  background-color: #ff2a8d;
  border-radius: 3px;
  animation: bounceBar 1.2s ease-in-out infinite alternate;
}
.music-active-wave span:nth-child(2) {
  background-color: #00f0ff;
  animation-delay: 0.2s;
  animation-duration: 0.8s;
}
.music-active-wave span:nth-child(3) {
  background-color: #ffd700;
  animation-delay: 0.4s;
  animation-duration: 1s;
}

@keyframes bounceBar {
  0% { height: 3px; }
  100% { height: 14px; }
}

/* Expanded Player Bar */
#music-player-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 6, 24, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  padding: 8px 16px 8px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 42, 141, 0.15);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: right center;
  width: 360px;
  overflow: hidden;
}

/* Collapsed / Expanded state toggles */
#music-widget.collapsed #music-player-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.7) translateX(30px);
  width: 0;
  padding: 0;
  margin: 0;
  gap: 0;
  border-color: transparent;
}

/* Cycle button remains visible, rotates on expanded */
#music-widget.expanded #music-cycle-btn {
  transform: rotate(180deg);
  border-color: rgba(255, 42, 141, 0.6);
}

#music-widget.expanded #music-cycle-btn:hover {
  transform: scale(1.08) rotate(180deg);
}

#music-widget.expanded #music-cycle-btn:active {
  transform: scale(0.92) rotate(180deg);
}

/* Song Info Display inside the bar */
.track-info {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
}

.track-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  text-overflow: ellipsis;
  overflow: hidden;
}

.track-vocal {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 1px;
}

/* Player controls button styling */
.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ctrl-btn svg {
  width: 16px;
  height: 16px;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-2px);
}

.ctrl-btn:active {
  transform: translateY(1px) scale(0.95);
}

/* Highlight main play/pause button */
.main-play-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #ff2a8d, #ff7eb3);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 42, 141, 0.35);
}

.main-play-btn:hover {
  background: linear-gradient(135deg, #ff409b, #ffa1c9);
  box-shadow: 0 6px 16px rgba(255, 42, 141, 0.5), 0 0 15px rgba(255, 42, 141, 0.3);
  transform: translateY(-2px) scale(1.05);
}

/* Collapse / fold button */
#music-collapse-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  margin-left: 4px;
}

#music-collapse-btn svg {
  width: 14px;
  height: 14px;
}

#music-collapse-btn:hover {
  color: #ff2a8d;
  transform: scale(1.15);
}

/* Responsive adjustment for Mobile viewports */
@media (max-width: 480px) {
  #music-widget {
    bottom: 20px;
    right: 12px;
    left: 12px;
    justify-content: flex-end;
    pointer-events: none;
  }
  
  #music-widget.expanded {
    gap: 8px;
  }
  
  #music-cycle-btn {
    pointer-events: auto;
    width: 38px;
    height: 38px;
  }
  
  .music-note-icon {
    width: 15px;
    height: 15px;
  }
  
  #music-player-bar {
    width: 0;
    max-width: 100%;
    padding: 6px 12px 6px 16px;
    gap: 8px;
    justify-content: space-between;
  }
  
  /* Collapsed state on mobile */
  #music-widget.collapsed #music-player-bar {
    width: 0 !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    border-color: transparent !important;
    transform: scale(0.8) translateX(20px) !important;
  }
  
  /* Expanded state on mobile (Full-width minus the cycle button) */
  #music-widget.expanded #music-player-bar {
    width: calc(100% - 46px) !important;
    padding: 6px 12px 6px 16px !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: scale(1) translateX(0) !important;
  }
  
  .track-info {
    min-width: 80px;
    max-width: 120px;
  }
  
  .track-title {
    font-size: 11.5px;
  }
  
  .track-vocal {
    font-size: 8.5px;
  }
  
  .player-controls {
    gap: 4px;
  }
  
  .ctrl-btn {
    width: 30px;
    height: 30px;
  }
  
  .ctrl-btn svg {
    width: 13px;
    height: 13px;
  }
  
  .main-play-btn {
    width: 34px;
    height: 34px;
  }
}

/* ── Caption Modal ──────────────────────────────────────────────────────── */
#caption-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(8,3,15,0.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.4s ease;
}
#caption-modal.hidden { display: none; }
#caption-modal.fade-out { opacity: 0; pointer-events: none; }
.caption-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px; padding: 36px 28px 28px;
  max-width: 340px; width: 100%; text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(255,42,141,0.12);
}
.caption-quote {
  font-size: 64px; line-height: 0.6; margin-bottom: 16px;
  background: linear-gradient(135deg, #ff7eb3, #ff2a8d);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-family: Georgia, serif;
}
#caption-text {
  font-size: 16px; line-height: 1.75;
  color: rgba(255,255,255,0.9); font-weight: 500; margin-bottom: 24px;
}
.caption-close {
  background: linear-gradient(135deg, #ff2a8d, #ff7eb3);
  color: #fff; border: none; border-radius: 50px;
  padding: 13px 28px; font-size: 15px; font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer; width: 100%;
  box-shadow: 0 4px 18px rgba(255,42,141,0.4);
  transition: transform 0.15s; pointer-events: auto;
}
.caption-close:active { transform: scale(0.96); }

/* ── Interactive CSS Letter Envelope ─────────────────────────────────────── */
.intro-inner-letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.envelope-wrapper {
  position: relative;
  width: 320px;
  height: 220px;
  cursor: not-allowed; /* disabled until preloaded */
  perspective: 1000px;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
  z-index: 10;
  opacity: 0.8;
}

.envelope-wrapper.ready {
  cursor: pointer;
  opacity: 1;
}

.envelope-wrapper.ready:hover {
  transform: translateY(-8px) scale(1.02);
}

.envelope-wrapper.ready:active {
  transform: translateY(-2px) scale(0.99);
}

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
  background: #230d35;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 40px rgba(255, 42, 141, 0.1);
  transform-style: preserve-3d;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Flap (top triangle of envelope) */
.flap {
  position: absolute;
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  border-left: 161px solid transparent;
  border-right: 161px solid transparent;
  border-top: 120px solid #36174d; /* Darker accent purple */
  border-radius: 16px 16px 0 0;
  transform-origin: top;
  z-index: 4;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
  backface-visibility: hidden;
}

/* Pocket (the front cover of envelope) */
.pocket {
  position: absolute;
  bottom: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  background: linear-gradient(135deg, #120520, #230d35);
  border-radius: 16px;
  z-index: 3;
  clip-path: polygon(0% 42%, 50% 74%, 100% 42%, 100% 100%, 0% 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Letter Card (slides up out of envelope) */
.letter-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 85%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  z-index: 2;
  transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.03);
}

.letter-text {
  text-align: center;
}

.letter-title {
  font-family: 'Great Vibes', cursive;
  font-size: 32px;
  font-weight: 400;
  background: linear-gradient(135deg, #ff7eb3, #ff2a8d, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2px;
}

.letter-heart {
  font-size: 26px;
  animation: hbeat 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 42, 141, 0.8));
  margin: 6px 0;
}

.letter-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
  font-weight: 500;
}

.letter-tap-hint {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
}

.envelope-wrapper.ready .letter-tap-hint {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  animation: pulseHint 1.2s infinite alternate;
}

@keyframes pulseHint {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* Heart Seal */
.heart-seal {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s ease, opacity 0.3s ease 0.4s;
}

.heart-seal-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 42, 141, 0);
  transition: background-color 0.4s;
}

.envelope-wrapper.ready .heart-seal-ring {
  background: rgba(255, 42, 141, 0.25);
  animation: pulse-ring 2s infinite;
}

.heart-seal-icon {
  font-size: 34px;
  z-index: 2;
  transition: transform 0.3s ease;
  filter: grayscale(1) opacity(0.5);
}

.envelope-wrapper.ready .heart-seal-icon {
  filter: grayscale(0) opacity(1) drop-shadow(0 0 12px rgba(255, 42, 141, 0.85));
  animation: hbeat 1.5s ease-in-out infinite;
}

/* Open Envelope States */
.envelope-wrapper.open {
  pointer-events: none;
}

.envelope-wrapper.open .flap {
  transform: rotateX(180deg);
  z-index: 1; /* Drop flap behind the letter card */
  border-top-color: #230d35; /* blend flap */
}

.envelope-wrapper.open .letter-card {
  transform: translateY(-115px);
  z-index: 5;
}

.envelope-wrapper.open .heart-seal {
  transform: translate(-50%, -150%) scale(0);
  opacity: 0;
}

/* Preload Progress Indicator */
.preload-container {
  margin-top: 36px;
  width: 260px;
  text-align: center;
  z-index: 10;
}

.preload-text {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.preload-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.preload-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff2a8d, #00f0ff);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 42, 141, 0.4);
}


/* ── Image Zoom Lightbox ────────────────────────────────────────────────── */
#image-zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.4s ease;
}

#image-zoom-modal.hidden {
  display: none;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 10, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: -1;
}

.lightbox-card {
  width: 100%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 42, 141, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: modalScaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

@keyframes modalScaleUp {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(20, 10, 30, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-caption {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 60%;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-btn svg {
  width: 15px;
  height: 15px;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: scale(1.05);
}

.lightbox-btn:active {
  transform: scale(0.95);
}

.lightbox-btn.close-btn {
  background: rgba(255, 42, 141, 0.15);
  border-color: rgba(255, 42, 141, 0.3);
  color: #ff2a8d;
}

.lightbox-btn.close-btn:hover {
  background: rgba(255, 42, 141, 0.3);
  border-color: rgba(255, 42, 141, 0.5);
  color: #fff;
}

.lightbox-viewport {
  width: 100%;
  height: 480px;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.lightbox-viewport:active {
  cursor: grabbing;
}

#zoomed-image-el {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.1s ease;
  transform-origin: center center;
}

@media (max-width: 480px) {
  .lightbox-viewport {
    height: 360px;
  }
  .lightbox-header {
    padding: 12px 16px;
  }
  .lightbox-caption {
    font-size: 13px;
  }
}

/* ── Passcode Screen ────────────────────────────────────────────────────── */
#passcode-screen {
  position: fixed;
  inset: 0;
  z-index: 500; /* Over everything */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at center, #1b0a2a 0%, #05020a 100%);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s ease;
  overflow: hidden;
}

#passcode-screen::before {
  content: '';
  position: absolute;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, rgba(255, 42, 141, 0.08) 0%, transparent 60%);
  animation: slowpulse 12s ease-in-out infinite alternate;
  pointer-events: none;
}

#passcode-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.passcode-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 32px;
  padding: 48px 36px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), 0 0 80px rgba(255, 42, 141, 0.15);
  position: relative;
  overflow: hidden;
  z-index: 10;
  animation: modalScaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.passcode-heart-icon {
  font-size: 48px;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 15px rgba(255, 42, 141, 0.6));
  animation: hbeat 1.5s ease-in-out infinite;
  display: inline-block;
}

.passcode-title {
  font-family: 'Great Vibes', cursive;
  font-size: 38px;
  font-weight: 400;
  background: linear-gradient(135deg, #ff7eb3, #ff2a8d, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  line-height: 1.15;
}

.passcode-subtitle {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 30px;
}

.passcode-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

#passcode-input {
  width: 100%;
  padding: 15px 20px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 15px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: all 0.3s;
  letter-spacing: 2px;
}

#passcode-input:focus {
  border-color: #ff2a8d;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(255, 42, 141, 0.25);
}

#passcode-submit-btn {
  width: 100%;
  padding: 15px 0;
  background: linear-gradient(135deg, #ff2a8d, #ff7eb3);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 42, 141, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#passcode-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 42, 141, 0.5), 0 0 20px rgba(255, 126, 179, 0.3);
}

#passcode-submit-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 4px 12px rgba(255, 42, 141, 0.3);
}

.passcode-error {
  margin-top: 18px;
  font-size: 12.5px;
  color: #ff3366;
  font-weight: 600;
  transition: all 0.3s;
}

.passcode-error.hidden {
  display: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* ── Strong Image and Content Security Protection ─────────────────────────── */
img, canvas {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

#zoomed-image-el {
  pointer-events: none !important; /* Prevents long-press "Save image" popup on mobile completely */
}

/* Disable text selection everywhere for extreme security */
body {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Allow typing in passcode inputs */
#passcode-input {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* ── DevTools Blocker ────────────────────────────────────────────────────── */
#devtools-blocker {
  position: fixed;
  inset: 0;
  background: rgba(8, 3, 15, 0.98);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999999;
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#devtools-blocker.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.blocker-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 48px 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: blockerFadeIn 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes blockerFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.blocker-icon {
  font-size: 54px;
  margin-bottom: 20px;
  animation: pulse-warn 2s infinite ease-in-out;
  display: inline-block;
}

@keyframes pulse-warn {
  0%, 100% { transform: scale(1); opacity: 0.9; filter: drop-shadow(0 0 5px rgba(255, 42, 141, 0.4)); }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px rgba(255, 42, 141, 0.8)); }
}

.blocker-title {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 26px;
  color: #ff2a8d;
  margin-bottom: 12px;
  text-shadow: 0 0 10px rgba(255, 42, 141, 0.4);
}

.blocker-subtitle {
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin-bottom: 18px;
}

.blocker-tip {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

/* ── First-Time Interaction Guide ────────────────────────────────────────── */
#interaction-guide {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 800; /* Over HUD but below Lightbox Zoom modal */
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.5s ease;
}

#interaction-guide.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.guide-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  padding: 40px 30px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), 0 0 60px rgba(255, 42, 141, 0.15);
  animation: modalScaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  position: relative;
  overflow: hidden;
}

.guide-sparkles {
  font-size: 36px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
  animation: floatSparkle 3s ease-in-out infinite alternate;
  display: inline-block;
}

@keyframes floatSparkle {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  100% { transform: translateY(-5px) scale(1.1) rotate(15deg); }
}

.guide-title {
  font-family: 'Great Vibes', cursive;
  font-size: 36px;
  font-weight: 400;
  background: linear-gradient(135deg, #ff7eb3, #ff2a8d, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  line-height: 1.2;
}

.guide-desc {
  font-family: 'Quicksand', sans-serif;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  margin-bottom: 28px;
  line-height: 1.5;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
  margin-bottom: 30px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.guide-step-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.guide-step-content {
  flex-grow: 1;
}

.guide-step-title {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  color: #ff2a8d;
  margin-bottom: 3px;
  text-shadow: 0 0 6px rgba(255, 42, 141, 0.2);
}

.guide-step-text {
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
}

#guide-close-btn {
  width: 100%;
  padding: 14px 0;
  background: linear-gradient(135deg, #ff2a8d, #ff7eb3);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 42, 141, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#guide-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 42, 141, 0.45), 0 0 15px rgba(255, 126, 179, 0.25);
}

#guide-close-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 4px 10px rgba(255, 42, 141, 0.25);
}

@media (max-width: 480px) {
  .guide-card {
    padding: 30px 20px;
  }
  .guide-title {
    font-size: 32px;
  }
  .guide-steps {
    gap: 16px;
  }
  .guide-step-icon {
    font-size: 20px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
}

