html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: #020409;
    overflow: hidden;
    font-family: system-ui;
    font-size: 18px;
    /* Zoom 1 removed to allow user scaling if needed and avoid issues */
}

#globe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

#globe.faded-in {
    opacity: 1;
}

#chips {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    z-index: 9999;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

#chips.faded-in {
    opacity: 1;
    pointer-events: auto;
}

.chip {
    background: #0b0f18;
    border: 0.0625rem solid #666;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
}

.chip:hover {
    background: #1a2238;
}

.target-marker {
    width: 1.5rem;
    height: 1.5rem;
    border: 0.125rem solid #ff4d4d;
    border-radius: 50%;
    position: relative;
}

.target-marker::after {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    background: #ff4d4d;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.click-marker {
    width: 1.5rem;
    height: 1.5rem;
    border: 0.125rem solid rgb(255, 165, 0);
    border-radius: 50%;
    position: relative;
}

.click-marker::after {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    background: rgb(255, 165, 0);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.click-marker::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3.75rem;
    height: 3.75rem;
    border: 0.1875rem solid rgb(255, 165, 0);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    /* animation: pulsing-ring 2s ease-out infinite; */
    pointer-events: none;
}

.flexible-poi-marker {
    width: 1.5rem;
    height: 1.5rem;
    border: 0.125rem solid #ff6b6b;
    border-radius: 50%;
    position: relative;
}

.flexible-poi-marker::after {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    background: #ff6b6b;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes pulsing-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

.beam-point-marker {
    position: relative;
}

.beam-point-marker::after {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    background: #ffd41d;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.beam-point-marker::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3.75rem;
    height: 3.75rem;
    border: 0.1875rem solid #ffd41d;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    /* animation: pulsing-ring 2s ease-out infinite; */
    pointer-events: none;
}

.sweep-point-marker {
    width: 1rem;
    height: 1rem;
    border: 0.125rem solid #fff;
    border-radius: 50%;
    position: relative;
    background: #ffd700;
    box-shadow: 0 0 0.5rem #ffd700;
    /* animation: sweep-pulse 1s ease-in-out infinite; */
}

@keyframes sweep-pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.7;
    }
}

.gps-coordinates {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 15, 24, 0.95);
    border: 0.0625rem solid #666;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    color: #ff6b6b;
    font-size: 0.875rem;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

.gps-coordinates.faded-in {
    opacity: 1;
    pointer-events: auto;
}

.gps-coordinates.visible {
    display: block;
}

/* Left-side UI wrapper */
.left-ui-wrapper {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

.left-ui-wrapper.faded-in {
    opacity: 1;
    pointer-events: auto;
}

.left-ui-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.poi-mode-container {
    background: rgba(11, 15, 24, 0.85);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
    width: 18rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


.gps-input-panel {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

.gps-input-panel.visible {
    display: flex;
}

.gps-input-label {
    color: #888;
    font-size: 0.75rem;
}

.gps-input {
    background: #1a2238;
    border: 0.0625rem solid #666;
    border-radius: 0.25rem;
    padding: 0.5rem;
    color: #fff;
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
}

.gps-input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.gps-input.error {
    border-color: #ff4d4d;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.gps-error {
    color: #ff4d4d;
    font-size: 0.75rem;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(11, 15, 24, 0.95);
    border: 1px solid #ff4d4d;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    padding: 0.5rem;
    z-index: 20;
    box-sizing: border-box;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.gps-error:not(:empty) {
    display: block;
}

.gps-hint {
    color: #666;
    font-size: 0.625rem;
}

#version {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    align-items: flex-end;
    font-family: 'JetBrains Mono', monospace;
}

#version.faded-in {
    opacity: 1;
}

/* Satellite Filter Styles */
.satellite-filter-container {
    background: rgba(11, 15, 24, 0.95);
    border: 0.0625rem solid #666;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-width: 5.5rem;
}

.sat-btn {
    background: #1a2238;
    border: 0.0625rem solid #666;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: #888;
    cursor: pointer;
    font-size: 0.6875rem;
    transition: all 0.2s ease;
}

.sat-btn:hover {
    background: #2a3248;
    color: #fff;
}

.sat-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.sat-btn[data-sat="S1A"].active {
    background: rgb(255, 107, 107);
    border-color: rgb(255, 107, 107);
}

.sat-btn[data-sat="S1C"].active {
    background: rgb(107, 200, 255);
    border-color: rgb(107, 200, 255);
}

/* Accessibility Styles */

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
.sat-btn:focus-visible,
.chip:focus-visible,
.toggle-switch input:focus-visible+.toggle-slider,
.gps-input:focus-visible {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

/* Remove default focus outline when using mouse */
.sat-btn:focus:not(:focus-visible),
.chip:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast focus for critical interactive elements */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #ff6b6b;
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 10000;
    text-decoration: none;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 10000;
    background: rgba(4, 7, 13, 0.95);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-out;
}

.loading-spinner {
    width: 3.5rem;
    height: 3.5rem;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid #ff6b6b;
    border-right: 4px solid #6bc8ff;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
    }
}

.loading-progress {
    width: 240px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #6bc8ff);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Calendar Premium Styles */
.calendar-container {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(11, 15, 24, 0.85);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.25rem;
    color: #fff;
    font-size: 0.875rem;
    z-index: 10000;
    width: 18rem;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
    scrollbar-color: #666 #2d2d2d;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    /* Hidden on desktop */
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(40, 40, 40, 0.95);
}

.mobile-menu-toggle.active {
    background: #2a2a2a;
    border-color: #ff6b6b;
}

.info-box {
    position: absolute;
}

.calendar-header {
    text-align: center;
    margin-bottom: 1.25rem;
    font-weight: 700;
    color: #ff6b6b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.date-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-item {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.date-item.selected {
    background: rgba(255, 107, 107, 0.15);
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.2);
}

.date-item-date {
    font-weight: 600;
    color: #fff;
}

.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-dots {
    display: flex;
    gap: 0.5rem;
}

.pagination-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-dot.active {
    background: #ff6b6b;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.4);
}

.copy-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(11, 15, 24, 0.9);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 107, 107, 0.2);
    z-index: 20000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.copy-feedback.show {
    opacity: 1;
}

/* Time Slider Premium Styles */
.time-slider-container {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 15, 24, 0.85);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 1.25rem 1.5rem;
    color: #fff;
    z-index: 10000;
    width: 40rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.time-slider-main-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.playback-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.375rem;
    border-radius: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-control {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.625rem;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-control.primary {
    background: #ff6b6b;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-control.primary:hover {
    background: #ff8787;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.time-info {
    display: flex;
    flex-direction: column;
    min-width: 7rem;
}

.time-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: #ff6b6b;
    letter-spacing: -0.02em;
}

.time-label {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.125rem;
}

.time-slider-track-wrap {
    flex-grow: 1;
    position: relative;
    padding: 0.5rem 0;
}

.time-slider-input {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.time-slider-input::-webkit-slider-runnable-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.time-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    margin-top: -5px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease;
}

.time-slider-input:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.progress-bar-minimal {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: #ff6b6b;
    border-radius: 2px;
    pointer-events: none;
    margin-top: -2px;
    z-index: 1;
}

.speed-control-compact {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.875rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.speed-selector-clean {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

/* Info Box Styles (Moved from inline JS) */
.info-box {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(11, 15, 24, 0.95);
    border: 0.0625rem solid #666;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #fff;
    font-size: 0.8125rem;
    z-index: 10000;
    min-width: 17.5rem;
    max-width: 21.875rem;
    backdrop-filter: blur(10px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Removed font-size: 16px to keep desktop size (18px) */

    /* Adjust Left UI Wrapper */
    .left-ui-wrapper {
        top: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        /* Full width minus margins */
        width: auto;
        bottom: auto;
        pointer-events: none;
        /* Let clicks pass through wrapper */
        align-items: center;
        /* Center content on mobile */
    }

    .left-ui-wrapper>* {
        pointer-events: auto;
        /* Re-enable pointer events for children */
    }

    .poi-mode-container {
        width: 100%;
        max-width: 24rem;
        /* Limit width on mobile */
        margin: 0 auto;
        /* Center it */
        box-sizing: border-box;
    }

    /* Adjust Calendar */
    .calendar-container {
        width: 100%;
        max-width: 24rem;
        max-height: 40vh;
        margin: 0 auto;
        box-sizing: border-box;
    }



    /* Hide rows by default on mobile */
    .left-ui-row,
    .calendar-container {
        display: none;
    }

    /* Show when expanded */
    .left-ui-wrapper.expanded .left-ui-row {
        display: flex;
    }

    .left-ui-wrapper.expanded .calendar-container {
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
        /* Show toggle button on mobile */
        pointer-events: auto;
    }

    /* Adjust Time Slider */
    .time-slider-container {
        width: 90%;
        bottom: 4rem;
        /* Move up slightly */
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .time-slider-main-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .playback-group {
        justify-content: center;
    }

    /* Info Box on Mobile */
    .info-box {
        display: none;
    }

    .info-box.info-box-active {
        display: block !important;
        top: auto !important;
        bottom: 1rem !important;
        left: 50% !important;
        transform: translateX(-50%);
        right: auto !important;
        width: 95%;
        max-width: 24rem;
        background: rgba(11, 15, 24, 0.5) !important;
        /* increased transparency */
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        border-radius: 12px;
        z-index: 10001;
        /* Ensure on top */
    }

    /* GPS Coordinates */
    .gps-coordinates {
        bottom: 0.5rem;
        width: 90%;
        text-align: center;
        font-size: 0.75rem;
        display: block;
        /* Ensure visible by default */
    }

    /* Chips */
    #chips {
        top: 50%;
        transform: translateY(-50%);
        left: auto;
        right: 0.5rem;
        width: auto;
        flex-direction: column;
        max-height: 60vh;
        overflow-y: auto;
        padding-right: 0.25rem;
        /* space for scrollbar if needed */
        justify-content: flex-start;
        align-items: flex-end;
    }

    /* Version Info */
    #version {
        display: none;
        /* Hide on mobile to save space */
    }

    /* Clean up POI Mode Container on Mobile */
    /* Hide everything EXCEPT the satellite filter */
    .poi-mode-container>div:not(.satellite-filter-container) {
        display: none !important;
    }

    /* Ensure the filter container is visible and styled correctly */
    .satellite-filter-container {
        display: block !important;
        margin-top: 0 !important;
        width: 100%;
        text-align: center;
        background: rgba(11, 15, 24, 0.5) !important;
        /* Transparent background */
        backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 8px !important;
        padding: 0.5rem !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    }

    .satellite-filter-container>div[role="radiogroup"] {
        justify-content: center;
    }
}