/* ============================================================
   LOV3LY · Mẫu 07 — Ngân Hà Tình Yêu (Chuẩn Bản Video Điện Ảnh)
   Quả Cầu Hạt Tâm Ngân Hà · Trái Tim Hạt 3D · Vành Đai Hàng Trăm Ảnh Bay
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #faf5ff;
  --muted: #cbbad8;
  --rose: #ff7aa8;
  --deep: #ff2e73;
  --gold: #ffe0a3;
  --serif: "Playfair Display", Georgia, serif;
  --script: "Dancing Script", cursive;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020005;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.script { font-family: var(--script); }

#galaxy {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  z-index: 1;
}
#galaxy.grabbing { cursor: grabbing; }

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(92% 82% at 50% 50%, transparent 62%, rgba(2, 0, 6, 0.65) 100%);
}

/* ----- 4 Nút Điều Khiển Góc Màn Hình Chuẩn Video ----- */
.corner-btn {
  position: fixed;
  z-index: 12;
  border: 1px solid rgba(255, 190, 215, 0.22);
  background: rgba(22, 8, 28, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 235, 245, 0.92);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease, transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}
body.entered .corner-btn {
  opacity: 1;
  pointer-events: auto;
}
.corner-btn:hover {
  background: rgba(255, 65, 130, 0.32);
  border-color: rgba(255, 190, 220, 0.55);
  transform: translateY(-2px);
}
.corner-btn:active {
  transform: scale(0.95);
}

/* Góc trên trái: < Quay lại */
#btn-return {
  top: calc(16px + env(safe-area-inset-top));
  left: 18px;
  padding: 8px 16px;
  border-radius: 999px;
}

/* Góc trên phải: Nhạc ♪ */
#btn-music {
  top: calc(16px + env(safe-area-inset-top));
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  background: rgba(95, 70, 135, 0.52);
  border-color: rgba(210, 190, 255, 0.35);
}
#btn-music.on {
  background: rgba(255, 75, 140, 0.55);
  border-color: rgba(255, 210, 230, 0.75);
  box-shadow: 0 0 20px rgba(255, 75, 140, 0.5);
}
#btn-music.off {
  opacity: 0.65;
}

/* Góc dưới trái: Ảnh */
#btn-photos {
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 18px;
  padding: 9px 18px;
  border-radius: 999px;
}

/* Góc dưới phải: Đổi góc nhìn / Xoay ↻ */
#btn-view {
  bottom: calc(18px + env(safe-area-inset-bottom));
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
}

/* Dòng gợi ý mảnh dưới màn hình */
#hint {
  position: fixed;
  left: 80px;
  right: 80px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 7;
  text-align: center;
  font-size: 12px;
  font-weight: 300;
  color: rgba(235, 215, 245, 0.62);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.entered #hint { opacity: 0.78; }

/* ----- Màn hình Đang mở ngân hà (Loading Transition) ----- */
#galaxy-loader {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #110521 0%, #030108 75%);
  color: rgba(255, 235, 245, 0.88);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}
#galaxy-loader.active {
  opacity: 1;
}

/* ----- Màn hình Mở đầu (Entry Screen) ----- */
#entry {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(95% 75% at 50% 45%, rgba(35, 10, 48, 0.52) 0%, rgba(4, 1, 10, 0.90) 82%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.85s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#entry.gone {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

.entry-card {
  position: relative;
  max-width: 550px;
  width: 100%;
  padding: 38px 32px 34px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(165deg, rgba(34, 12, 52, 0.78) 0%, rgba(12, 4, 22, 0.88) 100%);
  border: 1px solid rgba(255, 190, 225, 0.26);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.75), 0 0 60px rgba(255, 60, 130, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: entryUp 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes entryUp {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.e-badge {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 999px;
  background: rgba(255, 224, 163, 0.12);
  border: 1px solid rgba(255, 224, 163, 0.35);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.entry-card h1 {
  font-size: clamp(38px, 8vw, 58px);
  line-height: 1.16;
  margin-top: 16px;
  background: linear-gradient(135deg, #ffffff 15%, #ffb8d9 55%, #ffe2a8 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 24px rgba(255, 75, 140, 0.55));
}

.e-heart {
  font-size: 32px;
  margin: 14px 0 6px;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(255, 75, 140, 0.85));
  animation: heartBeat 1.6s ease-in-out infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.24); }
  28% { transform: scale(1); }
  42% { transform: scale(1.16); }
  65% { transform: scale(1); }
}

.e-sub {
  font-weight: 300;
  font-size: 15px;
  line-height: 1.82;
  color: #ede2f7;
  margin-top: 10px;
}

.e-for {
  margin-top: 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16.5px;
  color: var(--gold);
}

.btn-enter {
  margin-top: 24px;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  padding: 14px 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7eb3 0%, #ff3377 55%, #c92685 100%);
  box-shadow: 0 14px 36px rgba(255, 60, 130, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.btn-enter:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 20px 44px rgba(255, 60, 130, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-enter.small {
  padding: 10px 26px;
  font-size: 13.5px;
  margin-top: 16px;
}

/* ----- Popup Xem Chi Tiết Ảnh Kỷ Niệm ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 1, 10, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.38s ease;
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.pop-card {
  position: relative;
  background: linear-gradient(165deg, rgba(32, 12, 48, 0.94) 0%, rgba(14, 5, 24, 0.97) 100%);
  color: var(--ink);
  max-width: 420px;
  width: 100%;
  border-radius: 22px;
  padding: 15px 15px 22px;
  border: 1px solid rgba(255, 190, 225, 0.32);
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 60, 130, 0.25);
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

.pop-img-frame {
  position: relative;
  width: 100%;
  height: 270px;
  border-radius: 15px;
  overflow: hidden;
  background: #12061f;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.pop-img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pop-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(14, 5, 28, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pop-nav-btn:hover { background: rgba(255, 60, 130, 0.85); }
.pop-prev { left: 10px; }
.pop-next { right: 10px; }

.pop-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  margin-top: 15px;
  color: #ffc2df;
}
.pop-card p {
  font-weight: 300;
  font-size: 14.5px;
  line-height: 1.76;
  color: #e6d8f2;
  margin-top: 8px;
  padding: 0 8px;
}

.pop-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 13px;
}
.pop-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  cursor: pointer;
  transition: width 0.25s, background 0.25s;
}
.pop-dot.active {
  width: 22px;
  background: var(--rose);
}

/* ----- Modal Bộ Sưu Tập Ảnh & Thay Ảnh Trực Tiếp ----- */
.gallery-card {
  background: linear-gradient(165deg, rgba(32, 12, 48, 0.95) 0%, rgba(12, 4, 22, 0.98) 100%);
  border: 1px solid rgba(255, 190, 225, 0.32);
  border-radius: 22px;
  padding: 22px 20px;
  max-width: 520px;
  width: 100%;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.85);
  max-height: 88vh;
  overflow-y: auto;
}
.gallery-card h3 {
  font-family: var(--serif);
  font-size: 21px;
  color: #ffc4e1;
}
.gallery-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.gal-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 200, 230, 0.35);
  cursor: pointer;
  background: #160726;
  transition: transform 0.2s, border-color 0.2s;
}
.gal-item:hover {
  transform: scale(1.05);
  border-color: #ff7aa8;
}
.gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.btn-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 195, 225, 0.38);
  color: #ffe6f2;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-upload-label:hover {
  background: rgba(255, 75, 140, 0.28);
}
#file-upload { display: none; }

@media (max-width: 600px) {
  .entry-card { padding: 30px 20px 26px; }
  #hint { display: none; }
}

