/* ==========================================================
   CoB Live Map — Stylesheet
   Warm-toned dark theme (Claude design language) + CoB gold
   ========================================================== */

:root {
    /* ----- Surfaces (warm darks, no cool blue-grays) ----- */
    --bg-deepest:        #141413;                       /* page bg, leaflet behind tiles */
    --bg-surface:        #1c1b18;                       /* nav, sidebar, status bar */
    --bg-elevated:       #252420;                       /* cards, controls, popups */
    --bg-overlay:        rgba(20, 20, 19, 0.85);        /* legend, offline overlay */
    --bg-hover:          rgba(240, 238, 230, 0.04);     /* row hover */
    --bg-active:         rgba(240, 238, 230, 0.07);     /* row pressed */

    /* ----- CoB brand + Claude accents (all warm-toned) ----- */
    --accent:            #d4af37;                       /* CoB gold — primary brand */
    --accent-hover:      #e8c468;                       /* warmer gold hover */
    --accent-soft:       rgba(212, 175, 55, 0.14);      /* gold tint backgrounds */
    --accent-terracotta: #c96442;                       /* secondary warm accent */
    --accent-coral:      #d97757;                       /* link/text accent on dark */

    --accent-success:    #7fb069;                       /* warmed sage green */
    --accent-warn:       #d49a3f;                       /* warm amber */
    --accent-danger:     #b85450;                       /* warm crimson */
    --accent-info:       #6ea8c4;                       /* (rare) cool nudge */

    /* ----- Text (warm off-whites, warm grays) ----- */
    --text-primary:      #f0eee6;                       /* warm off-white */
    --text-secondary:    #a8a59c;                       /* warm secondary */
    --text-muted:        #75736d;                       /* warm muted */
    --text-faint:        #5e5d59;                       /* warm olive gray */

    /* ----- Borders (warm, low-contrast halos) ----- */
    --border:            rgba(240, 238, 230, 0.08);     /* default */
    --border-strong:     rgba(240, 238, 230, 0.14);     /* dividers, focused */
    --border-hover:      rgba(212, 175, 55, 0.4);       /* gold ring on hover */
    --border-subtle:     rgba(240, 238, 230, 0.04);     /* row separators */

    /* ----- Spacing ----- */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* ----- Border radius (generous per Claude design) ----- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* ----- Shadows (warm ring + whisper-soft drops) ----- */
    --ring:              0 0 0 1px rgba(240, 238, 230, 0.08);
    --ring-strong:       0 0 0 1px rgba(240, 238, 230, 0.16);
    --ring-accent:       0 0 0 1px rgba(212, 175, 55, 0.45);
    --shadow-whisper:    0 4px 24px rgba(0, 0, 0, 0.32);
    --shadow-elevated:   0 12px 40px rgba(0, 0, 0, 0.45), var(--ring);
    --shadow-inset:      inset 0 0 0 1px rgba(240, 238, 230, 0.06);

    /* ----- Type ----- */
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Anthropic Serif', 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono:  'Roboto Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ==========================================================
   Base
   ========================================================== */

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deepest);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'cv11', 'ss01';
}

/* Tabular numerals for monospaced data (FPS, scores, countdowns) */
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================
   Navbar
   ========================================================== */

.navbar {
    background: rgba(20, 20, 19, 0.8);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--spacing-lg);
    height: 56px;
    display: flex;
    align-items: center;
    z-index: 100;
    position: relative;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.2px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s ease;
}

.nav-brand::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.55);
    transform: translateY(-1px);
    flex-shrink: 0;
}

.nav-brand:hover {
    color: var(--accent-hover);
}

.nav-links-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-link-stats {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--ring);
    transition: color 0.2s, box-shadow 0.2s, background 0.2s;
    white-space: nowrap;
}

.nav-link-stats:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    box-shadow: var(--ring-accent);
}

/* ==========================================================
   Map Wrapper (flex container for sidebar + map)
   ========================================================== */

.map-wrapper {
    position: relative;
    display: flex;
    height: calc(100vh - 56px - 44px);
    background: var(--bg-deepest);
}

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

.player-sidebar {
    width: 256px;
    min-width: 256px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.22s cubic-bezier(.4,0,.2,1),
                min-width 0.22s cubic-bezier(.4,0,.2,1);
    z-index: 10;
}

.player-sidebar.collapsed {
    width: 32px;
    min-width: 32px;
}

.player-sidebar.collapsed .sidebar-header h3,
.player-sidebar.collapsed .objectives-list,
.player-sidebar.collapsed .sidebar-list,
.player-sidebar.collapsed .weather-widget {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--spacing-md);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: 0.1px;
    line-height: 1.2;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1;
    box-shadow: var(--ring);
    transition: color 0.2s, box-shadow 0.2s, background 0.2s;
}

.sidebar-toggle:hover {
    color: var(--accent);
    background: var(--bg-hover);
    box-shadow: var(--ring-accent);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    /* warm scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(240, 238, 230, 0.12) transparent;
}

.sidebar-list::-webkit-scrollbar { width: 6px; }
.sidebar-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(240, 238, 230, 0.12);
    border-radius: 3px;
}
.sidebar-list::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.4);
}

/* ==========================================================
   Objectives Panel (inside sidebar)
   ========================================================== */

.objectives-list {
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-sm) 0 10px;
    flex-shrink: 0;
}

.objectives-header {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px var(--spacing-md) 6px;
}

.objective-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px var(--spacing-md);
    font-size: 0.78rem;
    line-height: 1.4;
}

.objective-icon {
    width: 14px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.72rem;
}

.objective-icon.complete   { color: var(--accent-success); }
.objective-icon.incomplete { color: var(--text-muted); }

.objective-label          { color: var(--text-primary); }
.objective-label.complete {
    text-decoration: line-through;
    text-decoration-color: rgba(127, 176, 105, 0.5);
    opacity: 0.55;
    color: var(--accent-success);
}

/* ==========================================================
   Weather Widget (bottom of sidebar)
   ========================================================== */

.weather-widget {
    border-top: 1px solid var(--border);
    padding: 12px var(--spacing-md);
    flex-shrink: 0;
    margin-top: auto;
    background: linear-gradient(
        180deg,
        rgba(240, 238, 230, 0.0),
        rgba(240, 238, 230, 0.025)
    );
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.weather-icon {
    font-size: 1.7rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.weather-temp {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
}

.weather-temp-unit {
    font-family: var(--font-sans);
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 2px;
}

.weather-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.66rem;
    line-height: 1.4;
}

.weather-detail { white-space: nowrap; }
.weather-detail-label  { color: var(--text-muted); }
.weather-detail-value  {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
}

/* ==========================================================
   Player Rows
   ========================================================== */

.player-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s, transform 0.15s;
    white-space: nowrap;
}

.player-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: transparent;
    transition: background 0.15s;
}

.player-row:hover {
    background: var(--bg-hover);
}

.player-row:hover::before {
    background: var(--accent);
}

.player-row.dead {
    opacity: 0.4;
}

.player-row.incap {
    opacity: 0.7;
}

.player-row.incap::before {
    background: var(--accent-danger);
}

.rank-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    text-align: center;
    min-width: 30px;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.rank-badge.rank-enlisted { background: rgba(168, 165, 156, 0.14); color: var(--text-secondary); }
.rank-badge.rank-nco      { background: rgba(127, 176, 105, 0.16); color: var(--accent-success); }
.rank-badge.rank-officer  { background: rgba(212, 175, 55, 0.16);  color: var(--accent); }
.rank-badge.rank-senior   { background: rgba(212, 154, 63, 0.18);  color: var(--accent-warn); }

.player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
}

.player-score {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Collapsed sidebar: center the toggle button */
.player-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px 4px;
    border-bottom: none;
}

.player-sidebar.collapsed .sidebar-toggle {
    font-size: 0.95rem;
    padding: 6px 8px;
}

/* ==========================================================
   Map Container
   ========================================================== */

#map {
    flex: 1;
    height: 100%;
    background: var(--bg-deepest);
    z-index: 1;
}

/* ==========================================================
   Status Bar
   ========================================================== */

.map-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 0 var(--spacing-md);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    height: 44px;
    align-items: center;
    overflow: hidden;
    z-index: 10;
    position: relative;
}

.status-item {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    white-space: nowrap;
}

.status-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.status-live {
    margin-left: auto;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    background: rgba(127, 176, 105, 0.1);
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(127, 176, 105, 0.25);
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-success);
    animation: live-pulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 6px rgba(127, 176, 105, 0.7); }
    50%      { opacity: 0.5; box-shadow: 0 0 0 rgba(127, 176, 105, 0); }
}

.live-text {
    color: var(--accent-success) !important;
    font-family: var(--font-sans) !important;
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

/* SSE reconnecting state: amber */
.status-live.reconnecting {
    background: rgba(212, 154, 63, 0.1);
    box-shadow: 0 0 0 1px rgba(212, 154, 63, 0.3);
}

.status-live.reconnecting .live-dot {
    background: var(--accent-warn);
    animation: live-pulse-reconnecting 1s ease-in-out infinite;
}

.status-live.reconnecting .live-text {
    color: var(--accent-warn) !important;
    letter-spacing: 0.8px;
}

@keyframes live-pulse-reconnecting {
    0%, 100% { opacity: 1;   box-shadow: 0 0 6px rgba(212, 154, 63, 0.7); }
    50%      { opacity: 0.3; box-shadow: 0 0 0 rgba(212, 154, 63, 0); }
}

.status-item-error {
    color: var(--accent-danger) !important;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Keyboard focus ring — only shown for keyboard users, not mouse clicks */
.player-row:focus { outline: none; }
.player-row:focus-visible,
.refresh-btn:focus-visible,
.sidebar-toggle:focus-visible,
.nav-link-stats:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.status-refresh {
    margin-left: auto;
    gap: 6px;
}

/* When LIVE pill is visible, refresh sits next to it */
.status-live + .status-refresh {
    margin-left: 0;
}

.refresh-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1;
    box-shadow: var(--ring);
    transition: color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.3s;
    margin-left: 4px;
}

.refresh-btn:hover {
    color: var(--accent);
    background: var(--bg-hover);
    box-shadow: var(--ring-accent);
}

.refresh-btn:active {
    transform: rotate(180deg);
}

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

.map-legend {
    position: fixed;
    bottom: 28px;
    right: 14px;
    background: var(--bg-overlay);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    z-index: 1000;
    font-size: 0.74rem;
    color: var(--text-primary);
    line-height: 1.6;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow: var(--shadow-elevated);
    max-width: 200px;
}

.map-legend h4 {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.legend-section-header {
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    font-size: 0.6rem !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 1px 0;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.legend-row:not(.legend-section-header) {
    color: var(--text-secondary);
}

.legend-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-player { background: var(--accent-success); }
.legend-player-dead { background: var(--accent-danger); opacity: 0.5; }

/* Legend divider — warm, faint */
.legend-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0 6px;
}

.legend-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 16px;
    flex-shrink: 0;
}

/* ==========================================================
   Compass Rose
   ========================================================== */

.compass-rose {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.compass-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-overlay);
    box-shadow: var(--shadow-whisper), var(--ring-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

.compass-label {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1;
    letter-spacing: 0.5px;
}

.compass-n {
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent);
    font-size: 0.78rem;
}

.compass-s { bottom: 4px; left: 50%; transform: translateX(-50%); }
.compass-e { right: 6px; top: 50%; transform: translateY(-50%); }
.compass-w { left: 6px;  top: 50%; transform: translateY(-50%); }

.compass-needle {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 16px solid var(--accent);
    filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.5));
}

.compass-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-primary);
}

/* ==========================================================
   Offline Overlay
   ========================================================== */

.map-offline {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 28px 36px;
    background: var(--bg-overlay);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-elevated);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    max-width: 360px;
}

.map-offline h3 {
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: 0.1px;
    line-height: 1.2;
}

/* ==========================================================
   Town Labels
   ========================================================== */

.town-label {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-sans);
    text-shadow:
        0 0 3px #000,
        1px 1px 2px rgba(0, 0, 0, 0.95),
        -1px -1px 2px rgba(0, 0, 0, 0.95);
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.3px;
}

/* ==========================================================
   Player Vehicle Icons
   ========================================================== */

.player-icon, .opfor-icon, .marker-icon {
    background: none !important;
    border: none !important;
}

.player-icon-wrap, .opfor-icon-wrap, .marker-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vtype-badge {
    font-size: 0.55rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: var(--radius-xs);
    background: rgba(110, 168, 196, 0.16);
    color: var(--accent-info);
    flex-shrink: 0;
    font-family: var(--font-mono);
    letter-spacing: 0.4px;
    line-height: 1.3;
}

/* MHQ pulse animation for deployed (alive) MHQ markers */
.mhq-pulse {
    animation: mhq-flash 1.5s ease-in-out infinite;
}

@keyframes mhq-flash {
    0%, 100% { opacity: 1;   box-shadow: 0 0 8px 3px rgba(212, 154, 63, 0.7); }
    50%      { opacity: 0.5; box-shadow: 0 0 2px 0   rgba(212, 154, 63, 0.2); }
}

/* ==========================================================
   Leaflet Overrides — Warm Dark Theme
   ========================================================== */

/* Zoom controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-whisper) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.2s, color 0.2s !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(212, 175, 55, 0.18) !important;
    color: var(--accent) !important;
}

.leaflet-control-zoom-in {
    border-top-left-radius: var(--radius-md) !important;
    border-top-right-radius: var(--radius-md) !important;
}

.leaflet-control-zoom-out {
    border-bottom-left-radius: var(--radius-md) !important;
    border-bottom-right-radius: var(--radius-md) !important;
}

/* Layer control */
.leaflet-control-layers {
    background: var(--bg-overlay) !important;
    border: none !important;
    box-shadow: var(--shadow-whisper), var(--ring) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px !important;
}

.leaflet-control-layers-toggle {
    background-color: var(--bg-overlay) !important;
    border: none !important;
    box-shadow: var(--shadow-whisper), var(--ring) !important;
    border-radius: var(--radius-md) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaflet-control-layers label {
    color: var(--text-primary) !important;
    font-size: 0.78rem !important;
    font-family: var(--font-sans) !important;
}

.leaflet-control-layers-separator {
    border-top: 1px solid var(--border) !important;
    margin: 8px 0 !important;
}

/* Attribution */
.leaflet-control-attribution {
    background: rgba(20, 20, 19, 0.65) !important;
    color: var(--text-muted) !important;
    font-size: 0.62rem !important;
    border-radius: var(--radius-xs) 0 0 0 !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 2px 6px !important;
}

.leaflet-control-attribution a {
    color: var(--accent) !important;
    text-decoration: none !important;
}

.leaflet-control-attribution a:hover {
    color: var(--accent-hover) !important;
}

/* Popups */
.leaflet-popup-content-wrapper {
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: none !important;
    box-shadow: var(--shadow-elevated) !important;
    border-radius: var(--radius-lg) !important;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-family: var(--font-sans) !important;
    font-size: 0.78rem !important;
    line-height: 1.5 !important;
}

.leaflet-popup-tip {
    background: var(--bg-overlay) !important;
    box-shadow: var(--shadow-whisper);
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    font-size: 1.2rem !important;
    padding: 6px 8px !important;
    transition: color 0.2s !important;
}

.leaflet-popup-close-button:hover {
    color: var(--accent) !important;
    background: transparent !important;
}

/* Tooltips */
.leaflet-tooltip {
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: none !important;
    box-shadow: var(--shadow-whisper), var(--ring) !important;
    font-size: 0.74rem !important;
    font-family: var(--font-sans) !important;
    padding: 5px 10px !important;
    border-radius: var(--radius-sm) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaflet-tooltip-top:before    { border-top-color:    rgba(20, 20, 19, 0.85) !important; }
.leaflet-tooltip-bottom:before { border-bottom-color: rgba(20, 20, 19, 0.85) !important; }
.leaflet-tooltip-left:before   { border-left-color:   rgba(20, 20, 19, 0.85) !important; }
.leaflet-tooltip-right:before  { border-right-color:  rgba(20, 20, 19, 0.85) !important; }

/* Hide leaflet's default dotted focus outline on the container */
.leaflet-container:focus {
    outline: none;
}

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

@media (max-width: 768px) {
    .navbar { padding: 0 var(--spacing-md); }

    .nav-brand { font-size: 1.25rem; }

    .map-status-bar {
        gap: 8px;
        padding: 0 10px;
        font-size: 0.7rem;
        height: auto;
        min-height: 38px;
    }

    .map-wrapper {
        height: calc(100vh - 56px - 38px);
    }

    .player-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        width: 232px;
        min-width: 232px;
        box-shadow: var(--shadow-elevated);
    }

    .player-sidebar.collapsed {
        width: 0;
        min-width: 0;
    }

    .map-legend {
        bottom: 10px;
        right: 8px;
        padding: 10px 12px;
        font-size: 0.66rem;
    }

    .map-legend h4 { font-size: 0.85rem; }

    .status-item-dynamic:nth-child(n+6) {
        display: none;
    }
}
