/* CSS Variables for Common Values */
:root {
    --color-primary: #ff6800;
    --color-error: #ff3333;
    --color-success: #00ff00;
    --color-info: #0088ff;
    --color-bg-dark: #000;
    --color-bg-overlay: rgba(0, 0, 0, 0.85);
    --color-bg-panel: rgba(0, 0, 0, 0.9);
    --color-bg-sticky: rgba(0, 0, 0, 0.98);
    --color-border-dark: #1a0d00;
    --spacing-small: 10px;
    --spacing-medium: 15px;
    --spacing-standard: 20px;
    --spacing-controls-top: 70px;
    --spacing-overlay-top: 20px;
    --border-radius: var(--border-radius);
    --breakpoint-mobile: 768px;
}

/* GLOBAL BOX SIZING FIX */
* {
    box-sizing: border-box;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 1024px) {
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-hidden {
        display: none !important;
    }
}

body {
    margin: 0;
    padding: 0;
    background: var(--color-bg-dark);
    color: var(--color-primary);
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* Top Overlay */
#overlay {
    position: absolute;
    top: var(--spacing-overlay-top);
    left: var(--spacing-standard);
    height: 35px;
    background: var(--color-bg-overlay);
    border: 1px solid var(--color-primary);
    padding: 0;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 0 15px var(--color-primary);
    width: 180px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wrapper for left UI (Search + Sidebar) */
#ui-left-container {
    display: contents;
    /* Effectively "removes" the container on desktop */
}

/* Wrapper for sidebar */
#left-panel-wrapper {
    position: absolute;
    top: var(--spacing-controls-top);
    left: var(--spacing-standard);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

/* Controls */
#controls {
    pointer-events: auto;
    /* Re-enable clicks */
    /* position: absolute; top: var(--spacing-controls-top); left: var(--spacing-standard); */
    /* z-index: 10; removed */
    background: var(--color-bg-panel);
    border: 1px solid var(--color-primary);
    padding: var(--spacing-medium);
    box-shadow: 0 0 10px var(--color-primary);
    min-width: 180px;
    width: fit-content;
    max-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Max height is managed by JS */
}


/* Custom scrollbar for controls - matches console scrollbar exactly */
#controls::-webkit-scrollbar {
    width: 6px;
}

#controls::-webkit-scrollbar-track {
    background: var(--color-border-dark);
}

#controls::-webkit-scrollbar-thumb {
    background: var(--color-primary);
}

/* Trackable Folder Styles */
#trackable-header {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 8px 15px;
    margin: -15px -15px 0px -15px;
    transition: all 0.2s;
    background: var(--color-bg-sticky);
    position: sticky;
    top: -15px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    width: calc(100% + 30px);
    margin-right: -15px;
}

#trackable-header:hover {
    background: var(--color-bg-sticky);
}

/* Communications header - also sticky */
#communications-header {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 8px 15px;
    margin: -12px -15px 0px -15px;
    transition: all 0.2s;
    background: var(--color-bg-sticky);
    position: sticky;
    top: -15px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    width: calc(100% + 30px);
    margin-right: -15px;
}

#communications-header:hover {
    background: var(--color-bg-sticky);
}

/* News feed header - matching communications-header */
#news-feed-header {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 8px 15px;
    margin: -12px -15px 0px -15px;
    transition: all 0.2s;
    background: var(--color-bg-sticky);
    position: sticky;
    top: -15px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    width: calc(100% + 30px);
    margin-right: -15px;
}

#news-feed-header:hover {
    background: var(--color-bg-sticky);
}

/* Natural header - matching news-feed-header */
#natural-header {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 8px 15px;
    margin: -12px -15px 0px -15px;
    transition: all 0.2s;
    background: var(--color-bg-sticky);
    position: sticky;
    top: -15px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    width: calc(100% + 30px);
    margin-right: -15px;
}

#natural-header:hover {
    background: var(--color-bg-sticky);
}

.folder-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-right: 5px;
    transform: scaleY(1.5) scaleX(0.7);
    letter-spacing: -1px;
    transform-origin: center center;
}

.folder-arrow.rotated {
    transform: rotate(90deg) scaleY(1.5) scaleX(0.7);
}

.folder-label-container {
    pointer-events: none;
    width: 100%;
}

.folder-label-text {
    color: #ff6800;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
}

.trackable-folder-content {
    display: none;
    margin-top: 0px;
    margin-left: 7px;
    margin-bottom: 0;
    padding-top: 0;
    padding-left: 22px;
    border-left: 2px solid rgba(255, 104, 0, 0.4);
}

.trackable-folder-content.visible {
    display: block;
}

/* Reduce gap when folder content is hidden (collapsed) - targets the parent div */
#controls>div:has(#communications-content:not(.visible)) {
    margin-bottom: -12px;
}

/* Ensure news-feed section has consistent spacing when collapsed */
#controls>div:has(#news-feed-content:not(.visible)) {
    margin-bottom: -12px;
}

/* Ensure natural section has consistent spacing when collapsed */
#controls>div:has(#natural-content:not(.visible)) {
    margin-bottom: -12px;
}

/* Add consistent vertical spacing between items inside news-feed */
#news-feed-content .control-section {
    margin-bottom: 8px;
}

#news-feed-content .control-section:last-child {
    margin-bottom: 0;
}

/* Ensure trackable section has consistent spacing when collapsed */
#controls>div:has(#trackable-content:not(.visible)) {
    margin-bottom: -12px;
}

.trackable-folder-content.visible {
    display: block;
}

.control-section {
    margin-bottom: 12px;
}

.control-section:last-child {
    margin-bottom: 0;
}

/* Toggles & Icons */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
}

/* Toggle Container Fix */
.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
    flex: 1 1 0;
    min-height: 20px;
    min-width: 0;
}

.toggle-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 14px;
    width: 14px;
    background-color: #1a0d00;
    border: 1px solid #ff6800;
    display: inline-block;
    margin-right: 10px;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.toggle-container input:checked~.checkmark {
    background-color: #ff6800;
    box-shadow: 0 0 5px #ff6800;
}

.toggle-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.toggle-label.no-transform {
    text-transform: none;
}

/* Disabled Toggle Styles */
.toggle-container.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toggle-container.disabled input {
    cursor: not-allowed;
}

.toggle-container.disabled .checkmark {
    border-color: #666;
    background-color: #0a0a0a;
}

.toggle-container.disabled .toggle-label {
    color: #666;
}

.settings-icon.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.settings-icon.disabled:hover {
    opacity: 0.3;
    text-shadow: none;
}

.row-icons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    min-width: 50px;
    gap: 4px;
}

.settings-icon {
    cursor: pointer;
    font-size: 18px;
    color: #ff6800;
    opacity: 0.7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 1;
}

.settings-icon:hover {
    opacity: 1;
    text-shadow: 0 0 5px #ff6800;
}

.info-icon {
    cursor: pointer;
    font-size: 12px;
    color: #ff6800;
    opacity: 0.7;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border: 1px solid #ff6800;
    border-radius: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: translateX(-9px);
}

.info-icon:hover {
    opacity: 1;
    text-shadow: 0 0 5px #ff6800;
    background: rgba(255, 104, 0, 0.2);
}

/* Filter icon button - aligned with info-icon */
.filter-icon-btn {
    cursor: pointer;
    color: #ff6800;
    opacity: 0.7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: translateX(-9px);
    transition: all 0.2s;
}

.filter-icon-btn:hover {
    opacity: 1;
    filter: drop-shadow(0 0 3px #ff6800);
}

.filter-icon {
    cursor: pointer;
    font-size: 12px;
    color: #ff6800;
    opacity: 0.7;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all 0.2s;
}

.filter-icon:hover {
    opacity: 1;
    text-shadow: 0 0 5px #ff6800;
}

.filter-toggle-btn {
    background: #1a0d00;
    border: 1px solid #ff6800;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    text-transform: uppercase;
    transition: all 0.2s;
    flex: 1;
}

.filter-toggle-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 5px rgba(255, 104, 0, 0.5);
}

.filter-count {
    color: #ffcc00;
    font-size: 10px;
    margin-left: 4px;
}

.sub-options {
    display: none;
    margin-left: 24px;
    margin-top: 5px;
    border-left: 1px solid #331a00;
    padding-left: 8px;
}

.sub-options.visible {
    display: block;
}

/* POLL CONTROLS */
.poll-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    font-weight: bold;
    background: #1a0d00;
    padding: 4px;
    border: 1px solid #331a00;
}

.poll-btn {
    background: transparent;
    border: none;
    color: #ff6800;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    transition: 0.2s;
}

.poll-btn:hover {
    text-shadow: 0 0 5px #ff6800;
    color: #fff;
}

.step-btn {
    background: #331a00;
    border: 1px solid #ff6800;
    color: #ff6800;
    font-family: 'Courier New', Courier, monospace;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 5px;
    min-width: 30px;
}

.step-btn:hover {
    background: #ff6800;
    color: #000;
}

#poll-value {
    min-width: 25px;
    text-align: center;
    color: #ffcc00;
    font-size: 11px;
}

/* Console */
#status-box {
    display: none;
    position: absolute;
    /* bottom: 110px; handled by js */
    /* Above news tickers (20+35+5+35+15) */
    left: 20px;
    width: 320px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ff6800;
    padding: 8px;
    z-index: 10;
    font-size: 11px;
    color: #ff6800;
    box-shadow: 0 0 10px #ff6800;
}

#console-wrapper {
    position: absolute;
    /* bottom: 110px; handled by js */
    /* Above news tickers (20+35+5+35+15) */
    left: 20px;
    width: 320px;
    height: 200px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ff6800;
    z-index: 10;
    display: none;
    flex-direction: column;
    box-shadow: 0 0 10px #ff6800;
    font-size: 11px;
}

/* Button Groups */
.button-group {
    display: flex;
    width: 100%;
    border: 1px solid #ff6800;
    background: #1a0d00;
}

.group-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-right: 1px solid #ff6800;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    padding: 8px 0;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.group-btn:last-child {
    border-right: none;
}

.group-btn:hover {
    background: rgba(255, 104, 0, 0.2);
    color: #fff;
}

.group-btn.active {
    background: #ff6800;
    color: #000;
    font-weight: bold;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

#console-header {
    background: #1a0d00;
    border-bottom: 1px solid #ff6800;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 25px;
}

#console-title {
    font-weight: bold;
    text-transform: uppercase;
}

.console-btn {
    background: #ff6800;
    color: #000;
    border: none;
    font-family: inherit;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
    padding: 2px 8px;
    margin-left: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(255, 104, 0, 0.3);
}

.console-btn:hover {
    background: #ffcc66;
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.6);
    transform: scale(1.05);
}

.console-btn:active {
    transform: scale(0.95);
}

.console-btn.copied {
    background: var(--color-success);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
    animation: copyPulse 0.5s ease;
}

@keyframes copyPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

#console-output {
    padding: var(--spacing-small);
    overflow-y: auto;
    flex-grow: 1;
    color: #ff6800;
    white-space: pre-wrap;
    line-height: 1.4;
}

#console-output::-webkit-scrollbar {
    width: 6px;
}

#console-output::-webkit-scrollbar-track {
    background: #1a0d00;
}

#console-output::-webkit-scrollbar-thumb {
    background: #ff6800;
}

/* Popup Styling */
.maplibregl-popup-content {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid #ff6800;
    color: #ff6800;
    font-family: 'Courier New', Courier, monospace;
    padding: 12px;
    padding-top: 38px;
    /* Increased to make space for top-line buttons */
    box-shadow: 0 0 20px rgba(255, 104, 0, 0.4);
    min-width: 240px;
    max-width: 380px;
    border-radius: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    position: relative;
}

/* --- LIVE TV MODAL STYLES --- */
.livetv-content {
    max-width: 90vw !important;
    width: 1400px !important;
    height: 85vh !important;
    max-height: 85vh !important;
    display: flex;
    flex-direction: column;
}

.livetv-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #0a0a0a;
    overflow: hidden;
}

.livetv-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #331a00;
    padding-bottom: 10px;
}

.livetv-status-text {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #ff6800;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.livetv-grid {
    display: grid;
    gap: 20px;
    overflow-y: auto;
    padding-right: 5px;
    flex-grow: 1;
}

/* Scrollbar for grid */
.livetv-grid::-webkit-scrollbar {
    width: 8px;
}

.livetv-grid::-webkit-scrollbar-track {
    background: #1a0d00;
}

.livetv-grid::-webkit-scrollbar-thumb {
    background: #ff6800;
}

.livetv-grid.embedded {
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
}

.livetv-grid.thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.livetv-card {
    background: #141414;
    border: 1px solid #331a00;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.livetv-card:hover {
    border-color: #ff6800;
    box-shadow: 0 0 15px rgba(255, 104, 0, 0.2);
    transform: translateY(-2px);
}

/* Embed Container */
.livetv-embed-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
    border-bottom: 1px solid #331a00;
}

.livetv-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Thumbnail Container */
.livetv-thumb-container {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.livetv-thumb-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.livetv-card:hover .livetv-thumb-img {
    transform: scale(1.05);
}

.livetv-live-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff0000;
    color: white;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.livetv-live-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: blink 2s infinite;
}

.livetv-viewers-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffcc00;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
    border: 1px solid #331a00;
}

.livetv-info {
    padding: 12px;
}

.livetv-channel {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.livetv-title {
    font-size: 13px;
    font-weight: bold;
    color: #eee;
    margin-bottom: 10px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: sans-serif;
    /* Better readability for titles */
}

.livetv-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #2a2a2a;
    padding-top: 8px;
}

.livetv-viewers,
.livetv-uptime {
    font-size: 11px;
    color: #ff6800;
    font-family: 'Courier New', monospace;
}

.livetv-watch-btn,
.livetv-link-btn {
    background: #331a00;
    color: #ff6800;
    border: 1px solid #ff6800;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}

.livetv-watch-btn:hover,
.livetv-link-btn:hover {
    background: #ff6800;
    color: #000;
}

.livetv-stats-bar {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #331a00;
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 11px;
    color: #888;
    font-family: 'Courier New', monospace;
}

.livetv-error {
    text-align: center;
    padding: 40px;
    color: #ff3333;
    border: 1px dashed #ff3333;
    background: rgba(51, 0, 0, 0.2);
    margin: 20px;
    font-family: 'Courier New', monospace;
}

@media (max-width: 768px) {
    .livetv-grid.embedded {
        grid-template-columns: 1fr;
    }

    .livetv-grid.thumbnails {
        grid-template-columns: 1fr;
    }

    .livetv-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .livetv-controls button {
        flex: 1;
    }

    .livetv-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;

        border: none;
    }
}

/* List View Styles */
.livetv-grid.list-mode {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.livetv-list-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #0f0f0f;
    border: 1px solid #1f1f1f;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #888;
    transition: all 0.2s;
}

.livetv-list-item:hover {
    background: #1a0d00;
    border-color: #ff6800;
    color: #ff6800;
}

.livetv-list-channel {
    font-weight: bold;
    color: #aaa;
    margin-right: 8px;
    white-space: nowrap;
    text-transform: uppercase;
}

.livetv-list-item:hover .livetv-list-channel {
    color: #ff6800;
}

.livetv-list-separator {
    color: #333;
    margin-right: 8px;
}

.livetv-list-title {
    flex-grow: 1;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 15px;
}

.livetv-list-item:hover .livetv-list-title {
    color: #fff;
}

.livetv-list-viewers {
    color: #00ff00;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}


/* Subtle header separator for buttons */
.maplibregl-popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(255, 104, 0, 0.1);
    border-bottom: 1px dashed rgba(255, 104, 0, 0.3);
    pointer-events: none;
}

.maplibregl-popup-close-button {
    color: #ff6800;
    font-size: 20px;
    /* Slightly larger for easier clicking */
    top: 2px;
    right: 8px;
    /* Move back to right */
    left: auto;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.maplibregl-popup-close-button:hover {
    background: rgba(255, 51, 51, 0.2);
    color: #ff3333;
}

.popup-cloud-btn {
    position: absolute;
    top: 5px;
    right: 36px;
    /* Positioned next to the X on the top right */
    left: auto;
    background: transparent;
    border: none;
    color: #ff9500;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    opacity: 0.8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-cloud-btn:hover {
    opacity: 1;
    color: #ffcc00;
    transform: scale(1.1);
}

.popup-cloud-btn:active {
    transform: scale(0.95);
}

.popup-json-btn {
    position: absolute;
    top: 5px;
    right: 64px;
    background: transparent;
    border: none;
    color: #ff9500;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    opacity: 0.8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-json-btn:hover {
    opacity: 1;
    color: #ffcc00;
    transform: scale(1.1);
}

.popup-json-btn:active {
    transform: scale(0.95);
}

.popup-copy-btn {
    position: absolute;
    top: 5px;
    right: 92px;
    background: transparent;
    border: none;
    color: #ff9500;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    opacity: 0.8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-copy-btn:hover {
    opacity: 1;
    color: #ffcc00;
    transform: scale(1.1);
}

.popup-copy-btn:active {
    transform: scale(0.95);
}

.popup-row {
    margin-bottom: 6px;
    font-size: 12px;
    border-bottom: 1px dashed #331a00;
    padding-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

.popup-label {
    font-weight: bold;
    color: #ffcc00;
    margin-right: 5px;
}

.dark-warning {
    color: var(--color-error);
    font-weight: bold;
    animation: blinker 1s linear infinite;
}

/* Copy Link Button */
.copy-link-btn {
    background: transparent;
    border: 1px solid #ff6800;
    color: #ff6800;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
    vertical-align: middle;
    box-shadow: 0 0 3px rgba(255, 104, 0, 0.3);
    width: 22px;
    height: 22px;
    opacity: 0.7;
}

.copy-link-btn:hover {
    background: rgba(255, 104, 0, 0.2);
    box-shadow: 0 0 5px rgba(255, 104, 0, 0.5);
    opacity: 1;
}

.copy-link-btn svg {
    display: block;
    width: 16px;
    height: 16px;
}

.intel-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: #1a0d00;
    border: 1px solid #ff6800;
    color: #ff6800;
    padding: 8px;
    text-align: center;
    text-decoration: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    box-sizing: border-box;
}

.intel-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 10px #ff6800;
}

#clear-cache-btn:hover {
    background: rgba(255, 51, 51, 0.2);
    color: var(--color-error);
    box-shadow: 0 0 10px var(--color-error);
    border-color: var(--color-error);
}

/* Radio Popup Player */
.radio-popup-player {
    margin-top: 10px;
    padding: 0;
}

.radio-play-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: #1a0d00;
    border: 1px solid #ff6800;
    color: #ff6800;
    padding: 8px;
    text-align: center;
    text-decoration: none;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

.radio-play-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 10px #ff6800;
}

.radio-play-btn.playing {
    background: #1a0d00;
    border-color: #ff6800;
    color: #ff6800;
    box-shadow: 0 0 5px #ff6800;
}

.radio-play-btn.playing:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
}

.radio-play-btn.loading {
    opacity: 0.6;
    cursor: wait;
    background: #1a0d00;
    border-color: #666;
    color: #666;
}

.radio-play-btn.loading:hover {
    background: #1a0d00;
    color: #666;
    box-shadow: none;
}

h1 {
    margin: 0;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#overlay h1 {
    margin: 0;
    line-height: 35px;
}

p {
    margin: 0;
    font-size: 12px;
    opacity: 1;
}

.blink {
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* SETTINGS BTN */
#top-settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ff6800;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#top-settings-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#globe-toggle-btn {
    position: absolute;
    top: 70px;
    right: 20px;
    /* 50px below settings */
    color: #ff6800;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#globe-toggle-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#wallet-btn {
    position: absolute;
    top: 120px;
    right: 20px;
    /* 50px below globe */
    color: #ff6800;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wallet-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#info-btn {
    position: absolute;
    top: 170px;
    right: 20px;
    /* 50px below wallet */
    color: #ff6800;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#info-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#bug-report-btn {
    position: absolute;
    top: 220px;
    right: 20px;
    /* 50px below info */
    color: #ff6800;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bug-report-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#exit-btn {
    position: absolute;
    top: 270px;
    right: 20px;
    /* 50px below bug report */
    color: #ff6800;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px #ff6800;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#exit-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#globe-toggle-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
    transform: scale(1.1);
}

#globe-toggle-btn span,
.view-toggle-text {
    font-size: 16px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.flat-icon-hidden {
    display: none;
}

.hidden {
    display: none !important;
}


/* Settings Modal Styles are handled by .modal class now */
.panel-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ff6800;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

#close-settings-btn {
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

#close-settings-btn:hover {
    color: #fff;
}

/* Custom Slider */
.slider-container {
    width: 100%;
    margin: 15px 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    color: #ff6800;
    font-weight: bold;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

/* Webkit */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    background: #ff6800;
    cursor: pointer;
    border: 1px solid #000;
    margin-top: -6px;
    box-shadow: 0 0 5px #ff6800;
    border-radius: 0;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: linear-gradient(to right, var(--color-primary) var(--slider-percent, 0%), #331a00 var(--slider-percent, 0%));
    border: 1px solid #ff6800;
}

/* Firefox */
input[type=range]::-moz-range-thumb {
    height: 14px;
    width: 14px;
    background: #ff6800;
    cursor: pointer;
    border: 1px solid #000;
    box-shadow: 0 0 5px #ff6800;
    border-radius: 0;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: linear-gradient(to right, var(--color-primary) var(--slider-percent, 0%), #331a00 var(--slider-percent, 0%));
    border: 1px solid #ff6800;
}

/* LEGEND PANEL */
.legend-content {
    margin: 15px 0;
    font-size: 13px;
}

.filter-content {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    border: 1px solid #000;
}

.legend-desc {
    color: #ff6800;
    margin-left: auto;
    font-style: italic;
    font-size: 12px;
}

/* Legend Colors */
.legend-dot.aircraft {
    background: #00ccff;
}

.legend-dot.vessel {
    background: var(--color-info);
}

.legend-dot.fishing {
    background: #00ffcc;
}

.legend-dot.loitering {
    background: #ff6800;
}

.legend-dot.encounter {
    background: #ff00ff;
}

.legend-dot.dark {
    background: var(--color-error);
    box-shadow: 0 0 5px var(--color-error);
}

.legend-dot.flight-verified {
    background: #ff6800;
}

.legend-dot.flight-nosquawk {
    background: #00ccff;
}

.legend-dot.flight-nocallsign {
    background: #00ff00;
}

.legend-dot.flight-alert {
    background: var(--color-error);
    box-shadow: 0 0 5px var(--color-error);
}

/* Mesh Network Colors */
.legend-dot.meshtastic {
    background: #ff0000;
    box-shadow: 0 0 5px #ff0000;
}

.legend-dot.meshcore-client {
    background: #00aaff;
    box-shadow: 0 0 5px #00aaff;
}

.legend-dot.meshcore-repeater {
    background: #ff6800;
    box-shadow: 0 0 5px #ff6800;
}

.legend-dot.meshcore-room {
    background: var(--color-success);
    box-shadow: 0 0 5px var(--color-success);
}

.legend-dot.meshcore-sensor {
    background: #ff00ff;
    box-shadow: 0 0 5px #ff00ff;
}

/* Mesh Legend Section Styles */
.mesh-legend-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #331a00;
}

.mesh-legend-title {
    font-weight: bold;
    color: #ffcc00;
    margin-bottom: 8px;
}

.legend-text-red {
    color: var(--color-error);
}

#close-legend-btn {
    cursor: pointer;
}

#loading-text {
    color: #888;
}

/* Custom Checkmark Colors for Sub-options */
.custom-check-gap {
    background: transparent;
    border: 1px solid var(--color-error);
}

.custom-check-enc {
    background: transparent;
    border: 1px solid #ff00ff;
}

.custom-check-loit {
    background: transparent;
    border: 1px solid #ff6800;
}

.custom-check-fish {
    background: transparent;
    border: 1px solid #00ffcc;
}

.custom-check-port {
    background: transparent;
    border: 1px solid var(--color-info);
}

#ship-gap-toggle:checked~.checkmark {
    background-color: var(--color-error);
    box-shadow: 0 0 5px var(--color-error);
}

#ship-encounter-toggle:checked~.checkmark {
    background-color: #ff00ff;
    box-shadow: 0 0 5px #ff00ff;
}

#ship-loitering-toggle:checked~.checkmark {
    background-color: #ff6800;
    box-shadow: 0 0 5px #ff6800;
}

#ship-fishing-toggle:checked~.checkmark {
    background-color: #00ffcc;
    box-shadow: 0 0 5px #00ffcc;
}

#ship-port-toggle:checked~.checkmark {
    background-color: var(--color-info);
    box-shadow: 0 0 5px var(--color-info);
}

#search-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 450px;
    min-height: 35px;
    /* height: 35px; removed to allow growth */
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ff6800;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    z-index: 20;
    box-shadow: 0 0 10px #ff6800;
    pointer-events: auto;
}

#search-bar.has-results {
    border-bottom: none;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 35px;
    width: 100%;
}

#search-input {
    background: transparent;
    border: none;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    width: 100%;
    outline: none;
    text-transform: uppercase;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    overflow: hidden;
    text-overflow: ellipsis;
}

#search-input::placeholder {
    color: #cc7a00;
    opacity: 1;
}

#search-icon {
    color: #ff6800;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
}

#search-icon:hover {
    text-shadow: 0 0 5px #ff6800;
}

#search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ff6800;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    z-index: 100;
}

#search-dropdown::-webkit-scrollbar {
    width: 6px;
}

#search-dropdown::-webkit-scrollbar-track {
    background: #1a0d00;
}

#search-dropdown::-webkit-scrollbar-thumb {
    background: #ff6800;
}

#search-dropdown.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#search-dropdown.loading img {
    width: 40px;
    height: 40px;
}

.search-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #331a00;
    font-size: 11px;
    text-transform: uppercase;
    color: #ffcc00;
    display: flex;
    justify-content: space-between;
    overflow: hidden;
    min-width: 0;
}

.search-item>span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.search-item:hover {
    background: #331a00;
    color: #fff;
}

.search-tag {
    font-size: 9px;
    opacity: 0.7;
    border: 1px solid #ff6800;
    padding: 1px 3px;
    margin-right: 5px;
    display: inline-block;
    line-height: 1.2;
    vertical-align: middle;
}

#search-clear {
    color: #ff6800;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
    display: none;
}

#search-clear:hover {
    text-shadow: 0 0 5px var(--color-error);
    color: var(--color-error);
}

/* Unit Toggle Switch */
.unit-toggle-wrapper {
    display: flex;
    border: 1px solid #ff6800;
    background: #1a0d00;
    cursor: pointer;
    margin-top: 5px;
}

.unit-option {
    flex: 1;
    text-align: center;
    padding: 4px;
    font-size: 10px;
    font-weight: bold;
    color: #ff6800;
    transition: all 0.2s;
    opacity: 0.6;
}

.unit-option:hover {
    opacity: 1;
    background: rgba(255, 104, 0, 0.1);
}

.unit-option.active {
    background: #ff6800;
    color: #000;
    opacity: 1;
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.5);
}

/* Mobile Search Button */
#mobile-search-toggle {
    display: none;
    position: absolute;
    top: 20px;
    right: 120px;
    color: #ff6800;
    font-size: 18px;
    cursor: pointer;
    z-index: 20;
    padding: 6px;
    border: 1px solid #ff6800;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 5px #ff6800;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#mobile-search-toggle:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 15px #ff6800;
}

@media (max-width: 900px) {

    /* Full width search bar on mobile */
    #ui-left-container {
        pointer-events: none;
        position: absolute;
        top: 20px;
        left: 20px;
        right: auto;
        width: calc(100vw - 60px) !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        justify-items: stretch !important;
        gap: 5px !important;
        z-index: 20;
        height: auto !important;
    }

    #search-bar {
        display: flex !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        transform: none !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 !important;
        pointer-events: auto;
        height: auto !important;
        min-height: 35px;
        margin: 0 !important;
    }

    .search-input-wrapper {
        display: flex;
        align-items: center;
        padding: 0 10px;
        height: 35px;
        flex-shrink: 0;
    }

    #search-dropdown {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        border-right: none;
        border-left: none;
        border-bottom: none;
        border-top: 1px solid #ff6800;
        max-height: 40vh;
        z-index: 50;
    }

    #mobile-search-toggle {
        display: none !important;
    }

    #search-input,
    #issue-text {
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    /* Fix modal jumping when keyboard opens */
    .modal-content {
        margin: 60px auto !important;
        max-height: 60vh;
        overflow-y: auto;
    }

    #top-settings-btn {
        right: 20px;
    }

    #globe-toggle-btn {
        right: 20px;
        top: 70px;
    }

    #wallet-btn {
        right: 20px;
        top: 120px;
    }

    #info-btn {
        right: 20px;
        top: 170px;
    }

    #bug-report-btn {
        right: 20px;
        top: 220px;
    }

    #exit-btn {
        right: 20px;
        top: 270px;
    }

    /* Hide Title on Mobile */
    #overlay {
        display: none !important;
    }

    /* Move Sidebar below Search Bar */
    #left-panel-wrapper {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 15px !important;
        /* Restore gap for internal items */
        display: flex !important;
        flex-direction: column !important;
    }

    #controls {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Repeater Selection Buttons - Mobile */
    #repeater-load-btn,
    #repeater-skip-btn,
    #repeater-selected-areas {
        max-width: calc(100vw - 40px) !important;
        min-width: 200px !important;
    }

    #repeater-skip-btn>div {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

.maplibregl-ctrl-bottom-right {
    display: none !important;
}

/* Issue Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: rgba(10, 10, 10, 0.95);
    margin: 5vh auto;
    padding: 20px;
    border: 1px solid #ff6800;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 50px rgba(255, 104, 0, 0.2);
    color: #ff6800;
}

#issue-text {
    width: 100%;
    height: 150px;
    background: #080808;
    border: 1px solid #331a00;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    padding: var(--spacing-small);
    resize: vertical;
    outline: none;
    font-size: 12px;
}

#issue-text:focus {
    border-color: #ff6800;
    box-shadow: 0 0 5px rgba(255, 104, 0, 0.3);
}

#issue-status-message {
    display: none;
    margin-top: 10px;
    padding: var(--spacing-small) 15px;
    font-size: 12px;
    color: var(--color-success);
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
    font-weight: bold;
    border: 1px solid var(--color-success);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
    font-family: 'Courier New', monospace;
}

/* Helper Classes for Inline Style Removal */
.overlay-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    pointer-events: auto;
}

.live-dot {
    color: #ff6800;
    margin-left: 10px;
    font-size: 20px;
    vertical-align: middle;
    text-shadow: 0 0 8px #ff6800;
}

.search-icon-svg {
    margin-right: 10px;
    flex-shrink: 0;
    opacity: 0.8;
}

.info-btn-text {
    font-family: 'Georgia', serif;
    font-size: 20px;
    font-weight: bold;
    font-style: italic;
}

.unit-label-text {
    color: #ff6800;
}

.cursor-pointer {
    cursor: pointer;
}

.modal-section-margin {
    margin: 15px 0;
}

.modal-desc-text {
    margin-bottom: 5px;
    opacity: 0.8;
}

.info-content {
    margin: 15px 0;
    line-height: 1.5;
    font-size: 12px;
}

.info-list {
    padding-left: 20px;
    margin-top: 5px;
}

.legal-link {
    color: #ff6800;
    text-decoration: none;
    display: block;
    text-align: center;
}

.legal-link:hover {
    color: #ffcc66;
    text-decoration: underline;
}

.info-docs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.info-docs-grid .intel-btn {
    font-size: 10px;
    padding: 8px 5px;
    text-align: center;
    width: 100%;
}

.checkmark-small {
    width: 10px;
    height: 10px;
}

.label-small {
    font-size: 10px;
}

.poll-val-spacing {
    margin-right: 5px;
}

.text-red {
    color: var(--color-error);
}

.text-magenta {
    color: #ff00ff;
}

.text-orange {
    color: #ff6800;
}

.text-teal {
    color: #00ffcc;
}

.text-blue {
    color: var(--color-info);
}

.no-mmsi-msg {
    color: var(--color-error);
    margin-top: 10px;
}

.vessel-link {
    margin-top: 5px;
}

/* JS Generated Classes */
.fps-crit {
    color: var(--color-error);
}

.fps-warn {
    color: #ff6800;
}

.fps-good {
    color: #00ccff;
}

.status-cloaked {
    color: var(--color-success);
}

.status-helo {
    color: #00ccff;
}

.log-dim {
    color: #888;
}

.text-dim {
    color: #888;
}

.helo-shadow {
    filter: drop-shadow(0 0 4px #00ccff);
}

.pin-shadow {
    filter: drop-shadow(0 0 5px #ff6800);
}

.pin-container {
    width: 30px;
    height: 30px;
}

/* Radio Now Playing Bar */
#radio-now-playing-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid #ff6800;
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(255, 104, 0, 0.3);
    padding: 8px 20px;
}

.radio-now-playing-bar-hidden {
    display: none;
}

.radio-now-playing-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.radio-now-playing-label {
    color: #ffcc00;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.radio-now-playing-text-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 20px;
    min-width: 0;
}

.radio-now-playing-text {
    color: #ff6800;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    position: absolute;
    top: 0;
    left: 0;
}

.radio-now-playing-text:not(.no-scroll) {
    animation: scroll-text linear infinite;
    padding-right: 50px;
}

.radio-now-playing-text.no-scroll {
    animation: none;
    position: static;
    padding-right: 0;
}

@keyframes scroll-text {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

.radio-now-playing-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.radio-now-playing-btn {
    background: #1a0d00;
    border: 1px solid #ff6800;
    color: #ff6800;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}

.radio-now-playing-btn:hover {
    background: #ff6800;
    color: #000;
    box-shadow: 0 0 8px #ff6800;
}

.radio-now-playing-btn:active {
    transform: scale(0.95);
}

/* Radio Controls */
.radio-player-controls {
    display: none;
    margin-top: 8px;
    padding: 8px;
    background: #1a0d00;
    border: 1px solid #331a00;
}

.radio-now-playing {
    font-size: 10px;
    color: #ffcc00;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.radio-stop-btn {
    width: 100%;
    padding: 4px;
    background: var(--color-error);
    border: 1px solid #ff6800;
    color: #000;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
}

.radio-stop-btn:hover {
    background: #ff6666;
}

/* Repeater Selection Mode Back Button */
#repeater-back-btn:hover {
    background: rgba(0, 0, 0, 0.95) !important;
    box-shadow: 0 0 25px rgba(255, 104, 0, 1) !important;
    transform: scale(1.05);
    color: #ffcc66 !important;
}

#repeater-load-btn:hover {
    background: rgba(0, 0, 0, 0.95) !important;
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.9) !important;
    color: #66ff66 !important;
    border-color: #66ff66 !important;
}

#repeater-skip-btn:hover {
    background: rgba(0, 0, 0, 0.95) !important;
    box-shadow: 0 0 30px rgba(200, 200, 200, 0.7) !important;
    transform: scale(1.05);
    color: #dddddd !important;
    border-color: #dddddd !important;
}

/* Live Feed Button - Positioned in flex wrapper */
#live-feed-btn {
    position: static;
    pointer-events: auto;
    /* z-index: 9; removed */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(51, 0, 0, 0.8);
    border: 1px solid var(--color-error);
    color: var(--color-error);
    padding: var(--spacing-small) 15px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px var(--color-error);
    transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s;
    width: 180px;
}

#live-feed-btn:hover {
    background: var(--color-error);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.9);
    transform: scale(1.02);
}

#live-feed-btn svg {
    stroke: currentColor;
}

@media (max-width: 768px) {
    #live-feed-btn {
        width: 180px;
        padding: 8px 12px;
        font-size: 10px;
    }
}

/* Live Feed Modal Styles */
.live-feed-title {
    color: var(--color-error);
}

.live-feed-join-btn {
    display: block;
    text-align: center;
    background: rgba(255, 51, 51, 0.15);
    border: 1px solid var(--color-error);
    color: var(--color-error);
    padding: 12px 20px;
    margin-top: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s;
    animation: pulseGlowRed 2s ease-in-out infinite;
}

.live-feed-join-btn:hover {
    background: var(--color-error);
    color: #000;
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.8);
    animation: none;
}

/* Live Feed Modal */
.live-feed-modal-content {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.live-feed-body {
    padding: var(--spacing-medium);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.feed-wallet-input label {
    display: block;
    font-size: 10px;
    color: #ff6800;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.feed-wallet-input input {
    width: 100%;
    padding: var(--spacing-small) 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #331a00;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    outline: none;
}

.feed-wallet-input input:focus {
    border-color: #ff6800;
    box-shadow: 0 0 5px rgba(255, 104, 0, 0.3);
}

.feed-wallet-input input::placeholder {
    color: #664400;
}

.feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-scanning {
    font-size: 10px;
    color: #666;
    font-family: 'Courier New', monospace;
}

.feed-refresh-btn {
    background: transparent;
    border: 1px solid #ff6800;
    color: #ff6800;
    padding: 5px 10px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.feed-refresh-btn:hover {
    background: #ff6800;
    color: #000;
}

.memo-feed-list {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memo-feed-list::-webkit-scrollbar {
    width: 6px;
}

.memo-feed-list::-webkit-scrollbar-track {
    background: #1a0d00;
}

.memo-feed-list::-webkit-scrollbar-thumb {
    background: #ff6800;
}

.feed-placeholder {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding: 30px;
}

.memo-item {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #331a00;
    padding: 12px;
    transition: border-color 0.2s;
    position: relative;
    /* Ensure copy button positioning context */
}

.memo-copy-btn,
.memo-scope-btn {
    background: transparent;
    border: none;
    color: #ff6800;
    /* Theme orange constant */
    cursor: pointer;
    padding: 2px;
    opacity: 0.8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: static;
}

.memo-scope-btn:hover,
.memo-copy-btn:hover {
    opacity: 1;
    color: #ff6800;
    /* Theme orange */
    transform: scale(1.1);
    filter: drop-shadow(0 0 2px #ff6800);
}

.memo-item:hover {
    border-color: #ff6800;
}

.memo-content {
    font-size: 12px;
    line-height: 1.5;
    color: #ccc;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 8px;
}

.memo-author {
    font-size: 10px;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
    color: #ff6800;
}

.memo-author a {
    color: #ff6800;
    text-decoration: none;
}

.memo-author a:hover {
    text-decoration: underline;
    color: #ff6800;
}

.memo-wrapper {
    margin-bottom: 12px;
}

.memo-footer {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
}

.memo-sig {
    color: #ff6800;
    text-decoration: none;
    font-family: monospace;
}

.memo-sig:hover {
    text-decoration: underline;
}

.feed-loading {
    text-align: center;
    color: #ff6800;
    font-size: 12px;
    padding: 20px;
}

.feed-error {
    text-align: center;
    color: var(--color-error);
    font-size: 12px;
    padding: 20px;
}

/* --- Toast Notifications --- */
#toast-container {
    font-family: 'Courier New', monospace;
}

.toast {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.toast-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: toastSpin 0.8s linear infinite;
    flex-shrink: 0;
}

.toast-icon {
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.toast-msg {
    flex: 1;
    word-break: break-word;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

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

@media (max-width: 768px) {
    #toast-container {
        top: auto;
        bottom: 80px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto !important;
        max-width: none !important;
        font-size: 11px !important;
    }
}

/* --- News Ticker --- */
.bottom-ticker-row {
    position: fixed;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 0;
    z-index: 900;
    width: calc(100% - 40px);
}

#news-ticker-row {
    bottom: 20px;
}

#polymarket-ticker-row {
    bottom: 60px;
}

.bottom-ticker-btn {
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s;
    box-shadow: 0 0 10px var(--color-primary);
    pointer-events: auto;
    z-index: 10;
}

.bottom-ticker-btn:hover {
    background: var(--color-primary);
    color: #000;
    box-shadow: 0 0 15px var(--color-primary);
    transform: scale(1.1);
}

#polymarket-ticker-btn {
    border-color: #1452f0;
    color: #1452f0;
    box-shadow: 0 0 10px #1452f0;
}

#polymarket-ticker-btn:hover {
    background: #1452f0;
    color: #fff;
    box-shadow: 0 0 15px #1452f0;
}

/* Polymarket Modal Specifics */
.poly-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ff6800;
}

.poly-currency-symbol {
    position: absolute;
    left: 8px;
    color: var(--color-primary);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1;
}

.poly-modal-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-family: 'Courier New', monospace;
    padding: 8px;
    padding-left: 20px;
    /* Space for $ sign */
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}


.poly-modal-input:focus {
    outline: none;
}

.poly-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.3);
}

/* Tag System Styles */
.poly-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #080808;
    border: 1px solid #1a0d00;
    padding: 6px;
    min-height: 35px;
    transition: all 0.2s;
}

.poly-tag-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.3);
}

.poly-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.poly-tag {
    background: rgba(255, 104, 0, 0.05);
    border: 1px solid #331a00;
    color: #888;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.poly-tag:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(255, 104, 0, 0.1);
}

.poly-tag.active {
    background: rgba(255, 104, 0, 0.15);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.poly-tag-remove {
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.poly-tag-remove:hover {
    opacity: 1;
    color: #fff;
}

.poly-tag-input {
    flex: 1;
    min-width: 100px;
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    padding: 2px 4px;
}

.poly-modal-btn {
    background: #000;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0 15px;
    width: 80px;
    /* Fixed width for vertical alignment */
    text-align: center;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.poly-modal-btn:hover {
    background: var(--color-primary);
    color: #000;
    box-shadow: 0 0 10px var(--color-primary);
    border-color: var(--color-primary);
}

#news-ticker-container {
    height: 35px;
    background: transparent;
    /* Container is transparent, items are boxes */
    border: none;
    display: flex;
    align-items: center;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    box-shadow: none;
    pointer-events: none;
    /* Let clicks pass through gaps */
    flex-grow: 1;
}

#news-ticker-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: auto;
    /* Mask gradient to fade in/out at edges */
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

#news-ticker-content {
    white-space: nowrap;
    position: absolute;
    display: flex;
    align-items: center;
    will-change: transform;
}

#news-ticker-content:hover {
    animation-play-state: paused;
}

.news-box {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    /* Box background */
    border: 1px solid #331a00;
    border-left: 2px solid #ff6800;
    /* Accent */
    padding: 0 10px;
    height: 35px;
    margin-right: 14px;
    /* Buffer between boxes - matched to top-right button gap (50-36=14) */
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.4);
    transition: all 0.2s;
    pointer-events: auto;
}

.news-box:hover {
    border-color: #ff6800;
    background: rgba(20, 10, 0, 0.9);
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.2);
}

.news-item {
    font-size: 12px;
    color: #ccc;
    margin: 0 10px;
    display: inline-flex;
    align-items: center;
}

.news-country {
    color: #ff6800;
    font-weight: bold;
    margin-right: 5px;
    font-size: 12px;
}

.news-link {
    font-size: 12px;
    color: #eee;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.news-link:hover {
    color: #ff6800;
    text-decoration: underline;
}

.item-error {
    color: #ff3333;
}

@keyframes newsTicker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (max-width: 768px) {
    #news-ticker-container {
        bottom: 10px;
        left: 10px;
        width: calc(100% - 20px);
    }
}

/* --- Poly Market Ticker --- */
#polymarket-ticker-container {
    height: 35px;
    display: flex;
    align-items: center;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    pointer-events: none;
    flex-grow: 1;
}

#polymarket-ticker-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: auto;
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

#polymarket-ticker-content {
    white-space: nowrap;
    position: absolute;
    display: flex;
    align-items: center;
    will-change: transform;
}

#polymarket-ticker-content:hover {
    animation-play-state: paused;
}

.poly-box {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(20, 82, 240, 0.5);
    border-left: 2px solid #1452f0;
    /* Poly blue accent */
    padding: 0 10px;
    height: 35px;
    margin-right: 14px;
    /* Matched to top-right button gap (50-36=14) */
    box-shadow: 0 0 10px rgba(20, 82, 240, 0.2);
    transition: all 0.2s;
    pointer-events: auto;
    /* Ensure clicks reach the boxes */
}

.poly-box:hover {
    border-color: #1452f0;
    background: rgba(0, 10, 20, 0.9);
}

.poly-link {
    font-size: 12px;
    color: #eee;
    margin: 0 10px;
    text-decoration: none;
    transition: color 0.2s;
    pointer-events: auto;
    cursor: pointer;
}

.poly-link:hover {
    color: #1452f0;
    /* Poly blue hover */
    text-decoration: underline;
}

.poly-item {
    font-size: 12px;
    color: #eee;
    margin: 0 10px;
}

.poly-icon {
    font-size: 14px;
}

.poly-prob {
    font-weight: bold;
    font-size: 12px;
    margin-left: 8px;
}

.poly-green {
    color: #3fb950;
    text-shadow: 0 0 5px rgba(63, 185, 80, 0.5);
}

.poly-yellow {
    color: #d29922;
    text-shadow: 0 0 5px rgba(210, 153, 34, 0.5);
}

.poly-red {
    color: #f85149;
    text-shadow: 0 0 5px rgba(248, 81, 73, 0.5);
}

.poly-volume {
    font-size: 10px;
    color: #888;
}

/* Hide outcome tags completely - they should never display */
.poly-outcome {
    display: none !important;
    visibility: hidden !important;
}

@keyframes polyTicker {
    0% {
        transform: translate3d(0, 0, 0);
    }


    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* --- Poly Link Styling & Mobile Fixes --- */
.poly-link {
    color: #eee;
    text-decoration: none;
    font-weight: normal;
}

.poly-link:hover {
    text-decoration: underline;
    color: #fff;
}

/* Hide Title Box (GEOINT.WORLD) when Search Bar overlaps on narrow desktop/tablet */
@media (max-width: 1250px) {
    #overlay {
        display: none !important;
    }

    #left-panel-wrapper {
        top: 20px !important;
    }

    #search-bar {
        left: 215px !important;
        transform: none !important;
        width: 450px !important;
    }
}

@media (max-width: 600px) {
    #search-bar {
        left: 20px !important;
        right: 70px !important;
        /* leave space for settings button */
        transform: none !important;
        width: calc(100% - 90px) !important;
        z-index: 10 !important;
    }

    #left-panel-wrapper {
        top: 70px !important;
        left: 20px !important;
        width: calc(100% - 40px) !important;
        max-width: none !important;
    }
}

/* --- Polymarket Full List Table --- */
.view-toggle-container {
    display: flex;
    gap: 14px;
    background: transparent;
    margin-bottom: 5px;
}

.view-toggle-btn {
    flex: 1;
    background: #000;
    border: 1px solid #ff6800;
    color: #ff6800;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: bold;
    padding: 8px 5px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.poly-table-search-wrapper {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ff6800;
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 35px;
}

.poly-table-search-icon {
    flex-shrink: 0;
}

.view-toggle-btn:hover {
    background: #1a0d00;
    opacity: 1;
}

.view-toggle-btn.active {
    background: #ff6800;
    color: #000;
    opacity: 1;
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.4);
}

.poly-sort-arrow {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 900;
    color: #ff6800;
    vertical-align: middle;
    filter: drop-shadow(0 0 4px rgba(255, 104, 0, 0.6));
    transition: transform 0.2s ease;
}

#poly-table-search::placeholder {
    color: rgba(255, 104, 0, 0.4);
}

#poly-table-search:focus {
    box-shadow: 0 0 10px rgba(255, 104, 0, 0.3);
}

.poly-market-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
    color: #ff6800;
}

.poly-market-table thead th {
    background: #1a0d00;
    border-bottom: 2px solid #ff6800;
    padding: 10px 5px;
    text-align: left;
    position: sticky;
    top: -1px;
    /* Slight offset to ensure no gap */
    z-index: 10;
    white-space: nowrap;
}

.poly-market-table th[onclick]:hover {
    background: #1a0d00;
    color: #fff;
}

.poly-market-table td {
    padding: 10px 5px;
    border-bottom: 1px solid #1a1a1a;
}

.poly-market-table tr:hover {
    background: rgba(255, 104, 0, 0.05);
}

.poly-table-title {
    color: #eee;
    text-decoration: none;
}

.poly-table-title:hover {
    text-decoration: underline;
    color: #fff;
}

.poly-table-vol {
    color: #888;
}

.poly-table-prob {
    font-weight: bold;
}

/* Composite Modal */
.poly-composite-content,
.news-composite-content {
    display: flex;
    gap: 20px;
    margin: 15vh auto;
    width: 95%;
    max-width: 1400px;
    height: 80vh;
    pointer-events: none;
    /* Allow clicks between panels */
}

.poly-modal-side {
    background-color: rgba(10, 10, 10, 0.95);
    border: 1px solid #ff6800;
    box-shadow: 0 0 50px rgba(255, 104, 0, 0.2);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    min-height: 0;
    padding: 20px;
    /* Standard modal padding */
}

#polymarket-modal,
#gdelt-analytics-modal {
    width: 320px;
    flex-shrink: 0;
}

.poly-table-side {
    flex-grow: 1;
    min-width: 0;
}

#poly-show-all-btn,
#gdelt-show-all-btn {
    display: none !important;
}

@media (max-width: 1024px) {

    .poly-composite-content,
    .news-composite-content {
        flex-direction: column;
        margin: 60px auto;
        /* Symmetrical 15px buffer */
        height: auto;
        /* Dynamic height */
        max-height: calc(100vh - 120px);
        /* 60px top + 60px bottom margins */
        min-height: 0;
        /* Allow shrinking below content size */
        gap: 0;
        overflow: hidden;
        /* Prevent parent scroll */
        justify-content: flex-start;
    }

    /* Force inner containers to use flex column for scroll isolation */
    /* Force inner containers to use flex column for scroll isolation */
    #polymarket-modal,
    #gdelt-analytics-modal {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        flex: 0 1 auto;
        /* Hug content */
        min-height: 0;
        overflow: hidden;
        height: auto !important;
        max-height: 100%;
    }

    /* Target the content panel inside */
    #gdelt-analytics-modal .panel-content {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        /* Allow main panel to scroll if controls are tall */
        overflow-x: hidden;
        flex: 0 1 auto;

        /* Hug content */

    }

    /* Make the console FILL remaining space and scroll internally */
    /* Make the console FILL remaining space and scroll internally */
    #gdelt-console-isolation-frame {
        display: none !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        flex-grow: 0;
        flex-shrink: 0;
    }

    #gdelt-console-wrapper {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-y: auto !important;
        /* Enable internal scrolling */
        max-height: 250px !important;
        /* Cap height to trigger scroll */
    }

    #gdelt-analytics-modal {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .poly-table-side {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 10001 !important;
        background: #000 !important;
        display: none;
        flex-direction: column;
        pointer-events: auto !important;
    }

    #poly-show-all-btn {
        display: block !important;
        cursor: pointer !important;
        pointer-events: auto !important;
        -webkit-tap-highlight-color: transparent;
    }

    #gdelt-show-all-btn {
        display: block !important;
    }
}

/* Polymarket Table Loading Animation */
.poly-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 120px;
    gap: 15px;
}

.poly-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 104, 0, 0.2);
    border-top: 3px solid #ff6800;
    border-radius: 50%;
    animation: polySpin 1s linear infinite;
}

.poly-loader.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.search-loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    width: 100%;
}

.poly-loader-text {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #ff6800;
    letter-spacing: 2px;
    animation: polyPulse 1.5s ease-in-out infinite;
}

@keyframes polySpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes polyPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- Dynamic Popup Buttons & Header Alignment --- */
.maplibregl-popup-close-button {
    color: #ff6800 !important;
    font-size: 20px !important;
    right: 4px !important;
    top: 4px !important;
    font-weight: bold !important;
    padding: 0 !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    z-index: 25 !important;
    border-radius: 0 !important;
}

.popup-cloud-btn {
    position: absolute;
    top: 6px;
    right: 28px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: #ff6800;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.popup-json-btn {
    position: absolute;
    top: 6px;
    right: 52px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: #ff6800;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.popup-copy-btn {
    position: absolute;
    top: 6px;
    right: 76px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: #ff6800;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.popup-time-label {
    position: absolute;
    top: 6px;
    left: 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 20px;
    font-weight: bold;
    color: #ff6800;
    opacity: 0.8;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

/* Unified Hover Effects */
.popup-cloud-btn:hover,
.popup-json-btn:hover,
.popup-copy-btn:hover,
.maplibregl-popup-close-button:hover {
    color: #fff !important;
    filter: drop-shadow(0 0 4px #ff6800);
    background-color: transparent !important;
}

.popup-json-view {
    background: rgba(0, 0, 0, 0.95);
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    margin-top: 10px;
}

/* --- Dual Range Slider Styles --- */
.dual-range-wrapper {
    position: relative;
    width: 100%;
    height: 14px;
    /* Exact height of thumbs */
    margin-top: 14px;
    /* Space for labels above */
}

/* Custom visual track (Background) */
.dual-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: #333;
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

/* Orange fill between handles */
.dual-range-track::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--range-min, 0%);
    right: calc(100% - var(--range-max, 100%));
    background: #ff6800;
    border-radius: 2px;
}

/* Range inputs (Foreground) */
.dual-range {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 14px;
    /* Explicit match to thumb height */
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    z-index: 2;
}

/* Webkit Track - invisible container */
.dual-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 14px;
    /* Full height */
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Webkit Thumb - exact fit */
.dual-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: 0;
    /* No offset needed */
    background: #ff6800;
    border: 1px solid #000;
    border-radius: 2px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 4px rgba(255, 104, 0, 0.8);
}

/* Firefox Track */
.dual-range::-moz-range-track {
    width: 100%;
    height: 14px;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Firefox Thumb */
.dual-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #ff6800;
    border: 1px solid #000;
    border-radius: 2px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 4px rgba(255, 104, 0, 0.8);
    transform: none;
}

/* --- Standard Range Slider Styling (Cross-Browser) --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    margin: 10px 0;
    cursor: pointer;
}

/* Chrome/Safari/Edge Track */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
}

/* Chrome/Safari/Edge Thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #ff6800;
    border: 1px solid #000;
    border-radius: 2px;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 4px rgba(255, 104, 0, 0.8);
}

/* Firefox Track */
input[type="range"]::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    border: none;
}

/* Firefox Progress (the filled portion) */
input[type="range"]::-moz-range-progress {
    background: #ff6800;
    height: 4px;
    border-radius: 2px;
}

/* Firefox Thumb */
input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #ff6800;
    border: 1px solid #000;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(255, 104, 0, 0.8);
}

/* Focus states */
input[type="range"]:focus {
    outline: none;
}

input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 8px rgba(255, 104, 0, 1);
}

input[type="range"]:focus::-moz-range-thumb {
    box-shadow: 0 0 8px rgba(255, 104, 0, 1);
}

/* Popup Time Label - Header Top Left */
.popup-time-label {
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 12px;
    font-weight: bold;
    color: #888;
    font-family: 'Courier New', monospace;
    z-index: 10;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}


/* Live TV Floating Overlay */
#livetv-overlay-container {
    position: fixed;
    bottom: 140px;
    /* Above radio bar and tickers */
    left: 20px;
    width: 320px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    /* Stack upwards from bottom */
    gap: 10px;
    z-index: 50;
    pointer-events: none;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: transparent;
    z-index: 2000;
    /* High but below Close button */
}

.handle-nw {
    top: 0;
    left: 0;
    cursor: nw-resize;
}

.handle-ne {
    top: 0;
    right: 0;
    cursor: ne-resize;
}

.handle-sw {
    bottom: 0;
    left: 0;
    cursor: sw-resize;
}

.handle-se {
    bottom: 0;
    right: 0;
    cursor: se-resize;
}

.livetv-float-player {
    pointer-events: auto;
    background: #000;
    border: 1px solid #ff6800;
    box-shadow: 0 0 15px #ff6800;
    /* Glow Effect */
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
    min-width: 160px;
    min-height: 120px;
    position: relative;
    /* Ensure context for handles */
}

@keyframes slideIn {
    from {
        transform: translateX(50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.livetv-float-header {
    background: rgba(255, 104, 0, 0.15);
    color: #ff6800;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    border-bottom: 1px solid #331a00;
    position: relative;
    z-index: 1000;
    /* Above iframe, below handles */
}

.livetv-float-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.livetv-float-close {
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
    position: relative;
    z-index: 3000;
    /* Topmost to ensure clickability */
}

.livetv-float-close:hover {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

.livetv-float-iframe-container {
    position: relative;
    width: 100%;
    flex-grow: 1;
    overflow: hidden;
}

.livetv-float-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}