/* Base Styles & Resets */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
body { 
    font-family: 'Quicksand', sans-serif; 
    color: #2c3e50; 
    overflow-x: hidden; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 0 15px 30px 15px; 
    background-color: #f4ebe1; 
    transition: background 1.5s ease;
}
body::before { 
    content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background-size: cover; background-position: center; filter: blur(8px); 
    opacity: 0.35; z-index: -2; pointer-events: none; 
}

.site-main-container { max-width: 1400px; width: 100%; background-color: #FAF6F0; border-radius: 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06); position: relative; z-index: 1; padding-bottom: 40px; overflow: hidden;}

/* View Only Overrides */
.view-only .btn-action, .view-only .btn-fav, .view-only .fab-wrapper, 
.view-only #selectModeBtn, .view-only .book-controls, .view-only .action-overlay { display: none !important;}
.view-only .polaroid, .view-only .custom-text-box, .view-only .scrapbook-sticker { pointer-events: none !important; }
.view-only .gallery-item { cursor: default;}

/* Share Banner Flex Fix */
.share-banner { width: 100%; max-width: 1400px; border-radius: 0 0 16px 16px; margin-bottom: 20px; background: #ECFDF5; color: #064E3B; text-align: center; padding: 10px; font-weight: 700; font-size: 0.9rem; border-bottom: 1px solid #A7F3D0; display: none; justify-content: center; align-items: center; gap: 10px; z-index: 100; }
.share-banner button { background: #10B981; color: white; border: none; padding: 4px 12px; border-radius: 12px; font-weight: bold; cursor: pointer; font-family: 'Quicksand';}

/* Header & Glassmorphism */
.header-accent { background: rgba(255, 250, 214, 0.6); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-bottom: 1px solid rgba(255, 255, 255, 0.5); padding: 10px 0; }
.navbar { display: flex; justify-content: center; align-items: center; padding: 20px 40px; z-index: 50; }
.nav-brand { display: flex; align-items: center; gap: 16px; justify-content: center; width: 100%; max-width: 800px; position: relative;}
.nav-icon { width: 70px; height: 70px; border-radius: 50%; background: #FFF; display: flex; justify-content: center; align-items: center; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.06); border: 3px solid white; }
.nav-icon img { width: 100%; height: 100%; object-fit: cover;}
.nav-brand h1 { font-family: 'Playfair Display', serif; font-size: 2.3rem; color: #2C3E50; display: flex; align-items: center; gap: 8px; margin-bottom: 0;}
.nav-brand h1 span.sparkle { font-size: 1.5rem; color: #F59E0B; }
.nav-brand p { font-size: 0.95rem; color: #64748B; margin-top: 2px; font-weight: 600;}

/* Easter Egg Envelope Icon & Animations */
#secretMailIcon { display: flex; background: #FDE047; width: 42px; height: 42px; border-radius: 50%; justify-content: center; align-items: center; font-size: 1.4rem; cursor: pointer; box-shadow: inset -3px -3px 6px rgba(0,0,0,0.1), inset 3px 3px 6px rgba(255,255,255,0.8), 0 4px 10px rgba(0,0,0,0.15); border: none; transition: transform 0.2s;}
#secretMailIcon:hover { transform: scale(1.1) rotate(5deg); }
#secretMailIcon:active { transform: scale(0.95); }

@keyframes floatHint { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.confetti-particle { position: fixed; font-size: 1.2rem; pointer-events: none; z-index: 200005; animation: confettiPop 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;}
@keyframes confettiPop { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-50px) scale(0); opacity: 0;} }

/* Interactive Stacked Carousel CSS */
.spotlight-container { display: flex; justify-content: center; position: relative; width: 100%; margin: 40px 0 60px 0; }
.spotlight-badge { position: absolute; top: -10px; right: 50%; transform: translateX(180px) rotate(5deg); background:#EF4444; color: white; padding: 6px 14px; border-radius: 20px; font-weight: 800; font-size: 0.85rem; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4); border: 2px solid white; z-index: 100; pointer-events: none;}
.stacked-wrapper { position: relative; width: 320px; height: 380px; perspective: 1000px; touch-action: pan-y; cursor: grab; max-width: 90vw;}
.stacked-wrapper:active { cursor: grabbing; }
.stacked-card { position: absolute; width: 100%; height: 100%; background: #ffffff; padding: 12px; border-radius: 2px; box-shadow: 0 15px 40px rgba(0,0,0,0.15); transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); transform-origin: bottom center; border: none; display: flex; flex-direction: column;}
.stacked-photo-wrapper { position: relative; width: 100%; border-radius: 2px; overflow: hidden; border: 1px solid rgba(0,0,0,0.05); flex: 1;}
.stacked-photo-wrapper img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.stacked-card::before { content: ""; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); width: 80px; height: 25px; background-color: rgba(253, 224, 71, 0.7); box-shadow: 0 1px 3px rgba(0,0,0,0.1); z-index: 5; }
.stacked-caption { text-align: center; font-family: 'Caveat', cursive; font-size: 1.8rem; color: #334155; margin-top: 10px; width: 100%; font-weight: 700; pointer-events: none; min-height: 40px; display: flex; align-items: center; justify-content: center;}
.stacked-card:nth-last-child(1) { transform: translateY(0) rotate(-2deg) scale(1); z-index: 3; opacity: 1;}
.stacked-card:nth-last-child(2) { transform: translateY(-15px) rotate(3deg) scale(0.95); z-index: 2; opacity: 0.8;}
.stacked-card:nth-last-child(3) { transform: translateY(-30px) rotate(-4deg) scale(0.90); z-index: 1; opacity: 0.6;}
.stacked-card:nth-last-child(n+4) { opacity: 0; transform: translateY(-30px) scale(0.85); pointer-events: none; }
.stacked-wrapper:hover .stacked-card:nth-last-child(1) { transform: translateY(-15px) rotate(-1deg) scale(1.02); z-index: 4; box-shadow: 0 25px 50px rgba(0,0,0,0.2); }
.stacked-wrapper:hover .stacked-card:nth-last-child(2) { transform: translateX(-45px) translateY(10px) rotate(-12deg); z-index: 3; opacity: 0.9;}
.stacked-wrapper:hover .stacked-card:nth-last-child(3) { transform: translateX(45px) translateY(10px) rotate(12deg); z-index: 2; opacity: 0.8;}

/* Section Headers & Filters */
.section-header { text-align: left; max-width: 1320px; margin: 20px auto 10px auto; padding: 0 30px; }
.section-header h2 { font-family: 'Playfair Display', serif; font-size: 2.1rem; color: #2C3E50; margin-bottom: 2px; }
.section-header p { font-size: 0.95rem; color: #64748B; font-weight: 500;}

.filter-nav { display: flex; flex-direction: column; margin: 0 auto 20px auto; max-width: 1320px; width: 100%; position: sticky; top: 0; z-index: 40; background: rgba(250, 246, 240, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 15px 0 5px 0; border-bottom: 1px solid rgba(255,255,255,0.4); }
.filter-row { display: flex; gap: 10px; flex-wrap: nowrap; margin-bottom: 15px; justify-content: flex-start; width: 100%; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-left: 20px; padding-right: 20px;}
.filter-row::-webkit-scrollbar { display: none; }
.filter-label { font-size: 1.1rem; color: #B45309; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; width: 100%; text-align: left; padding-left: 20px;}

.filter-btn { background: #FFFFFF; border: none; color: #475569; padding: 10px 20px; border-radius: 24px; font-weight: 700; font-family: 'Quicksand', sans-serif; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.05), inset 2px 2px 5px rgba(255,255,255,1), 2px 4px 8px rgba(0,0,0,0.05); display: inline-block; white-space: nowrap; flex-shrink: 0; position: relative; overflow: hidden;}
.filter-btn:hover { background: #F8FAFC; transform: translateY(-2px); }
.filter-btn.active { background: #FFFAD6; color: #D97706; box-shadow: inset -3px -3px 6px rgba(245, 158, 11, 0.1), inset 3px 3px 6px rgba(255,255,255,0.8), 0 4px 12px rgba(245, 158, 11, 0.15);}

/* Select Button */
.btn-select-mode { background: #1E293B; color: white; margin-left: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.2);}
.btn-select-mode:hover { background: #334155; transform: translateY(-2px); }
.btn-select-mode.active { background: #3B82F6; color: white; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.2), inset 2px 2px 5px rgba(255,255,255,0.3); }

/* Ripples */
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.6); transform: scale(0); animation: rippleEffect 0.6s linear; pointer-events: none; }
@keyframes rippleEffect { to { transform: scale(4); opacity: 0; } }

/* 3D ALBUM CAROUSEL */
.album-carousel { display: none; width: 100%; max-width: 1320px; margin: 0 auto; overflow-x: auto; padding: 20px 30px 40px 30px; gap: 20px; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.album-carousel::-webkit-scrollbar { display: none;}
.album-stack-card { flex: 0 0 240px; min-height: 270px; background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%); border-radius: 4px 12px 12px 4px; box-shadow: inset -4px 0 10px rgba(0,0,0,0.05), inset 12px 0 10px rgba(0,0,0,0.1), 6px 8px 20px rgba(0,0,0,0.15); border-left: 18px solid #F59E0B; border-right: 4px solid #FFFFFF; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 30px 20px 20px 10px; position: relative; cursor: pointer; scroll-snap-align: center; transition: transform 0.3s;}
.album-stack-card:hover { transform: translateY(-10px) rotate(2deg); box-shadow: inset -4px 0 10px rgba(0,0,0,0.05), inset 12px 0 10px rgba(0,0,0,0.1), 10px 15px 30px rgba(0,0,0,0.2); }
.album-stack-card::before { content: ''; position: absolute; right: -4px; top: 4px; bottom: 4px; width: 4px; background: #FDFBF7; border-radius: 0 4px 4px 0; border-right: 1px solid #CBD5E1; }
.album-tab { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: rgba(253, 224, 71, 0.9); padding: 4px 20px; font-weight: 800; font-size: 0.75rem; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border-radius: 2px;}
.album-preview-frame { background: white; padding: 10px 10px 30px 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); transform: rotate(-2deg); margin-bottom: 25px; width: 100%; position: relative; margin-top: 10px;}
.album-preview-frame img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 2px; }
.album-stack-card h3 { font-family: 'Caveat', cursive; font-size: 2.6rem; color: #1E293B; margin: 0; line-height: 1; text-align: center;}

/* Ghost class for SortableJS */
.dragging-ghost { opacity: 0.4; box-shadow: 0 0 10px rgba(0,0,0,0.3) inset; }

/* Main Masonry Grid */
.gallery-container { max-width: 1320px; margin: 10px auto 25px auto; padding: 0 30px; columns: 4 270px; column-gap: 25px; transition: height 0.3s; }
.gallery-item { background: #ffffff; padding: 12px; border-radius: 2px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); position: relative; transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s; display: inline-block; width: 100%; margin-bottom: 25px; break-inside: avoid; border: none; cursor: grab; }
.gallery-item:active { cursor: grabbing; }
.gallery-item:hover { transform: translateY(-6px) rotate(1deg); box-shadow: 0 15px 30px rgba(0,0,0,0.2); z-index: 2;}
.gallery-item::before { content: ""; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); width: 80px; height: 25px; background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.2) 5px, rgba(255,255,255,0.2) 10px), rgba(253, 224, 71, 0.85); box-shadow: 0 1px 3px rgba(0,0,0,0.1); z-index: 5; pointer-events: none;}

.photo-wrapper { position: relative; width: 100%; border-radius: 2px; overflow: hidden; border: 1px solid rgba(0,0,0,0.05); background: #E2E8F0; }
.gallery-item img.main-photo { width: 100%; display: block; object-fit: cover; touch-action: none; user-select: none; -webkit-touch-callout: none; transition: opacity 0.3s;}

/* Selection Mode & Multi-Bar */
.selection-mode-active .gallery-item { cursor: pointer; }
.selection-mode-active .gallery-item:hover { transform: none; box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 1; }
.selection-mode-active .gallery-item .action-overlay, 
.selection-mode-active .gallery-item .btn-fav { display: none !important; }
.selection-mode-active .gallery-item::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border: 4px solid transparent; border-radius: 2px; transition: border 0.2s, background 0.2s; z-index: 12; pointer-events: none;}
.gallery-item.selected::after { border-color: #3B82F6; background: rgba(59, 130, 246, 0.15); }
.gallery-item.selected::before { content: '✓'; position: absolute; top: 10px; left: 10px; width: 30px; height: 30px; background: #3B82F6; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: bold; z-index: 13; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

.multi-select-bar { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background: rgba(30, 41, 59, 0.95); backdrop-filter: blur(10px); padding: 15px 25px; border-radius: 30px; display: flex; align-items: center; gap: 15px; z-index: 10000; transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 10px 30px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);}
.multi-select-bar.show { bottom: 30px; }
.multi-select-text { color: white; font-weight: 700; font-family: 'Quicksand'; margin-right: 10px;}
.multi-btn { padding: 8px 16px; border-radius: 20px; font-weight: 700; cursor: pointer; border: none; font-family: 'Quicksand'; transition: transform 0.2s;}
.multi-btn:hover { transform: scale(1.05); }
.multi-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.multi-btn.move { background: #3B82F6; color: white; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.2), inset 2px 2px 5px rgba(255,255,255,0.2); }
.multi-btn.delete { background: #EF4444; color: white; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.2), inset 2px 2px 5px rgba(255,255,255,0.2); }
.multi-btn.cancel { background: transparent; color: #94A3B8; border: 1px solid #64748B; }

/* Skeletons */
.skeleton { background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; min-height: 200px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton img { opacity: 0; }

.btn-fav { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(4px); border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 15; box-shadow: inset -2px -2px 4px rgba(0,0,0,0.1), inset 2px 2px 4px rgba(255,255,255,1), 0 4px 10px rgba(0,0,0,0.15); border: none; outline: none;}
.btn-fav svg { width: 20px; height: 20px; stroke: #64748B; fill: none; transition: all 0.2s; z-index: 2; position: relative;}
.btn-fav:hover { transform: scale(1.1); background: white; }
.btn-fav:active { transform: scale(0.9);}
.gallery-item.is-favorite .btn-fav svg, .stacked-card.is-favorite .btn-fav svg, .polaroid.is-favorite .btn-fav svg { stroke: #EF4444; fill: #EF4444; }

.gallery-container.view-all-grid { columns: 3 320px;}
/*.gallery-container.view-all-grid .photo-wrapper { aspect-ratio: 1 / 1; }
.gallery-container.view-all-grid .main-photo { height: 100%; object-fit: cover;}*/
.gallery-container.view-all-grid .memory-details { padding: 15px 10px 5px 10px; align-items: center; text-align: center; }
.gallery-container.view-all-grid .memory-caption { font-size: 2.6rem; text-align: center; width: 100%; margin-bottom: 5px; }
.gallery-container.view-all-grid .memory-date { font-size: 0.95rem; text-align: center; width: 100%; }

.memory-details { margin-top: 12px; padding: 0 35px 5px 10px; text-align: left; width: 100%; display: flex; flex-direction: column; justify-content: center; }
.memory-caption { font-family: 'Caveat', cursive; font-size: 1.8rem; color: #334155; margin-bottom: 2px; font-weight: 700; line-height: 1.1; word-wrap: break-word;}
.memory-date { font-size: 0.75rem; color: #94A3B8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;}

.action-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.7); display: flex; justify-content: center; align-items: center; gap: 10px; opacity: 0; transition: opacity 0.2s; z-index: 10;} 
.photo-wrapper:hover .action-overlay, .polaroid-inner:hover .action-overlay { opacity: 1;}

.btn-action { background: white; border: none; border-radius: 50%; width: 50px; height: 50px; display: flex; justify-content: center; align-items: center; cursor: pointer; color: #334155; box-shadow: inset -2px -2px 6px rgba(0,0,0,0.05), inset 2px 2px 6px rgba(255,255,255,1), 0 4px 15px rgba(0,0,0,0.2); transition: all 0.2s; position: relative; overflow: hidden; }
.btn-action:hover { background: #F8FAFC; transform: scale(1.1); }
.btn-action svg { position: relative; z-index: 2;}
.btn-action.delete { color: #EF4444; }
.btn-action.delete:hover { background: #FEF2F2; color: #EF4444; box-shadow: inset -2px -2px 6px rgba(239,68,68,0.1), inset 2px 2px 6px rgba(255,255,255,1), 0 4px 15px rgba(239,68,68,0.2); }

.corner-psyduck { position: absolute; bottom: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: #FFF5C2; border: 2px solid white; box-shadow: 0 3px 8px rgba(0,0,0,0.1); overflow: hidden; z-index: 30; pointer-events: none; opacity: 0.9; }
.corner-psyduck img { width: 100%; height: 100%; object-fit: cover; display:block; }

.badge-container { position: absolute; top: 8px; left: 8px; display: flex;flex-direction: column; gap: 4px; z-index: 10; pointer-events: none;}
.category-badge { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(4px); padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; color: #475569; box-shadow:0 2px 5px rgba(0,0,0,0.1);}

/* PHASE 3: REALTIME REACTION MENU, BADGES, & EXPLOSIONS */
.reaction-menu { position: fixed; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); padding: 10px 16px; border-radius: 30px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); display: flex; gap: 15px; z-index: 10002; transform: scale(0) translateY(20px); opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: none; }
.reaction-menu.show { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }
.reaction-menu span { font-size: 2rem; cursor: pointer; transition: transform 0.2s; user-select: none;}
.reaction-menu span:hover { transform: scale(1.3) translateY(-5px); }

.reactions-container { position: absolute; bottom: 8px; right: 8px; left: auto; display: flex; flex-direction: row-reverse; z-index: 20; pointer-events: none; }
.reaction-badge { background: white; border-radius: 50%; padding: 3px; font-size: 1.1rem; box-shadow: 0 4px 10px rgba(0,0,0,0.25); border: 2px solid #F8FAFC; margin-right: -10px; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);}
.reaction-badge:first-child { margin-right: 0; }
@keyframes popIn { 0% { transform: scale(0) rotate(-15deg); } 100% { transform: scale(1) rotate(0deg); } }

/* Explosion Animation */
.reaction-particle { position: fixed; font-size: 1.8rem; pointer-events: none; z-index: 10005; animation: explodeEmoji 1s cubic-bezier(0.25, 1, 0.5, 1) forwards; text-shadow: 0 2px 5px rgba(0,0,0,0.3); }
@keyframes explodeEmoji { 0% { transform: translate(0, 0) scale(0.5); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(1.5); opacity: 0; } }

/* Toast Notifications */
#toastContainer { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10001; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(30, 41, 59, 0.95); backdrop-filter: blur(8px); color: white; padding: 12px 24px; border-radius: 30px; font-weight: 700; font-size: 0.95rem; box-shadow: 0 10px 25px rgba(0,0,0,0.2); transform: translateY(100px); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,0.1);}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto;}
.toast.success { background: rgba(16, 185, 129, 0.95);}
.toast.error { background: rgba(239, 68, 68, 0.95); }

/* Overlays & Modals */
.confirm-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 10005; display: none; justify-content: center; align-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s;}
.confirm-box { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 24px; text-align: center; width: 90%; max-width: 340px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); transform: scale(0.9); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); border: 1px solid rgba(255,255,255,0.5);}
.confirm-overlay.show { opacity: 1; display: flex; }
.confirm-overlay.show .confirm-box { transform: scale(1);}
.confirm-box h3 { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: #1E293B; margin-bottom: 10px; }
.confirm-box p { color: #64748B; font-size: 0.95rem; margin-bottom: 25px; line-height: 1.4; }
.confirm-btns { display: flex; gap: 10px; justify-content: center;}
.confirm-btns button { flex: 1; padding: 12px; border-radius: 16px; font-weight: 700; font-family: 'Quicksand', sans-serif; cursor: pointer; border: none; font-size: 1rem; position: relative; overflow: hidden;}
.btn-cancel { background: #F1F5F9; color: #475569; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.05), inset 2px 2px 5px rgba(255,255,255,1); }
.btn-danger { background: #FEF2F2; color: #EF4444; box-shadow: inset -2px -2px 5px rgba(239,68,68,0.1), inset 2px 2px 5px rgba(255,255,255,1); }

@keyframes fadeOutFootprint { 0% { opacity: 0.5; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1);} }
.drag-footprint { position: fixed; font-size: 1.5rem; pointer-events: none; z-index: 5; animation: fadeOutFootprint 2s forwards;}

.fab-wrapper { position: fixed; bottom: 25px; right: 25px; z-index: 999; display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: transform 0.2s; }
.fab-wrapper:hover { transform: scale(1.05) translateY(-5px);}
.fab-psyduck { width: 105px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15)); margin-bottom: -20px; z-index: 2; position: relative;}

.fab-camera-btn { width: 64px; height: 64px; background: #FDE047; border-radius: 50%; display: flex; justify-content: center; align-items: center; box-shadow: inset -4px -4px 10px rgba(0,0,0,0.15), inset 4px 4px 10px rgba(255,255,255,0.8), 0 8px 20px rgba(253, 224, 71, 0.5); z-index: 3; color: #1E293B; border: none; position: relative; overflow: hidden;}
.fab-camera-btn svg { position: relative; z-index: 2;}
.fab-camera-btn:active { transform: scale(0.95); box-shadow: inset 4px 4px 10px rgba(0,0,0,0.15), inset -4px -4px 10px rgba(255,255,255,0.8), 0 4px 10px rgba(253, 224, 71, 0.5);}
.fab-text-badge { background: white; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 800; color: #1E293B; margin-top: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 1px solid #E2E8F0; z-index: 3; font-family: 'Quicksand', sans-serif;}

/* Upload UI */
.upload-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display:none; justify-content: center; align-items: flex-end; z-index: 10000; transition: opacity 0.3s;}
.upload-wrapper { position: relative; width: 100%; max-width: 500px; display: flex; flex-direction: column; align-items: center; animation: slideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1); margin-top: auto;}
.mascot-container { position: relative; width: 250px; height: 200px; margin-bottom: -40px; z-index: 1; pointer-events: none; display: flex; justify-content: center; transition: transform 0.1s;}
.upload-mascot-peek { width: 100%; display: block; z-index: 2; filter: drop-shadow(0 -4px 6px rgba(0,0,0,0.1)); object-fit: contain; }
.mascot-bg-patch { position: absolute; top: 40%; right: 24%; width: 42px; height: 42px; background: white; border-radius: 50%; z-index: 1; display: flex; align-items: center; justify-content: center; transform: rotate(-10deg); }
.mascot-bg-patch::after { content: ''; width: 4px; height: 4px; background: #1E293B; border-radius: 50%; margin-right: -6px; margin-bottom: 4px; }
.mascot-bg-patch-left { position: absolute; top: 58%; left: 37%; width: 6px; height: 6px; background: #1E293B; border-radius: 50%; z-index: 1; }

.upload-content { background: rgba(255, 255, 255, 0.95); width: 100%; padding: 30px; border-radius: 24px 24px 0 0; text-align: left; position: relative; box-shadow: 0 -10px 40px rgba(0,0,0,0.2); border-top: 6px solid #FDE047; max-height: 80vh; overflow-y: auto; z-index: 2; border-left: 1px solid rgba(255,255,255,0.5); border-right: 1px solid rgba(255,255,255,0.5);}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.upload-content h3 { font-family: 'Playfair Display', serif; margin-bottom: 20px; font-size: 1.8rem; color: #1E293B; text-align: center;}
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 2rem; cursor: pointer; color: #94A3B8; line-height: 1; padding: 5px; z-index: 10; }

input[type="file"] { display: none !important; }
.upload-type-container { display: flex; gap: 15px; margin-bottom: 15px; }
.upload-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 10px; border-radius: 16px; cursor: pointer; transition: all 0.2s; text-align: center; border: 2px solid transparent; box-shadow: inset -2px -2px 6px rgba(0,0,0,0.02), inset 2px 2px 6px rgba(255,255,255,0.8); }
.gallery-card { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.gallery-card:hover { background: #DBEAFE; transform: translateY(-2px); }
.camera-card { background: #ECFDF5; border-color: #A7F3D0; color: #064E3B;}
.camera-card:hover { background: #D1FAE5; transform: translateY(-2px); }
.upload-card .icon { font-size: 2rem; margin-bottom: 8px; }
.upload-card .title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; font-family: 'Quicksand', sans-serif;}
.upload-card .subtitle { font-size: 0.75rem; opacity: 0.8; }

.form-input { width: 100%; padding: 14px 16px; border: 2px solid #E2E8F0; border-radius: 16px; font-family: 'Quicksand', sans-serif; font-size: 1rem; margin-bottom: 15px; outline: none; transition: border-color 0.2s, background-color 0.2s; background: #F8FAFC; -webkit-appearance: none; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.02);}
.form-input:focus { border-color: #60A5FA; background: white; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05);}

.cat-selection-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin-bottom: 15px;}
.cat-pill { cursor: pointer;}
.cat-pill input { display: none; }
.cat-pill span { display: inline-block; padding: 8px 16px; background: #F1F5F9; color: #64748B; border-radius: 20px; font-size: 0.9rem; font-weight: 700; transition: all 0.2s; border: 2px solid transparent; box-shadow: inset -1px -1px 3px rgba(0,0,0,0.05), inset 1px 1px 3px rgba(255,255,255,1);}
.cat-pill input:checked + span { background: #DBEAFE; color: #2563EB; border-color: #93C5FD; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.05);}

.btn-primary { background: #3B82F6; color: white; font-weight: 800; font-size: 1.1rem; border: none; border-radius: 16px; cursor: pointer; display: flex; align-items: center; transition: all 0.2s; font-family: 'Quicksand'; box-shadow: inset -3px -3px 8px rgba(0,0,0,0.15), inset 3px 3px 8px rgba(255,255,255,0.3), 0 4px 10px rgba(59, 130, 246, 0.3); position: relative; overflow: hidden;}
.btn-primary:hover { background: #2563EB; transform: translateY(-1px);}
.btn-primary:active { transform: scale(0.96); box-shadow: inset 3px 3px 8px rgba(0,0,0,0.15), inset -3px -3px 8px rgba(255,255,255,0.2); }

#dragOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(59, 130, 246, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 100000; display: none; justify-content: center; align-items: center; color: white; font-family: 'Playfair Display', serif; font-size: 3rem; pointer-events: none;}

/* --- 3D BOOK --- */
.book-viewer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: none; justify-content: center; align-items: center; z-index: 10000; perspective: 2000px; overflow: hidden;}
.book-wrapper { position: relative; width: 90vw; max-width: 1100px; height: 85vh; margin: 0 auto; display: flex; justify-content: center; align-items: center; }

.leaf { position: absolute; top: 0; width: 50%; height: 100%; right: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1); cursor: pointer;}
.leaf::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 30px; background: linear-gradient(to right, rgba(0,0,0,0.3), transparent); z-index: 100; opacity: 0; transition: opacity 0.3s; pointer-events: none;}
.leaf.flipped::before { opacity: 0.8; }
.leaf.flipped { transform: rotateY(-180deg); }

.page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 4px; overflow: hidden; }
.page.back { transform: rotateY(180deg);}

.cover-front { 
    background-color: #2C3E50; 
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.08"/></svg>');
    padding: 40px 20px; border-radius: 4px 16px 16px 4px; 
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.2), 10px 10px 30px rgba(0,0,0,0.5);
    border-left: 20px solid #1A252F; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
.cover-front::after { content: ''; position: absolute; left: 24px; top: 0; bottom: 0; width: 2px; border-left: 2px dashed rgba(255,255,255,0.2); }
.cover-front-inner-frame { background: #FAFAFA; padding: 15px 15px 45px 15px; box-shadow: 0 15px 35px rgba(0,0,0,0.3); transform: rotate(-2deg); margin-bottom: 40px; width: 85%; position: relative;}
.cover-front-inner-frame::before { content: ''; position: absolute; top: -15px; left: 50%; transform: translateX(-50%) rotate(2deg); width: 80px; height: 26px; background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.2) 5px, rgba(255,255,255,0.2) 10px), rgba(253, 224, 71, 0.85); box-shadow: 0 2px 5px rgba(0,0,0,0.15);}
.cover-front-inner-frame img { width: 100%; height: 240px; object-fit: cover; border-radius: 2px; }
.cover-front h2 { font-family: 'Caveat', cursive; font-size: 3.8rem; text-align: center; color: #1E293B; margin: 0; background: #FDFBF7; padding: 8px 30px; border-radius: 4px; box-shadow: inset 0 0 10px rgba(0,0,0,0.05), 0 5px 15px rgba(0,0,0,0.25); transform: rotate(1deg); }
.cover-back { background: #2C3E50; background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.08"/></svg>'); border-radius: 16px 4px 4px 16px; box-shadow: inset 10px 0 20px rgba(0,0,0,0.2); border-right: 20px solid #1A252F;}

.paper-page { overflow: hidden; position: relative; transition: background 0.3s;}
.paper-parchment { 
    background-color: #E6D5B8;
    background-image: radial-gradient(#94A3B8 1px, transparent 1px), url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.05"/></svg>');
    background-size: 20px 20px, 100% 100%;
}
.paper-grid { background-color: #F8FAFC; background-image: linear-gradient(#E2E8F0 1px, transparent 1px), linear-gradient(90deg, #E2E8F0 1px, transparent 1px); background-size: 20px 20px;}
.paper-dark { background-color: #1E293B; background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.1"/></svg>'); color: white !important;}

.paper-page::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 12px; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 12" preserveAspectRatio="none"><path d="M0 12 L5 2 L10 10 L15 0 L20 11 L25 3 L30 12 L35 4 L40 11 L45 2 L50 12 L55 1 L60 10 L65 3 L70 11 L75 2 L80 12 L85 4 L90 11 L95 1 L100 12 Z" fill="%23D4C4A8" opacity="0.5"/></svg>'); background-size: 40px 12px; z-index: 1; pointer-events: none;}
.paper-grid::after { opacity: 0.2;}
.paper-dark::after { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 12" preserveAspectRatio="none"><path d="M0 12 L5 2 L10 10 L15 0 L20 11 L25 3 L30 12 L35 4 L40 11 L45 2 L50 12 L55 1 L60 10 L65 3 L70 11 L75 2 L80 12 L85 4 L90 11 L95 1 L100 12 Z" fill="%230F172A" opacity="0.8"/></svg>');}

.page.front.paper-page { border-left: 1px solid rgba(0,0,0,0.15); box-shadow: inset 20px 0 25px -10px rgba(0,0,0,0.25); }
.page.back.paper-page { border-right: 1px solid rgba(0,0,0,0.15); box-shadow: inset -20px 0 25px -10px rgba(0,0,0,0.25); border-radius: 16px 4px 4px 16px; }

.page-number { position: absolute; bottom: 18px; font-family: 'Quicksand', sans-serif; font-size: 0.9rem; color: #64748B; font-weight: 700; pointer-events: none; z-index: 2;}
.page.front .page-number { right: 20px;}
.page.back .page-number { left: 20px; }
.paper-dark .page-number { color: #94A3B8; }

.absolute-drag { position: absolute; cursor: grab; z-index: 10; touch-action: none; will-change: top, left, transform, box-shadow; outline: none; }
.absolute-drag:active { cursor: grabbing; }
.absolute-drag.dragging { box-shadow: 0 25px 40px rgba(0,0,0,0.4) !important; z-index: 100 !important; }
@keyframes dropBounce { 0% { transform: scale(1.05); } 50% { transform: scale(0.97); } 100% { transform: scale(1);} }
.dropped-bounce { animation: dropBounce 0.2s ease-out; }

.polaroid { background: white; padding: 10px 10px 35px 10px; box-shadow: 0 6px 15px rgba(0,0,0,0.2); border-radius: 2px; width: 42%; max-width: 200px; transition: box-shadow 0.2s;}

.washi-tape { position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-2deg); width: 65px; height: 22px; z-index: 11; cursor: pointer; transition: transform 0.2s;}
.washi-tape:hover { transform: translateX(-50%) rotate(-2deg) scale(1.1); }
.tape-1 { background: rgba(253, 224, 71, 0.85); box-shadow: 0 1px 3px rgba(0,0,0,0.15); background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.2) 5px, rgba(255,255,255,0.2) 10px); transform: translateX(-50%) rotate(3deg); }
.tape-2 { background: rgba(147, 197, 253, 0.85); box-shadow: 0 1px 3px rgba(0,0,0,0.15); transform: translateX(-50%) rotate(-3deg); background-image: repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(255,255,255,0.25) 4px, rgba(255,255,255,0.25) 8px);}
.tape-3 { background: rgba(244, 114, 182, 0.85); box-shadow: 0 1px 3px rgba(0,0,0,0.15); transform: translateX(-50%) rotate(1deg); background-image: radial-gradient(rgba(255,255,255,0.4) 2px, transparent 2px); background-size: 8px 8px; }
.tape-none { display: none; }

.polaroid:hover { box-shadow: 0 15px 30px rgba(0,0,0,0.3); }
.polaroid-inner { position: relative; width: 100%; pointer-events: none;}
.polaroid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border: 1px solid rgba(0,0,0,0.05); pointer-events: none;}
.polaroid .caption { position: absolute; bottom: -28px; left: 0; width: 100%; text-align: center; font-family: 'Caveat', cursive; font-size: 1.4rem; color: #111; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

.custom-text-box { font-family: 'Caveat', cursive; font-size: 2.5rem; color: #1E293B; min-width: 150px; min-height: 40px; padding: 5px 10px; border: 2px dashed rgba(0,0,0,0.15); cursor: grab; user-select: none; text-shadow: 1px 1px 0px rgba(255,255,255,0.8); white-space: pre-wrap; z-index: 15; text-align: center; }
.paper-dark .custom-text-box { color: #F8FAFC; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); border-color: rgba(255,255,255,0.2); }
.custom-text-box[contenteditable="true"] { border: 2px dashed #93C5FD; outline: none; background: rgba(255,255,255,0.6); border-radius: 8px; cursor: text; user-select: auto; }
.paper-dark .custom-text-box[contenteditable="true"] { background: rgba(0,0,0,0.5);}

@keyframes writeText { 0% { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); opacity: 0; transform: translateX(-10px);} 100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 1; transform: translateX(0);} }
.text-animate { animation: writeText 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

.scrapbook-sticker { font-size: 3rem; cursor: grab; z-index: 12; user-select: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); text-shadow: none; display: flex; align-items: center; justify-content: center;}

#stickerTray { position: absolute; top: -70px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); padding: 10px 15px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: none; gap: 12px; font-size: 1.8rem; z-index: 10003; }
#stickerTray.show { display: flex; animation: slideDown 0.3s ease; }
.sticker-item { cursor: pointer; transition: transform 0.2s; user-select: none; }
.sticker-item:hover { transform: scale(1.3); }

.text-controls { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,0.95); padding: 15px 20px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); display: none; flex-wrap: wrap; gap: 15px; z-index: 10002; justify-content: center; align-items: center; width: 90%; max-width: 400px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.text-controls.show { display: flex; animation: slideDown 0.3s ease;}
.text-controls label { display: flex; flex-direction: column; font-size: 0.8rem; font-weight: bold; color: #475569; width: 45%; }
.text-controls input[type="range"] { width: 100%; margin-top: 5px; }

.ink-colors { display: flex; gap: 10px; width: 100%; justify-content: center; margin: 5px 0;}
.ink-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); cursor: pointer; transition: transform 0.2s;}
.ink-btn:hover { transform: scale(1.2);}
.ink-navy { background: #1E293B; } .ink-red { background: #EF4444; } .ink-blue { background: #3B82F6; } .ink-gold { background: #F59E0B;} .ink-white { background: #FFFFFF; }

.text-controls .ctrl-btns { display: flex; gap: 10px; width: 100%; justify-content: center; margin-top: 5px;}
.text-controls button.action-btn { padding: 8px 20px; border-radius: 20px; border: none; font-weight: bold; cursor: pointer; position: relative; overflow: hidden;}
.btn-done { background: #3B82F6; color: white; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.1), inset 2px 2px 5px rgba(255,255,255,0.3);}
.btn-del { background: #FEE2E2; color: #EF4444; box-shadow: inset -2px -2px 5px rgba(239,68,68,0.1), inset 2px 2px 5px rgba(255,255,255,1);}

.book-close-btn { position: absolute; top: 20px; right: 30px; font-size: 3rem; cursor: pointer; color: white; z-index: 100; font-weight: bold; line-height: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.5);}
.book-controls { position: absolute; bottom: 20px; width: 100%; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; z-index: 100; pointer-events: none;}
.book-controls span { background: rgba(255,255,255,0.2); color: white; padding: 10px 20px; border-radius: 30px; font-family: 'Quicksand', sans-serif; font-weight: 700; backdrop-filter: blur(4px); pointer-events: auto; cursor: pointer; border: 1px solid rgba(255,255,255,0.3); position: relative; overflow: hidden; font-size: 0.9rem;}
.book-controls span.btn-accent { background: #3B82F6; border-color: #60A5FA; box-shadow: inset -2px -2px 5px rgba(0,0,0,0.1), inset 2px 2px 5px rgba(255,255,255,0.3);}
.book-controls span.btn-danger { background: rgba(239, 68, 68, 0.8); border-color: #F87171;}
.book-controls span:hover { background: rgba(255,255,255,0.4); }

.viewer-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 10000; padding: 20px; transition: transform 0.2s; overflow: hidden;}
.viewer-blur-bg { position: absolute; top: -10%; left: -10%; width: 120%; height: 120%; background-size: cover; background-position: center; filter: blur(60px) brightness(0.7); opacity: 0.6; z-index: -1; transition: background-image 0.4s ease; }
.viewer-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 2rem; cursor: pointer; z-index: 10001; }
.viewer-img-container { position: relative; width: 100%; height: 65vh; display: flex; align-items: center; justify-content: center; touch-action: none; z-index: 2;}
.viewer-modal img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.1); object-fit: contain; transition: transform 0.1s ease-out; transform-origin: center center;}
.swipe-indicator { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); width: 40px; height: 5px; background: rgba(255,255,255,0.3); border-radius: 5px; display: none;} 
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 3rem; cursor: pointer; user-select: none; opacity: 0.7; transition: opacity 0.2s; padding: 20px; z-index: 3;}
.nav-arrow:hover { opacity: 1;} .nav-arrow.left { left: 20px; } .nav-arrow.right { right: 20px; }

.viewer-text { color: white; text-align: center; margin-top: 15px; z-index: 2;}
.viewer-caption { font-family: 'Playfair Display', serif; font-size: 1.6rem;font-style: italic; margin-bottom: 5px; text-shadow: 0 2px 4px rgba(0,0,0,0.5);}
.viewer-date { font-size: 0.9rem; color: #94A3B8; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;}
.viewer-location { font-size: 0.9rem; color: #93C5FD; font-weight: 600; margin-top: 4px;}
.btn-set-cover { margin-top: 15px; background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.3); padding: 8px 20px; border-radius: 20px; cursor: pointer; font-family: 'Quicksand'; font-weight: 700; backdrop-filter: blur(4px); transition: background 0.2s;}

.main-footer { text-align: center; padding: 30px; font-size: 0.9rem; color: #64748B; font-weight: 500; border-top:1px solid rgba(0,0,0,0.04); margin-top: 10px; padding-bottom: 140px; }
.empty-state { width: 100%; text-align: center; padding: 60px 20px; display: none; column-span: all; -webkit-column-span: all; }
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 1.8rem; color: #475569; margin-bottom: 10px;}

@media (max-width: 1024px) { 
    .gallery-container { columns: 3;} 
    .gallery-container.view-all-grid { column-count: 3; column-width: auto;}
}
@media (max-width: 768px) {
    .gallery-container { column-count: 3; column-width: auto !important; padding: 0 10px; column-gap: 12px; margin-top: 0;}
    .gallery-item { padding: 8px; margin-bottom: 15px;}
    .navbar { flex-direction: column; text-align: center; justify-content: center; padding: 15px; }
    .nav-brand { flex-direction: column; text-align: center; gap: 12px; }
    .nav-brand > div:last-child { margin-left: 0 !important; justify-content: center; width: 100%; margin-top: 5px; }
    .nav-brand h1 { font-size: 1.8rem; justify-content: center; }
    .nav-icon { width: 60px; height: 60px; margin: 0 auto; }
    
    .book-wrapper { width: 95vw; height: 75vh;}
    .leaf { width: 100%; right: auto; left: 0; }
    .leaf.flipped { transform: rotateY(-90deg); opacity: 0; transition: transform 0.5s, opacity 0.4s 0.1s; pointer-events: none;}
    .page.back { display: none;} 
    .upload-content { padding: 25px 20px 40px 20px; }
    .swipe-indicator { display: block;} 
    .nav-arrow { display: none; } 
}
@media (max-width: 500px) { 
    .gallery-container { column-count: 2 !important; column-width: auto !important; padding: 0 8px; column-gap: 8px; }
    .gallery-item { margin-bottom: 12px; padding: 6px;}
    .memory-details { margin-top: 6px; padding: 0 16px 4px 16px; min-height: 30px;} 
    .memory-caption { font-size: 0.9rem; line-height: 1.1; margin-bottom: 2px;}
    .memory-date { font-size: 0.45rem; }
    .corner-psyduck { width: 22px; height: 22px; bottom: 6px; right: 6px; }
    .gallery-item::before { width: 40px; height: 14px; top: -7px;} 
    .album-carousel { padding: 10px 15px 20px 15px; gap: 15px;}
    .album-stack-card { flex: 0 0 180px; min-height: 220px; padding: 15px; border-left-width: 12px;}
    .album-preview-frame { padding: 6px 6px 20px 6px; margin-bottom: 15px;}
    .album-stack-card h3 { font-size: 1.5rem; }
    .album-tab { font-size: 0.65rem; padding: 4px 12px;}
    .filter-btn { padding: 8px 16px; font-size: 0.85rem;}
    .btn-action { width: 34px; height: 34px; }
    .btn-action svg { width: 16px; height: 16px; }
    .fab-wrapper { bottom: 15px; right: 15px; }
    .fab-psyduck { width: 75px; margin-bottom: -15px; right: 0px;}
    .fab-camera-btn { width: 54px; height: 54px; border-width: 2px;}
    .fab-camera-btn svg { width: 22px; height: 22px; }
    .fab-text-badge { font-size: 0.7rem; padding: 6px 12px; margin-top: -8px; }
    .gallery-container.view-all-grid { column-count: 3 !important; column-width: auto !important; column-gap: 6px;}
   /* .gallery-container.view-all-grid .photo-wrapper { aspect-ratio: 1 / 1; }
    .gallery-container.view-all-grid .main-photo { height: 100%; object-fit: cover; }*/
    .gallery-container.view-all-grid .memory-details { padding: 8px 4px 2px 4px; min-height: auto; align-items: center; text-align: center;}
    .gallery-container.view-all-grid .memory-caption { font-size: 1.15rem; text-align: center; width: 100%; margin-bottom: 2px;}
    .gallery-container.view-all-grid .memory-date { font-size: 0.5rem; text-align: center; width: 100%;}
    .gallery-container.view-all-grid .badge-container { display: none; }
    .gallery-container.view-all-grid .corner-psyduck { width: 16px; height: 16px; bottom: 4px; right: 4px; }
    .polaroid { width: 45%; padding: 4px 4px 20px 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.15);}
    .polaroid .caption { font-size: 1rem; bottom: -18px;}
    .upload-type-container { flex-direction: row; }
    .upload-card .title { font-size: 0.9rem;}
    .upload-card .subtitle { display: none; }
    .custom-text-box { font-size: 2rem;}
}

/* Upload UI Status indicators */
.upload-file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 150px; overflow-y: auto; }
.upload-item { display: flex; align-items: center; justify-content: space-between; background: #F8FAFC; padding: 8px 12px; border-radius: 12px; border: 1px solid #E2E8F0; font-size: 0.85rem; font-weight: 600; }
.upload-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; color: #475569;}
.upload-item-status { font-weight: 800; }
.status-pending { color: #94A3B8; }
.status-uploading { color: #3B82F6; }
.status-success { color: #10B981; }
.status-error { color: #EF4444;}

/* Map View UI */
.custom-map-pin { background: transparent; border: none; }
.pin-wrapper { position: relative; width: 40px; height: 40px; background: white; border-radius: 50%; padding: 3px; box-shadow: 0 4px 10px rgba(0,0,0,0.3); border: 2px solid #3B82F6; transition: transform 0.2s;}
.pin-wrapper:hover { transform: scale(1.1) translateY(-5px); z-index: 1000 !important;}
.pin-wrapper::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid #3B82F6;}
.pin-wrapper img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.leaflet-popup-content-wrapper { border-radius: 12px; padding: 0; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: none;}
.leaflet-popup-content { margin: 0; width: 220px !important; }
.map-popup-img { width: 100%; height: 140px; object-fit: cover; display: block; }
.map-popup-info { padding: 12px; text-align: center; }
.map-popup-cap { font-family: 'Caveat', cursive; font-size: 1.4rem; color: #1E293B; margin-bottom: 2px; line-height: 1.1; }
.map-popup-date { font-size: 0.7rem; color: #94A3B8; font-weight: 700; text-transform: uppercase; }