/* =========================================
   ✨ NEW MONTHSARY SURPRISE ASSETS ✨
   ========================================= */

/* --- FLOATING MUSIC PLAYER WIDGET --- */
#musicPlayerWidget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, box-shadow 0.3s;
}

#musicPlayerWidget:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 40px rgba(255, 107, 129, 0.3);
}

#musicPlayerWidget .music-icon {
    font-size: 1.8rem;
    color: #ff6b81;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.3s;
}

#musicPlayerWidget.playing .music-icon {
    animation: spinVinyl 4s linear infinite;
}

#musicPlayerWidget.paused .music-icon {
    animation: none;
    color: #a4b0be;
}

#musicPlayerWidget .music-bars {
    position: absolute;
    bottom: -15px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.3s;
}

#musicPlayerWidget.playing .music-bars {
    opacity: 1;
}

#musicPlayerWidget .music-bars span {
    width: 4px;
    height: 10px;
    background: #ff4757;
    border-radius: 2px;
    animation: bounceBars 1s infinite alternate;
}
#musicPlayerWidget .music-bars span:nth-child(2) { animation-delay: 0.2s; height: 14px; }
#musicPlayerWidget .music-bars span:nth-child(3) { animation-delay: 0.4s; height: 8px; }

@keyframes spinVinyl {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounceBars {
    0% { transform: scaleY(0.5); }
    100% { transform: scaleY(1.5); }
}

/* --- FILM ROLL BACKGROUND MODE --- */
.board.film-roll-mode { display: flex !important; flex-wrap: nowrap !important; overflow-x: hidden !important; overflow-y: hidden !important; align-items: center !important; justify-content: flex-start !important; height: 440px !important; width: 100vw !important; margin: 0 !important; padding: 45px 0 !important; box-sizing: border-box !important; position: absolute !important; top: 50% !important; left: 0 !important; transform: translateY(-50%) !important; background: rgba(15, 15, 15, 0.5) !important; backdrop-filter: blur(6px) !important; -webkit-backdrop-filter: blur(6px) !important; border-top: 1px solid rgba(255,255,255,0.1) !important; border-bottom: 1px solid rgba(255,255,255,0.1) !important; z-index: 105 !important; }
.board.film-roll-mode::before, .board.film-roll-mode::after { content: ""; position: absolute; left: 0; width: 50000px !important; height: 14px; background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0px, rgba(255, 255, 255, 0.35) 12px, transparent 12px, transparent 24px); z-index: 20; pointer-events: none; }
.board.film-roll-mode::before { top: 15px; } .board.film-roll-mode::after { bottom: 15px; }

.cinematic-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #111; z-index: 100; opacity: 0; transition: opacity 0.5s ease; pointer-events: none; }

/* Countdown Overlay */
.countdown-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #111; z-index: 6000; display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.5s ease; }
.countdown-circle { position: relative; width: 280px; height: 280px; border: 4px solid rgba(255, 255, 255, 0.8); border-radius: 50%; display: flex; justify-content: center; align-items: center; filter: sepia(0.3) contrast(1.2); }
.countdown-circle::before { content: ""; position: absolute; top: 0; left: 50%; width: 4px; height: 50%; background: rgba(255, 255, 255, 0.8); transform-origin: bottom center; animation: radarSweep 1s linear infinite; }
.countdown-circle::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: rgba(255, 255, 255, 0.4); }
.countdown-circle-horizontal { position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: rgba(255, 255, 255, 0.4); }
.countdown-number { color: #fff; font-size: 10rem; font-family: 'Courier New', Courier, monospace; font-weight: bold; z-index: 10; animation: filmPulse 1s infinite; }
@keyframes radarSweep { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes filmPulse { 0% { transform: scale(1); opacity: 1; filter: brightness(1); } 50% { transform: scale(1.1); opacity: 0.8; filter: brightness(1.5); } 100% { transform: scale(1); opacity: 1; filter: brightness(1); } }

/* Magic Particles */
.magic-particle { font-size: 1.5rem; }

/* Scratch Card */
.scratch-card-container { position: relative; z-index: 10; width: 90%; max-width: 420px; height: 450px; max-height: 85vh; background: #fff; border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.3); overflow: hidden; animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-sizing: border-box; }
.ticket-reveal-zone { padding: 30px 25px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; height: 100%; box-sizing: border-box; background: radial-gradient(circle at top left, #fff0f5, #ffffff); }
.ticket-header { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: #ff6b81; font-weight: bold; margin-bottom: 10px; }
.ticket-title { color: #ff4757; font-family: 'Georgia', serif; font-style: italic; margin: 5px 0 15px 0; font-size: 1.6rem; }
.ticket-body { color: #444; line-height: 1.6; font-size: 1.02rem; flex-grow: 1; overflow-y: auto; margin-bottom: 15px; padding-right: 5px; min-height: 0; }
#scratchCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" style="fill:%23ff4757"><text y="20" font-size="20"> </text></svg>'), auto; touch-action: none; transition: opacity 0.5s ease; border-radius: 20px; }
@keyframes scaleUp { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Roulette Machine */
.roulette-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 4500; display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.5s ease; pointer-events: none; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(10px); }
.roulette-overlay * { pointer-events: auto; }
.roulette-machine { position: relative; z-index: 10; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(15px); width: 90%; max-width: 400px; padding: 30px 20px; border-radius: 25px; box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 5px rgba(241, 196, 15, 0.3); text-align: center; border: 2px solid #f1c40f; transform: scale(0.9); transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.roulette-title { color: #e17055; margin-top: 0; margin-bottom: 20px; font-family: 'Poppins', sans-serif; font-weight: 800; letter-spacing: 1px; }
.roulette-screen { background: #fdfdfd; border: inset 4px #dfe6e9; border-radius: 15px; height: 320px; display: flex; justify-content: center; align-items: center; overflow: hidden; padding: 0; box-sizing: border-box; box-shadow: inset 0 5px 15px rgba(0,0,0,0.05); position: relative; perspective: 1000px; }
.roulette-card-inner { position: relative; width: 100%; height: 100%; text-align: left; transition: transform 0.6s; transform-style: preserve-3d; cursor: pointer; }
.roulette-card-inner.flipped { transform: rotateY(180deg); }
.roulette-card-front, .roulette-card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; padding: 20px; box-sizing: border-box; overflow-y: auto; background: #fdfdfd; }
.roulette-card-back { transform: rotateY(180deg); display: flex; flex-direction: column; }
.roulette-instruction { font-size: 0.8rem; color: #888; text-align: center; margin-top: 10px; font-style: italic; }
#pullLeverBtn:active { transform: translateY(6px); box-shadow: 0 0 0 #e17055, 0 2px 5px rgba(0,0,0,0.2) !important; }

/* Cinematic Film Frame */
.note.film-frame { position: relative !important; top: auto !important; left: auto !important; transform: none !important; flex: 0 0 320px !important; height: 100% !important; box-sizing: border-box !important; margin: 0 !important; padding: 0 !important; background: transparent !important; border-radius: 0 !important; border-left: 15px solid rgba(20, 20, 0, 0.85) !important; border-right: 15px solid rgba(20, 20, 0, 0.85) !important; border-top: none !important; border-bottom: none !important; box-shadow: 0 0 25px rgba(241, 196, 15, 0.5) !important; overflow: visible !important; z-index: 15 !important; animation: none !important; perspective: 1000px; }
.film-card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.film-card-inner.flipped { transform: rotateY(180deg); }
.film-card-front, .film-card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; padding: 20px; box-sizing: border-box; background: rgba(255, 254, 245, 0.85); overflow-y: auto; display: flex; flex-direction: column; }
.film-card-front img.note-image { 
    width: 100%;
    height: 160px; 
    object-fit: cover; 
    flex-shrink: 0; 
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 15px;
}
.film-card-front .content { flex-shrink: 0; word-wrap: break-word; overflow-wrap: break-word; }
.film-card-back { transform: rotateY(180deg); display: flex; flex-direction: column; }

/* The Midnight Takeover Blur (Used by all games) */
.monthsary-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 99998;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out;
}

/* =========================================
   ENVELOPE SURPRISE STYLES
   ========================================= */

.envelope-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 99999;
}

.envelope-container:hover {
    transform: scale(1.05);
}

.envelope {
    position: relative;
    width: 320px;
    height: 210px;
    background: #f6cc61;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    transition: transform 0.4s ease;
}

/* The folded letter sitting inside the pocket */
.envelope-paper {
    position: absolute;
    bottom: 5px; 
    left: 10px; 
    right: 10px; 
    height: 180px;
    background: #fffdf2;
    border-radius: 5px;
    z-index: 2; /* Sits in front of back, behind front pocket */
    box-shadow: 0 -2px 15px rgba(0,0,0,0.15);
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* The front pocket of the envelope (Using advanced border hacks for geometry) */
.envelope-front {
    position: absolute;
    bottom: 0; left: 0; right: 0; top: 0;
    z-index: 3;
    border-radius: 8px;
    overflow: hidden;
}
.envelope-front::before {
    content: "";
    position: absolute;
    bottom: 0; left: 0;
    border-left: 160px solid #f6cc61;
    border-right: 160px solid #f6cc61;
    border-bottom: 110px solid #f9d77e;
    border-top: 100px solid transparent;
    z-index: 3;
    filter: drop-shadow(0 -4px 6px rgba(0,0,0,0.05));
}

/* The Top Flap */
.envelope-flap {
    position: absolute;
    top: 0; left: 0;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-top: 115px solid #eab543;
    z-index: 4;
    transform-origin: top;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.3s;
    filter: drop-shadow(0 5px 6px rgba(0,0,0,0.25));
}

/* The Glowing Wax Seal */
.wax-seal {
    position: absolute;
    top: 110px; /* Aligned perfectly with the tip of the flap */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; 
    height: 48px;
    background: radial-gradient(circle, #ff4757 30%, #c0392b 100%);
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 0 4px rgba(255,255,255,0.4);
    display: flex; 
    justify-content: center; 
    align-items: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* 1. Flap flips into the 3D background */
.envelope.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1; /* Drops behind the paper once opened */
}

/* 2. Wax seal shatters/fades instantly */
.envelope.open .wax-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
}

/* 3. The letter physically slides up and out! */
.envelope.open .envelope-paper {
    transform: translateY(-90px);
    transition-delay: 0.4s; /* Waits for the flap to get out of the way first */
}

/* Letter Modal */
.letter-modal {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 5000;
    animation: letterScaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-modal .letter-content {
    overflow-y: auto;
    padding-right: 10px;
}

@keyframes letterScaleUp {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* =========================================
   📱 MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 600px) {
    /* Scale down the envelope */
    .envelope-container {
        transform: scale(0.65);
    }
    .envelope-container:hover {
        transform: scale(0.7);
    }

    /* Shrink the film roll drastically to mimic zoomed-out desktop view */
    .board.film-roll-mode {
        height: 280px !important;
        padding: 15px 0 !important;
    }
    .board.film-roll-mode::before, .board.film-roll-mode::after {
        height: 8px;
    }
    .board.film-roll-mode::before { top: 8px; }
    .board.film-roll-mode::after { bottom: 8px; }

    .note.film-frame {
        flex: 0 0 190px !important;
        border-left: 8px solid rgba(20, 20, 0, 0.85) !important;
        border-right: 8px solid rgba(20, 20, 0, 0.85) !important;
    }
    
    .film-card-front, .film-card-back {
        padding: 10px;
    }
    
    .film-card-front img.note-image {
        height: 100px;
        border-width: 2px;
        margin-bottom: 8px;
    }
    
    .film-card-front .content {
        font-size: 0.75rem;
    }
    
    /* Make roulette smaller */
    .roulette-machine {
        transform: scale(0.7);
    }
    
    /* Adjust letter modal to mimic desktop view (smaller text & padding) */
    .letter-modal {
        width: 85%;
        padding: 20px;
    }
    .letter-modal h2 {
        font-size: 1.3rem !important;
    }
    .letter-modal .letter-content {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }
    .letter-modal button {
        font-size: 0.9rem !important;
        padding: 10px !important;
    }
    
    .soft-home-btn {
        top: 15px;
        left: 15px;
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}

/* Soft Home Button */
.soft-home-btn {
    position: fixed;
    top: 25px;
    left: 30px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 999999 !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
}
.soft-home-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
