/* ─── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --cream:    #F8F5EF;
  --paper:    #FBF8F1;
  --blush:    #DCD5E8;
  --rose:     #8FA8C5;
  --deep-rose:#56758B;
  --wine:     #496679;
  --brown:    #344A58;
  --teal:     #8FC4CE;
  --sky:      #B8D4E1;
  --lavender: #B8B4D5;
  --gold:     #BE9550;
  --white:    #FFFFFF;
  --card-bg:  rgba(255,255,255,0.82);
  --shadow:   0 12px 42px rgba(73,102,121,0.13);
  --shadow-lg:0 24px 64px rgba(73,102,121,0.20);
  --radius:   18px;
  --font-script: 'Great Vibes', cursive;
  --font-serif:  'Playfair Display', Georgia, serif;
  --font-sans:   'Jost', sans-serif;
  --timeline-w:  3px;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 40% 28% at 8% 12%, rgba(184,180,213,0.38), transparent 70%),
    radial-gradient(ellipse 34% 24% at 92% 18%, rgba(143,196,206,0.35), transparent 70%),
    radial-gradient(ellipse 42% 24% at 85% 88%, rgba(143,168,197,0.32), transparent 72%),
    linear-gradient(135deg, var(--paper) 0%, var(--cream) 45%, #EEF4F4 100%);
  color: var(--brown);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── NOISE TEXTURE OVERLAY ────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.065'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='360' height='180' viewBox='0 0 360 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23be9550' stroke-width='1' opacity='.26'%3E%3Cpath d='M-20 150 C70 96 142 204 244 128 S394 72 420 108'/%3E%3Cpath d='M-18 122 C72 68 140 176 248 100 S392 44 420 80'/%3E%3Cpath d='M-20 95 C76 38 144 150 252 74 S394 18 420 54'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.62;
  pointer-events: none;
  z-index: 0;
}

/* ─── PASSWORD GATE ────────────────────────────────────────────── */
#gate {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 52% 32% at 16% 16%, rgba(184,180,213,0.78), transparent 72%),
    radial-gradient(ellipse 46% 30% at 86% 78%, rgba(143,196,206,0.68), transparent 72%),
    linear-gradient(145deg, #F8F5EF 0%, #DCEAF0 45%, #ADBFD9 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#gate.hide {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
.gate-card {
  background: rgba(255,255,255,0.68);
  backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255,255,255,0.78);
  border-radius: 28px;
  padding: 52px 44px 44px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 30px 80px rgba(52,74,88,0.18);
  position: relative;
  overflow: hidden;
}
.gate-card::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 48% 24% at 4% 95%, rgba(143,196,206,0.22), transparent 70%),
    linear-gradient(160deg, rgba(255,255,255,0.62) 0%, transparent 100%);
  pointer-events: none;
}
.gate-hearts {
  font-size: 2.2rem;
  margin-bottom: 12px;
  display: block;
  animation: pulse-heart 2s ease-in-out infinite;
}
@keyframes pulse-heart {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.gate-title {
  font-family: var(--font-script);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  color: var(--wine);
  margin-bottom: 6px;
  line-height: 1.1;
}
.gate-subtitle {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--deep-rose);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 36px;
}
.gate-input-wrap { position: relative; margin-bottom: 16px; }
.gate-input-wrap input {
  width: 100%;
  padding: 15px 52px 15px 22px;
  border: 1.5px solid rgba(86,117,139,0.26);
  border-radius: 50px;
  background: rgba(255,255,255,0.72);
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--brown);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  letter-spacing: 0.1em;
}
.gate-input-wrap input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(143,196,206,0.18);
}
.eye-toggle {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--deep-rose);
  line-height: 0;
}
.eye-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.74;
  transition: opacity 0.2s, color 0.2s;
}
.eye-toggle:hover svg,
.eye-toggle:focus-visible svg {
  color: var(--teal);
  opacity: 1;
}
.gate-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--teal), var(--deep-rose));
  border: none; border-radius: 50px;
  color: white;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 24px rgba(73,102,121,0.28);
}
.gate-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(73,102,121,0.36); }
.gate-btn:active { transform: translateY(0); }
.gate-error {
  color: #9B4F52; font-size: 0.84rem; margin-top: 12px;
  min-height: 20px; transition: opacity 0.3s;
}
/* Floating hearts background */
.hearts-bg {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 999;
}
.floating-heart {
  position: absolute; bottom: -60px;
  font-size: 1.4rem; opacity: 0; color: var(--white);
  animation: float-up linear infinite;
}
@keyframes float-up {
  0%   { opacity: 0; transform: translateY(0) rotate(-10deg) scale(0.8); }
  15%  { opacity: 0.6; }
  85%  { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-110vh) rotate(20deg) scale(1.2); }
}

/* ─── MAIN APP (hidden until login) ─────────────────────────────── */
#app { display: none; }
#app.show { display: block; }

/* ─── NAV ────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248,245,239,0.82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(190,149,80,0.20);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-family: var(--font-script);
  font-size: 1.9rem;
  color: var(--deep-rose);
  text-decoration: none;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-lock-btn {
  background: rgba(255,255,255,0.46);
  border: 1px solid rgba(86,117,139,0.18);
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--deep-rose);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(52,74,88,0.08);
}
.nav-lock-btn:hover {
  background: rgba(143,196,206,0.22);
  border-color: rgba(143,196,206,0.58);
  transform: translateY(-1px);
}
.nav-stats {
  font-size: 0.8rem; color: var(--deep-rose); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}

/* ─── HERO ───────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: clamp(60px, 12vw, 110px) 24px clamp(50px, 10vw, 90px);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 34% 22% at 18% 42%, rgba(184,180,213,0.22), transparent 70%),
    radial-gradient(ellipse 34% 22% at 82% 28%, rgba(143,196,206,0.20), transparent 70%),
    linear-gradient(105deg, transparent 0 15%, rgba(143,196,206,0.18) 15% 22%, transparent 22% 52%, rgba(184,180,213,0.16) 52% 60%, transparent 60% 100%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: min(560px, 72vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(190,149,80,0.62), transparent);
  transform: translateX(-50%);
  opacity: 0.7;
}
.hero-script {
  font-family: var(--font-script);
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  color: var(--deep-rose);
  margin-bottom: 8px;
  opacity: 0; animation: fade-up 0.9s 0.2s forwards;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 10vw, 5.5rem);
  font-weight: 700;
  color: var(--wine);
  line-height: 1.1;
  margin-bottom: 16px;
  opacity: 0; animation: fade-up 0.9s 0.4s forwards;
}
.hero-title em { font-style: italic; color: var(--deep-rose); }
.hero-divider {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin: 20px auto 24px;
  opacity: 0; animation: fade-up 0.9s 0.6s forwards;
}
.hero-divider span { font-size: 1.3rem; }
.divider-line {
  width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero-date {
  font-family: var(--font-sans);
  font-size: 0.9rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--deep-rose);
  margin-bottom: 8px;
  opacity: 0; animation: fade-up 0.9s 0.7s forwards;
}
.hero-counter {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: var(--wine); font-style: italic;
  opacity: 0; animation: fade-up 0.9s 0.85s forwards;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── FILTER BAR ─────────────────────────────────────────────────── */
.filter-bar {
  position: sticky; top: 64px; z-index: 90;
  background: rgba(248,245,239,0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(86,117,139,0.14);
  padding: 12px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-inner {
  display: flex; gap: 8px; align-items: center;
  min-width: max-content; margin: 0 auto;
  justify-content: center;
}
.filter-btn {
  padding: 8px 18px; border-radius: 50px; border: 1.5px solid rgba(86,117,139,0.25);
  background: transparent; font-family: var(--font-sans); font-size: 0.82rem;
  font-weight: 500; color: var(--deep-rose); cursor: pointer; white-space: nowrap;
  transition: all 0.25s; letter-spacing: 0.05em;
}
.filter-btn:hover { background: rgba(143,196,206,0.18); border-color: var(--teal); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--teal), var(--deep-rose));
  border-color: transparent; color: white;
  box-shadow: 0 4px 16px rgba(73,102,121,0.24);
}
.filter-sep { width: 1px; height: 20px; background: rgba(190,149,80,0.32); flex-shrink: 0; }

/* ─── TIMELINE ───────────────────────────────────────────────────── */
.timeline {
  max-width: 900px; margin: 0 auto;
  padding: 60px 20px 100px;
  position: relative;
}
/* Center vertical line (desktop only) */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: var(--timeline-w);
  background: linear-gradient(to bottom,
    transparent 0%,
    var(--sky) 5%,
    var(--teal) 30%,
    var(--lavender) 70%,
    transparent 100%);
  transform: translateX(-50%);
}

/* Year marker */
.year-marker {
  display: flex; justify-content: center; align-items: center;
  margin: 48px 0 36px; position: relative; z-index: 2;
}
.year-pill {
  background: linear-gradient(135deg, var(--deep-rose), #789CB1);
  color: white; font-family: var(--font-serif); font-size: 1.05rem;
  font-weight: 600; padding: 8px 24px; border-radius: 50px;
  box-shadow: 0 6px 20px rgba(73,102,121,0.26);
  letter-spacing: 0.05em;
}

/* Memory card wrapper */
.memory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 84px;
  align-items: center;
  margin-bottom: 56px; position: relative;
  opacity: 0; transform: translateY(34px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.memory-item.visible { opacity: 1; transform: translateY(0); }

/* Dot on timeline */
.memory-dot {
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--teal);
  box-shadow: 0 0 0 5px rgba(143,196,206,0.22);
  transform: translate(-50%, -50%); z-index: 3; flex-shrink: 0;
  transition: transform 0.3s, box-shadow 0.3s;
}
.memory-item:hover .memory-dot {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 0 8px rgba(190,149,80,0.18);
  background: var(--gold);
}

/* The card itself */
.memory-card {
  background: var(--card-bg);
  border: 1.5px solid rgba(86,117,139,0.13);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 100%;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s;
  position: relative;
}
.memory-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg);
}
.memory-detail-card {
  align-self: center;
  margin-top: 0;
}
.memory-item.image-left .memory-detail-card,
.memory-item.image-right .memory-detail-card {
  position: relative;
}
.memory-item.image-left .memory-detail-card::after,
.memory-item.image-right .memory-detail-card::after {
  content: '';
  position: absolute; top: 50%; left: -42px;
  width: 42px; height: 1.5px;
  background: linear-gradient(90deg, rgba(190,149,80,0.50), transparent);
}
.memory-item.image-right .memory-detail-card::after {
  left: auto; right: -42px;
  background: linear-gradient(90deg, transparent, rgba(190,149,80,0.50));
}

/* Media area */
.card-media {
  position: relative; overflow: hidden;
  aspect-ratio: 4/3;
  background:
    linear-gradient(135deg, rgba(184,180,213,0.55), rgba(143,196,206,0.46)),
    var(--sky);
}
.card-media img, .card-media video {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}
.memory-card:hover .card-media img { transform: scale(1.06); }
.card-note-preview {
  width: 100%; height: 100%;
  padding: 34px 28px;
  display: flex; flex-direction: column; justify-content: flex-end;
  color: var(--wine);
}
.card-note-preview p {
  position: relative; z-index: 2;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.65;
}

.play-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(52,74,88,0.18);
}
.play-btn-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; padding-left: 4px;
  color: var(--deep-rose);
  box-shadow: 0 4px 20px rgba(52,74,88,0.22);
  transition: transform 0.2s;
}
.memory-card:hover .play-btn-circle { transform: scale(1.1); }
/* Text content */
.card-body { padding: 18px 20px 20px; position: relative; z-index: 2; }
.card-date {
  font-family: var(--font-serif);
  font-size: clamp(1.02rem, 2vw, 1.32rem);
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--deep-rose); font-weight: 500; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.memory-item.image-right .memory-detail-card .card-date {
  justify-content: flex-end;
  text-align: right;
}
.card-date::before { content: ''; width: 18px; height: 1px; background: var(--gold); display: inline-block; }
.memory-item.image-right .memory-detail-card .card-date::before { display: none; }
.memory-item.image-right .memory-detail-card .card-date::after {
  content: ''; width: 18px; height: 1px; background: var(--gold); display: inline-block;
}
.card-title {
  font-family: var(--font-serif); font-size: 1.15rem;
  font-weight: 600; color: var(--wine); margin-bottom: 8px;
  line-height: 1.3;
}
.card-caption {
  font-size: 0.87rem; color: #5E6A70; line-height: 1.65;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.media-tags {
  padding: 14px 20px 16px;
  position: relative;
  z-index: 2;
}
.tag {
  font-size: 0.74rem; padding: 3px 10px; border-radius: 20px;
  background: rgba(143,196,206,0.20); color: var(--deep-rose);
  font-weight: 500; letter-spacing: 0.06em;
}

.card-quote-mark {
  position: absolute;
  top: 28px;
  left: 24px;
  font-family: var(--font-serif); font-size: 4rem; color: var(--lavender);
  line-height: 0.6; display: block; margin-bottom: 12px;
}
/* ─── MOBILE TIMELINE ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .timeline::before { left: 28px; transform: none; }
  .memory-item,
  .memory-item.image-left,
  .memory-item.image-right {
    grid-template-columns: 1fr;
    row-gap: 12px;
    padding-left: 56px;
    column-gap: 0;
  }
  .memory-item.image-right .memory-detail-card { order: 2; }
  .memory-item.image-right .memory-media-card { order: 1; }
  .memory-dot { left: 28px; transform: translateX(-50%); top: 20px; }
  .memory-item:hover .memory-dot { transform: translateX(-50%) scale(1.3); }
  .memory-item.image-left .memory-detail-card::after,
  .memory-item.image-right .memory-detail-card::after { display: none; }
  .memory-card { width: 100%; }
  .memory-detail-card { margin-top: 0; }
  .memory-item.image-right .memory-detail-card .card-date {
    justify-content: flex-start;
    text-align: left;
  }
  .memory-item.image-right .memory-detail-card .card-date::before { display: inline-block; }
  .memory-item.image-right .memory-detail-card .card-date::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .memory-item,
  .hero-script,
  .hero-title,
  .hero-divider,
  .hero-date,
  .hero-counter {
    animation: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─── EMPTY STATE ────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 20px;
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.2rem; color: var(--deep-rose); opacity: 0.72;
}

/* ─── LIGHTBOX ───────────────────────────────────────────────────── */
#lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(29,45,55,0.92);
  backdrop-filter: blur(16px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
#lightbox.open { display: flex; }
.lb-inner {
  max-width: 900px; width: 100%; position: relative;
  animation: lb-fade 0.22s ease-out;
}
@keyframes lb-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes lb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lb-media img, .lb-media video {
  max-width: 100%; max-height: 70vh; object-fit: contain;
  border-radius: 14px; display: block;
}
.lb-album {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-album-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  background: #0d1117;
}
.lb-blur-bg {
  display: none;
}
.lb-album-main > img,
.lb-album-main > video {
  width: auto;
  max-width: 100%;
  max-height: 66vh;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  display: block;
  overflow: hidden;
}
.lb-note-panel {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 40px 36px;
  text-align: center;
}
.lb-note-panel span {
  font-family: var(--font-script);
  font-size: 5rem;
  color: var(--blush);
  line-height: 0.5;
  display: block;
  margin-bottom: 16px;
}
.lb-note-panel p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--wine);
  line-height: 1.8;
}
.lb-album-count {
  position: absolute; top: 12px; right: 12px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(29,45,55,0.68); color: white;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
}
.lb-thumbs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 2px 2px; scrollbar-width: thin;
}
.lb-thumb {
  width: 64px; height: 48px; flex: 0 0 auto;
  border-radius: 8px; border: 2px solid transparent;
  padding: 0; overflow: hidden; cursor: pointer;
  background: rgba(255,255,255,0.12);
}
.lb-thumb.active { border-color: var(--teal); }
.lb-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 0; display: block;
}
.lb-thumb span {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-family: var(--font-serif); font-size: 1.35rem;
}
.lb-info {
  padding: 20px 8px 8px; color: white;
  display: flex; flex-direction: column; gap: 6px;
}
.lb-title {
  font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600;
}
.lb-title-row {
  display: block;
}
.lb-edit-btn {
  position: fixed; top: 24px; right: 76px; z-index: 510;
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.16); color: white;
  font-family: var(--font-sans); font-size: 1rem; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(10px);
}
.lb-edit-btn:hover { background: rgba(143,196,206,0.34); }
.lb-date { font-size: 0.82rem; color: var(--sky); letter-spacing: 0.1em; text-transform: uppercase; }
.lb-caption { font-size: 0.92rem; color: rgba(255,255,255,0.75); line-height: 1.6; }
.lb-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.lb-tags .tag { background: rgba(143,196,206,0.18); color: var(--sky); }
.lb-close {
  position: fixed; top: 24px; right: 24px;
  z-index: 511;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--deep-rose); border: none; color: white;
  font-size: 1.2rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: background 0.2s, transform 0.2s;
}
.lb-close:hover { background: var(--teal); transform: rotate(90deg); }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  z-index: 509;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.25); color: white;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lb-nav:hover { background: rgba(143,196,206,0.42); }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-progress {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 511;
  display: none;
  gap: 7px;
}
.lb-progress button {
  width: 32px;
  height: 3px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.34);
  cursor: pointer;
}
.lb-progress button.active {
  background: rgba(255,255,255,0.92);
}
@media (max-width: 700px) {
  #lightbox {
    --lb-mobile-edge-gap: 16px;
    --lb-mobile-control-size: 38px;
    --lb-mobile-stage-height: min(100dvh, 216.667vw);
    --lb-mobile-stage-end-gap: max(0px, calc(100dvh - var(--lb-mobile-stage-height)));
    --lb-mobile-control-top: calc(var(--lb-mobile-edge-gap) + env(safe-area-inset-top));
    --lb-mobile-panel-bottom: calc(var(--lb-mobile-stage-end-gap) + 8px + env(safe-area-inset-bottom));
    --lb-mobile-thumb-bottom: calc(var(--lb-mobile-stage-end-gap) + 28px + env(safe-area-inset-bottom) + var(--lb-mobile-info-height) - 8px);
    --lb-mobile-info-height: 116px;
    --lb-mobile-thumb-strip-height: 58px;
    --lb-mobile-image-base-top: calc(var(--lb-mobile-control-top) + var(--lb-mobile-control-size) + var(--lb-mobile-edge-gap));
    --lb-mobile-image-bottom: calc(var(--lb-mobile-thumb-bottom) + var(--lb-mobile-thumb-strip-height) + var(--lb-mobile-edge-gap));
    --lb-mobile-media-max-height: 133.3vw;
    --lb-mobile-image-height: min(
      calc(100dvh - var(--lb-mobile-image-base-top) - var(--lb-mobile-image-bottom)),
      var(--lb-mobile-media-max-height)
    );
    --lb-mobile-image-top: calc(100dvh - var(--lb-mobile-image-bottom) - var(--lb-mobile-image-height));
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    overflow: hidden;
    background: #111d24;
  }
  #lightbox::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46dvh;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(
      180deg,
      rgba(17,29,36,0) 0%,
      rgba(17,29,36,0.42) 32%,
      rgba(17,29,36,0.86) 72%,
      rgba(17,29,36,0.98) 100%
    );
  }
  .lb-inner {
    max-width: 100%;
    min-height: 100dvh;
    padding: 0;
  }
  .lb-media {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    height: 100dvh;
    width: 100vw;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }
  .lb-album {
    width: 100%;
    height: 100%;
    justify-content: flex-start;
    pointer-events: auto;
  }
  .lb-album-main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    background: #0d1117;
  }
  .lb-album.has-thumbs .lb-album-main {
    height: 100%;
  }
  .lb-media img,
  .lb-media video,
  .lb-album-main > img,
  .lb-album-main > video {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    max-height: none;
    max-width: none;
    object-fit: contain;
    border-radius: 0;
  }
  .lb-album-main > img,
  .lb-album-main > video {
    position: absolute;
    top: var(--lb-mobile-image-top);
    bottom: auto;
    left: 0;
    right: 0;
    height: var(--lb-mobile-image-height);
    max-height: var(--lb-mobile-media-max-height);
    object-position: center;
  }
  .lb-blur-bg {
    display: block;
    position: absolute;
    inset: -20px;
    z-index: 1;
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.45);
    transform: scale(1.05);
    pointer-events: none;
  }
  .lb-note-panel {
    max-height: 100%;
    overflow-y: auto;
  }
  .lb-info {
    position: fixed;
    left: 5vw;
    right: 5vw;
    top: auto;
    bottom: var(--lb-mobile-panel-bottom);
    z-index: 4;
    min-height: 0;
    height: var(--lb-mobile-info-height);
    padding: 0;
    margin: 0;
    overflow: hidden;
    gap: 5px;
  }
  .lb-inner:has(.lb-thumbs) .lb-info {
    top: auto;
  }
  .lb-close,
  .lb-edit-btn {
    top: var(--lb-mobile-control-top);
    width: var(--lb-mobile-control-size);
    height: var(--lb-mobile-control-size);
    border: 1px solid rgba(255,255,255,0.28);
    background: rgba(17,29,36,0.42);
    color: white;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    backdrop-filter: blur(12px);
  }
  .lb-close { right: 18px; }
  .lb-edit-btn { left: 18px; right: auto; }
  .lb-nav {
    display: none;
    top: 50%;
    width: 34px;
    height: 34px;
    border-color: rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.12);
    font-size: 0.9rem;
  }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
  .lb-progress {
    top: calc(var(--lb-mobile-control-top) + 16px);
    z-index: 512;
    gap: 7px;
  }
  .lb-progress button {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.46);
  }
  .lb-progress button.active {
    background: white;
  }
  .lb-album-count { display: none; }
  .lb-thumbs {
    position: fixed;
    left: 5vw;
    right: 5vw;
    bottom: var(--lb-mobile-thumb-bottom);
    z-index: 4;
    width: auto;
    height: var(--lb-mobile-thumb-strip-height);
    min-height: 0;
    overflow-y: hidden;
    padding: 4px 0;
    justify-content: flex-start;
    touch-action: pan-x;
    scrollbar-width: none;
  }
  .lb-thumbs::-webkit-scrollbar {
    display: none;
  }
  .lb-thumb {
    width: 62px;
    height: 48px;
    border-radius: 8px;
    background: rgba(255,255,255,0.16);
  }
  .lb-thumb.active {
    border-color: white;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.72);
  }
  .lb-date {
    position: static;
    color: rgba(255,255,255,0.72);
    font-size: 0.72rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lb-title {
    font-size: 1.18rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .lb-caption {
    font-size: 0.86rem;
    color: rgba(255,255,255,0.76);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 62%, rgba(0,0,0,0));
    mask-image: linear-gradient(180deg, #000 62%, rgba(0,0,0,0));
  }
  .lb-tags {
    display: none;
  }
  .lb-tags .tag { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.82); }
}

/* ─── ADD MEMORY FAB ─────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 28px; right: 24px; z-index: 200;
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--deep-rose));
  border: none; color: white; font-size: 1.6rem; cursor: pointer;
  box-shadow: 0 8px 28px rgba(73,102,121,0.32);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
}
.fab:hover { transform: scale(1.12) rotate(15deg); box-shadow: 0 12px 36px rgba(73,102,121,0.42); }
.guest-mode .fab { display: none; }
.fab-tooltip {
  position: absolute; right: 68px; top: 50%; transform: translateY(-50%);
  background: var(--brown); color: white; font-size: 0.78rem; white-space: nowrap;
  padding: 6px 12px; border-radius: 8px; opacity: 0;
  pointer-events: none; transition: opacity 0.2s;
}
.fab:hover .fab-tooltip { opacity: 1; }

/* ─── ADD MEMORY MODAL ───────────────────────────────────────────── */
#addModal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(29,45,55,0.58); backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#addModal.open { display: flex; }
.modal-box {
  background:
    radial-gradient(ellipse 46% 24% at 100% 0%, rgba(143,196,206,0.15), transparent 72%),
    radial-gradient(ellipse 40% 22% at 0% 100%, rgba(184,180,213,0.14), transparent 72%),
    var(--white);
  border: 1px solid rgba(190,149,80,0.18);
  border-radius: 24px;
  padding: 36px 32px; max-width: 540px; width: 100%;
  box-shadow: 0 30px 80px rgba(52,74,88,0.22);
  animation: lb-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh; overflow-y: auto;
}
.modal-title {
  font-family: var(--font-script); font-size: 2rem;
  color: var(--wine); margin-bottom: 4px;
}
.modal-sub { font-size: 0.83rem; color: var(--rose); margin-bottom: 24px; letter-spacing: 0.08em; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-close-btn {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid rgba(86,117,139,0.22);
  background: rgba(255,255,255,0.64);
  color: var(--deep-rose);
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(52,74,88,0.10);
  transition: background 0.2s, transform 0.2s;
}
.modal-close-btn:hover {
  background: rgba(143,196,206,0.18);
  transform: rotate(90deg);
}
.form-row { display: flex; gap: 14px; }
.form-row[hidden],
.album-item-date-group[hidden] {
  display: none !important;
}
.form-group { margin-bottom: 18px; flex: 1; }
.form-group label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--deep-rose); letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 7px;
}
.form-group input, .form-group textarea, .form-group select,
.album-row input,
.album-row textarea {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  border: 1.5px solid rgba(86,117,139,0.22);
  background: rgba(248,245,239,0.72);
  font-family: var(--font-sans); font-size: 0.92rem; color: var(--brown);
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus,
.album-row input:focus,
.album-row textarea:focus {
  border-color: var(--teal);
}
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: -4px 0 18px;
  color: var(--deep-rose);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--deep-rose);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.album-editor {
  display: flex; flex-direction: column; gap: 10px;
}
.album-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(86,117,139,0.14);
  border-radius: 16px;
  background: rgba(248,245,239,0.46);
}
.album-row input, .album-row select, .album-row textarea { margin: 0; }
.album-item-date-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--deep-rose);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.album-row textarea {
  min-height: 44px;
  overflow: hidden;
  resize: none;
  line-height: 1.55;
}
.album-row-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.album-row-title {
  color: var(--deep-rose);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.album-kind-hint {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(143,196,206,0.18);
  color: var(--deep-rose);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.album-kind-hint[data-kind="video"] { background: rgba(184,180,213,0.26); }
.album-kind-hint[data-kind="note"] { background: rgba(190,149,80,0.16); color: var(--wine); }
.album-kind-hint[data-kind="auto"] { background: rgba(86,117,139,0.10); color: rgba(73,102,121,0.68); }
.album-remove-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid rgba(86,117,139,0.22);
  background: rgba(255,255,255,0.72); color: var(--deep-rose);
  cursor: pointer; font-size: 1rem;
}
.album-remove-btn:hover { background: rgba(143,196,206,0.18); }
.album-add-btn {
  margin-top: 10px; padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid rgba(86,117,139,0.26);
  background: rgba(255,255,255,0.54); color: var(--deep-rose);
  font-family: var(--font-sans); font-size: 0.84rem; font-weight: 600;
  cursor: pointer;
}
.album-add-btn:hover { background: rgba(143,196,206,0.18); }
@media (max-width: 700px) {
  .album-url,
  .album-caption { grid-column: 1 / -1; }
}
.modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}
.btn-primary {
  padding: 13px 20px; border-radius: 50px;
  background: linear-gradient(135deg, var(--teal), var(--deep-rose));
  border: none; color: white; font-family: var(--font-sans);
  font-size: 0.9rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; cursor: pointer;
  box-shadow: 0 6px 20px rgba(73,102,121,0.26);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(73,102,121,0.35); }
.btn-ghost {
  padding: 13px 17px; border-radius: 50px;
  background: transparent; border: 1.5px solid rgba(86,117,139,0.28);
  color: var(--deep-rose); font-family: var(--font-sans); font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(143,196,206,0.18); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 17px; border-radius: 50px;
  background: rgba(155,79,82,0.08); border: 1.5px solid rgba(155,79,82,0.28);
  color: #9B4F52; font-family: var(--font-sans); font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: rgba(155,79,82,0.14); transform: translateY(-1px); }
.btn-danger.solid {
  flex: 1;
  background: linear-gradient(135deg, #B85F63, #7F3C46);
  border-color: transparent;
  color: white;
  box-shadow: 0 6px 20px rgba(127,60,70,0.24);
}
@media (max-width: 700px) {
  .modal-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .btn-primary,
  .btn-ghost,
  .btn-danger { width: 100%; }
}

#deleteModal {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(29,45,55,0.62); backdrop-filter: blur(14px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#deleteModal.open { display: flex; }
.delete-box {
  width: min(440px, 100%);
  background:
    radial-gradient(ellipse 48% 28% at 100% 0%, rgba(184,180,213,0.16), transparent 72%),
    var(--white);
  border: 1px solid rgba(155,79,82,0.18);
  border-radius: 24px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(52,74,88,0.28);
  animation: lb-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.delete-title {
  font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600;
  color: var(--wine); margin-bottom: 8px;
}
.delete-copy {
  color: #5E6A70; line-height: 1.6; font-size: 0.92rem;
  margin-bottom: 20px;
}
.delete-error {
  min-height: 20px; color: #9B4F52; font-size: 0.84rem;
  margin: -6px 0 12px;
}

/* ─── FOOTER ─────────────────────────────────────────────────────── */
footer {
  text-align: center; padding: 60px 24px 40px;
  border-top: 1px solid rgba(190,149,80,0.18);
}
.footer-script {
  font-family: var(--font-script); font-size: 2.2rem;
  color: var(--deep-rose); display: block; margin-bottom: 10px;
}
.footer-text { font-size: 0.83rem; color: rgba(73,102,121,0.58); letter-spacing: 0.12em; }

/* ─── SCROLLBAR ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sky); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--deep-rose); }
