* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body, html { width: 100%; height: 100%; overflow: hidden; font-family: 'Segoe UI', Arial, sans-serif; background: #000; color: #fff; }

.screen {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover; background-position: center;
  transition: opacity 1s ease, transform 1s ease;
  display: flex; justify-content: center; align-items: center; opacity: 1; z-index: 1;
}
.screen.hidden { opacity: 0; pointer-events: none; transform: scale(1.05); z-index: 0; }

#screen-outside { background-image: url('assets/images/01-outside.png'); }
#screen-welcome, #screen-hall { background-image: url('assets/images/02-hall.png'); }
#screen-console { background-image: url('assets/images/03-console.png'); }

#flash-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #fff; opacity: 0; pointer-events: none; z-index: 999;
  transition: opacity 0.6s ease;
}
#flash-overlay.active { opacity: 1; }

.music-btn {
  position: fixed; top: 20px; left: 20px; z-index: 1000;
  background: rgba(4, 12, 30, 0.85); border: 1px solid #e2b041; color: #fbe389;
  font-size: 1.3rem; width: 46px; height: 46px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); box-shadow: 0 0 15px rgba(226, 176, 65, 0.4); transition: 0.3s;
}
.music-btn:hover { transform: scale(1.1); box-shadow: 0 0 25px rgba(251, 227, 137, 0.8); background: rgba(226, 176, 65, 0.2); }

.auth-box {
  background: rgba(4, 12, 30, 0.85); border: 1px solid #e2b041; border-radius: 16px;
  padding: 35px; text-align: center; backdrop-filter: blur(12px);
  box-shadow: 0 0 35px rgba(226, 176, 65, 0.3); max-width: 420px; width: 90%; z-index: 10;
}
.auth-box h2 { color: #e2b041; font-size: 1.4rem; margin-bottom: 10px; text-transform: uppercase; }
.auth-box p { color: #a0c0e0; font-size: 0.9rem; margin-bottom: 20px; }
input[type="password"] {
  width: 100%; padding: 14px; border-radius: 8px; border: 1px solid #e2b041;
  background: #020815; color: #fff; font-size: 1.6rem; text-align: center;
  letter-spacing: 8px; margin-bottom: 15px; outline: none;
}
.error-msg { color: #ff5252; font-size: 0.9rem; margin-top: 10px; min-height: 20px; font-weight: bold; }

.btn-gold {
  width: 100%; padding: 14px; border: none; border-radius: 8px;
  background: linear-gradient(45deg, #c59329, #fbe389); color: #000;
  font-weight: bold; font-size: 1rem; cursor: pointer; transition: 0.3s;
  box-shadow: 0 0 15px rgba(226, 176, 65, 0.4); text-transform: uppercase;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 0 25px rgba(251, 227, 137, 0.8); }
.pulse { animation: btnPulse 2s infinite alternate; }
@keyframes btnPulse { 0% { box-shadow: 0 0 15px rgba(226, 176, 65, 0.4); } 100% { box-shadow: 0 0 35px rgba(251, 227, 137, 0.9); } }

/* ========================================== */
/* СЦЕНА 1: Главная карточка приветствия */
/* ========================================== */
.welcome-card {
  max-width: 580px;
  width: 90%;
  padding: 40px 35px;
  text-align: center;
  background: rgba(10, 15, 28, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 176, 65, 0.4);
  border-radius: 16px;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(226, 176, 65, 0.2);
  margin: 0 auto;
  z-index: 10;
}

.welcome-title {
  color: #ffffff; font-size: 2.1rem; font-weight: 800; margin-bottom: 18px;
  letter-spacing: 1px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.welcome-subtitle { margin-bottom: 25px; }
.welcome-subtitle .quote { color: #ffe066; font-size: 1.1rem; font-style: italic; font-weight: 600; margin-bottom: 12px; text-shadow: 0 0 8px rgba(255, 224, 102, 0.4); }
.welcome-subtitle .message { color: #e0e6ed; font-size: 1.05rem; line-height: 1.55; font-weight: 400; }

.btn-start { margin-top: 10px; padding: 14px 28px; font-weight: bold; cursor: pointer; border-radius: 8px; transition: all 0.3s ease; }

/* ========================================== */
/* ОБЩИЕ СТИЛИ ПАСХАЛКИ "ДВЕРЬ" */
/* ========================================== */
.console-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.door-hotspot {
  position: absolute;
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

#screen-welcome .door-hotspot {
  top: 11.5%;
  left: 11%;
  width: 8%;
  height: 18%;
}

#screen-console .door-hotspot {
  top: 1.8%;
  left: 11.2%;
  width: 7.5%;
  height: 16%;
}

.door-hint-icon {
  font-size: 1.5rem;
  opacity: 0.65;
  filter: drop-shadow(0 0 10px rgba(226, 176, 65, 0.9));
  transition: opacity 0.3s ease, transform 0.3s ease;
  user-select: none;
  animation: lockGlow 2s infinite alternate;
}

.door-hotspot:hover .door-hint-icon {
  opacity: 1;
  transform: scale(1.2);
}

@keyframes lockGlow {
  0% { opacity: 0.45; filter: drop-shadow(0 0 6px rgba(226, 176, 65, 0.5)); }
  100% { opacity: 0.9; filter: drop-shadow(0 0 18px rgba(226, 176, 65, 1)); }
}

.door-toast {
  position: fixed;
  top: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(10, 15, 28, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e2b041;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.9), 0 0 20px rgba(226, 176, 65, 0.4);
  color: #ffffff;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1000;
  text-align: center;
  white-space: nowrap;
}

.door-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.console-screen-overlay {
  position: absolute; top: 61.8%; left: 50%; transform: translate(-50%, -50%);
  width: 28.5%; text-align: center; pointer-events: none; z-index: 10;
}

.screen-content { transform: translateY(10px) scaleY(1.2); text-align: center; background: transparent; padding: 0; }

.coord-label {
  color: #ffe066; font-family: monospace; font-size: 1.15rem; font-weight: bold;
  letter-spacing: 2px; margin-bottom: 8px;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 10px #000, 0 0 15px rgba(226, 176, 65, 0.9);
}

.memory-name {
  color: #ffffff; font-weight: 800; font-size: 1.4rem; letter-spacing: 1px;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 12px #000, 0 0 20px rgba(0, 0, 0, 0.8);
}

.console-controls { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 20px; z-index: 10; }
.btn-nav { background: rgba(4, 12, 30, 0.9); border: 1px solid #e2b041; color: #e2b041; padding: 12px 24px; border-radius: 30px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-nav:hover { background: #e2b041; color: #000; }

.btn-red-big { background: linear-gradient(45deg, #b71c1c, #ff5252); border: 2px solid #fff; color: #fff; padding: 16px 36px; font-size: 1.1rem; font-weight: bold; border-radius: 40px; cursor: pointer; box-shadow: 0 0 25px rgba(255, 82, 82, 0.8); transition: 0.3s; }
.btn-red-big:hover { transform: scale(1.08); box-shadow: 0 0 40px rgba(255, 82, 82, 1); }

#vortex-video { width: 100%; height: 100%; object-fit: cover; }

#screen-memory {
  display: block; overflow-y: auto; overflow-x: hidden;
  background-attachment: fixed; background-size: cover; background-position: center;
  scroll-behavior: smooth; transition: background-image 0.8s ease-in-out;
}

.memory-hero-section { min-height: 100vh; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 40px; }
.hero-bottom-bar { background: rgba(4, 12, 30, 0.85); border: 1px solid #e2b041; border-radius: 20px; padding: 20px 30px; text-align: center; backdrop-filter: blur(12px); box-shadow: 0 0 35px rgba(226, 176, 65, 0.4); max-width: 600px; width: 90%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hero-bottom-bar .memory-date { color: #e2b041; font-family: monospace; font-size: 1rem; }
.hero-bottom-bar .memory-title { font-size: 1.8rem; color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }

.scroll-down-btn { background: rgba(226, 176, 65, 0.2); border: 1px solid #e2b041; color: #fbe389; width: 42px; height: 42px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; margin-top: 10px; display: flex; align-items: center; justify-content: center; transition: 0.3s; animation: bounce 2s infinite; }
.scroll-down-btn:hover { background: #e2b041; color: #000; box-shadow: 0 0 20px rgba(226, 176, 65, 0.9); }

@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } 60% { transform: translateY(-5px); } }

.memory-scroll-container {
  min-height: 100vh; background: rgba(5, 12, 28, 0.45); backdrop-filter: blur(8px);
  padding: 40px 20px; border-radius: 16px; display: flex; flex-direction: column;
  align-items: center; gap: 30px; box-shadow: inset 0 20px 30px rgba(0, 0, 0, 0.4);
  transition: background-color 0.5s ease;
}

.memory-layout-block { width: 100%; max-width: 680px; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.part-wrapper { width: 100%; max-width: 680px; display: flex; flex-direction: column; align-items: center; gap: 30px; transition: all 0.5s ease; }

.memory-text-card { position: relative; max-width: 680px; width: 100%; background: rgba(10, 20, 42, 0.75); border: 1px solid rgba(226, 176, 65, 0.4); border-radius: 16px; padding: 30px; box-shadow: 0 0 25px rgba(0, 0, 0, 0.5); }
.memory-text { font-size: 1.1rem; line-height: 1.7; color: #d0e0f0; white-space: pre-line; }

.letter-card { border: 1px solid rgba(226, 176, 65, 0.7); background: rgba(8, 18, 38, 0.85); box-shadow: 0 0 35px rgba(226, 176, 65, 0.25); }

/* ========================================== */
/* ГАЛЕРЕЯ: ОПТИМИЗИРОВАННЫЙ HOVER ЭФФЕКТ */
/* ========================================== */
.memory-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  align-items: center;
  margin-top: 25px;
  width: 100%;
}

.gallery-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(226, 176, 65, 0.3);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
  will-change: transform;
  transform: translateZ(0);
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(226, 176, 65, 0.45);
}

.gallery-card img,
.gallery-card .memory-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.gallery-card:hover img,
.gallery-card:hover .memory-photo {
  transform: scale(1.05) translateZ(0);
}

/* --- РАСКЛАДКА ДЛЯ 5 ФОТО (2 вертикальных сверху, 3 снизу) --- */
.memory-gallery[data-count="5"] .gallery-card:nth-child(1),
.memory-gallery[data-count="5"] .gallery-card:nth-child(2) {
  flex: 1 1 calc(48% - 10px);
  max-width: 48%;
  height: 390px;
  aspect-ratio: 3 / 4;
}

.memory-gallery[data-count="5"] .gallery-card:nth-child(3),
.memory-gallery[data-count="5"] .gallery-card:nth-child(4),
.memory-gallery[data-count="5"] .gallery-card:nth-child(5) {
  flex: 1 1 calc(31% - 10px);
  max-width: 31%;
  height: 250px;
  aspect-ratio: 3 / 4;
}

/* --- РАСКЛАДКА ДЛЯ 3 ФОТО (Роспись / Свадьба / Годовщина) --- */
.memory-gallery[data-count="3"] .gallery-card {
  flex: 1 1 calc(31% - 10px);
  max-width: 31%;
  height: 240px;
}

/* --- РАСКЛАДКА ДЛЯ 2 ВЕРТИКАЛЬНЫХ ФОТО 9:16 (Годовщина) --- */
.memory-gallery[data-count="2"] .gallery-card {
  flex: 1 1 calc(48% - 10px);
  max-width: 48%;
  height: 480px;
  aspect-ratio: 9 / 16;
}

/* --- СЕТКА ВИДЕО ДЛЯ ВОСПОМИНАНИЯ 2 --- */
.video-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 15px;
}

.memory-video {
  flex: 1 1 calc(31% - 10px);
  max-width: 31%;
  max-height: 480px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
  border: 1px solid #e2b041;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(226, 176, 65, 0.3);
  background: #000;
  outline: none;
}

@media (max-height: 800px) {
  .memory-gallery[data-count="5"] .gallery-card:nth-child(1),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(2) {
    height: 320px;
  }
  .memory-gallery[data-count="5"] .gallery-card:nth-child(3),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(4),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(5) {
    height: 200px;
  }
}

@media (max-width: 600px) {
  .memory-gallery[data-count="5"] .gallery-card:nth-child(1),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(2),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(3),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(4),
  .memory-gallery[data-count="5"] .gallery-card:nth-child(5),
  .memory-gallery[data-count="3"] .gallery-card,
  .memory-gallery[data-count="2"] .gallery-card {
    flex: 1 1 100%;
    max-width: 100%;
    height: 420px;
  }

  .memory-video {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.memory-video-container { width: 100%; max-width: 320px; margin: 0 auto; }
.memory-video-container video { width: 100%; max-height: 520px; aspect-ratio: 9 / 16; object-fit: cover; display: block; border: 1px solid #e2b041; border-radius: 12px; box-shadow: 0 0 25px rgba(226, 176, 65, 0.3); background: #000; outline: none; }

.tardis-warning-box {
  max-width: 680px; width: 100%; background: rgba(45, 15, 20, 0.85);
  border: 1px solid #ff5252; border-radius: 16px; padding: 22px 25px;
  text-align: center; backdrop-filter: blur(10px); box-shadow: 0 0 25px rgba(255, 82, 82, 0.3);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.warning-icon { font-size: 2rem; animation: pulseWarning 1.5s infinite alternate; }
@keyframes pulseWarning { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }

.warning-text { color: #ff8a8a; font-size: 0.95rem; line-height: 1.5; }

.btn-correct-timeline {
  background: linear-gradient(45deg, #b71c1c, #ff5252); border: 1px solid #fff;
  color: #fff; padding: 12px 24px; font-weight: bold; font-size: 0.95rem;
  border-radius: 30px; cursor: pointer; box-shadow: 0 0 20px rgba(255, 82, 82, 0.6);
  transition: all 0.3s ease;
}
.btn-correct-timeline:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 82, 82, 0.9); }

.flashback-banner {
  width: 100%; max-width: 680px; background: rgba(14, 30, 60, 0.85);
  border: 1px solid #e2b041; border-radius: 12px; padding: 14px 20px;
  color: #fbe389; font-weight: bold; font-size: 0.95rem; text-align: center;
  cursor: pointer; box-shadow: 0 0 15px rgba(226, 176, 65, 0.3); backdrop-filter: blur(8px);
  transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
}
.flashback-banner:hover { transform: scale(1.02); background: rgba(226, 176, 65, 0.25); box-shadow: 0 0 25px rgba(251, 227, 137, 0.6); }

.glitch-divider {
  color: #a5d6a7; font-size: 1.1rem; font-weight: bold; text-align: center;
  border-top: 1px dashed #66bb6a; border-bottom: 1px dashed #66bb6a;
  padding: 15px 0; width: 100%; text-shadow: 0 0 10px rgba(102, 187, 106, 0.8);
}

.btn-return-tardis { max-width: 320px; margin-top: 20px; }
.shake { animation: shakeAnim 0.5s infinite; }
@keyframes shakeAnim { 0% { transform: translate(0, 0); } 25% { transform: translate(-4px, 4px); } 50% { transform: translate(4px, -3px); } 75% { transform: translate(-3px, -4px); } 100% { transform: translate(0, 0); } }

/* ========================================== */
/* ПАСХАЛКА: ТРЕЩИНА ВО ВРЕМЕНИ */
/* ========================================== */
.time-crack-wrapper {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  cursor: pointer;
  z-index: 10;
}

.time-crack-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 4px #ffffff) 
          drop-shadow(0 0 10px #00f0ff) 
          drop-shadow(0 0 18px #00f0ff);
  animation: crackPulse 2.5s infinite alternate ease-in-out;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.time-crack-wrapper:hover .time-crack-svg {
  transform: scale(1.18);
  filter: drop-shadow(0 0 6px #ffffff) 
          drop-shadow(0 0 14px #00f0ff) 
          drop-shadow(0 0 25px #00f0ff);
}

@keyframes crackPulse {
  0% { opacity: 0.65; }
  100% { opacity: 1; }
}

.crack-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.crack-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.crack-modal-content {
  position: relative;
  background: rgba(12, 20, 38, 0.95);
  border: 1px solid #00f0ff;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.35);
  padding: 35px 30px 30px;
  border-radius: 16px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  color: #ffffff;
  transform: scale(0.9);
  transition: transform 0.4s ease;
}

.crack-modal-overlay.active .crack-modal-content {
  transform: scale(1);
}

.crack-modal-close {
  position: absolute;
  top: 12px;
  right: 15px;
  background: transparent;
  border: none;
  color: #88a0c0;
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.crack-modal-close:hover {
  color: #00f0ff;
}

.crack-modal-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.crack-modal-title {
  color: #00f0ff;
  font-size: 1.15rem;
  margin-bottom: 14px;
  letter-spacing: 1px;
  font-weight: 700;
}

.crack-modal-text {
  color: #e0e6ed;
  font-size: 1rem;
  line-height: 1.6;
  font-style: italic;
}

/* ========================================== */
/* МОДАЛЬНОЕ ОКНО ДЛЯ ПРОСМОТРА ФОТО (ЛАЙТБОКС) */
/* ========================================== */
.photo-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 8, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
}

.photo-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.photo-modal-content {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(226, 176, 65, 0.6);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), 0 0 25px rgba(226, 176, 65, 0.4);
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  cursor: default;
}

.photo-modal-overlay.active .photo-modal-content {
  transform: scale(1);
}

.photo-modal-close {
  position: absolute;
  top: 20px;
  right: 25px;
  color: #fbe389;
  font-size: 2.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
  z-index: 3001;
}

.photo-modal-close:hover {
  color: #ffffff;
  transform: scale(1.15);
}

/* ========================================== */
/* ПОЛНОЭКРАННЫЙ РЕЖИМ ДЛЯ ВИДЕО (БЕЗ ОБРЕЗАНИЯ 9:16) */
/* ========================================== */
video:fullscreen,
video:-webkit-full-screen {
  object-fit: contain !important;
  background-color: #000000 !important;
  width: 100% !important;
  height: 100% !important;
}