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

        /* Leaflet tooltip/popup font fix — Safari computes line-height:normal as
           enormous when the Twemoji font is in the font stack, causing a gap above
           the first line. Force a sane line-height and safe font stack. */
        .leaflet-tooltip,
        .leaflet-popup-content,
        .leaflet-popup-content-wrapper {
            line-height: 1.4 !important;
            font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, Helvetica, sans-serif !important;
        }
        .leaflet-popup-content p {
            margin: 8px 0 !important;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, 'Twemoji Flags', sans-serif;
            background: #1a1a1a;
            color: #fff;
            overflow: hidden;
            line-height: 1.2;
        }

        #map {
            position: absolute;
            top: 60px;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 1;
        }

        .header {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid #333;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            z-index: 1000;
            gap: 20px;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .header h1 {
            font-size: 1.5em;
            color: #4a9eff;
            margin: 0;
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: bold;
        }

        .status-connected {
            background: #28a745;
            color: white;
        }

        .status-disconnected {
            background: #dc3545;
            color: white;
        }

        .spot-count {
            font-size: 14px;
            color: #aaa;
        }

        .filter-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .filter-label {
            font-size: 12px;
            color: #aaa;
            font-weight: 500;
        }

        .filter-select {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid #444;
            border-radius: 4px;
            color: #fff;
            padding: 6px 10px;
            font-size: 12px;
            cursor: pointer;
            outline: none;
            transition: all 0.2s;
        }

        .filter-select option {
            color: initial;
            background: initial;
        }

        .filter-select:hover {
            background: rgba(255, 255, 255, 0.15);
            border-color: #4a9eff;
        }

        .filter-select:focus {
            border-color: #4a9eff;
            box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
        }

        .legend {
            position: absolute;
            bottom: 10px;
            right: 10px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            padding: 15px;
            z-index: 1000;
            max-width: 200px;
        }

        .legend h3 {
            margin: 0 0 10px 0;
            font-size: 14px;
            color: #4a9eff;
        }

        .space-weather-legend {
            position: absolute;
            bottom: 420px;
            left: 10px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            padding: 10px 15px;
            z-index: 1000;
            min-width: 220px;
        }

        .distance-legend {
            position: absolute;
            bottom: 10px;
            left: 10px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            padding: 15px;
            z-index: 1000;
            min-width: 220px;
        }

        .distance-legend h3 {
            margin: 0 0 10px 0;
            font-size: 14px;
            color: #4a9eff;
        }

        .sw-metric {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 11px;
        }

        .sw-metric-label {
            color: #aaa;
        }

        .sw-metric-value {
            color: #fff;
            font-weight: bold;
        }

        .new-entities-legend {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            padding: 8px 15px;
            z-index: 1000;
            display: flex;
            gap: 20px;
        }

        .new-entities-legend h3 {
            margin: 0 0 10px 0;
            font-size: 14px;
            color: #4a9eff;
        }

        .new-entity-column {
            flex: 1;
            min-width: 200px;
            white-space: nowrap;
        }

        .distance-range {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
            font-size: 12px;
        }

        .distance-bar-container {
            flex: 1;
            height: 16px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            margin: 0 8px;
            overflow: hidden;
        }

        .distance-bar {
            height: 100%;
            background: linear-gradient(90deg, #4a9eff, #2d7dd2);
            transition: width 0.3s ease;
        }

        .distance-extremes {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid #333;
            font-size: 11px;
            color: #aaa;
        }

        .distance-extreme {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4px;
        }

        .distance-extreme span:last-child {
            text-align: right;
        }

        .distance-extreme-label {
            font-weight: 500;
            color: #4a9eff;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
            font-size: 12px;
        }

        .legend-color {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.3);
        }

        .legend-receiver {
            width: 16px;
            height: 16px;
            background: #ff0000;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.8);
        }

        .band-legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
            font-size: 12px;
        }

        .band-legend-color {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.3);
        }

        .band-legend-label {
            color: #ccc;
        }

        /* Custom marker styles */
        .custom-marker {
            border-radius: 50%;
            border: none;
        }

        .receiver-marker {
            background: #ff0000;
            border: 3px solid rgba(255, 255, 255, 0.9);
            box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
        }
        /* Live Messages Panel */
        .live-messages-panel {
            position: absolute;
            top: 70px;
            right: 10px;
            width: 350px;
            max-height: 380px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
        }

        .live-messages-header {
            padding: 12px 15px;
            border-bottom: 1px solid #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            user-select: none;
        }

        .live-messages-header:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        .live-messages-title {
            font-size: 14px;
            font-weight: 600;
            color: #4a9eff;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .live-messages-toggle {
            font-size: 18px;
            color: #aaa;
            transition: transform 0.2s;
        }

        .live-messages-toggle.collapsed {
            transform: rotate(-90deg);
        }

        .live-messages-content {
            overflow-y: auto;
            max-height: 330px;
            padding: 10px;
        }

        .live-messages-content.collapsed {
            display: none;
        }

        .live-message {
            padding: 8px;
            margin-bottom: 6px;
            background: rgba(255, 255, 255, 0.05);
            border-left: 3px solid #4a9eff;
            border-radius: 4px;
            font-size: 11px;
            font-family: ui-monospace, 'Courier New', monospace, 'Twemoji Flags';
        }

        .live-message-time {
            color: #888;
            font-size: 10px;
            margin-bottom: 4px;
        }

        .live-message-callsign {
            color: #4a9eff;
            font-weight: bold;
            font-size: 12px;
        }

        .live-message-details {
            color: #ccc;
            margin-top: 4px;
        }

        .live-message-mode {
            display: inline-block;
            padding: 2px 6px;
            background: rgba(74, 158, 255, 0.2);
            border-radius: 3px;
            color: #4a9eff;
            font-size: 10px;
            margin-right: 4px;
        }

        .live-messages-empty {
            text-align: center;
            color: #666;
            padding: 20px;
            font-size: 12px;
        }

        /* Decode Cycles Panel */
        .decode-cycles-panel {
            position: absolute;
            top: 70px;
            right: 370px;
            width: 320px;
            max-height: 380px;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border: 1px solid #333;
            border-radius: 8px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
        }

        .decode-cycles-header {
            padding: 12px 15px;
            border-bottom: 1px solid #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            user-select: none;
        }

        .decode-cycles-header:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        .decode-cycles-title {
            font-size: 14px;
            font-weight: 600;
            color: #4a9eff;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .decode-cycles-toggle {
            font-size: 18px;
            color: #aaa;
            transition: transform 0.2s;
        }

        .decode-cycles-toggle.collapsed {
            transform: rotate(-90deg);
        }

        .decode-cycles-content {
            overflow-y: auto;
            overflow-x: hidden;
            max-height: 330px;
            padding: 10px;
        }

        .decode-cycles-content.collapsed {
            display: none;
        }

        .decode-cycles-empty {
            text-align: center;
            color: #666;
            padding: 20px;
            font-size: 12px;
        }

        .cycle-item {
            margin-bottom: 12px;
            padding: 10px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
            border-left: 3px solid #4a9eff;
        }

        .cycle-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .cycle-mode-band {
            font-size: 13px;
            font-weight: 600;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .cycle-band-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }

        .cycle-current-count {
            font-size: 12px;
            color: #4a9eff;
            font-weight: bold;
        }

        .cycle-history {
            display: flex;
            align-items: flex-end;
            gap: 3px;
            height: 40px;
            margin-top: 8px;
            padding: 4px 0;
        }

        .cycle-bar {
            flex: 1;
            background: linear-gradient(to top, #4a9eff, #2d7dd2);
            border-radius: 2px 2px 0 0;
            min-width: 4px;
            position: relative;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .cycle-bar:hover {
            background: linear-gradient(to top, #5aafff, #3d8de2);
            transform: scaleY(1.05);
        }

        .cycle-bar-tooltip {
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.9);
            color: #fff;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 10px;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s;
            margin-bottom: 4px;
            z-index: 10;
        }

        .cycle-bar:hover .cycle-bar-tooltip {
            opacity: 1;
        }

        .cycle-stats {
            display: flex;
            justify-content: space-between;
            margin-top: 6px;
            font-size: 10px;
            color: #888;
        }

        .cycle-stat-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .cycle-stat-label {
            color: #666;
        }

        .cycle-stat-value {
            color: #aaa;
            font-weight: 500;
        }

        .cycle-new-badge {
            display: inline-block;
            background: rgba(74, 158, 255, 0.3);
            color: #4a9eff;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 9px;
            font-weight: bold;
            margin-left: 6px;
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .cycle-trend {
            font-size: 11px;
            margin-left: 4px;
        }

        .cycle-trend.up {
            color: #22c55e;
        }

        .cycle-trend.down {
            color: #ef4444;
        }

        .cycle-trend.neutral {
            color: #888;
        }

        /* Map view toggle — fixed overlay, top-left, to the right of Leaflet zoom controls */
        #map-view-toggle-wrap {
            position: fixed;
            top: 70px; /* same vertical position as Leaflet zoom control (60px header + 10px Leaflet offset) */
            left: 46px; /* 10px Leaflet margin + ~26px zoom control width + 10px gap */
            z-index: 1001;
        }

        /* Globe controls wrapper — centred top, only shown in globe mode */
        #globe-controls {
            background: transparent;
        }

        /* Globe theme selector and spin button share the same base style */
        #globe-theme-select,
        #globe-spin-btn {
            background: rgba(26, 26, 26, 0.92);
            border: 1px solid #555;
            border-radius: 6px;
            color: #fff;
            font-size: 12px;
            padding: 5px 10px;
            cursor: pointer;
            outline: none;
            box-shadow: 0 2px 8px rgba(0,0,0,0.5);
            backdrop-filter: blur(6px);
            transition: border-color 0.15s;
        }

        #globe-theme-select:hover,
        #globe-spin-btn:hover {
            border-color: #4a9eff;
        }

        #globe-spin-btn.spin-active {
            border-color: #4a9eff;
            color: #4a9eff;
        }

        /* Map view toggle button */
        .map-view-btn {
            display: block;
            padding: 0;
            width: 34px;
            height: 34px;
            background: #fff;
            border: 2px solid rgba(0, 0, 0, 0.2);
            border-radius: 4px;
            color: #333;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            line-height: 30px;
            text-align: center;
            transition: background 0.15s;
            box-shadow: 0 1px 5px rgba(0,0,0,0.4);
            white-space: nowrap;
        }

        .map-view-btn:hover {
            background: #f4f4f4;
        }

        .map-view-btn.active-globe {
            background: rgba(26, 26, 26, 0.92);
            border-color: #555;
            color: #fff;
            box-shadow: 0 2px 8px rgba(0,0,0,0.5);
            backdrop-filter: blur(6px);
        }

        .map-view-btn.active-globe:hover {
            background: rgba(40, 40, 40, 0.95);
            border-color: #4a9eff;
        }

        /* Globe container */
        #globe-container {
            position: absolute;
            top: 60px;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 1;
            display: none;
            background: #000010;
        }

        #globe-container canvas {
            display: block;
        }

        /* Map tile selector — light Leaflet-style control */
        #map-tile-select {
            appearance: auto;
            background: #fff;
            border: 2px solid rgba(0, 0, 0, 0.2);
            border-radius: 4px;
            color: #333;
            font-size: 12px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            padding: 4px 6px;
            cursor: pointer;
            outline: none;
            box-shadow: 0 1px 5px rgba(0,0,0,0.4);
            transition: border-color 0.15s;
        }

        #map-tile-select:hover {
            border-color: rgba(0,0,0,0.4);
        }

        #map-tile-select option {
            background: #fff;
            color: #333;
        }

        /* Globe tooltip */
        .globe-tooltip {
            position: fixed;
            background: rgba(26, 26, 26, 0.95);
            border: 1px solid #444;
            border-radius: 6px;
            padding: 8px 12px;
            font-family: ui-monospace, 'Courier New', monospace, 'Twemoji Flags';
            font-size: 12px;
            color: #fff;
            pointer-events: none;
            z-index: 9999;
            max-width: 260px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.5);
        }