/* =============================================================================
   Taiwan Gray Zone Monitor - Main Stylesheet
   ============================================================================= */

:root {
    /* Colors */
    --bg-primary: #0a0f1c;
    --bg-secondary: #141e32;
    --bg-card: rgba(25, 35, 60, 0.95);
    --text-primary: #e8eef7;
    --text-secondary: #8aa4c8;
    --accent-cyan: #00f5ff;
    --accent-orange: #ff6b35;
    --accent-red: #ff3366;
    --accent-green: #00ff88;
    --accent-yellow: #ffd700;
    --accent-purple: #9b59b6;
    --border-glow: rgba(0, 245, 255, 0.3);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    /* Animation */
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
}

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

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* =============================================================================
   Layout
   ============================================================================= */

.app-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

/* =============================================================================
   Header
   ============================================================================= */

.header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-glow);
}

.header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--accent-cyan);
    text-shadow: 0 0 15px rgba(0, 245, 255, 0.5);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-nav a {
    font-size: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--spacing-xs) 10px;
    border: 1px solid var(--border-glow);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.header-nav a:hover { 
    color: var(--accent-cyan); 
    border-color: var(--accent-cyan); 
}

.header-nav a.active { 
    color: var(--accent-cyan); 
    border-color: var(--accent-cyan); 
    background: rgba(0,245,255,0.1); 
}

.data-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--text-secondary);
    padding: var(--spacing-xs) 10px;
    background: var(--bg-card);
    border-radius: 4px;
    border: 1px solid var(--border-glow);
}

.data-status.live {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

/* =============================================================================
   Map Section
   ============================================================================= */

.map-section { position: relative; }
#map { width: 100%; height: 100%; background: #0a1628; }

/* Route search box */
.route-search {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    gap: 4px;
}
.route-search input {
    width: 140px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-glow);
    background: rgba(10, 15, 28, 0.9);
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    backdrop-filter: blur(10px);
}
.route-search input::placeholder { color: var(--text-secondary); opacity: 0.6; }
.route-search button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--accent-cyan);
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
    font-size: 12px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}
.route-search button:hover { background: rgba(0, 245, 255, 0.3); }

/* Route toast notification */
#routeToast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 28, 0.95);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #ffd700;
    font-size: 13px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

/* Route lookup button in vessel popup */
/* Sanction warning in vessel popup */
.sanction-warning {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    border-radius: 3px;
    color: #ff0000;
    font-weight: bold;
    font-size: 10px;
    animation: sanctionPulse 2s ease-in-out infinite;
}
@keyframes sanctionPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.route-lookup-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.6);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.route-lookup-btn:hover {
    background: rgba(255, 215, 0, 0.35);
    transform: scale(1.03);
}
.route-lookup-btn:active {
    transform: scale(0.97);
}

.mt-lookup-link {
    display: inline-block;
    margin-top: 4px;
    color: #00d4ff;
    font-size: 11px;
    text-decoration: none;
}
.mt-lookup-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* Bottom sheet route search */
.bs-route-search {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.bs-route-search input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-glow);
    background: rgba(10, 15, 28, 0.9);
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'JetBrains Mono', monospace;
}
.bs-route-search input::placeholder { color: var(--text-secondary); opacity: 0.5; }
.bs-route-search button {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--accent-cyan);
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    min-height: 48px;
}
.bs-route-search button:active { background: rgba(0, 245, 255, 0.3); }

/* Route loading spinner */
#routeLoadingSpinner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(10, 15, 28, 0.95);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    font-size: 13px;
    z-index: 10000;
    font-family: 'JetBrains Mono', monospace;
}
#routeLoadingSpinner.active { display: flex; }
.route-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: routeSpin 0.8s linear infinite;
}
@keyframes routeSpin { to { transform: rotate(360deg); } }

/* Track info panel */
#trackInfoPanel {
    position: absolute;
    bottom: 20px;
    right: 10px;
    z-index: 1000;
    background: rgba(10, 15, 28, 0.92);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 11px;
    min-width: 150px;
    max-width: 200px;
    display: none;
    backdrop-filter: blur(8px);
}
#trackInfoPanel.active { display: block; }
.track-action-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.track-action-row button {
    flex: 1;
    min-height: 32px;
}
.track-snapshot-btn {
    display: block;
    width: 100%;
    padding: 4px 0;
    background: rgba(0, 245, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 245, 255, 0.4);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.track-snapshot-btn:active { background: rgba(0, 245, 255, 0.3); }
.track-info-header {
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 11px;
}
.track-info-body {
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 10px;
}
.track-clear-btn {
    display: block;
    width: 100%;
    padding: 4px 0;
    background: rgba(255, 51, 102, 0.2);
    color: #ff3366;
    border: 1px solid rgba(255, 51, 102, 0.5);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.track-clear-btn:active {
    background: rgba(255, 51, 102, 0.4);
}

.map-overlay {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.overlay-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 5px;
    padding: 6px 10px;
    backdrop-filter: blur(10px);
    min-width: 95px;
}

.overlay-card .label { 
    font-size: 8px; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
}

.overlay-card .value { 
    font-family: 'Orbitron', sans-serif; 
    font-size: 18px; 
    font-weight: 700; 
    color: var(--accent-cyan); 
}

.overlay-card.alert .value { color: var(--accent-red); }

/* =============================================================================
   Map Legend
   ============================================================================= */

.map-legend {
    position: absolute;
    bottom: 15px;
    left: var(--spacing-sm);
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 5px;
    padding: var(--spacing-sm) 10px;
    font-size: 8px;
}

.legend-section { margin-bottom: 6px; }
.legend-title { 
    font-size: 7px; 
    color: var(--text-secondary); 
    margin-bottom: 3px; 
    text-transform: uppercase; 
}
.legend-item { display: flex; align-items: center; gap: 4px; margin: 2px 0; }
.legend-clickable { cursor: pointer; padding: 1px 3px; border-radius: 3px; transition: background 0.2s; }
.legend-clickable:hover { background: rgba(255,255,255,0.1); }
.legend-clickable:active { background: rgba(255,255,255,0.2); }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-line { width: 14px; height: 2px; border-radius: 1px; }

/* Vessel list panel (LNG locate) */
.vessel-list-panel {
    margin-top: 6px;
    padding: 6px 0 2px;
    border-top: 1px solid var(--border-glow);
}
.vlp-title {
    font-size: 8px;
    color: #f0e130;
    font-weight: bold;
    margin-bottom: 4px;
    padding: 0 2px;
}
.vlp-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 8px;
}
.vlp-item:hover {
    background: rgba(240, 225, 48, 0.15);
}
.vlp-num {
    color: #f0e130;
    font-weight: bold;
    min-width: 10px;
}
.vlp-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
}
.vlp-speed {
    color: var(--text-secondary);
    font-size: 7px;
    white-space: nowrap;
}

/* =============================================================================
   Layer Toggles
   ============================================================================= */

.layer-toggles {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 5px;
    padding: 6px var(--spacing-sm);
}

.layer-toggle { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    margin: 3px 0; 
    cursor: pointer; 
    font-size: 9px; 
}

.layer-toggle input { 
    width: 12px; 
    height: 12px; 
    accent-color: var(--accent-cyan); 
}

/* =============================================================================
   Sidebar
   ============================================================================= */

.sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glow);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-section { 
    padding: 10px; 
    border-bottom: 1px solid rgba(0, 245, 255, 0.1); 
}

.section-title { 
    font-size: 10px; 
    font-weight: 500; 
    color: var(--text-primary); 
    margin-bottom: 6px; 
}

/* =============================================================================
   Stats Grid
   ============================================================================= */

.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 5px; 
}

.stat-box { 
    background: var(--bg-card); 
    border-radius: 4px; 
    padding: 6px; 
    text-align: center; 
}

.stat-box .value { 
    font-family: 'Orbitron', sans-serif; 
    font-size: 16px; 
    font-weight: 700; 
    color: var(--accent-cyan); 
}

.stat-box .label { 
    font-size: 7px; 
    color: var(--text-secondary); 
    margin-top: 1px; 
}

/* Stats Row (for full width pages) */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-sm);
    padding: 10px var(--spacing-md);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 6px;
    padding: 10px 14px;
    text-align: center;
}

.stat-card .value {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.stat-card .value.alert { color: var(--accent-red); }
.stat-card .label { font-size: 9px; color: var(--text-secondary); margin-top: 2px; }

/* =============================================================================
   Suspicious Vessels List
   ============================================================================= */

.suspicious-list { max-height: 150px; overflow-y: auto; }

.suspicious-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: var(--spacing-xs) 5px;
    margin: 2px 0;
    background: rgba(255, 51, 102, 0.1);
    border-radius: 3px;
    font-size: 8px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-left: 2px solid var(--accent-red);
}

.suspicious-item:hover { background: rgba(255, 51, 102, 0.25); }

.suspicious-item .risk-badge {
    font-size: 6px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
}

.risk-critical { background: var(--accent-red); color: #fff; }
.risk-high { background: var(--accent-orange); color: #fff; }
.risk-medium { background: var(--accent-yellow); color: #000; }

/* =============================================================================
   Vessel List
   ============================================================================= */

.vessel-list { max-height: 130px; overflow-y: auto; }

.vessel-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: var(--spacing-xs) 5px;
    margin: 2px 0;
    background: var(--bg-card);
    border-radius: 3px;
    font-size: 8px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.vessel-item:hover { background: rgba(0, 245, 255, 0.15); }

/* =============================================================================
   Zone List
   ============================================================================= */

.zone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 6px;
    margin: 2px 0;
    background: var(--bg-card);
    border-radius: 3px;
    font-size: 9px;
    cursor: pointer;
}

.zone-item:hover { background: rgba(0, 245, 255, 0.15); }
.zone-count { font-family: 'Orbitron', sans-serif; font-weight: 700; }

/* =============================================================================
   GFW Stats
   ============================================================================= */

.gfw-stats-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 5px; 
}

.gfw-stat-box { 
    background: var(--bg-card); 
    border-radius: 4px; 
    padding: 6px; 
}

.gfw-stat-box .value { 
    font-family: 'Orbitron', sans-serif; 
    font-size: 14px; 
    font-weight: 700; 
    color: var(--accent-cyan); 
}

.gfw-stat-box .label { 
    font-size: 7px; 
    color: var(--text-secondary); 
    margin-top: 1px; 
}

.gfw-stat-box.warn .value { color: var(--accent-orange); }
.gfw-stat-box.alert .value { color: var(--accent-red); }

.trend-up { color: var(--accent-red); }
.trend-down { color: var(--accent-green); }
.trend-flat { color: var(--text-secondary); }

/* =============================================================================
   Sparkline
   ============================================================================= */

.sparkline-container { 
    background: var(--bg-card); 
    border-radius: 4px; 
    padding: 6px var(--spacing-sm); 
    margin-top: 5px; 
}

.sparkline-label { 
    font-size: 7px; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
    margin-bottom: 3px; 
}

.sparkline-bar-row { 
    display: flex; 
    align-items: flex-end; 
    gap: 1px; 
    height: 30px; 
}

.sparkline-bar { 
    flex: 1; 
    min-width: 2px; 
    background: var(--accent-cyan); 
    border-radius: 1px 1px 0 0; 
    opacity: 0.8; 
}

/* =============================================================================
   Alerts
   ============================================================================= */

.alert-item {
    display: flex; 
    align-items: center; 
    gap: 5px;
    padding: var(--spacing-xs) 6px; 
    margin: 2px 0;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 3px; 
    font-size: 8px;
    border-left: 2px solid var(--accent-orange);
}

/* =============================================================================
   Update Info
   ============================================================================= */

.update-info {
    padding: var(--spacing-sm) 10px;
    background: var(--bg-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: auto;
}

/* =============================================================================
   Panels (for statistics page)
   ============================================================================= */

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px var(--spacing-md);
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 6px;
    overflow: hidden;
}

.panel-title {
    font-size: 11px;
    font-weight: 500;
    padding: var(--spacing-sm) 12px;
    border-bottom: 1px solid rgba(0,245,255,0.1);
    color: var(--text-primary);
}

.panel-body { padding: var(--spacing-sm); }

.map-panel { grid-column: 1 / -1; }
.chart-panel { grid-column: 1 / -1; }
.chart-container { height: 250px; padding: var(--spacing-sm) 12px; }

/* =============================================================================
   Region Table
   ============================================================================= */

.region-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.region-table th {
    text-align: left;
    padding: 6px var(--spacing-sm);
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid rgba(0,245,255,0.15);
    font-size: 9px;
}

.region-table td {
    padding: 6px var(--spacing-sm);
    border-bottom: 1px solid rgba(0,245,255,0.05);
}

.region-table tr:hover td { background: rgba(0,245,255,0.05); }

.ratio-bar {
    display: inline-block;
    height: 6px;
    border-radius: 3px;
    background: var(--accent-red);
    min-width: 2px;
}

/* =============================================================================
   Flag List
   ============================================================================= */

.panel-title.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.panel-title.collapsible::after {
    content: '▶';
    font-size: 9px;
    transition: transform 0.2s;
    color: var(--accent-cyan);
}

.panel-title.collapsible.expanded::after {
    transform: rotate(90deg);
}

.panel-collapsible-body {
    display: none;
}

.panel-collapsible-body.expanded {
    display: block;
}

.flag-list { font-size: 9px; }

.flag-item {
    display: flex;
    justify-content: space-between;
    padding: 3px var(--spacing-sm);
    border-bottom: 1px solid rgba(0,245,255,0.05);
}

.flag-item:hover { background: rgba(0,245,255,0.05); }

/* =============================================================================
   Empty State
   ============================================================================= */

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 11px;
}

/* =============================================================================
   Pulse Animation
   ============================================================================= */

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* =============================================================================
   Leaflet Customization
   ============================================================================= */

.leaflet-popup-content-wrapper { 
    background: var(--bg-card); 
    color: var(--text-primary); 
    border-radius: 5px; 
    border: 1px solid var(--border-glow); 
}

.leaflet-popup-tip { background: var(--bg-card); }

.leaflet-popup-content { 
    margin: 6px var(--spacing-sm); 
    font-size: 9px; 
    line-height: 1.4; 
}

/* =============================================================================
   Mobile Responsive
   ============================================================================= */

@media (max-width: 900px) {
    /* Layout */
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)); }
    .app-container { grid-template-columns: 1fr; }
    .main-content { grid-template-columns: 1fr; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)); }

    /* Header - minimal: title + lang toggle + status */
    .header {
        padding: 10px 12px;
        min-height: 48px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .header h1 {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 120px);
    }
    .header-nav,
    .header-info { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
    .header-nav a,
    .header-info a { display: none; }

    /* Language toggle */
    #langToggle {
        min-width: 40px;
        min-height: 36px;
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    .data-status {
        font-size: 10px;
        padding: 3px 6px;
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Sidebar - slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: min(280px, 85vw);
        height: 100vh;
        transform: translateX(100%);
        transition: transform var(--transition-normal) ease;
        z-index: 2000;
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-normal);
    }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }

    /* Mobile menu button - hidden, replaced by bottom sheet */
    .mobile-menu-btn { display: none; }

    /* ===== Mobile Bottom Navigation ===== */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        height: calc(56px + env(safe-area-inset-bottom, 0));
        background: rgba(20, 30, 50, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-glow);
        padding: 4px 0 env(safe-area-inset-bottom, 0);
        z-index: 1500;
    }
    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 11px;
        gap: 3px;
        border: none;
        background: none;
        cursor: pointer;
        font-family: inherit;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-bottom-nav a.active,
    .mobile-bottom-nav button.active {
        color: var(--accent-cyan);
    }
    .mobile-bottom-nav a.active::before,
    .mobile-bottom-nav button.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 25%;
        right: 25%;
        height: 2px;
        background: var(--accent-cyan);
        border-radius: 0 0 2px 2px;
    }
    .mobile-bottom-nav .nav-icon { font-size: 22px; }

    /* ===== Animation Popover (submenu) ===== */
    .nav-popover {
        position: fixed;
        bottom: calc(56px + env(safe-area-inset-bottom, 0));
        left: 0;
        right: 0;
        background: rgba(20, 30, 50, 0.98);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-glow);
        z-index: 1499;
        transform: translateY(100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 8px 0;
    }
    .nav-popover.open { transform: translateY(0); }
    .nav-popover a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 20px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 14px;
        transition: background 0.15s;
    }
    .nav-popover a:active { background: rgba(0, 245, 255, 0.08); }
    .nav-popover a.active { color: var(--accent-cyan); }
    .nav-popover .pop-icon { font-size: 20px; width: 28px; text-align: center; }

    /* ===== Bottom Sheet (tools panel) ===== */
    .bottom-sheet {
        position: fixed;
        bottom: calc(56px + env(safe-area-inset-bottom, 0));
        left: 0;
        right: 0;
        max-height: min(70vh, 500px);
        background: rgba(20, 30, 50, 0.98);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-radius: 16px 16px 0 0;
        border-top: 1px solid var(--border-glow);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1400;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px 24px;
    }
    .bottom-sheet.open { transform: translateY(0); }
    .bottom-sheet-handle {
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 0 auto 16px;
    }
    .bottom-sheet-section {
        margin-bottom: 20px;
    }
    .bottom-sheet-title {
        font-size: 13px;
        font-weight: 600;
        color: var(--accent-cyan);
        margin-bottom: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .bottom-sheet .layer-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .bottom-sheet .layer-toggle input {
        width: 20px;
        height: 20px;
        accent-color: var(--accent-cyan);
    }
    .bs-stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .bs-stat-item {
        background: rgba(255, 255, 255, 0.04);
        border-radius: 8px;
        padding: 10px 12px;
        text-align: center;
    }
    .bs-stat-value {
        font-family: 'Orbitron', monospace;
        font-size: 20px;
        font-weight: 700;
        color: var(--accent-cyan);
    }
    .bs-stat-value.alert { color: var(--accent-red); }
    .bs-stat-label {
        font-size: 12px;
        color: var(--text-secondary);
        margin-top: 4px;
    }
    .bs-suspect-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 13px;
        cursor: pointer;
    }
    .bs-suspect-item:active { opacity: 0.7; }
    .bs-lng-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 14px;
        cursor: pointer;
    }
    .bs-lng-item:active { opacity: 0.7; }
    .bs-lng-num {
        color: #f0e130;
        font-weight: bold;
        min-width: 18px;
    }
    .bs-lng-name {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .bs-lng-speed {
        color: var(--text-secondary);
        font-size: 12px;
        white-space: nowrap;
    }
    .bottom-sheet-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom, 0));
        background: rgba(0, 0, 0, 0.4);
        z-index: 1399;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s;
    }
    .bottom-sheet-overlay.active { opacity: 1; visibility: visible; }

    /* ===== Font sizes - minimum 12px ===== */
    .overlay-card .label { font-size: 12px; }
    .overlay-card .value { font-size: 22px; font-weight: 700; }
    .map-legend { display: none; }
    .layer-toggle { font-size: 13px; padding: 8px 4px; min-height: 44px; }
    .layer-toggle input { width: 20px; height: 20px; }
    .section-title { font-size: 14px; font-weight: 600; }
    .stat-box .label { font-size: 12px; }
    .stat-box .value { font-size: 20px; }
    .stat-card .label { font-size: 12px; }
    .stat-card .value { font-size: 22px; }
    .suspicious-item { font-size: 13px; padding: 12px; }
    .suspicious-item .risk-badge { font-size: 9px; padding: 3px 8px; }
    .vessel-item { font-size: 13px; padding: 12px; }
    .zone-item { font-size: 13px; padding: 12px; }
    .flag-list { font-size: 12px; }
    .flag-item { padding: 10px 12px; font-size: 13px; }
    .region-table { font-size: 12px; }
    .region-table th { font-size: 12px; }
    .update-info { font-size: 12px; }
    .leaflet-popup-content { font-size: 13px; line-height: 1.6; }
    .leaflet-popup-content-wrapper { max-width: 280px; }
    .route-lookup-btn {
        display: block;
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
        text-align: center;
        margin-top: 8px;
        border-radius: 6px;
        min-height: 44px;
        line-height: 24px;
    }
    .sanction-warning { font-size: 11px; padding: 4px 10px; }
    #trackInfoPanel { bottom: 70px; right: 8px; left: auto; max-width: 200px; font-size: 12px; }
    .track-clear-btn { padding: 8px 0; font-size: 13px; min-height: 40px; border-radius: 6px; }
    .track-snapshot-btn { padding: 8px 0; font-size: 13px; min-height: 40px; border-radius: 6px; }
    .track-action-row button { min-height: 40px; }
    .route-search { display: none; }  /* Hidden on mobile, use bottom sheet instead */
    .gfw-stat-box .label { font-size: 12px; }
    .alert-item { font-size: 13px; padding: 12px; }
    .panel-title { font-size: 14px; }
    .panel-title.collapsible { padding: 12px; min-height: 44px; }

    /* Map overlays & controls */
    .overlay-card { padding: 6px 10px; }
    .layer-toggles { display: none; }  /* Moved into bottom sheet on mobile */

    /* Map responsive height */
    #map {
        height: calc(100vh - 44px - 56px - 20px) !important;
        max-height: 400px;
        min-height: 250px;
    }

    /* Tables horizontal scroll */
    .panel-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .region-table, .freq-table, .timeline-table { min-width: 400px; }

    /* Chart heights */
    .chart-container { height: 200px; }

    /* About section */
    .about-section { padding-bottom: 80px; }
    .about-grid { grid-template-columns: 1fr; }

    /* Text contrast boost */
    --text-secondary: #a0b8d8;
}

/* Phone breakpoint */
@media (max-width: 600px) {
    .header h1 { font-size: 12px; max-width: calc(100vw - 100px); }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px 8px; }
    .stat-card { padding: 8px 6px; }
    .stat-card .value { font-size: 20px; }
    .stat-card .label { font-size: 10px; }
}

@media (min-width: 901px) {
    .mobile-menu-btn { display: none; }
    .mobile-bottom-nav { display: none; }
    .nav-popover { display: none; }
    .bottom-sheet { display: none; }
    .bottom-sheet-overlay { display: none; }
    .sidebar-overlay { display: none; }
}

/* =============================================================================
   About Section
   ============================================================================= */

.about-section {
    background: var(--bg-primary);
    padding: var(--spacing-lg) var(--spacing-md);
    border-top: 1px solid var(--border-glow);
}

.about-container {
    max-width: 1100px;
    margin: 0 auto;
}

.about-title {
    font-family: 'Orbitron', 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border-glow);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 6px;
    padding: var(--spacing-md);
}

.about-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: var(--spacing-sm);
}

.about-card p {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.about-card p:last-child {
    margin-bottom: 0;
}

.about-card ul {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    padding-left: 18px;
    margin: 0;
}

.about-card ul li {
    margin-bottom: 4px;
}

.about-card ul li strong {
    color: var(--text-primary);
}

.about-card em {
    color: var(--accent-cyan);
    font-style: italic;
}

.about-card .reference-list {
    list-style: none;
    padding-left: 0;
}

.about-card .reference-list li {
    padding-left: 16px;
    position: relative;
    margin-bottom: 8px;
}

.about-card .reference-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
}

/* =============================================================================
   Site Footer
   ============================================================================= */

.site-footer {
    background: #0d1b2a;
    border-top: 1px solid rgba(106, 236, 249, 0.2);
    padding: var(--spacing-md);
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.site-footer a {
    color: #6aecf9;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Vessel triangle icon - remove default leaflet div icon styling */
/* =============================================================================
   Today's Overview Dashboard
   ============================================================================= */
.today-overview {
    padding: 16px 20px 12px;
    background: linear-gradient(135deg, rgba(10, 15, 28, 0.95), rgba(20, 35, 60, 0.9));
    border-bottom: 1px solid var(--border-glow);
}
.overview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.overview-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}
.overview-updated {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.overview-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.overview-card {
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.15);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}
.overview-card.alert {
    border-color: rgba(255, 51, 102, 0.3);
    background: rgba(255, 51, 102, 0.06);
}
.overview-card.warn {
    border-color: rgba(255, 107, 53, 0.3);
    background: rgba(255, 107, 53, 0.06);
}
.overview-value {
    font-family: 'Orbitron', 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.1;
}
.overview-card.alert .overview-value { color: #ff3366; }
.overview-card.warn .overview-value { color: #ff6b35; }
.overview-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.overview-alert-bar {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.overview-alert-bar:empty { display: none; }
.overview-alert-item {
    padding: 6px 10px;
    background: rgba(255, 51, 102, 0.08);
    border-left: 3px solid #ff3366;
    border-radius: 0 6px 6px 0;
    margin-bottom: 6px;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 6px;
}
.share-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-glow);
    background: rgba(0, 245, 255, 0.06);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.share-btn:hover, .share-btn:active {
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
}

@media (max-width: 900px) {
    .overview-cards { grid-template-columns: repeat(2, 1fr); }
    .overview-value { font-size: 24px; }
    .overview-header h2 { font-size: 14px; }
}
@media (max-width: 400px) {
    .overview-value { font-size: 20px; }
    .overview-card { padding: 8px 6px; }
}

.vessel-icon {
    background: none !important;
    border: none !important;
}

.vessel-cluster-wrapper {
    background: none !important;
    border: none !important;
}

.vessel-cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 245, 255, 0.1);
    border: 1.5px solid rgba(0, 245, 255, 0.45);
    border-radius: 50%;
    color: #e0f0ff;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.vessel-cluster:hover {
    transform: scale(1.1);
    border-color: rgba(0, 245, 255, 0.8);
}
.vessel-cluster .cluster-count {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.vessel-cluster .cluster-label {
    font-size: 8px;
    opacity: 0.7;
    line-height: 1;
    margin-top: 1px;
}

/* =============================================================================
   Introduction Page
   ============================================================================= */

.intro-hero {
    text-align: center;
    padding: 60px 24px 40px;
    max-width: 720px;
    margin: 0 auto;
}

.intro-hero h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.intro-hero .subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.intro-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 24px 8px;
}

.intro-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--accent-cyan);
}

.intro-section p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.intro-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 32px;
}

.intro-tool-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid rgba(0, 245, 255, 0.12);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.intro-tool-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 4px 20px rgba(0, 245, 255, 0.1);
}

.intro-tool-card .tool-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.intro-tool-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.intro-tool-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.intro-cta {
    text-align: center;
    padding: 16px 24px 64px;
}

.intro-cta a {
    display: inline-block;
    background: var(--accent-cyan);
    color: var(--bg-primary);
    padding: 14px 36px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.intro-cta a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 24px rgba(0, 245, 255, 0.3);
}

@media (max-width: 600px) {
    .intro-hero {
        padding: 40px 20px 28px;
    }
    .intro-hero h1 {
        font-size: 22px;
    }
    .intro-tools-grid {
        grid-template-columns: 1fr;
        padding: 0 16px 24px;
    }
    .intro-section {
        padding: 20px 16px 8px;
    }
}

/* =============================================================================
   Onboarding Tour
   ============================================================================= */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: ob-fadein 0.3s ease forwards;
}

@keyframes ob-fadein { to { opacity: 1; } }

.onboarding-card {
    background: linear-gradient(135deg, rgba(20, 30, 50, 0.98), rgba(10, 15, 28, 0.98));
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 80px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 245, 255, 0.08);
}

.ob-icon {
    font-size: 48px;
    text-align: center;
    padding: 28px 24px 8px;
    line-height: 1;
}

.ob-body {
    padding: 8px 24px 20px;
    flex: 1;
    overflow-y: auto;
}

.ob-body h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: center;
}

.ob-body p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    text-align: center;
}

.ob-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid rgba(0, 245, 255, 0.1);
}

.ob-dots {
    display: flex;
    gap: 6px;
}

.ob-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 245, 255, 0.2);
    transition: all 0.25s;
}

.ob-dot.active {
    background: var(--accent-cyan);
    box-shadow: 0 0 6px var(--accent-cyan);
}

.ob-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ob-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ob-btn-skip {
    background: transparent;
    color: var(--text-secondary);
}

.ob-btn-skip:hover {
    color: var(--text-primary);
}

.ob-btn-prev {
    background: rgba(0, 245, 255, 0.08);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 245, 255, 0.2);
}

.ob-btn-prev:hover {
    background: rgba(0, 245, 255, 0.15);
}

.ob-btn-next {
    background: var(--accent-cyan);
    color: #0a0f1c;
}

.ob-btn-next:hover {
    background: #33f7ff;
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
}

/* Slide transition */
.ob-slide-enter {
    animation: ob-slide-in 0.25s ease forwards;
}

@keyframes ob-slide-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.ob-slide-exit {
    animation: ob-slide-out 0.2s ease forwards;
}

@keyframes ob-slide-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-30px); }
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .onboarding-overlay {
        align-items: flex-end;
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
    }
    .onboarding-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
    }
    .ob-icon {
        font-size: 40px;
        padding: 20px 20px 6px;
    }
    .ob-body {
        padding: 6px 20px 16px;
    }
    .ob-body h2 {
        font-size: 18px;
    }
    .ob-body p {
        font-size: 13px;
    }
}
