* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== CUSTOM PROPERTIES ==================== */
:root {
    /* Vintage Gold Palette */
    --gold-primary: #d4af37;
    --gold-light: #ffd700;
    --gold-dark: #b8960c;
    --gold-muted: #c5a572;
    
    /* Warm Tones */
    --cream: #f4e8d0;
    --cream-dark: #e8d9b8;
    --parchment: #f5eed5;
    --sepia: #704214;
    --sepia-light: #8b5a2b;
    --burgundy: #722f37;
    --burgundy-dark: #4a1c23;
    
    /* Shadows */
    --shadow-warm: rgba(112, 66, 20, 0.6);
    --shadow-dark: rgba(30, 20, 10, 0.9);
    
    /* Backgrounds */
    --bg-dark: #1a0f0a;
    --bg-darker: #0d0705;
    
    /* Particle Colors */
    --particle-gold: #ffd700;
    --particle-amber: #ffbf00;
    --particle-bronze: #cd7f32;
}

/* ==================== PAGE LOADER OVERLAY — Two Sorcerers ==================== */
.page-loader {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, #2a1a0c 0%, var(--bg-dark) 45%, var(--bg-darker) 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Darkened edges to focus the eye on the sigil */
.loader-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 42%, transparent 30%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}

/* Rising embers field */
.loader-embers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.ember {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-light) 0%, var(--gold-primary) 60%, transparent 100%);
    box-shadow: 0 0 8px rgba(255, 191, 0, 0.8);
    opacity: 0;
    animation: emberRise linear infinite;
}

@keyframes emberRise {
    0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
    10%  { opacity: var(--ember-opacity, 0.9); }
    80%  { opacity: var(--ember-opacity, 0.9); }
    100% { transform: translateY(-105vh) translateX(var(--ember-drift, 20px)) scale(0.3); opacity: 0; }
}

/* ---- Central stage that holds rings + sigil ---- */
.loader-stage {
    position: relative;
    width: 220px;
    height: 220px;
    display: grid;
    place-items: center;
    margin-bottom: 38px;
}

/* Soft magical aura behind everything */
.arcane-aura {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,175,55,0.28) 0%, rgba(212,175,55,0.08) 40%, transparent 70%);
    filter: blur(6px);
    animation: auraBreathe 3.4s ease-in-out infinite;
}

@keyframes auraBreathe {
    0%, 100% { transform: scale(0.9); opacity: 0.55; }
    50%      { transform: scale(1.12); opacity: 1; }
}

/* ---- Runic scrying rings ---- */
.rune-ring {
    position: absolute;
    border-radius: 50%;
}

.rune-ring-outer {
    width: 200px;
    height: 200px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: inset 0 0 18px rgba(212,175,55,0.18), 0 0 22px rgba(212,175,55,0.12);
    animation: spinCW 18s linear infinite;
}

/* Dashed "rune tick" ring drawn with a conic mask feel via repeating gradient border */
.rune-ring-ticks {
    width: 168px;
    height: 168px;
    border: 2px dashed rgba(255, 215, 0, 0.45);
    animation: spinCCW 9s linear infinite;
}

.rune-ring-inner {
    width: 132px;
    height: 132px;
    border: 1px solid transparent;
    border-top-color: var(--gold-light);
    border-right-color: var(--gold-primary);
    border-bottom-color: rgba(205, 127, 50, 0.6);
    box-shadow: 0 0 16px rgba(212,175,55,0.35);
    animation: spinCW 2.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

@keyframes spinCW  { to { transform: rotate(360deg); } }
@keyframes spinCCW { to { transform: rotate(-360deg); } }

/* ---- The two sorcerers orbiting the tome ---- */
.sorcerer-orbit {
    position: absolute;
    width: 200px;
    height: 200px;
}

.orbit-a { animation: spinCW 3.6s linear infinite; }
.orbit-b { animation: spinCCW 3.6s linear infinite; }

.sorcerer-orb {
    position: absolute;
    top: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
}

.orb-gold {
    background: radial-gradient(circle at 35% 30%, #fff6d8, var(--gold-light) 45%, var(--gold-dark) 100%);
    box-shadow: 0 0 14px 3px rgba(255, 215, 0, 0.85), 0 0 26px rgba(255,215,0,0.4);
}

.orb-ember {
    background: radial-gradient(circle at 35% 30%, #ffe1b0, var(--particle-amber) 45%, var(--burgundy) 120%);
    box-shadow: 0 0 14px 3px rgba(255, 145, 40, 0.85), 0 0 26px rgba(255,120,20,0.4);
}

.orbit-b .sorcerer-orb { top: auto; bottom: -7px; }

/* Comet trail behind each orb */
.sorcerer-orb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 3px;
    transform: translate(-100%, -50%);
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, currentColor);
    opacity: 0.5;
}
.orb-gold  { color: var(--gold-light); }
.orb-ember { color: var(--particle-amber); }

/* ---- Central enchanted disc / sigil ---- */
.loader-sigil {
    position: relative;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
}

.sigil-disc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle at 50% 50%,
            rgba(0,0,0,0.55) 0 3px, rgba(40,25,12,0.55) 3px 6px);
    box-shadow: inset 0 0 14px rgba(0,0,0,0.8), 0 0 22px rgba(212,175,55,0.45);
    border: 1px solid rgba(212,175,55,0.5);
    animation: spinCW 4s linear infinite;
}

.sigil-core {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff3cf 0%, var(--gold-primary) 55%, var(--gold-dark) 100%);
    box-shadow: 0 0 18px rgba(255,215,0,0.7);
    animation: pulseGlow 1.6s ease-in-out infinite;
}

.sigil-note {
    position: relative;
    z-index: 2;
    font-size: 1.15em;
    color: var(--bg-darker);
    animation: noteBob 1.6s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(0.85); opacity: 0.8; }
    50%      { transform: scale(1.08); opacity: 1; }
}

@keyframes noteBob {
    0%, 100% { transform: translateY(1px) rotate(-4deg); }
    50%      { transform: translateY(-2px) rotate(4deg); }
}

/* ---- Title + flavor text ---- */
.loader-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-weight: 900;
    color: var(--gold-light);
    font-size: clamp(1.1em, 4vw, 1.7em);
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 16px rgba(212,175,55,0.55), 0 2px 4px rgba(0,0,0,0.6);
    margin-bottom: 12px;
    animation: titleShimmer 3s ease-in-out infinite;
}

@keyframes titleShimmer {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.35); }
}

.loader-text {
    font-family: 'Cinzel', serif;
    color: var(--gold-muted);
    font-size: clamp(0.8em, 2.5vw, 1em);
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    min-height: 1.2em;
    transition: opacity 0.4s ease;
}

.loader-text.swap { opacity: 0; }

/* ---- Gilded progress bar ---- */
.loader-progress {
    position: relative;
    width: min(260px, 70vw);
    height: 4px;
    background: rgba(212, 175, 55, 0.18);
    border-radius: 3px;
    margin-top: 24px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.loader-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold-primary));
    background-size: 200% 100%;
    width: 0%;
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(255,215,0,0.7);
    animation: progressShimmer 1.5s ease-in-out infinite;
    transition: width 0.35s ease;
}

@keyframes progressShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .page-loader * {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
    }
    .loader-embers { display: none; }
}

/* ==================== FLOATING PARTICLES BACKGROUND ==================== */
.particles-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: floatParticle linear infinite;
}

/* Different particle sizes and colors */
.floating-particle.small {
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, var(--particle-gold), transparent);
    box-shadow: 0 0 6px var(--particle-gold);
    opacity: 0.4;
}

.floating-particle.medium {
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, var(--particle-amber), transparent);
    box-shadow: 0 0 10px var(--particle-amber);
    opacity: 0.5;
}

.floating-particle.large {
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, var(--particle-bronze), transparent);
    box-shadow: 0 0 15px var(--particle-bronze);
    opacity: 0.3;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: var(--particle-opacity, 0.5);
    }
    90% {
        opacity: var(--particle-opacity, 0.5);
    }
    100% {
        transform: translateY(-100px) translateX(var(--drift, 50px)) rotate(360deg);
        opacity: 0;
    }
}

/* Stardust sparkle effect */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold-light);
    border-radius: 50%;
    animation: sparkleEffect 3s ease-in-out infinite;
    box-shadow: 
        0 0 4px var(--gold-light),
        0 0 8px var(--gold-primary);
}

@keyframes sparkleEffect {
    0%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== TYPOGRAPHY & HEADINGS ==================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel Decorative', cursive;
    color: var(--gold-light);
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5em;
}

h1 { font-size: clamp(1.8em, 5vw, 3em); font-weight: 700; }
h2 { font-size: clamp(1.6em, 4vw, 2.4em); }
h3 { font-size: clamp(1.4em, 3.5vw, 2em); }
h4 { font-size: clamp(1.2em, 3vw, 1.6em); }
h5 { font-size: clamp(1em, 2.5vw, 1.4em); }
h6 { font-size: clamp(0.9em, 2vw, 1em); }

/* ==================== BODY & LAYOUT ==================== */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Cinzel', serif;
    background: url('https://assets.dinuping.com/assets/music/images/grama.jpg') center/cover fixed;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    padding-bottom: 100px;
    position: relative;
    z-index: 0;
    min-height: 100vh;
    opacity: 0;
    animation: bodyReveal 0.8s ease-out 0.3s forwards;
}

@keyframes bodyReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    background-attachment: fixed;
    filter: blur(3px) brightness(0.7) sepia(20%);
    transform: scale(1.05);
    z-index: -1;
}

/* ==================== HEADER ==================== */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    backdrop-filter: blur(15px) saturate(180%);
    background: linear-gradient(180deg, 
        rgba(26, 15, 10, 0.95), 
        rgba(26, 15, 10, 0.85));
    z-index: 9998;
    padding: 12px 0;
    border-bottom: 3px solid var(--gold-primary);
    box-shadow: 
        0 5px 30px var(--shadow-dark),
        0 0 40px rgba(212, 175, 55, 0.2);
    animation: headerSlideDown 0.6s ease-out 0.5s both;
}

@keyframes headerSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.book-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: clamp(1.1em, 3.5vw, 1.8em);
    background: linear-gradient(135deg, #ffd700, #d4af37, #b8960c);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    animation: titleShine 4s ease-in-out infinite;
    flex: 1;
    min-width: 0;
}

@keyframes titleShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.back-btn {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(184, 150, 12, 0.25));
    color: var(--gold-light);
    border: 2px solid var(--gold-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-size: clamp(0.8em, 2vw, 1em);
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.back-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.back-btn:hover::before {
    width: 300px;
    height: 300px;
}

.back-btn:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(184, 150, 12, 0.4));
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.back-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ==================== CHAPTER CONTENT ==================== */
.chapter-content {
    margin-top: var(--header-h, 120px);
    padding: 20px 10px;
    position: relative;
    width: 100%;
    max-width: 100%;
    /* Hidden until access is granted; revealed via body.revealed for a smooth,
       flash-free magical entrance. */
    opacity: 0;
    transform: translateY(30px);
}

@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.chapter-header {
    text-align: center;
    margin-bottom: 30px;
    background: var(--cream);
    padding: clamp(20px, 4vw, 40px);
    border-radius: 12px;
    max-width: 900px;
    margin: 0 auto 30px;
    box-shadow: 
        0 10px 40px var(--shadow-warm),
        inset 0 0 60px rgba(244, 232, 208, 0.5);
    border: 3px solid var(--gold-primary);
    animation: headerReveal 0.8s ease-out 0.8s both;
}

@keyframes headerReveal {
    from { 
        opacity: 0; 
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

/* ==================== PHOTO GRID - ENHANCED ==================== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* ==================== PHOTO CARD - SKELETON LOADING ==================== */
.photo-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 9 / 16;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-color: var(--bg-darker);
    box-shadow: 
        0 8px 25px var(--shadow-warm),
        inset 0 0 0 3px var(--gold-primary);
    animation: cardFadeIn 0.6s ease-out backwards;
    transform-style: preserve-3d;
}

/* Skeleton Loading State */
.photo-card.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        rgba(26, 15, 10, 1) 0%,
        rgba(45, 30, 20, 1) 30%,
        rgba(60, 40, 25, 1) 50%,
        rgba(45, 30, 20, 1) 70%,
        rgba(26, 15, 10, 1) 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    z-index: 10;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading Icon Overlay */
.photo-card.loading::after {
    content: '♪';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: var(--gold-muted);
    z-index: 11;
    animation: loadingNote 1s ease-in-out infinite;
}

@keyframes loadingNote {
    0%, 100% { 
        opacity: 0.3; 
        transform: translate(-50%, -50%) scale(0.9);
    }
    50% { 
        opacity: 0.8; 
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Staggered animation delays */
.photo-card:nth-child(1) { animation-delay: 0.1s; }
.photo-card:nth-child(2) { animation-delay: 0.15s; }
.photo-card:nth-child(3) { animation-delay: 0.2s; }
.photo-card:nth-child(4) { animation-delay: 0.25s; }
.photo-card:nth-child(5) { animation-delay: 0.3s; }
.photo-card:nth-child(6) { animation-delay: 0.35s; }
.photo-card:nth-child(7) { animation-delay: 0.4s; }
.photo-card:nth-child(8) { animation-delay: 0.45s; }
.photo-card:nth-child(9) { animation-delay: 0.5s; }
.photo-card:nth-child(10) { animation-delay: 0.55s; }
.photo-card:nth-child(11) { animation-delay: 0.6s; }
.photo-card:nth-child(12) { animation-delay: 0.65s; }

@keyframes cardFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.85) translateY(30px);
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0);
    }
}

/* Image with smooth reveal */
.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: sepia(10%) saturate(1.1);
    opacity: 0;
}

.photo-card img.loaded {
    opacity: 1;
    animation: imageRevealSmooth 0.6s ease-out forwards;
}

@keyframes imageRevealSmooth {
    from { 
        opacity: 0; 
        filter: blur(10px) sepia(10%) saturate(1.1);
    }
    to { 
        opacity: 1; 
        filter: blur(0) sepia(10%) saturate(1.1);
    }
}

/* ==================== PARTICLE SYSTEM FOR CARDS ==================== */
.particle-container {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

/* Particle Variants */
.particle.gold {
    background: radial-gradient(circle, var(--gold-light), var(--gold-primary));
    box-shadow: 0 0 6px var(--gold-light), 0 0 12px rgba(255, 215, 0, 0.5);
}

.particle.amber {
    background: radial-gradient(circle, #ffbf00, #ff9500);
    box-shadow: 0 0 6px #ffbf00, 0 0 12px rgba(255, 191, 0, 0.5);
}

.particle.bronze {
    background: radial-gradient(circle, #cd7f32, #b8860b);
    box-shadow: 0 0 6px #cd7f32, 0 0 12px rgba(205, 127, 50, 0.5);
}

.particle.white {
    background: radial-gradient(circle, #fff, #f0e6d2);
    box-shadow: 0 0 8px #fff, 0 0 16px rgba(255, 255, 255, 0.5);
}

/* Particle Sizes */
.particle.xs { width: 3px; height: 3px; }
.particle.sm { width: 5px; height: 5px; }
.particle.md { width: 7px; height: 7px; }
.particle.lg { width: 10px; height: 10px; }

/* Particle Animation States */
.photo-card:hover .particle,
.photo-card.particle-active .particle {
    animation: particleFloat var(--duration, 3s) var(--delay, 0s) ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translate(var(--start-x, 0), var(--start-y, 0)) scale(0);
    }
    20% {
        opacity: 1;
        transform: translate(var(--mid-x, 0), var(--mid-y, 0)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x, 0), var(--end-y, 0)) scale(0.3);
    }
}

/* Burst effect on click */
.photo-card.particle-burst .particle {
    animation: particleBurst var(--burst-duration, 0.8s) ease-out forwards;
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--burst-x, 50px), var(--burst-y, -50px)) scale(0);
    }
}

/* Swirl particles for active state */
.photo-card.active .particle {
    animation: particleSwirl 4s linear infinite;
}

@keyframes particleSwirl {
    0% {
        opacity: 0.8;
        transform: rotate(0deg) translateX(var(--orbit-radius, 30px)) rotate(0deg);
    }
    100% {
        opacity: 0.8;
        transform: rotate(360deg) translateX(var(--orbit-radius, 30px)) rotate(-360deg);
    }
}

/* ==================== HOVER EFFECTS (Desktop) ==================== */
@media (hover: hover) {
    .photo-card:hover {
        transform: translateY(-10px) scale(1.03);
        box-shadow: 
            0 20px 50px var(--shadow-warm),
            inset 0 0 0 3px var(--gold-light),
            0 0 30px rgba(212, 175, 55, 0.3);
        z-index: 10;
    }

    .photo-card:hover img {
        filter: sepia(5%) saturate(1.2) brightness(1.05);
        transform: scale(1.1);
    }

    .photo-card:hover .music-overlay {
        opacity: 1;
    }
    
    .photo-card:hover .particle-container {
        opacity: 1;
    }
}

/* ==================== MUSIC OVERLAY ==================== */
.music-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(114, 47, 55, 0.9), 
        rgba(212, 175, 55, 0.85));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
    z-index: 6;
}

.music-icon {
    font-size: clamp(2em, 6vw, 3.5em);
    margin-bottom: 10px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    animation: iconBounce 1.5s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

.song-preview {
    font-family: 'Cinzel', 'Noto Sans Tamil', 'Noto Sans Malayalam', serif;
    color: #fff;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.3px;
    font-size: clamp(0.85em, 2vw, 1.05em);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    word-break: break-word;
    text-align: center;
    padding: 0 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* ==================== ACTIVE CARD STATE ==================== */
.photo-card.active {
    box-shadow: 
        0 10px 35px var(--shadow-warm),
        inset 0 0 0 4px var(--gold-light),
        0 0 40px rgba(212, 175, 55, 0.4);
    transform: scale(1.03);
}

.photo-card.active::after {
    content: '▶';
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
    color: var(--bg-darker);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    box-shadow: 0 4px 15px var(--shadow-warm);
    animation: playIconPulse 2s ease-in-out infinite;
    z-index: 15;
}

@keyframes playIconPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px var(--shadow-warm);
    }
    50% { 
        transform: scale(1.15);
        box-shadow: 0 4px 25px rgba(255, 215, 0, 0.6);
    }
}

/* Animated Border Glow for Active */
.photo-card.active::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(45deg, 
        var(--gold-light), 
        var(--gold-primary), 
        var(--burgundy),
        var(--gold-primary),
        var(--gold-light));
    background-size: 400% 400%;
    border-radius: 10px;
    z-index: -1;
    animation: borderGlow 3s ease infinite;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ==================== MUSIC PLAYER BAR - COMPLETELY REDESIGNED ==================== */
.music-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, 
        rgba(13, 7, 5, 0.98), 
        rgba(26, 15, 10, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 3px solid var(--gold-primary);
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 9999;
    box-shadow: 
        0 -8px 40px var(--shadow-dark),
        0 0 30px rgba(212, 175, 55, 0.15);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.music-player-bar.hidden {
    transform: translateY(100%);
}

/* Expand indicator on player bar */
.music-player-bar::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--gold-muted);
    border-radius: 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.music-player-bar:hover::before {
    width: 50px;
    opacity: 1;
    background: var(--gold-light);
}

.player-expand-hint {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(212, 175, 55, 0.9);
    color: var(--bg-darker);
    padding: 3px 10px;
    border-radius: 10px 10px 0 0;
    font-family: 'Cinzel', serif;
    font-size: 0.65em;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.music-player-bar:hover .player-expand-hint {
    opacity: 1;
    transform: translateX(-50%) translateY(-3px);
}

/* DESKTOP LAYOUT */
.player-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.player-album-art {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 4px 15px var(--shadow-warm);
    border: 2px solid var(--gold-primary);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.player-album-art.spinning {
    animation: albumSpin 25s linear infinite;
}

@keyframes albumSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player-info {
    flex: 1;
    min-width: 120px;
    max-width: 300px;
}

.player-song-title {
    font-family: 'Cinzel', 'Noto Sans Tamil', 'Noto Sans Malayalam', serif;
    font-size: 0.9em;
    color: var(--gold-light);
    margin-bottom: 2px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-song-artist {
    font-size: 0.75em;
    color: var(--gold-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.control-btn {
    background: linear-gradient(145deg, rgba(26, 15, 10, 0.9), rgba(45, 30, 20, 0.9));
    border: 2px solid var(--gold-primary);
    color: var(--gold-light);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.control-btn:hover::before {
    opacity: 1;
}

.control-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, rgba(45, 30, 20, 0.95), rgba(60, 40, 25, 0.95));
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.control-btn:active { 
    transform: translateY(0) scale(0.95);
}

.play-btn {
    background: linear-gradient(145deg, var(--gold-light), var(--gold-primary));
    color: var(--bg-darker);
    width: 44px;
    height: 44px;
    font-size: 1.1em;
    border: none;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.play-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.5);
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.time-display {
    font-size: 0.7em;
    color: var(--gold-primary);
    font-family: 'Cinzel', serif;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    height: 5px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--burgundy), var(--gold-primary), var(--gold-light));
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--gold-light);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
    transition: transform 0.2s ease;
}

.progress-bar:hover .progress-fill::after {
    transform: translateY(-50%) scale(1.3);
}

/* ==================== FULLSCREEN MODAL ==================== */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    overflow: hidden;
}

.fullscreen-modal.active {
    display: block;
    animation: modalFadeIn 0.5s ease;
}

@keyframes modalFadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

.modal-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(20px) brightness(0.3) sepia(30%);
    z-index: 1;
    transition: background-image 0.8s ease-in-out;
}

/* Smooth background transition */
.modal-background.transitioning {
    opacity: 0.7;
}

/* Modal Particles */
.modal-particles {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.modal-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold-light);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--gold-light);
    animation: modalParticleFloat 8s linear infinite;
}

@keyframes modalParticleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 0.8;
        transform: scale(1);
    }
    90% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) translateX(var(--drift, 0)) scale(0.5);
    }
}

.modal-content {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    padding: 80px 20px 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.modal-image {
    max-width: 90%;
    width: auto;
    max-height: 50vh;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 
        0 20px 80px var(--shadow-dark),
        0 0 50px rgba(212, 175, 55, 0.2);
    animation: imageReveal 0.6s ease;
    border: 4px solid var(--gold-primary);
    flex-shrink: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Image update animation */
.modal-image.updating {
    opacity: 0;
    transform: scale(0.95);
}

@keyframes imageReveal {
    0% { 
        transform: scale(0.8) rotate(-5deg); 
        opacity: 0;
        filter: blur(10px);
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1;
        filter: blur(0);
    }
}

/* ==================== VINTAGE LETTER MESSAGE BOX ==================== */
.message-card {
    max-width: 450px;
    width: 90%;
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #f5eed5 0%, #f4e8d0 20%, #e8d9b8 80%, #dbc9a8 100%);
    border-radius: 8px;
    padding: clamp(20px, 4vw, 35px);
    box-shadow: 
        0 15px 50px var(--shadow-warm),
        0 0 0 1px rgba(139, 90, 43, 0.3),
        inset 0 0 80px rgba(139, 90, 43, 0.1);
    animation: letterSlideIn 0.7s ease 0.3s both;
    position: relative;
    border: none;
    flex-shrink: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Message update animation */
.message-card.updating {
    opacity: 0;
    transform: translateY(20px);
}

/* Torn Edge Effect */
.message-card::before {
    content: '';
    position: absolute;
    inset: -8px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='tear'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.05' numOctaves='2' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='8' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='%23f4e8d0' filter='url(%23tear)'/%3E%3C/svg%3E");
    border-radius: 4px;
    z-index: -1;
    opacity: 0.6;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 8px;
}

/* Paper Fold Line */
.message-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(139, 90, 43, 0.15) 20%, rgba(139, 90, 43, 0.2) 50%, rgba(139, 90, 43, 0.15) 80%, transparent 100%);
    pointer-events: none;
}

@keyframes letterSlideIn {
    from { 
        transform: translateY(30px); 
        opacity: 0;
        filter: blur(5px);
    }
    to { 
        transform: translateY(0); 
        opacity: 1;
        filter: blur(0);
    }
}

/* Gold Wax Seal */
.message-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: radial-gradient(circle at 30% 30%, #ffd700 0%, #d4af37 40%, #b8960c 70%, #8b7a2e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    color: var(--bg-darker);
    box-shadow: 
        0 4px 15px var(--shadow-warm),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: sealBounce 0.8s ease 0.6s both;
}

@keyframes sealBounce {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.1) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.message-icon::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.message-icon::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px dashed rgba(139, 90, 43, 0.4);
}

.message-title {
    font-family: 'Cinzel Decorative', 'Cinzel', 'Noto Sans Tamil', 'Noto Sans Malayalam', serif;
    font-size: clamp(1.3em, 4vw, 1.9em);
    color: var(--sepia);
    text-align: center;
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.message-artist {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.8em, 2.2vw, 0.95em);
    color: var(--sepia-light);
    text-align: center;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.message-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-primary) 20%, var(--gold-dark) 50%, var(--gold-primary) 80%, transparent);
    margin: 15px 0;
    position: relative;
}

.message-divider::before {
    content: '✦';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--parchment);
    padding: 0 10px;
    color: var(--gold-primary);
    font-size: 0.8em;
}

.message-label {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.65em, 1.6vw, 0.75em);
    color: var(--sepia-light);
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.message-text {
    font-family: 'Libre Baskerville', 'Crimson Text', 'Noto Sans Tamil', 'Noto Sans Malayalam', Georgia, serif;
    color: var(--sepia);
    font-size: clamp(0.95em, 2.5vw, 1.1em);
    line-height: 1.8;
    text-align: center;
    font-style: italic;
}

.message-date {
    margin-top: 20px;
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--sepia-light);
    font-size: clamp(0.75em, 1.9vw, 0.85em);
    letter-spacing: 1px;
}

/* Corner Flourishes */
.message-card .corner-flourish {
    position: absolute;
    width: 35px;
    height: 35px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.message-card:hover .corner-flourish {
    opacity: 0.7;
}

.message-card .corner-flourish.top-left { 
    top: 8px; 
    left: 8px; 
    border-top: 2px solid var(--gold-primary); 
    border-left: 2px solid var(--gold-primary); 
}

.message-card .corner-flourish.top-right { 
    top: 8px; 
    right: 8px; 
    border-top: 2px solid var(--gold-primary); 
    border-right: 2px solid var(--gold-primary); 
}

.message-card .corner-flourish.bottom-left { 
    bottom: 8px; 
    left: 8px; 
    border-bottom: 2px solid var(--gold-primary); 
    border-left: 2px solid var(--gold-primary); 
}

.message-card .corner-flourish.bottom-right { 
    bottom: 8px; 
    right: 8px; 
    border-bottom: 2px solid var(--gold-primary); 
    border-right: 2px solid var(--gold-primary); 
}

/* Close Button */
.close-modal-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    background: linear-gradient(145deg, rgba(26, 15, 10, 0.95), rgba(45, 30, 20, 0.95));
    border: 2px solid var(--gold-primary);
    color: var(--gold-light);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4em;
    transition: all 0.3s ease;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px var(--shadow-warm);
}

.close-modal-btn:hover {
    background: linear-gradient(145deg, rgba(45, 30, 20, 0.95), rgba(60, 40, 25, 0.95));
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4);
}

.close-modal-btn:active { 
    transform: rotate(90deg) scale(0.95); 
}

/* ==================== AUDIO VISUALIZER ==================== */
.audio-visualizer {
    position: fixed;
    bottom: 88px;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 10002;
    pointer-events: none;
    background: linear-gradient(to top, rgba(13, 7, 5, 0.95), rgba(13, 7, 5, 0.3), transparent);
    display: none;
    overflow: hidden;
}

.visualizer-canvas { 
    width: 100%; 
    height: 100%; 
    display: block; 
}

.fullscreen-modal.active .audio-visualizer { 
    display: block; 
}

/* ==================== MODAL PLAYER BAR - COMPLETELY REDESIGNED ==================== */
.modal-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(13, 7, 5, 0.98), rgba(26, 15, 10, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 2px solid var(--gold-primary);
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 10003;
    box-shadow: 
        0 -8px 40px var(--shadow-dark), 
        0 0 30px rgba(212, 175, 55, 0.15);
}

/* DESKTOP LAYOUT */
.modal-player-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.modal-player-album-art {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 4px 12px var(--shadow-warm);
    border: 2px solid var(--gold-primary);
    flex-shrink: 0;
    transition: opacity 0.5s ease;
}

/* Album art update animation */
.modal-player-album-art.updating {
    opacity: 0.3;
}

.modal-player-album-art.spinning {
    animation: albumSpin 25s linear infinite;
}

.modal-player-info { 
    flex: 1;
    min-width: 120px;
    max-width: 300px;
}

.modal-player-song-title {
    font-family: 'Cinzel', 'Noto Sans Tamil', 'Noto Sans Malayalam', serif;
    font-size: 0.9em;
    color: var(--gold-light);
    margin-bottom: 2px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

.modal-player-song-artist {
    font-size: 0.75em;
    color: var(--gold-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

/* Text update animation */
.modal-player-song-title.updating,
.modal-player-song-artist.updating {
    opacity: 0.5;
}

.modal-player-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.modal-control-btn {
    background: linear-gradient(145deg, rgba(26, 15, 10, 0.9), rgba(45, 30, 20, 0.9));
    border: 2px solid var(--gold-primary);
    color: var(--gold-light);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-control-btn:active { 
    transform: scale(0.95); 
}

.modal-play-btn {
    background: linear-gradient(145deg, var(--gold-light), var(--gold-primary));
    color: var(--bg-darker);
    width: 44px;
    height: 44px;
    font-size: 1.1em;
    border: none;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.modal-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.modal-time-display {
    font-size: 0.7em;
    color: var(--gold-primary);
    font-family: 'Cinzel', serif;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.modal-progress-bar {
    flex: 1;
    height: 5px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.modal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--burgundy), var(--gold-primary), var(--gold-light));
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.modal-progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--gold-light);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
}

.modal-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-volume-control i {
    color: var(--gold-primary);
    font-size: 1em;
}

.modal-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(212, 175, 55, 0.25);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.modal-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--gold-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--gold-light);
}

.modal-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--gold-primary);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* ==================== UTILITY CLASSES ==================== */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out forwards;
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Content loaded state */
.content-ready .photo-card.loading::before,
.content-ready .photo-card.loading::after {
    display: none;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Desktop Large */
@media (min-width: 1400px) {
    .photo-grid { 
        grid-template-columns: repeat(6, 1fr); 
    }
    .modal-content {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 80px 40px 140px;
    }
    .modal-image {
        max-width: 45%;
        max-height: 70vh;
    }
    .message-card {
        max-width: 450px;
    }
}

/* Desktop */
@media (min-width: 1200px) and (max-width: 1399px) {
    .photo-grid { 
        grid-template-columns: repeat(5, 1fr); 
    }
}

/* Large Tablets */
@media (min-width: 1024px) and (max-width: 1199px) {
    .photo-grid { 
        grid-template-columns: repeat(4, 1fr); 
    }
}

/* Tablets Portrait & Landscape */
@media (max-width: 1023px) {
    body { 
        padding-bottom: 140px;
    }
    
    .photo-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 15px; 
    }
    
    .modal-content {
        padding: 70px 15px 150px;
    }
    
    .modal-image {
        max-width: 85%;
        max-height: 45vh;
    }
    
    .message-card {
        max-width: 85%;
    }
    
    .audio-visualizer {
        display: none !important;
    }

    /* MOBILE PLAYER BAR LAYOUT - STACKED */
    .player-container,
    .modal-player-container {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "album info"
            "controls controls"
            "progress progress";
        gap: 8px;
        row-gap: 10px;
    }

    .player-album-art,
    .modal-player-album-art {
        grid-area: album;
        width: 45px;
        height: 45px;
    }

    .player-info,
    .modal-player-info {
        grid-area: info;
        max-width: none;
    }

    .player-controls,
    .modal-player-controls {
        grid-area: controls;
        justify-content: center;
        width: 100%;
    }

    .progress-container,
    .modal-progress-container {
        grid-area: progress;
        width: 100%;
        min-width: auto;
    }

    .modal-volume-control {
        display: none;
    }
}

/* Mobile Landscape */
@media (max-height: 600px) and (orientation: landscape) {
    .modal-content { 
        padding: 50px 10px 150px; 
    }
    .modal-image { 
        max-height: 40vh; 
    }
    .message-card { 
        max-height: 50vh; 
        overflow-y: auto; 
    }
}

/* Mobile Large */
@media (max-width: 768px) {
    body { 
        padding-bottom: 150px;
    }
    
    .chapter-content { 
        margin-top: var(--header-h, 120px); 
    }
    
    .photo-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px;
        padding: 0 10px;
    }
    
    .modal-content {
        padding: 65px 12px 160px;
    }
    
    .modal-image {
        max-width: 92%;
        max-height: 40vh;
    }
    
    .message-card {
        max-width: 92%;
    }
    
    .close-modal-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2em;
    }
    
    .player-expand-hint {
        display: none;
    }
    
    .floating-particle:nth-child(n+10) {
        display: none;
    }
    
    .loader-stage {
        width: 180px;
        height: 180px;
        margin-bottom: 30px;
    }
    .arcane-aura,
    .rune-ring-outer,
    .sorcerer-orbit { width: 180px; height: 180px; }
    .rune-ring-ticks { width: 150px; height: 150px; }
    .rune-ring-inner { width: 118px; height: 118px; }

    /* MOBILE SPECIFIC PLAYER ADJUSTMENTS */
    .player-container,
    .modal-player-container {
        gap: 6px;
        row-gap: 8px;
    }

    .player-song-title,
    .modal-player-song-title {
        font-size: 0.85em;
    }

    .player-song-artist,
    .modal-player-song-artist {
        font-size: 0.7em;
    }

    .control-btn,
    .modal-control-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9em;
    }

    .play-btn,
    .modal-play-btn {
        width: 42px;
        height: 42px;
        font-size: 1.05em;
    }

    .time-display,
    .modal-time-display {
        font-size: 0.65em;
        min-width: 30px;
    }
}

/* Mobile Medium */
@media (max-width: 480px) {
    body { 
        padding-bottom: 165px;
    }
    
    .chapter-content {
        margin-top: var(--header-h, 120px);
        padding: 15px 8px;
    }
    
    .photo-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
        padding: 0 8px;
    }
    
    .modal-content { 
        padding: 60px 10px 170px;
    }
    
    .modal-image { 
        max-width: 95%; 
        max-height: 38vh;
    }
    
    .message-card { 
        max-width: 95%;
    }
    
    .close-modal-btn {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
    }
    
    .floating-particle:nth-child(n+6) {
        display: none;
    }
    
    .loader-stage {
        width: 156px;
        height: 156px;
        margin-bottom: 26px;
    }
    .arcane-aura,
    .rune-ring-outer,
    .sorcerer-orbit { width: 156px; height: 156px; }
    .rune-ring-ticks { width: 130px; height: 130px; }
    .rune-ring-inner { width: 104px; height: 104px; }

    /* EXTRA SMALL MOBILE PLAYER */
    .player-album-art,
    .modal-player-album-art {
        width: 42px;
        height: 42px;
    }

    .player-song-title,
    .modal-player-song-title {
        font-size: 0.8em;
    }

    .player-song-artist,
    .modal-player-song-artist {
        font-size: 0.68em;
    }

    .control-btn,
    .modal-control-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85em;
        gap: 5px;
    }

    .play-btn,
    .modal-play-btn {
        width: 40px;
        height: 40px;
        font-size: 1em;
    }

    .progress-bar,
    .modal-progress-bar {
        height: 4px;
    }

    .progress-fill::after,
    .modal-progress-fill::after {
        width: 8px;
        height: 8px;
        right: -4px;
    }
}

/* Mobile Small */
@media (max-width: 360px) {
    body { 
        padding-bottom: 175px;
    }
    
    .photo-grid {
        gap: 8px;
    }
    
    .modal-content { 
        padding: 55px 8px 180px; 
    }
    
    .message-card {
        padding: 18px 12px;
    }

    .player-controls,
    .modal-player-controls {
        gap: 4px;
    }

    .control-btn,
    .modal-control-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8em;
    }

    .play-btn,
    .modal-play-btn {
        width: 38px;
        height: 38px;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .control-btn, 
    .play-btn, 
    .back-btn, 
    .close-modal-btn, 
    .modal-control-btn, 
    .modal-play-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .photo-card:hover {
        transform: none;
        box-shadow: 
            0 8px 25px var(--shadow-warm), 
            inset 0 0 0 3px var(--gold-primary);
    }
    
    .photo-card:hover img { 
        filter: sepia(10%) saturate(1.1); 
        transform: none; 
    }
    
    .photo-card:hover .music-overlay { 
        opacity: 0; 
    }
    
    .photo-card:active { 
        opacity: 0.9;
        transform: scale(0.98);
    }

    .back-btn:active, 
    .control-btn:active, 
    .play-btn:active, 
    .close-modal-btn:active, 
    .modal-control-btn:active, 
    .modal-play-btn:active {
        transform: scale(0.95);
    }
    
    .photo-card img {
        animation: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-particle,
    .modal-particle,
    .sparkle,
    .particle {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --gold-primary: #ffd700;
        --gold-light: #ffff00;
        --shadow-warm: rgba(0, 0, 0, 0.8);
    }
    
    .photo-card {
        box-shadow: 0 0 0 4px var(--gold-light);
    }
}


/* ==================== ENCHANTED SIGN-IN GATE ==================== */
.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212,175,55,0.12), transparent 60%),
        linear-gradient(160deg, #0d0705 0%, #1a0f0a 45%, #120a16 100%);
    padding: 20px;
    overflow: hidden;
    transition: opacity 1s ease, filter 1s ease, transform 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-gate.hidden {
    display: none;
}

/* Magical dissolve when access is granted */
.auth-gate.dissolving {
    opacity: 0;
    filter: blur(14px) brightness(1.4);
    transform: scale(1.08);
    pointer-events: none;
}
.auth-gate.dissolving .auth-card {
    animation: cardAscend 1s ease forwards;
}
@keyframes cardAscend {
    to { transform: translateY(-30px) scale(0.92); opacity: 0; }
}

/* Gentle reveal of the page content beneath the gate */
.chapter-content { transition: opacity 1.1s ease 0.2s, transform 1.1s ease 0.2s; }
body.revealed .chapter-content { opacity: 1; transform: translateY(0); }

/* Drifting star field behind the card */
.gate-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.gate-stars .twinkle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffe9a8;
    border-radius: 50%;
    box-shadow: 0 0 6px #ffd700, 0 0 12px rgba(255,215,0,0.5);
    animation: twinkleFade var(--dur, 4s) ease-in-out infinite;
    opacity: 0;
}
@keyframes twinkleFade {
    0%, 100% { opacity: 0; transform: scale(0.6); }
    50% { opacity: 0.9; transform: scale(1.2); }
}

.auth-card {
    position: relative;
    z-index: 2;
    background:
        radial-gradient(circle at 50% -10%, rgba(212,175,55,0.18), transparent 55%),
        linear-gradient(180deg, rgba(30, 18, 12, 0.96), rgba(13, 7, 5, 0.98));
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 20px;
    padding: clamp(32px, 6vw, 52px) clamp(26px, 5vw, 46px);
    text-align: center;
    max-width: 430px;
    width: 100%;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(212, 175, 55, 0.12),
        inset 0 0 40px rgba(212, 175, 55, 0.06);
    animation: authCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(26px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo shown edge-to-edge (square) with a soft glow + gentle float. */
.auth-logo-wrap {
    position: relative;
    width: clamp(140px, 36vw, 190px);
    height: clamp(140px, 36vw, 190px);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-logo {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.55);
    animation: logoFloat 5s ease-in-out infinite;
}
.auth-logo-glow {
    position: absolute;
    inset: -8%;
    z-index: 1;
    border-radius: 24px;
    background: radial-gradient(circle, rgba(212,175,55,0.4), rgba(212,175,55,0.08) 60%, transparent 75%);
    filter: blur(10px);
    animation: logoGlowPulse 4s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-7px) scale(1.015); }
}
@keyframes logoGlowPulse {
    0%, 100% { opacity: 0.55; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1.05); }
}

.auth-title {
    font-family: 'Cinzel Decorative', cursive;
    background: linear-gradient(135deg, #fff1c2, #ffd700, #b8960c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    font-size: clamp(1.5em, 5vw, 2.1em);
    line-height: 1.2;
    letter-spacing: 0.5px;
}
.auth-title-soft { font-size: clamp(1.3em, 4.5vw, 1.8em); }

.auth-subtitle {
    color: var(--gold-muted, #c5a572);
    font-family: 'Libre Baskerville', 'Noto Sans Tamil', serif;
    font-style: italic;
    margin-bottom: 26px;
    font-size: 0.95em;
    line-height: 1.6;
}

.denied-email {
    color: var(--gold-light, #ffd700);
    font-style: normal;
    font-weight: 700;
    word-break: break-word;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, #ffe488, var(--gold-primary, #d4af37));
    color: #2a1a08;
    border: none;
    padding: 14px 30px;
    border-radius: 30px;
    font-family: 'Cinzel', serif;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}
.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(212, 175, 55, 0.55);
    filter: brightness(1.05);
}
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-btn-ghost {
    background: transparent;
    color: var(--gold-light, #ffd700);
    border: 1px solid rgba(212,175,55,0.6);
    box-shadow: none;
    margin-top: 8px;
}
.auth-btn-ghost:hover {
    background: rgba(212,175,55,0.12);
    box-shadow: 0 6px 18px rgba(212,175,55,0.2);
}

.auth-hint {
    color: rgba(197, 165, 114, 0.75);
    font-family: 'Cinzel', serif;
    font-size: 0.74em;
    letter-spacing: 1px;
    margin-top: 18px;
}

/* Loading spinner inside the gate */
.auth-spinner {
    width: 38px;
    height: 38px;
    margin: 18px auto 0;
    border: 3px solid rgba(212,175,55,0.25);
    border-top-color: var(--gold-light, #ffd700);
    border-radius: 50%;
    animation: authSpin 0.9s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ==================== KEEPER'S (ADMIN) + LOGOUT — TOP RIGHT ==================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-admin,
.header-logout {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    cursor: pointer;
    text-decoration: none;
    background: linear-gradient(145deg, rgba(45,30,20,0.9), rgba(26,15,10,0.95));
    border: 1px solid rgba(212,175,55,0.55);
    color: var(--gold-light, #ffd700);
    box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 0 10px rgba(212,175,55,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.header-admin:hover {
    transform: translateY(-2px) rotate(-8deg);
    box-shadow: 0 8px 22px rgba(212,175,55,0.4);
}
.header-logout {
    opacity: 0.7;
}
.header-logout:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(212,175,55,0.35);
}

.header-admin.hidden { display: none; }


/* ==================== SEARCH BAR ==================== */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    max-width: 320px;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--gold-muted, #c5a572);
    font-size: 0.9em;
    pointer-events: none;
}

.song-search {
    width: 100%;
    background: linear-gradient(145deg, rgba(26, 15, 10, 0.9), rgba(45, 30, 20, 0.85));
    border: 2px solid var(--gold-primary, #d4af37);
    border-radius: 24px;
    color: var(--cream, #f4e8d0);
    font-family: 'Cinzel', 'Noto Sans Tamil', serif;
    font-size: 0.9em;
    padding: 9px 16px 9px 38px;
    outline: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.song-search::placeholder {
    color: var(--gold-muted, #c5a572);
    opacity: 0.8;
}

.song-search:focus {
    border-color: var(--gold-light, #ffd700);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.35);
}

/* No-results message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gold-muted, #c5a572);
    font-family: 'Cinzel', serif;
    padding: 50px 20px;
    font-size: 1.1em;
}

@media (max-width: 640px) {
    .header-container { flex-wrap: wrap; }
    .search-wrap { max-width: 100%; order: 3; }
}


/* Small logo beside the header title */
.book-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.title-logo {
    height: 2em;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .title-logo { height: 1.7em; }
}


/* ==================== BUFFERING STATE on play buttons ==================== */
.play-btn.buffering,
.modal-play-btn.buffering {
    position: relative;
    color: transparent !important;
}
.play-btn.buffering i,
.modal-play-btn.buffering i {
    visibility: hidden;
}
.play-btn.buffering::after,
.modal-play-btn.buffering::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 55%; height: 55%;
    margin: -27.5% 0 0 -27.5%;
    border: 2.5px solid rgba(26, 15, 10, 0.35);
    border-top-color: #1a0f0a;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

/* Make progress bars feel grabbable for drag-to-seek */
.progress-bar, .modal-progress-bar {
    touch-action: none;
    cursor: pointer;
}


/* ==================== FAVORITES ==================== */
/* Heart button on each photo card */
.fav-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 12;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(13, 7, 5, 0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.2s ease, background 0.25s ease;
}
.photo-card:hover .fav-btn,
.fav-btn.faved {
    opacity: 1;
    transform: scale(1);
}
.fav-btn.faved {
    color: #ff5a7a;
    background: rgba(13, 7, 5, 0.7);
    text-shadow: 0 0 10px rgba(255, 90, 122, 0.7);
}
.fav-btn:hover { background: rgba(13, 7, 5, 0.85); transform: scale(1.12); }
.fav-btn.fav-pop { animation: heartPop 0.4s ease; }

@keyframes heartPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Always show the heart on touch devices (no hover) */
@media (hover: none) {
    .fav-btn { opacity: 0.9; transform: scale(1); }
}

/* Modal favorite heart */
.modal-fav-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(244, 232, 208, 0.5);
    color: #b04a5e;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.25s ease;
}
.modal-fav-btn.faved { color: #ff5a7a; background: rgba(255, 90, 122, 0.15); }
.modal-fav-btn:hover { transform: scale(1.12); }
.modal-fav-btn.fav-pop { animation: heartPop 0.4s ease; }

/* Header favorites filter toggle */
.header-fav-filter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: linear-gradient(145deg, rgba(45,30,20,0.9), rgba(26,15,10,0.95));
    border: 1px solid rgba(212,175,55,0.55);
    color: var(--gold-light, #ffd700);
    font-size: 0.95em;
    opacity: 0.8;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease, color 0.25s ease;
}
.header-fav-filter:hover { opacity: 1; transform: translateY(-2px); }
.header-fav-filter.active {
    color: #ff5a7a;
    border-color: rgba(255, 90, 122, 0.6);
    box-shadow: 0 0 16px rgba(255, 90, 122, 0.35);
    opacity: 1;
}

/* Spinning album art while playing */
#player-album-art.spinning,
#modal-player-album-art.spinning {
    animation: albumSpin 18s linear infinite;
    border-radius: 50%;
}
@keyframes albumSpin { to { transform: rotate(360deg); } }


/* ==================== 💖 HEART BURST MAGIC ==================== */
#heart-burst-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100002;
    overflow: hidden;
}

/* Particles are positioned at 0,0 and moved via JS transform translate(). */
.burst-heart,
.burst-spark {
    position: fixed;
    top: 0;
    left: 0;
    will-change: transform, opacity;
    opacity: 0;
    pointer-events: none;
    user-select: none;
}
.burst-heart {
    font-size: 24px;
    color: #ff5a7a;
    text-shadow: 0 0 10px rgba(255, 90, 122, 0.85), 0 0 22px rgba(255, 120, 90, 0.45);
}
.burst-spark {
    font-size: 16px;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.9), 0 0 16px rgba(255, 215, 0, 0.5);
}

/* Expanding soft glow ring at the source */
.heart-ring {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    background: radial-gradient(circle, rgba(255,90,122,0.35), transparent 70%);
    box-shadow: 0 0 22px rgba(255, 90, 122, 0.6);
    animation: heartRing 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes heartRing {
    0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.3); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(7); }
}

/* Warm love-glow flash over the whole page */
body.love-flash::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100001;
    background: radial-gradient(circle at 50% 60%, rgba(255, 90, 122, 0.16), transparent 60%);
    animation: loveFlash 0.55s ease-out forwards;
}
@keyframes loveFlash {
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

/* Satisfying squish-bounce on the heart button when liked */
.fav-btn.faved i,
.modal-fav-btn.faved i {
    animation: heartBeat 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes heartBeat {
    0%   { transform: scale(1); }
    25%  { transform: scale(1.5); }
    45%  { transform: scale(0.82); }
    65%  { transform: scale(1.22); }
    100% { transform: scale(1); }
}


/* ==================== 🌟 SONG OF THE DAY ==================== */
.sotd {
    position: relative;
    max-width: 760px;
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(45,30,20,0.92), rgba(26,15,10,0.95));
    border: 1px solid rgba(212,175,55,0.5);
    box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 30px rgba(212,175,55,0.12);
    overflow: hidden;
    animation: sotdIn 0.7s cubic-bezier(0.22,1,0.36,1);
}
.sotd.hidden { display: none; }
@keyframes sotdIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.sotd-glow {
    position: absolute;
    top: -40%; left: -10%;
    width: 60%; height: 180%;
    background: radial-gradient(circle, rgba(212,175,55,0.22), transparent 70%);
    filter: blur(8px);
    pointer-events: none;
    animation: sotdGlow 6s ease-in-out infinite;
}
@keyframes sotdGlow {
    0%,100% { transform: translateX(0); opacity: 0.6; }
    50% { transform: translateX(40%); opacity: 1; }
}
.sotd-art {
    width: 92px; height: 92px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--gold-primary, #d4af37);
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 1;
}
.sotd-art:hover { transform: scale(1.05); }
.sotd-body { flex: 1; min-width: 0; z-index: 1; }
.sotd-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Cinzel', serif; font-size: 0.7em; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--gold-light, #ffd700);
    margin-bottom: 4px;
}
.sotd-title {
    font-family: 'Cinzel Decorative', 'Cinzel', 'Noto Sans Tamil', 'Noto Sans Malayalam', serif;
    color: var(--cream, #f4e8d0); font-size: clamp(1.1em, 3vw, 1.4em);
    font-weight: 700; line-height: 1.2; margin: 2px 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sotd-artist { color: var(--gold-muted, #c5a572); font-size: 0.85em; margin-bottom: 6px; }
.sotd-note { color: rgba(244,232,208,0.8); font-style: italic; font-size: 0.82em; margin-bottom: 10px; font-family: 'Libre Baskerville', serif; }
.sotd-play {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(145deg, #ffe488, var(--gold-primary, #d4af37));
    color: #2a1a08; border: none; padding: 9px 18px; border-radius: 22px;
    font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.85em; cursor: pointer;
    box-shadow: 0 5px 16px rgba(212,175,55,0.35); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.sotd-play:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(212,175,55,0.5); }

@media (max-width: 560px) {
    .sotd { flex-direction: row; padding: 12px; gap: 12px; }
    .sotd-art { width: 70px; height: 70px; }
    .sotd-note { display: none; }
}

/* ==================== 🌙 SLEEP TIMER ==================== */
.header-sleep {
    position: relative;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: linear-gradient(145deg, rgba(45,30,20,0.9), rgba(26,15,10,0.95));
    border: 1px solid rgba(212,175,55,0.55);
    color: var(--gold-light, #ffd700); font-size: 0.95em; opacity: 0.8;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.header-sleep:hover { opacity: 1; transform: translateY(-2px); }
.header-sleep.active {
    color: #b9a3ff; border-color: rgba(150,130,255,0.6);
    box-shadow: 0 0 16px rgba(150,130,255,0.4); opacity: 1;
}
.sleep-badge {
    position: absolute; bottom: -4px; right: -4px;
    background: #6c5ce7; color: #fff; font-size: 0.55em; font-weight: 700;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cinzel', serif; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.sleep-badge.hidden { display: none; }

.sleep-menu {
    position: fixed;
    top: 70px; right: 16px;
    z-index: 9998;
    background: linear-gradient(180deg, rgba(30,18,12,0.98), rgba(13,7,5,0.99));
    border: 1px solid rgba(212,175,55,0.5);
    border-radius: 14px; padding: 10px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.6);
    display: flex; flex-direction: column; gap: 4px; min-width: 190px;
    animation: sotdIn 0.3s ease;
}
.sleep-menu.hidden { display: none; }
.sleep-menu-title {
    font-family: 'Cinzel', serif; color: var(--gold-light, #ffd700);
    font-size: 0.8em; letter-spacing: 1px; padding: 6px 10px 8px;
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid rgba(212,175,55,0.2); margin-bottom: 4px;
}
.sleep-menu button {
    background: transparent; border: none; color: var(--cream, #f4e8d0);
    text-align: left; padding: 10px 12px; border-radius: 8px;
    font-family: 'Cinzel', serif; font-size: 0.85em; cursor: pointer;
    transition: background 0.2s ease;
}
.sleep-menu button:hover { background: rgba(212,175,55,0.15); }
.sleep-menu .sleep-cancel { color: #ff8a80; border-top: 1px solid rgba(212,175,55,0.2); margin-top: 4px; }

/* ==================== 🔗 SYNCPLAY HEADER BUTTON ==================== */
.header-sync {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: linear-gradient(145deg, rgba(45,30,20,0.9), rgba(26,15,10,0.95));
    border: 1px solid rgba(212,175,55,0.55);
    color: var(--gold-light, #ffd700); font-size: 0.95em; opacity: 0.8;
    text-decoration: none;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}
.header-sync:hover {
    opacity: 1; transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(212,175,55,0.4);
}

/* ==================== 🔗 SYNCPLAY SLIDING DRAWER & MODALS ==================== */
.syncplay-panel {
    position: fixed;
    top: 70px;
    right: 16px;
    bottom: 80px;
    width: 320px;
    z-index: 9990;
    background: linear-gradient(180deg, rgba(30,18,12,0.96), rgba(13,7,5,0.98));
    border: 1px solid rgba(212,175,55,0.5);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
}
@keyframes slideInRight {
    from { transform: translateX(340px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.syncplay-panel.hidden { display: none !important; }

.syncplay-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(212,175,55,0.25);
    background: rgba(13,7,5,0.4);
}
.syncplay-panel-header h3 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 0.95em;
    color: var(--gold-light, #ffd700);
    margin: 0;
}
.close-panel-btn {
    background: transparent;
    border: none;
    color: var(--gold-muted, #c5a572);
    font-size: 1.1em;
    cursor: pointer;
    transition: color 0.2s;
}
.close-panel-btn:hover { color: var(--gold-light, #ffd700); }

.syncplay-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sync-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.75em;
    color: var(--gold-muted, #c5a572);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* User item cards */
.sync-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sync-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(244, 232, 208, 0.04);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.2s;
}
.sync-user-item:hover {
    background: rgba(212,175,55,0.08);
    border-color: rgba(212,175,55,0.4);
}
.sync-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--gold-primary, #d4af37);
    background: rgba(212,175,55,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--gold-light, #ffd700);
}
.sync-user-info {
    flex: 1;
    min-width: 0;
}
.sync-user-name {
    font-size: 0.8em;
    font-weight: bold;
    color: var(--cream, #f4e8d0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sync-user-status {
    font-size: 0.6em;
    color: rgba(197,165,114,0.6);
    display: flex;
    align-items: center;
    gap: 4px;
}
.sync-user-status.online { color: #4ade80; }
.sync-user-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #94a3b8;
}
.sync-user-status.online .sync-user-status-dot {
    background: #4ade80;
    box-shadow: 0 0 4px #4ade80;
}
.btn-invite-small {
    padding: 4px 10px;
    font-size: 0.7em;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe488, var(--gold-primary, #d4af37));
    border: none;
    color: #1a0f0a;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    transition: all 0.2s ease;
}
.btn-invite-small:hover { transform: scale(1.05); }

/* Chat Section */
.sync-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: var(--gold-light, #ffd700);
    border-bottom: 1px solid rgba(212,175,55,0.2);
    padding-bottom: 6px;
    margin-bottom: 8px;
}
#sync-chat-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.sync-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(13,7,5,0.3);
    border-radius: 8px;
    padding: 8px;
}
.sync-chat-msg {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border-radius: 10px;
    max-width: 85%;
    font-size: 0.75em;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}
.sync-chat-msg.me {
    align-self: flex-end;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-bottom-right-radius: 3px;
}
.sync-chat-msg.them {
    align-self: flex-start;
    background: rgba(244, 232, 208, 0.08);
    border: 1px solid rgba(244, 232, 208, 0.15);
    border-bottom-left-radius: 3px;
}
.sync-chat-msg .msg-sender { font-size: 0.85em; color: var(--gold-primary, #d4af37); font-weight: bold; margin-bottom: 2px; }
.sync-chat-msg .msg-text { font-family: 'Libre Baskerville', serif; color: var(--cream, #f4e8d0); }
.sync-chat-msg .msg-time { font-size: 0.8em; color: var(--gold-muted, #c5a572); margin-top: 2px; text-align: right; }

.sync-chat-input-wrap {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.sync-chat-input-wrap input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 18px;
    background: rgba(13,7,5,0.6);
    color: var(--cream, #f4e8d0);
    font-size: 0.75em;
    outline: none;
}
.sync-chat-emojis {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    justify-content: center;
}
.emoji-btn {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    transition: transform 0.1s;
}
.emoji-btn:hover {
    transform: scale(1.2);
}
.sync-chat-input-wrap input:focus { border-color: var(--gold-light, #ffd700); }
.sync-chat-input-wrap button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-primary, #d4af37), var(--gold-dark, #b8960c));
    color: #1a0f0a;
    font-size: 0.85em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.syncplay-panel-footer {
    padding: 12px;
    border-top: 1px solid rgba(212,175,55,0.2);
    background: rgba(13,7,5,0.4);
}

/* Modals Overlay */
.syncplay-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(13, 7, 5, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}
.syncplay-modal-overlay.hidden { display: none !important; }
.syncplay-modal-card {
    background: linear-gradient(180deg, rgba(30,18,12,0.98), rgba(13,7,5,0.99));
    border: 1px solid rgba(212,175,55,0.5);
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.sync-modal-subtitle {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.8em;
    color: var(--gold-muted, #c5a572);
    font-style: italic;
    margin-top: 8px;
}

/* ── Floating Hearts background ───────────────────────────────── */
.sync-floating-hearts {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.sync-floating-hearts.hidden { display: none !important; }
.sync-fheart {
    position: absolute;
    bottom: -50px;
    font-size: var(--sz, 20px);
    color: var(--col, #ff5a7a);
    opacity: var(--op, 0.6);
    filter: drop-shadow(0 0 6px var(--col, #ff5a7a));
    animation: syncHeartAnimation var(--dur, 8s) linear infinite;
}
@keyframes syncHeartAnimation {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: var(--op, 0.6);
    }
    90% {
        opacity: var(--op, 0.6);
    }
    100% {
        transform: translateY(-110vh) translateX(var(--drift, 100px)) rotate(var(--rot, 360deg));
        opacity: 0;
    }
}

