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

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    color: #e0e0e0;
    font-family: 'Cinzel', serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated background particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px #ff6b35; }
    100% { box-shadow: 0 0 15px #ff6b35; }
}

@keyframes spooky-bounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Generic page structure */
.grid {
    display: grid;
    grid-template-columns: 1fr repeat(9, minmax(auto, 8em)) 1fr;
    grid-template-rows: minmax(1em, auto);
}

/* Common card styling */
.info-card,
.location-selection,
.story-form-section,
.content-section {
    background: linear-gradient(145deg, #2a2a3e, #1e1e30);
    border-radius: 15px;
    padding: 2rem;
    border: 2px solid #8B4513;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.info-card::before,
.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b35, #d4a574, #ff6b35);
}

.info-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 25px rgba(255, 107, 53, 0.2);
}

/* Common title styling */
.card-title,
.section-title {
    font-family: 'Griffy', cursive;
    color: #ff6b35;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.card-title {
    font-size: 1.5rem;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.submission-title {
    font-family: 'Creepster', cursive;
    font-size: 2.5rem;
    color: #ff6b35;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 1rem;
}

/* Header styles */
.header {
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 100%);
    padding: 2rem 0;
    text-align: center;
    position: relative;
    z-index: 10;
    border-bottom: 3px solid #8B4513;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    grid-row: 3;    
    grid-column: 1/12;
}

.title {
    font-family: 'Creepster', cursive;
    font-size: 3.5rem;
    color: #ff6b35;
    text-shadow: 3px 3px 0px #000, -3px -3px 0px #000, 3px -3px 0px #000, -3px 3px 0px #000,
                 0 0 20px #ff6b35, 0 0 40px #ff6b35;
    margin-bottom: 0.5rem;
    animation: flicker 3s infinite alternate;
}

.subtitle,
.submission-subtitle {
    font-family: 'Griffy', cursive;
    color: #d4a574;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    line-height: 1.6;
}

.subtitle {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.submission-subtitle {
    font-size: 1.1rem;
    color: #c0c0c0;
    max-width: 600px;
    margin: 0 auto;
}

.description {
    font-size: 1.1rem;
    color: #c0c0c0;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    padding: 0 1rem;
}

/* Main content */
.main-content {
    position: relative;
    z-index: 10;
    padding: 2rem;
    grid-row: 4/8;
    grid-column: 1/12;
}

/* Map containers */
.map-container,
#submission-map {
    border-radius: 10px;
    border: 2px solid #8B4513;
}

.map-container {
    background: linear-gradient(145deg, #2a2a3e, #1e1e30);
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), 
                inset 0 1px 0 rgba(255,255,255,0.1),
                0 0 50px rgba(255, 107, 53, 0.1);
    border: 2px solid #8B4513;
    grid-row: 6;
    grid-column: 3/8;
}

.map-title {
    text-align: center;
    font-family: 'Griffy', cursive;
    font-size: 2rem;
    color: #ff6b35;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#map {
    height: 500px;
    width: 100%;
    border-radius: 10px;
    border: 3px solid #8B4513;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#submission-map {
    height: 400px;
    width: 100%;
    margin-bottom: 1rem;
}

/* Info section */
.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem auto;
    max-width: 1200px;
    grid-row: 7;
}

.card-text {
    line-height: 1.6;
    color: #c0c0c0;
}

/* Footer */
.footer {
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.9) 100%);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
    border-top: 3px solid #8B4513;
    position: relative;
    z-index: 10;
    grid-row: 9;
    grid-column: 1/12;
}

.footer-text {
    color: #888;
    font-size: 0.9rem;
}

/* Custom map marker styles */
.custom-marker {
    background-color: #ff6b35;
    border: 3px solid #8B4513;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

/* Navigation Bar Styles */
.navbar {
    background: linear-gradient(145deg, rgba(0,0,0,0.95) 0%, rgba(26,26,46,0.95) 50%, rgba(0,0,0,0.95) 100%);
    padding: 1rem 0;
    position: relative;
    z-index: 20;
    border-bottom: 2px solid #8B4513;
    box-shadow: 0 2px 15px rgba(0,0,0,0.8);
    grid-row: 2;
    grid-column: 1/12;
    backdrop-filter: blur(10px);
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e0e0e0;
    text-decoration: none;
    font-family: 'Griffy', cursive;
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.2), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    color: #ff6b35;
    border-color: #8B4513;
    background: rgba(255, 107, 53, 0.1);
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
    text-shadow: 0 0 5px #ff6b35;
    transform: translateY(-2px);
}

.nav-link.active {
    color: #ff6b35;
    background: linear-gradient(145deg, rgba(255, 107, 53, 0.2), rgba(139, 69, 19, 0.2));
    border-color: #ff6b35;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    text-shadow: 0 0 8px #ff6b35;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff6b35, #d4a574, #ff6b35);
    animation: pulse-glow 2s infinite alternate;
}

.nav-link:hover .nav-icon {
    animation: spooky-bounce 0.6s ease-in-out;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid #8B4513;
    color: #e0e0e0;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    color: #ff6b35;
    border-color: #ff6b35;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
}

/* Story submission styles */
.story-submission-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.submission-header {
    text-align: center;
    margin-bottom: 3rem;
}

.submission-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.instruction {
    color: #c0c0c0;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.coordinates-display {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #8B4513;
}

.coord-label {
    color: #d4a574;
    font-weight: bold;
}

.coord-text {
    color: #e0e0e0;
    margin-left: 0.5rem;
}

.coord-selected {
    color: #ff6b35 !important;
    text-shadow: 0 0 5px #ff6b35;
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #d4a574;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-family: 'Griffy', cursive;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0,0,0,0.3);
    border: 2px solid #8B4513;
    border-radius: 8px;
    color: #e0e0e0;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

/* Button styles */
.submit-btn {
    background: linear-gradient(145deg, #8B4513, #ff6b35);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-family: 'Griffy', cursive;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.submit-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

.submit-btn.enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.submission-note {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: 1rem;
    font-style: italic;
}

/* Messages */
.messages {
    margin-bottom: 2rem;
}

.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.message.success {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00aa00;
    color: #00ff00;
}

.message.error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #aa0000;
    color: #ff6666;
}

.error-message {
    color: #ff6666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Custom marker styles */
.user-location-marker {
    background: transparent;
    border: none;
}

.user-marker-pulse {
    animation: pulse 2s infinite;
    font-size: 24px;
}

.existing-story-marker {
    opacity: 0.7;
}

/* Haunting card and popup images */
.haunting-card-image {
    width: 100%;
    height: 100px;
    overflow: hidden;
    position: relative;
}

.haunting-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1);
}

.popup-container {
    text-align: center;
    min-width: 150px;
}

.popup-thumbnail {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
    border: 2px solid #8B4513;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.popup-link {
    color: #ff6b35;
    text-decoration: none;
    font-family: 'Griffy', cursive;
    font-size: 1rem;
    font-weight: bold;
    display: block;
}

.popup-link:hover {
    text-shadow: 0 0 8px #ff6b35;
}

/* Responsive design */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .map-container {
        padding: 1rem;
    }
    
    #map {
        height: 400px;
    }
    
    #submission-map {
        height: 300px;
    }
    
    .submission-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .submission-title {
        font-size: 2rem;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: linear-gradient(145deg, rgba(0,0,0,0.98) 0%, rgba(26,26,46,0.98) 50%, rgba(0,0,0,0.98) 100%);
        border: 2px solid #8B4513;
        border-top: none;
        box-shadow: 0 5px 20px rgba(0,0,0,0.8);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        gap: 0;
        padding: 1rem 0;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        padding: 1rem 2rem;
        margin: 0.25rem 0;
        border-radius: 0;
        justify-content: center;
    }
    
    .nav-link:hover {
        transform: none;
        background: rgba(255, 107, 53, 0.15);
    }
}
/* ========================================= */
/* STAR WARS CRAWL STYLES */
/* ========================================= */

.star-wars-scroll-container {
    /* Set up the 3D viewing environment */
    perspective: 800px; 
    overflow: hidden; /* Hide content outside the main area */
    height: 600px; /* Define a viewing height for the crawl */
    position: relative;
    z-index: 10;
    /* Ensure no margins/padding interfere with the full screen effect if possible */
    padding: 0;
    margin: 0;
    
    /* Center the perspective view */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Start the crawl from the top of the container */
}

.crawl-container {
    /* Create the area where the crawl text lives */
    position: absolute;
    top: 100%; /* Start the text completely below the bottom of the container */
    height: auto;
    width: 60%; /* Define the width of the text column */
    max-width: 800px; /* Optional: limit text width */
    transform-origin: 50% 100%; /* Rotate around the bottom center */
    
    /* Apply the 3D rotation (the iconic look) */
    transform: rotateX(25deg); 
    
    /* Start the animation */
    animation: crawl-scroll 30s linear forwards; /* Adjust time (e.g., 60s, 120s) for speed */
}

.crawl {
    /* Text alignment and color */
    color: #ffd700; /* Gold/Yellow color for Star Wars text */
    text-align: justify;
    font-family: 'Cinzel', serif; /* Use a more formal font from your base.html */
    font-size: 200%;
    line-height: 1.5;
    
    /* Create the fade effect on the text as it moves up */
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to top, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
}

.crawl-title {
    color: #00bfff; /* A distinct color for the title */
    text-align: center;
    font-size: 250%;
    margin-bottom: 3em;
}

.crawl-heading {
    text-align: center;
    font-size: 150%;
    margin: 2em 0 1em;
}

.contributor-entry h3 {
    text-align: center;
    font-size: 120%;
    margin-bottom: 0.5em;
    color: #fff; /* White for the name */
}

.contributor-role-notes,
.contributor-status {
    text-align: center;
    font-size: 80%;
}


/* The Keyframe Animation */
@keyframes crawl-scroll {
    from {
        /* Start text off-screen below the container */
        top: 100%;
    }
    to {
        /* INCREASE this value to ensure all content moves past the top edge. 
           Try -300% or even -400% if -250% isn't enough. */
        top: -500%; 
    }
}