:root {
    --bg-color: #1a0b2e;
    --text-color: #e0e0e0;
    --gold: #ffd700;
    --gold-dim: #b8860b;
    --neon-pink: #ff00ff;
    --neon-blue: #00ffff;
    --turquoise: #40e0d0;
    --purple-glow: rgba(138, 43, 226, 0.6);
    --font-heading: 'Cinzel Decorative', cursive;
    --font-body: 'Quicksand', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* Background Pattern - Responsive Images for Performance */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(26, 11, 46, 0.4), rgba(26, 11, 46, 0.4)),
        url('xmas_bground1_mobile.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
}

/* Desktop: Use larger image for better quality */
@media (min-width: 601px) {
    .background-pattern {
        background-image:
            linear-gradient(rgba(26, 11, 46, 0.4), rgba(26, 11, 46, 0.4)),
            url('xmas_bground1_desktop.jpeg');
    }
}

/* High-resolution displays: Use full-size image */
@media (min-width: 1921px) {
    .background-pattern {
        background-image:
            linear-gradient(rgba(26, 11, 46, 0.4), rgba(26, 11, 46, 0.4)),
            url('xmas_bground1.jpeg');
    }
}

/* Top Right Logo */
.top-right-logo {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.top-right-logo img {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 10px var(--purple-glow));
    transition: filter 0.3s ease;
}

.top-right-logo:hover {
    transform: scale(1.1);
}

.top-right-logo:hover img {
    filter: drop-shadow(0 0 15px var(--neon-pink));
}

header {
    text-align: center;
    margin: 2rem 0;
    padding: 0 1rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-dim), 0 0 20px var(--purple-glow);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    color: var(--turquoise);
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.music-btn {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
    padding: 0.5rem 1.5rem;
    font-family: var(--font-body);
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px var(--purple-glow);
}

.music-btn:hover {
    background: var(--gold);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--gold);
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-flow: dense;
    gap: 1rem;
    width: 95%;
    max-width: 1200px;
    padding: 2rem;
    margin-bottom: 4rem;
}

/* Door Styles */
.door {
    background: linear-gradient(135deg, #2d1b4e, #1a0b2e);
    border: 2px solid var(--gold-dim);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 100px;
    /* Ensure visibility */
}

/* Sizes */
.door.size-sm {
    grid-column: span 1;
    grid-row: span 1;
}

.door.size-md {
    grid-column: span 2;
    grid-row: span 1;
}

.door.size-lg {
    grid-column: span 2;
    grid-row: span 2;
}

.door.size-xl {
    grid-column: span 3;
    grid-row: span 3;
    border-color: var(--neon-pink);
    box-shadow: 0 0 20px var(--purple-glow);
    z-index: 5;
}

/* Oriental Arch Shape via Clip Path - varied for weirdness? Keep simple for now or random in JS? 
   Let's keep the shape but maybe rotate in JS. 
   Actually, let's remove the strict clip-path to allow for better grid fitting, 
   or adjust it to be less restrictive. */
.door {
    /* clip-path: polygon(0% 10%, 50% 0%, 100% 10%, 100% 100%, 0% 100%); */
    /* Let's try a different shape or just rounded corners for now to fit the dense grid better */
    border-radius: 15px;
}

.door:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 15px var(--neon-pink), 0 0 30px var(--purple-glow);
    border-color: var(--gold);
    z-index: 10;
}

.door-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Decorative Pattern on Door */
.door::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 50% 30%, transparent 30%, rgba(255, 215, 0, 0.1) 31%, transparent 32%),
        radial-gradient(circle at 50% 70%, transparent 30%, rgba(64, 224, 208, 0.1) 31%, transparent 32%);
    background-size: 100% 100%;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.door:hover::before {
    opacity: 0.8;
}

/* Opened State */
.door.opened {
    background: #000;
    border-color: var(--turquoise);
}

.door.opened .door-number {
    color: #555;
    text-shadow: none;
}

/* Locked State */
.door.locked {
    filter: grayscale(0.8);
    cursor: not-allowed;
    opacity: 0.7;
}

.door.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--gold-dim);
}

.door.locked .door-number {
    color: #888;
    text-shadow: none;
}

/* Shake Animation for Locked Click */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.door.shake {
    animation: shake 0.4s ease-in-out;
    border-color: var(--neon-pink);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(to bottom, #2a1b3e, #1a0b2e);
    border: 2px solid var(--gold);
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 0 30px var(--purple-glow), inset 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--neon-pink);
}

.modal-body h2 {
    font-family: var(--font-heading);
    color: var(--turquoise);
    margin-bottom: 0.5rem;
}

.modal-body h3 {
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    border: 1px solid currentColor;
}

/* Badge Colors */
.type-history {
    color: var(--turquoise);
    border-color: var(--turquoise);
    box-shadow: 0 0 5px var(--turquoise);
}

.type-failure {
    color: var(--neon-pink);
    border-color: var(--neon-pink);
    box-shadow: 0 0 5px var(--neon-pink);
}

.type-use-case {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: 0 0 5px var(--neon-blue);
}

.type-ai-slop {
    color: #ff4500;
    border-color: #ff4500;
    box-shadow: 0 0 5px #ff4500;
}

/* Orange-Red for Slop */

.modal-body p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #fff;
}

/* Responsive - Creative Mobile Layout */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    /* Creative Grid Layout - Variable columns creating organic shape */
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.6rem;
        padding: 1rem;
        max-width: 100%;
    }

    /* Override all size classes on mobile */
    .door.size-sm,
    .door.size-md,
    .door.size-lg,
    .door.size-xl {
        grid-column: auto;
        grid-row: auto;
    }

    .door {
        width: 100%;
        height: 85px;
        min-height: 85px;
    }

    .door-number {
        font-size: 1.6rem;
    }

    /* Day 1 - Star on top, centered across all columns */
    .door:nth-child(1) {
        grid-column: 2 / 4;
        border-radius: 50%;
        border-color: var(--gold);
        box-shadow: 0 0 20px var(--gold);
        height: 80px;
    }

    /* Days 2-3: Two doors side by side */
    .door:nth-child(2) {
        grid-column: 2 / 3;
    }
    .door:nth-child(3) {
        grid-column: 3 / 4;
    }

    /* Days 4-6: Three doors in a row */
    .door:nth-child(4) {
        grid-column: 1 / 2;
    }
    .door:nth-child(5) {
        grid-column: 2 / 3;
    }
    .door:nth-child(6) {
        grid-column: 3 / 5;
        border-color: var(--neon-pink);
        box-shadow: 0 0 15px var(--purple-glow);
    }

    /* Days 7-10: Full row of 4 */
    .door:nth-child(7),
    .door:nth-child(8),
    .door:nth-child(9),
    .door:nth-child(10) {
        grid-column: span 1;
    }

    /* Days 11-12: Special wider doors */
    .door:nth-child(11) {
        grid-column: 1 / 3;
    }
    .door:nth-child(12) {
        grid-column: 3 / 5;
        border-color: var(--turquoise);
        box-shadow: 0 0 15px var(--turquoise);
    }

    /* Days 13-16: Full row */
    .door:nth-child(13),
    .door:nth-child(14),
    .door:nth-child(15),
    .door:nth-child(16) {
        grid-column: span 1;
    }

    /* Days 17-18: Two wider doors */
    .door:nth-child(17) {
        grid-column: 1 / 3;
    }
    .door:nth-child(18) {
        grid-column: 3 / 5;
        border-color: var(--neon-blue);
        box-shadow: 0 0 15px var(--neon-blue);
    }

    /* Days 19-22: Full row */
    .door:nth-child(19),
    .door:nth-child(20),
    .door:nth-child(21),
    .door:nth-child(22) {
        grid-column: span 1;
    }

    /* Day 23: Wider door */
    .door:nth-child(23) {
        grid-column: 1 / 3;
    }

    /* Day 24 - Christmas Eve, spanning remaining space */
    .door:nth-child(24) {
        grid-column: 3 / 5;
        height: 100px;
        border-width: 3px;
        border-color: var(--gold);
        box-shadow: 0 0 25px var(--gold), 0 0 35px var(--neon-pink);
        background: linear-gradient(135deg, #4a2d6e, #2d1b4e);
    }

    .door:nth-child(24) .door-number {
        font-size: 2.2rem;
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        0%, 100% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.8; transform: scale(1.1); }
    }

    /* Add slight rotation variety for visual interest */
    .door:nth-child(3n+1):not(.door:nth-child(1)):not(.door:nth-child(24)) {
        transform: rotate(-1deg);
    }
    .door:nth-child(3n+2):not(.door:nth-child(24)) {
        transform: rotate(1deg);
    }
}

/* Footer Branding */
footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--turquoise);
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-logo {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 0 5px var(--purple-glow));
    transition: all 0.3s ease;
}

.footer-logo:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--neon-pink));
}