/* ============================================
   RETRO DESIGN SYSTEM - Matching Main Site
   ============================================ */

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

/* Retro Color Palette - CSS Variables */
:root {
    /* Primary Background Colors */
    --bg-primary: #E8E8E8;        /* Light Gray */
    --bg-primary-alt: #F5F5F5;    /* Lighter Gray */
    --bg-secondary: #D0D0D0;       /* Medium Gray */
    --bg-secondary-alt: #FFFFFF;   /* White */
    
    /* Accent Colors - Toned Down */
    --accent-green: #4CAF50;       /* Muted Green */
    --accent-green-bright: #66BB6A; /* Lighter Green */
    --accent-magenta: #9C27B0;      /* Muted Magenta */
    --accent-yellow: #FFC107;       /* Amber Yellow */
    --accent-cyan: #00BCD4;         /* Muted Cyan */
    
    /* Text Colors */
    --text-light: #FFFFFF;          /* White on dark */
    --text-dark: #212121;           /* Dark Gray */
    
    /* Link Colors */
    --link-unvisited: #66BB6A;      /* Lighter Green */
    --link-visited: #4CAF50;        /* Muted Green */
    --link-hover: #FFC107;          /* Amber Yellow */
    
    /* Border Colors */
    --border-light: #FFFFFF;
    --border-dark: #808080;
}

body {
    font-family: 'Courier New', 'Courier', monospace;
    background: var(--bg-primary);
    color: var(--text-dark);
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 16px;
    /* Prevent zoom on double tap for iOS */
    touch-action: manipulation;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Allow container to grow beyond viewport */
    width: 100vw;
    padding-bottom: 80px; /* Add padding at bottom to prevent content from being hidden behind fixed footer */
}

/* Header - Retro Style */
.header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-green);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 24px;
    color: var(--accent-green);
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    margin: 0;
}

.back-home-link {
    color: var(--accent-green-bright);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border: 2px solid var(--accent-green);
    font-family: 'Courier New', 'Courier', monospace;
    transition: all 0.2s ease;
    display: inline-block;
}

.back-home-link:hover {
    background-color: var(--accent-green);
    color: var(--bg-primary);
    border-color: var(--accent-green-bright);
}

.status {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 2px outset var(--border-light);
    font-size: 14px;
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: bold;
    color: var(--text-dark);
}

.status.connected {
    background: var(--accent-green);
    color: var(--bg-primary);
    border: 2px solid var(--accent-green-bright);
}

.status.error {
    background: #d32f2f;
    color: var(--text-light);
    border: 2px solid #b71c1c;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: visible; /* Allow content to extend beyond viewport */
    gap: 10px;
    padding: 10px;
    min-height: 0; /* Allow flex children to shrink */
}

/* 3D Viewer - Full Width Top Row - Retro Style */
.viewer-3d-container {
    width: 100%;
    background: var(--bg-secondary);
    border: 2px outset var(--border-light);
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 45vh;
    min-height: 400px;
    flex: 0 0 auto;
    overflow: visible;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.viewer-3d-container h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

#godot-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 4px;
    min-height: 350px;
    display: block;
    border: none;
    /* Prevent iframe from causing layout issues on mobile */
    touch-action: none;
    -webkit-touch-callout: none;
}

.viewer-info {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    font-size: 14px;
    flex-wrap: wrap;
    padding: 8px 4px;
    overflow: visible;
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Courier New', 'Courier', monospace;
}

.viewer-info > div {
    white-space: nowrap;
    overflow: visible;
    padding: 2px 4px;
    line-height: 1.5;
    flex-shrink: 0;
    color: var(--text-dark);
}

.timestamp-display {
    color: var(--accent-green);
    font-weight: bold;
    font-family: 'Courier New', 'Courier', monospace;
}

.viewer-info span {
    color: var(--accent-green-bright);
    font-weight: bold;
}

/* Bottom Row - Video and Map/Chart */
.bottom-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    flex: 1 1 auto; /* Allow to grow and shrink */
    min-height: 450px; /* Increased to ensure video controls are visible */
    max-height: 50vh; /* Maximum 50% of viewport */
    overflow: hidden; /* Changed to hidden to prevent content overflow */
    align-items: stretch; /* Ensure children stretch to same height */
}

/* Video Container - Left Side (50% width) - Retro Style */
.video-container {
    background: var(--bg-secondary);
    border: 2px outset var(--border-light);
    padding: 10px;
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden; /* Changed to hidden to contain content */
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative; /* For proper containment */
}

.video-container h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    flex-shrink: 0; /* Prevent heading from being cut off */
    padding: 0;
    line-height: 1.2;
}

.video-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 4px;
    overflow: hidden; /* Changed to hidden to contain video */
    position: relative;
    min-height: 400px;
    width: 100%;
    margin-bottom: 0; /* Ensure no margin cutting off controls */
    min-width: 0; /* Allow flex item to shrink */
}

/* YouTube player container */
#youtube-player-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    background: #000;
    overflow: hidden; /* Changed to hidden to contain video */
    display: flex;
    align-items: center;
    justify-content: center;
}

#youtube-player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    min-height: 400px; /* Ensure minimum height for controls */
    max-width: 100%; /* Ensure it doesn't overflow container */
    max-height: 100%; /* Ensure it doesn't overflow container */
}


/* Map and Chart Column - Right Side (50% width, stacked vertically) */
.map-chart-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 50%;
    min-width: 0;
    overflow: hidden; /* Keep hidden for proper flex behavior */
    align-items: stretch; /* Ensure children stretch to full width */
}

.map-container {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px outset var(--border-light);
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative; /* For proper containment of map controls */
}

.map-container h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    flex-shrink: 0; /* Prevent heading from being cut off */
    padding: 0;
    line-height: 1.2;
}

#map {
    flex: 1;
    border: 2px inset var(--border-dark);
    min-height: 200px;
    width: 100%;
    height: 100%;
    position: relative; /* For proper positioning of Leaflet controls */
    overflow: hidden; /* Ensure map doesn't overflow */
}

.chart-container {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px outset var(--border-light);
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.chart-container h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    flex-shrink: 0; /* Prevent heading from being cut off */
    padding: 0;
    line-height: 1.2;
}

#altitude-chart {
    flex: 1;
    min-height: 200px;
    width: 100%;
    height: 100%;
}

/* Attitude Chart Container - Full Width Below Bottom Row - Retro Style */
.attitude-chart-container {
    width: 100%;
    background: var(--bg-secondary);
    border: 2px outset var(--border-light);
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 25vh;
    min-height: 200px;
    flex: 0 0 auto;
    margin-top: 10px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.attitude-chart-container h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

#attitude-chart {
    flex: 1;
    min-height: 200px;
    width: 100%;
    height: 100%;
    display: block;
    max-width: 100%;
}

/* Controls Panel - Fixed Footer - Retro Style */
.controls-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-top: 2px solid var(--accent-green);
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    /* Ensure panel is above other content */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--accent-green);
    color: var(--bg-primary);
    border: 2px outset var(--accent-green-bright);
    cursor: pointer;
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.mobile-menu-toggle:hover {
    background: var(--accent-green-bright);
    border: 2px inset var(--accent-green);
}

.mobile-menu-toggle:active {
    border: 2px inset var(--accent-green);
    background: var(--link-visited);
}

.mobile-menu-toggle[aria-expanded="true"] {
    background: var(--accent-green-bright);
    border: 2px inset var(--accent-green);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    margin-left: 12px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--bg-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    color: var(--text-dark);
    border: 2px outset var(--border-light);
    cursor: pointer;
    font-size: 14px;
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: bold;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn:hover {
    background: var(--button-hover-bg);
    border: 2px inset var(--border-dark);
    padding: 8px 16px;
    font-size: 14px;
}

.btn:active {
    background: var(--bg-secondary);
    border: 2px inset var(--border-dark);
    padding: 8px 16px;
    font-size: 14px;
}

.btn-primary {
    min-width: 80px;
    background: var(--accent-green);
    color: var(--bg-primary);
    border-top: 2px solid var(--accent-green-bright);
    border-left: 2px solid var(--accent-green-bright);
    border-bottom: 2px solid var(--link-visited);
    border-right: 2px solid var(--link-visited);
}

.btn-primary:hover {
    background: var(--accent-green-bright);
    color: var(--bg-primary);
    border-top: 2px solid var(--accent-yellow);
    border-left: 2px solid var(--accent-yellow);
    border-bottom: 2px solid var(--accent-green);
    border-right: 2px solid var(--accent-green);
    padding: 8px 16px;
    font-size: 14px;
}

.btn-jump {
    background: var(--bg-primary);
    color: var(--text-dark);
    font-size: 12px;
    padding: 6px 12px;
    border: 2px outset var(--border-light);
}

.btn-jump:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--accent-green);
    padding: 6px 12px;
    font-size: 12px;
}

.playback-controls {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-light);
}

.playback-controls h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.playback-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-play, .btn-pause, .btn-stop {
    min-width: 100px;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-play {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.btn-play:hover {
    background: var(--accent-green-bright);
}

.jump-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.jump-controls h3 {
    font-size: 14px;
    color: var(--text-dark);
    white-space: nowrap;
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: bold;
    text-transform: uppercase;
}

.jump-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Leaflet Map Retro Theme Override */
.leaflet-container {
    background: var(--bg-primary);
}

/* Ensure Leaflet attribution is visible */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 5px !important;
    font-size: 11px !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    z-index: 1000 !important;
}

/* Scrollbar Styling - Retro Theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-green);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green-bright);
}

/* Loading Overlay - Retro Style */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh; /* Use viewport height for better mobile support */
    background: rgba(232, 232, 232, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    /* Prevent scrolling when loading */
    overflow: hidden;
    /* Ensure it covers the entire viewport on mobile */
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}

.loading-content {
    text-align: center;
    color: var(--text-dark);
    font-family: 'Courier New', 'Courier', monospace;
    max-width: 90%;
    padding: 20px;
    box-sizing: border-box;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-secondary);
    border-top: 4px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background: var(--bg-secondary-alt);
    border: 2px solid var(--border-dark);
    border-left: 4px solid var(--accent-green);
    padding: 15px 20px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 14px;
    color: var(--text-dark);
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    position: relative;
}

.notification.info {
    border-left-color: var(--accent-cyan);
}

.notification.warning {
    border-left-color: var(--accent-yellow);
}

.notification.error {
    border-left-color: #f44336;
}

.notification.success {
    border-left-color: var(--accent-green);
}

.notification.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.loading-text {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-green);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.loading-status {
    font-size: 14px;
    color: var(--text-dark);
    margin-top: 10px;
    font-family: 'Courier New', 'Courier', monospace;
}

/* ============================================
   RESPONSIVE DESIGN - Mobile First Approach
   ============================================ */

/* Mobile devices (phones, up to 768px) */
@media screen and (max-width: 768px) {
    /* Prevent horizontal scrolling */
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    /* Header adjustments */
    .header {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .header-content {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .header h1 {
        font-size: 16px;
        width: 100%;
        margin: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        letter-spacing: 0.5px;
    }
    
    .back-home-link {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .status {
        font-size: 11px;
        padding: 6px 10px;
        align-self: flex-end;
        margin-top: -8px;
    }
    
    /* Main content padding */
    .main-content {
        padding: 6px;
        gap: 6px;
    }
    
    /* 3D Viewer - smaller on mobile */
    .viewer-3d-container {
        height: auto;
        min-height: 250px;
        max-height: 40vh;
        padding: 6px;
    }
    
    .viewer-3d-container h2 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    #godot-iframe {
        min-height: 200px;
        max-height: calc(40vh - 80px);
    }
    
    .viewer-info {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
        margin-top: 6px;
        padding: 4px 0;
    }
    
    .viewer-info > div {
        white-space: normal;
        overflow: visible;
        line-height: 1.4;
    }
    
    /* Bottom row - stack vertically on mobile */
    .bottom-row {
        flex-direction: column;
        max-height: none;
        gap: 6px;
    }
    
    .video-container,
    .map-chart-column {
        flex: 1 1 100%;
        min-width: 100%;
        width: 100%;
    }
    
    .video-container {
        min-height: 220px;
        max-height: 50vh;
    }
    
    .video-wrapper,
    #youtube-player-container {
        min-height: 220px;
        max-height: calc(50vh - 50px);
    }
    
    /* Map and chart containers */
    .map-chart-column {
        gap: 6px;
    }
    
    .map-container {
        min-height: 180px;
        max-height: 30vh;
        padding: 6px;
    }
    
    .chart-container {
        min-height: 140px;
        max-height: 20vh;
        padding: 6px;
    }
    
    .map-container h2,
    .chart-container h2 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    #map {
        min-height: 150px;
        max-height: calc(30vh - 40px);
    }
    
    #altitude-chart {
        min-height: 120px;
        max-height: calc(20vh - 40px);
    }
    
    /* Attitude chart */
    .attitude-chart-container {
        min-height: 200px;
        max-height: none;
        padding: 8px;
        margin-top: 6px;
        display: flex;
        flex-direction: column;
    }
    
    .attitude-chart-container h2 {
        font-size: 14px;
        margin-bottom: 8px;
        flex-shrink: 0;
    }
    
    #attitude-chart {
        flex: 1;
        min-height: 180px;
        width: 100%;
        height: auto;
        max-height: none;
    }
    
    /* Controls panel - mobile friendly */
    .controls-panel {
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: none;
        overflow: visible;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .jump-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        padding: 12px 10px;
        background: var(--bg-secondary);
        border-top: 2px solid var(--accent-green);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        opacity: 0;
        visibility: hidden;
    }
    
    .jump-controls.active {
        max-height: 60vh;
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .jump-controls h3 {
        font-size: 13px;
        text-align: center;
        margin: 0 0 8px 0;
        padding: 0;
        font-weight: bold;
        color: var(--accent-green);
    }
    
    .jump-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
    }
    
    .btn-jump {
        font-size: 10px;
        padding: 10px 6px;
        min-height: 44px;
        width: 100%;
        max-width: none;
        text-align: center;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Container padding adjustment */
    .container {
        padding-bottom: 60px; /* Reduced since menu is collapsible */
    }
    
    /* Loading overlay - mobile adjustments */
    .loading-content {
        max-width: 85%;
        padding: 15px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
        margin: 0 auto 15px;
    }
    
    .loading-text {
        font-size: 16px;
        letter-spacing: 1px;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .loading-status {
        font-size: 12px;
        line-height: 1.4;
    }
    
    /* Notification adjustments */
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .notification {
        min-width: auto;
        max-width: 100%;
        font-size: 13px;
        padding: 12px 16px;
    }
}

/* Tablet devices (768px to 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .header h1 {
        font-size: 20px;
    }
    
    .viewer-3d-container {
        height: 40vh;
        min-height: 350px;
    }
    
    #godot-iframe {
        min-height: 300px;
    }
    
    .bottom-row {
        min-height: 350px;
        max-height: 45vh;
    }
    
    .video-wrapper,
    #youtube-player-container {
        min-height: 350px;
    }
    
    .map-container {
        min-height: 160px;
        max-height: 28vh;
    }
    
    .chart-container {
        min-height: 140px;
        max-height: 20vh;
    }
    
    #map {
        min-height: 150px;
        max-height: calc(28vh - 40px);
    }
    
    #altitude-chart {
        min-height: 120px;
        max-height: calc(20vh - 40px);
    }
    
    .attitude-chart-container {
        height: auto;
        min-height: 200px;
        max-height: none;
    }
    
    #attitude-chart {
        min-height: 180px;
        max-height: none;
    }
    
    .jump-buttons {
        gap: 8px;
        grid-template-columns: repeat(3, 1fr);
    }
    
    .btn-jump {
        font-size: 11px;
        padding: 8px 10px;
    }
}

/* Large screens (1025px and up) - current desktop styles */
@media screen and (min-width: 1025px) {
    /* Desktop styles are already defined above */
    /* Add any desktop-specific overrides here if needed */
}

/* Very small mobile devices (up to 480px) */
@media screen and (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }
    
    .header h1 {
        font-size: 14px;
        letter-spacing: 0.3px;
    }
    
    .back-home-link {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .status {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .main-content {
        padding: 4px;
        gap: 4px;
    }
    
    .viewer-3d-container {
        min-height: 200px;
        max-height: 35vh;
        padding: 4px;
    }
    
    .viewer-3d-container h2 {
        font-size: 12px;
    }
    
    #godot-iframe {
        min-height: 150px;
        max-height: calc(35vh - 60px);
    }
    
    .viewer-info {
        font-size: 10px;
        gap: 3px;
    }
    
    .viewer-info > div {
        white-space: normal;
        line-height: 1.3;
    }
    
    .video-container {
        min-height: 200px;
        max-height: 45vh;
        padding: 4px;
    }
    
    .video-container h2 {
        font-size: 12px;
    }
    
    .video-wrapper,
    #youtube-player-container {
        min-height: 200px;
        max-height: calc(45vh - 40px);
    }
    
    .map-container {
        min-height: 160px;
        max-height: 28vh;
        padding: 4px;
    }
    
    .chart-container {
        min-height: 120px;
        max-height: 18vh;
        padding: 4px;
    }
    
    .map-container h2,
    .chart-container h2 {
        font-size: 12px;
    }
    
    #map {
        min-height: 130px;
        max-height: calc(28vh - 35px);
    }
    
    #altitude-chart {
        min-height: 100px;
        max-height: calc(18vh - 35px);
    }
    
    .attitude-chart-container {
        min-height: 180px;
        max-height: none;
        padding: 6px;
    }
    
    .attitude-chart-container h2 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    #attitude-chart {
        min-height: 160px;
        max-height: none;
    }
    
    .mobile-menu-toggle {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .hamburger-icon {
        width: 20px;
        height: 18px;
        margin-left: 8px;
    }
    
    .jump-controls.active {
        max-height: 65vh;
        padding: 10px 8px;
    }
    
    .jump-controls {
        gap: 8px;
    }
    
    .jump-controls h3 {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .jump-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    
    .btn-jump {
        font-size: 9px;
        padding: 10px 4px;
        min-height: 44px;
        line-height: 1.2;
    }
    
    .container {
        padding-bottom: 60px; /* Reduced since menu is collapsible */
    }
    
    /* Loading overlay - very small screens */
    .loading-content {
        max-width: 90%;
        padding: 12px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
        margin: 0 auto 12px;
    }
    
    .loading-text {
        font-size: 14px;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
        line-height: 1.2;
    }
    
    .loading-status {
        font-size: 11px;
        line-height: 1.3;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 8px 12px;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .header-content {
        flex-direction: row;
        align-items: center;
        flex: 1;
    }
    
    .header h1 {
        font-size: 14px;
        flex: 0 1 auto;
        margin: 0;
    }
    
    .back-home-link {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .status {
        margin-top: 0;
    }
    
    .main-content {
        padding: 6px;
        gap: 6px;
    }
    
    .viewer-3d-container {
        height: auto;
        min-height: 280px;
        max-height: 50vh;
    }
    
    #godot-iframe {
        min-height: 250px;
        max-height: calc(50vh - 70px);
    }
    
    .viewer-info {
        flex-direction: row;
        font-size: 11px;
        gap: 10px;
    }
    
    .bottom-row {
        flex-direction: row;
        max-height: 45vh;
        gap: 6px;
    }
    
    .video-container {
        flex: 0 0 50%;
        min-height: auto;
        max-height: 45vh;
    }
    
    .video-wrapper,
    #youtube-player-container {
        min-height: 200px;
        max-height: calc(45vh - 50px);
    }
    
    .map-chart-column {
        flex: 0 0 50%;
        gap: 6px;
    }
    
    .map-container {
        max-height: calc(28vh - 10px);
    }
    
    .chart-container {
        max-height: calc(20vh - 10px);
    }
    
    #map {
        min-height: 120px;
        max-height: calc(28vh - 40px);
    }
    
    #altitude-chart {
        min-height: 100px;
        max-height: calc(20vh - 40px);
    }
    
    .attitude-chart-container {
        min-height: 160px;
        max-height: 25vh;
    }
    
    #attitude-chart {
        min-height: 120px;
        max-height: calc(25vh - 40px);
    }
    
    .controls-panel {
        padding: 0;
        flex-direction: column;
        align-items: stretch;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .jump-controls {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        opacity: 0;
        visibility: hidden;
    }
    
    .jump-controls.active {
        max-height: 50vh;
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .jump-controls h3 {
        font-size: 11px;
        text-align: center;
        margin-bottom: 6px;
    }
    
    .jump-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .btn-jump {
        font-size: 10px;
        padding: 8px 6px;
        min-height: 40px;
        white-space: normal;
        max-width: none;
    }
    
    .container {
        padding-bottom: 80px;
    }
}

/* High DPI displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    /* Ensure crisp rendering on retina displays */
    .btn,
    .btn-jump {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .btn,
    .btn-jump {
        min-height: 44px; /* Apple's recommended minimum touch target */
        padding: 10px 16px;
    }
    
    .back-home-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    .viewer-info {
        /* Larger text for easier reading on touch devices */
        font-size: 13px;
    }
    
    /* Prevent text selection on buttons during touch */
    .btn,
    .btn-jump,
    .back-home-link {
        -webkit-tap-highlight-color: rgba(76, 175, 80, 0.3);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Improve scrolling performance */
    .controls-panel,
    .jump-buttons {
        -webkit-overflow-scrolling: touch;
    }
}

