[data-color-scheme="dark"] {
            color-scheme: dark;
        }

        .modal-overlay {
            display: none;
            position: fixed;
            z-index: 2000;
            left: 0; top: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.5);
            align-items: center;
            justify-content: center;
        }
        .modal-overlay.visible {
            display: flex;
        }
        .modal-box {
            background: #222;
            color: #fff;
            padding: 24px 32px;
            border-radius: 8px;
            box-shadow: 0 2px 16px rgba(0,0,0,0.5);
            text-align: center;
            max-width: 500px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            box-sizing: border-box;
        }
        .modal-box a {
            color: #4da3ff;
            text-decoration: none;
        }
        .modal-box a:hover {
            text-decoration: underline;
        }
        .modal-box h3 {
            margin-top: 0;
            border-bottom: 1px solid #555;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .settings-content {
            text-align: left;
            margin-bottom: 20px;
        }
        .setting-item {
            margin-bottom: 15px;
        }
        .setting-item label {
            display: block;
            margin-bottom: 5px;
            color: #ccc;
        }
        .setting-item input {
            width: 100%;
            padding: 8px;
            background: #333;
            border: 1px solid #555;
            color: #fff;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .modal-box button {
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .autocomplete-results {
            position: absolute;
            background: #444;
            border: 1px solid #666;
            border-radius: 4px;
            z-index: 2001; /* Above modal overlay */
            max-height: 150px;
            overflow-y: auto;
            width: calc(100% - 64px); /* Match modal padding */
        }
        .autocomplete-item {
            padding: 8px 12px;
            color: #eee;
            cursor: pointer;
        }
        .autocomplete-item:hover {
            background: #555;
        }
        .autocomplete-item:not(:last-child) {
            border-bottom: 1px solid #555;
        }



        body, html {
            font-family: 'Source Sans Pro', Tahoma, sans-serif;
            font-size: 16px;
            line-height: 1.4em;
            margin: 0;
            height: 100% !important;
        }

        body {
            /*padding: 0 1em 3em 1em;            */
        }

            body.dark {
                background-color: #090909;
                color: #ccc;
            }

        body, html {
            font-family: 'Source Sans Pro', Tahoma, sans-serif;
            font-size: 16px;
            line-height: 1.4em;
            margin: 0;
        }

            body > div {
                /*                max-width: 800px;
                        min-width: 260px;
        */
            }

                body > div > div {
                    /*margin: 2em 0;*/
                }

        h3 {
            margin: 0;
        }

        h2 {
            margin: 0;
        }

        /* Styles for the new native-style timeframe control */
        .leaflet-control-timeframe-button {
                        /* Center children with flex */
                        width: 44px;
                        height: 44px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        background-color: #fff;
                        border: 2px solid #ccc;
                        border-radius: 4px;
                        box-shadow: 0 1px 5px rgba(0,0,0,0.65);
                        box-sizing: border-box;
                        background-position: 50% 50%;
                        background-repeat: no-repeat;
                        cursor: pointer;
                        display: block;
                        outline: none;
                        text-align: center;
                        text-decoration: none;
                        color: black;
                        font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
                        overflow: hidden;
                        position: relative;
                        padding: 0;
                        margin: 0;
        }
        .leaflet-control-timeframe-button:hover {
            border-color: #999;
        }

        .timeframe-panel {
            position: absolute;
            top: 10px;
            right: 50px; /* Position next to the control button */
            z-index: 1000;
            background: #222;
            border-radius: 4px;
            box-shadow: 0 1px 5px rgba(0,0,0,0.65);
            display: none; /* Hidden by default */
            
            /* Scrollability for mobile */
            max-width: calc(100vw - 65px);
            overflow-x: auto;
            white-space: nowrap; /* Keep buttons in a single line */
            -webkit-overflow-scrolling: touch;
            -ms-overflow-style: none;
            scrollbar-width: none;
        }
        .timeframe-panel.visible {
            display: block;
        }
        .timeframe-panel::-webkit-scrollbar {
            display: none;
        }

        .timeframe-panel button {
            font-size: 1em;
            padding: 8px 12px;
            margin: 0;
            border: none;
            border-right: 1px solid #555;
            background: transparent;
            color: #eee;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .timeframe-panel button:hover {
            background-color: #444;
        }
        .timeframe-panel button:last-child {
            border-right: none;
        }
        .timeframe-panel button.active {
            background-color: cornflowerblue;
            color: #fff;
        }

        #map {
            width: 100%;
            height: 100%;
        }

        .station-icon {
            filter: grayscale(100%) brightness(150%) invert(10%);
        }

        .marker-cluster span {
            color: #000;
        }

        .leaflet-marker-icon {
            transition: opacity 300ms;
        }

        .leaflet-tooltip-mobile-station {
            font-size: 9px;
            padding: 1px 2px 0 2px !important;
            border: 0 !important;
            background-color: rgba(255,255,255,0.8) !important;
            transition: opacity 1s;
        }

            .leaflet-tooltip-mobile-station::before {
                bottom: 0;
                margin-bottom: -12px;
                border-top-color: rgba(255,255,255,0.8) !important;
            }

        /* Distance info bar at bottom */
        .distance-info {
            position: absolute;
            bottom: 20px;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
            z-index: 1000;
            background: rgba(0, 100, 200, 0.85);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: bold;
            display: none;
            box-shadow: 0 2px 6px rgba(0,0,0,0.3);
            white-space: nowrap;
        }
        
        .distance-info.visible {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .distance-info .bearing {
            color: #90EE90;
        }
        
        .distance-info .copy-btn {
            background: #00CC00;
            border: none;
            color: white;
            padding: 4px 10px;
            border-radius: 12px;
            cursor: pointer;
            font-size: 12px;
            font-weight: bold;
            display: none;
        }
        
        .distance-info .copy-btn:hover {
            background: #00FF00;
            color: #006600;
        }
        
        .distance-info .copy-btn.visible {
            display: inline-block;
        }
        
        .distance-info .copy-btn.copied {
            background: #FFD700;
            color: #333;
        }
        
        /* Directional compass arrow */
        .direction-compass {
            position: absolute;
            bottom: 80px;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
            z-index: 1000;
            display: none;
            flex-direction: column;
            align-items: center;
        }
        
        .direction-compass.visible {
            display: flex;
        }
        
        .direction-compass .arrow {
            width: 60px;
            height: 60px;
            background: rgba(0, 100, 200, 0.9);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.3);
            transition: transform 0.3s ease;
            -webkit-transition: -webkit-transform 0.3s ease;
        }
        
        .direction-compass .arrow::before {
            content: '';
            width: 0;
            height: 0;
            border-left: 12px solid transparent;
            border-right: 12px solid transparent;
            border-bottom: 30px solid #00FF00;
            filter: drop-shadow(0 0 3px rgba(0,255,0,0.5));
        }
        
        .direction-compass .trend {
            margin-top: 5px;
            font-size: 18px;
            font-weight: bold;
            text-shadow: 0 0 5px black;
        }
        
        .direction-compass .trend.closer {
            color: #00FF00;
        }
        
        .direction-compass .trend.farther {
            color: #FF6666;
        }
        
        /* Saved tracks panel */
        .saved-tracks-btn {
            position: fixed;
            bottom: 70px;
            right: 10px;
            background: rgba(0,0,0,0.7);
            color: white;
            border: none;
            border-radius: 5px;
            padding: 8px 12px;
            cursor: pointer;
            font-size: 14px;
            z-index: 1000;
        }
        
        .saved-tracks-btn:hover {
            background: rgba(0,0,0,0.9);
        }
        
        .saved-tracks-panel {
            position: fixed;
            bottom: 110px;
            right: 10px;
            background: rgba(0,0,0,0.85);
            color: white;
            border-radius: 8px;
            padding: 10px;
            max-height: 300px;
            overflow-y: auto;
            z-index: 1000;
            min-width: 200px;
            display: none;
        }
        
        .saved-tracks-panel.visible {
            display: block;
        }
        
        .saved-tracks-panel h4 {
            margin: 0 0 10px 0;
            border-bottom: 1px solid #555;
            padding-bottom: 5px;
        }
        
        .track-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 0;
            border-bottom: 1px solid #333;
        }
        
        .track-item:last-child {
            border-bottom: none;
        }
        
        .track-info {
            flex: 1;
            cursor: pointer;
        }
        
        .track-info:hover {
            color: #66CCFF;
        }
        
        .track-date {
            font-size: 11px;
            color: #999;
        }
        
        .track-delete {
            background: #AA3333;
            border: none;
            color: white;
            padding: 3px 8px;
            border-radius: 3px;
            cursor: pointer;
            margin-left: 10px;
        }
        
        .track-delete:hover {
            background: #CC4444;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .leaflet-control-locate.active a {
            color: #2196F3 !important;
        }

        .leaflet-popup-content {
            max-width: calc(100vw - 120px) !important;
            overflow-wrap: break-word;
        }

        .predict-button {
            display: inline-block;
            padding: 10px 18px;
            font-size: 1.1em;
            font-weight: bold;
            background: linear-gradient(90deg,#0078d7,#00bfff);
            color: #fff;
            border: none;
            border-radius: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            cursor: pointer;
            transition: background 0.2s;
            white-space: normal;
            max-width: 100%;
            box-sizing: border-box;
            line-height: 1.2;
        }

        /* Responsive adjustments for small screens */
        @media (max-width: 480px) {
            body, html {
                font-size: 14px;
            }

            .leaflet-container {
                font-size: 12px;
            }

            .timeframe-panel button {
                padding: 6px 8px;
                font-size: 0.9em;
            }

            .modal-box {
                padding: 16px;
            }

            .modal-box h3 {
                font-size: 1.2em;
                margin-bottom: 15px;
            }

            .settings-content, .modal-box p {
                font-size: 0.95em;
            }

            .predict-button {
                font-size: 0.9em;
                padding: 8px 12px;
            }
        }
