@media screen and (max-width: 768px) {

    /* =========================================
       1. GLOBAL & VIDEO RESET
       ========================================= */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

    /* Fix Background Video Sizing */
    #video-background-layer, 
    #bg-video {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; /* Fallback */
        height: 100dvh;
        object-fit: cover;
        z-index: -50;
    }

    /* =========================================
       2. NAVBAR
       ========================================= */
    nav.nav-wrapper {
        height: auto !important;
        padding: 10px 0;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(10px);
    }

    nav .max-w-7xl {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
    }

    /* Left Logo */
    nav a[aria-label="AEROCREST 2026"] {
        transform: scale(0.8);
        margin-left: -10px;
    }

    /* Right Group */
    nav .flex.items-center.gap-4 {
        gap: 8px;
        display: flex;
        align-items: center;
    }

    nav a[href="sponsor.html"] {
        display: block !important;
        padding: 6px 10px;
        font-size: 9px;
        border: 1px solid rgba(255, 140, 0, 0.5);
    }

    nav button.nav-cta, nav a.bg-slate-900 {
        padding: 6px 12px;
        font-size: 10px;
    }

    nav img[alt="BS Crescent Institute"] {
        height: 28px;
        width: auto;
    }

    nav .hidden.md\:flex { display: none !important; }

    /* =========================================
       3. HERO & 3D
       ========================================= */
    #cinematic-hero { min-height: 100dvh; padding: 0 20px; }
    .cine-title-primary { font-size: 12vw !important; margin-top: 20px; }
    .cine-actions { flex-direction: column; width: 100%; gap: 15px; }
    .cine-actions button { width: 100%; }
    
    .cube-lock-container, .shape-lock-container { height: 100vh; }
    .cube-scene, .tetra-scene { transform: scale(0.6); }
    .sphere-scene { width: 90vw; height: 90vw; }

    /* =========================================
       4. MISSION SECTION (COUNTDOWN FIXED)
       ========================================= */
    #mission {
        padding-top: 80px !important;
        padding-bottom: 40px !important;
        padding-left: 15px;
        padding-right: 15px;
        height: auto !important;
    }

    #mission .flex-col.md\:flex-row {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    /* Mission Title */
    #mission h2 {
        font-size: 3rem !important;
        line-height: 1;
        text-align: center;
        width: 100%;
    }

    #mission p { text-align: center; }

    /* --- COUNTDOWN: ONE LINE FIX --- */
    #mission .flex.gap-4 {
        display: flex !important;
        flex-direction: row !important; /* Force row layout */
        flex-wrap: nowrap !important;   /* No wrapping */
        justify-content: space-between;
        gap: 5px !important;
        width: 100%;
    }

    .countdown-box {
        min-width: 0 !important;
        flex: 1; /* Distribute space evenly */
        padding: 8px 2px !important;
        height: auto;
    }

    .countdown-val {
        font-size: 1.3rem !important; /* Adjusted to ensure 4 fit */
        line-height: 1.2;
    }

    .countdown-label {
        font-size: 0.55rem !important; /* Tiny labels */
    }

    /* Mission Content */
    #mission .grid.lg\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* =========================================
       5. TIMELINE (Vertical List)
       ========================================= */
    .timeline-section {
        height: auto !important; 
        min-height: auto !important;
        display: block !important;
        padding: 60px 20px !important;
        position: relative !important;
    }

    .timeline-horizontal {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        transform: none !important;
        gap: 0 !important;
        padding: 0 !important;
    }

    .h-timeline-item {
        width: 100% !important;
        flex: none !important;
        padding-bottom: 40px;
        position: relative;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .h-timeline-item::before {
        content: '';
        position: absolute;
        left: 6px;
        top: 10px;
        bottom: 0;
        width: 2px;
        background: rgba(196, 30, 58, 0.3);
    }
    .h-timeline-item:last-child::before,
    .h-timeline-item:first-child::before { display: none; }

    .h-timeline-content {
        border-left: none !important;
        padding-left: 40px;
        margin-left: 0;
    }

    .h-timeline-node {
        left: 0 !important;
        top: 5px !important;
    }

    /* Timeline Header */
    .h-timeline-item:first-child h2 {
        font-size: 2.5rem !important;
        text-align: center;
        width: 100%;
        padding-bottom: 20px;
    }

    /* =========================================
       6. REWARDS (Title & Cards Fit)
       ========================================= */
    /* Sticky Container Reset */
    #rewards .sticky {
        position: relative !important;
        top: auto !important;
        padding: 20px 0 !important;
        background: transparent !important;
        z-index: 1;
    }

    /* Rewards Title Fit */
    #rewards h2 {
        font-size: 2.5rem !important;
        text-align: center !important;
        width: 100% !important;
        white-space: normal !important;
        margin-bottom: 20px !important;
    }

    .stack-wrapper {
        padding-bottom: 50px;
        padding-top: 0 !important;
    }

    /* Card Layout */
    .stack-card {
        position: relative !important;
        top: 0 !important;
        margin-bottom: 30px;
        display: block !important;
    }

    .stack-card > div {
        width: 90% !important;
        margin: 0 auto;
        height: auto !important;
        flex-direction: column;
        padding: 30px 20px !important;
        text-align: center;
        border-radius: 20px;
    }

    .stack-card .text-8xl { font-size: 3.5rem !important; margin-bottom: 10px; }
    .stack-card h3 { font-size: 1.8rem !important; }
    .stack-card p { font-size: 1rem !important; }
    .stack-card .flex { flex-wrap: wrap; justify-content: center; gap: 10px; }

    /* =========================================
       7. SECTION TITLES & LAYOUTS (MOMENTS, COUNCIL, REGISTER)
       ========================================= */
    
    /* Universal Title Fix */
    #gallery h2, 
    #team h2, 
    #speakers h2, 
    #challenges h2,
    #register h2 {
        font-size: 2.2rem !important; /* Forces all big titles to fit */
        line-height: 1.1 !important;
        text-align: center !important;
        width: 100% !important;
        margin: 0 auto 30px auto !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        padding: 0 10px;
    }

    /* Specific fix for Register.html Form Container */
    #register .glass-panel {
        padding: 30px 20px !important;
        width: 100% !important;
    }

    /* Gallery Grid */
    #gallery .grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        grid-auto-rows: 120px;
    }
    #gallery .col-span-2 { grid-column: span 2; }
    #gallery .row-span-2 { grid-row: span 2; }

    /* Team/Leadership */
    #team .flex-wrap { gap: 30px; justify-content: center; }
    #team .glass-panel { width: 100% !important; max-width: 300px; margin: 0 auto; }
    #team .h-\[1px\] { display: none; }

    /* Martian Council */
    #speakers .grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 20px;
    }

    /* Challenges */
    .challenges-grid { grid-template-columns: 1fr; gap: 30px; padding: 0 10px; }
    .challenge-card { min-height: auto; }

    /* FAQ */
    #faq .glass-panel { padding: 20px !important; }
    #faq h2 { font-size: 2.2rem !important; }

    /* Footer */
    footer .flex-col { gap: 20px; }

    /* =========================================
       8. MISSION BRIEFING POPUP FIX
       ========================================= */
    
    /* Adjust overall popup padding */
    #mission-briefing {
        padding: 15px !important;
    }

    /* Fix header alignment to prevent button from squishing */
    #mission-briefing .flex.justify-between.items-start {
        align-items: center !important;
        gap: 15px;
    }

    /* Scale down the title so it fits */
    #brief-title {
        font-size: 1.4rem !important; 
        line-height: 1.2 !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }

    /* Make Close Button (X) larger, highly visible, and tappable */
    #mission-briefing button[onclick="closeBriefing()"] {
        min-width: 44px !important; /* Easy tap target */
        height: 44px !important;
        background: rgba(196, 30, 58, 0.2) !important;
        border: 1px solid rgba(196, 30, 58, 0.6) !important;
        border-radius: 8px;
        flex-shrink: 0; /* Prevents title from squeezing the button */
    }

    /* Make the X icon itself bright white and larger */
    #mission-briefing button[onclick="closeBriefing()"] .material-icons {
        font-size: 1.8rem !important; 
        color: #ffffff !important;    
        opacity: 1 !important;
    }
    /* =========================================
       9. PREVIOUS EVENTS TITLE FIX (ONE LINE)
       ========================================= */
    #gallery h2 {
        font-size: 7.5vw !important; /* Smaller percentage to fit the wide Orbitron font */
        letter-spacing: -1px !important; /* Pull letters slightly tighter */
        white-space: nowrap !important; /* Forces it to NEVER break into two lines */
        word-wrap: normal !important;
        padding: 0 !important;
    }
}
