:root {
    --bg-dark: #07090e;
    --panel-bg: rgba(13, 17, 24, 0.82);
    --panel-border: rgba(255, 255, 255, 0.10);
    --accent-primary: #4cc9f0;
    --accent-glow: rgba(76, 201, 240, 0.35);
    --accent-gold: #ffd166;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-sans);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    z-index: 10;
    pointer-events: auto;
    transition: all 0.25s ease;
}

/* Top Header */
.header-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.city-selector-btn {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.25), rgba(76, 201, 240, 0.25));
    border: 1px solid rgba(76, 201, 240, 0.35);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.2);
    transition: all 0.2s ease;
}

.city-selector-btn:hover {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.45), rgba(76, 201, 240, 0.45));
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(76, 201, 240, 0.4);
}

.flag-mini {
    font-size: 15px;
}

.region-badge {
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-chevron {
    font-size: 9px;
    color: var(--accent-primary);
    margin-left: 2px;
}

.app-titles h1 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(90deg, #ffffff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.quick-stats {
    display: flex;
    gap: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
}

.stat-value.highlight {
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--accent-glow);
}

/* Landmark Navigator */
.landmark-nav {
    position: absolute;
    top: 86px;
    left: 16px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
}

.nav-title {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--accent-primary);
}

.landmark-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 220px;
    overflow-y: auto;
}

.landmark-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.landmark-btn:hover {
    background: rgba(76, 201, 240, 0.18);
    border-color: rgba(76, 201, 240, 0.45);
    color: #fff;
    transform: translateY(-1px);
}

.landmark-btn.active {
    background: var(--accent-primary);
    color: #0b101b;
    border-color: var(--accent-primary);
    font-weight: 700;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Timeline Controller */
.timeline-panel {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 16px;
    max-width: 860px;
    margin: 0 auto;
    padding: 16px 24px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.timeline-controls {
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    background: var(--accent-primary);
    border: none;
    color: #0a0e17;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 14px var(--accent-glow);
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ctrl-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    box-shadow: none;
    border: 1px solid var(--panel-border);
}

.ctrl-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.slider-readout {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.readout-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.readout-year {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.speed-control select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
    color: #fff;
    padding: 3px 6px;
    border-radius: 6px;
    font-family: var(--font-mono);
    cursor: pointer;
}

.slider-container {
    position: relative;
    padding-top: 6px;
}

#time-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #3a0ca3, #4361ee, #4cc9f0, #06d6a0, #ffd166, #f77f00, #e63946);
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0f172a;
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.8);
    cursor: grab;
    transition: transform 0.1s ease;
}

#time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-ticks {
    position: relative;
    width: 100%;
    height: 18px;
    margin-top: 6px;
}

.slider-ticks span {
    position: absolute;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: #64748b;
}

/* Chronological Legend */
.legend-panel {
    position: absolute;
    bottom: 120px;
    right: 16px;
    padding: 12px 16px;
    max-width: 240px;
}

.legend-title {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #cbd5e1;
}

.color-swatch {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* Tooltip / Details Card */
.tooltip-panel {
    position: absolute;
    top: 86px;
    right: 16px;
    padding: 14px 18px;
    width: 260px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.card-type {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: var(--accent-primary);
}

.card-id {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.card-stat {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 8px;
    border-radius: 6px;
}

.card-stat .lbl {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
}

.card-stat .val {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
}

/* ========================================================== */
/* CITY SELECTION LANDING MODAL                                */
/* ========================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 12, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(76, 201, 240, 0.12);
    border: 1px solid rgba(76, 201, 240, 0.35);
    color: var(--accent-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.modal-sub {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.city-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.city-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4361ee, #4cc9f0);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.city-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(76, 201, 240, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(76, 201, 240, 0.15);
}

.city-card:hover::before {
    opacity: 1;
}

.city-card.active-card {
    border-color: var(--accent-primary);
    background: rgba(76, 201, 240, 0.08);
}

.city-card.active-card::before {
    opacity: 1;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-city-name {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.card-region-tag {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.card-desc {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
    font-size: 11px;
}

.meta-count {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-primary);
}

.meta-years {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
}

.data-badge {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .header-panel {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .quick-stats {
        width: 100%;
        justify-content: space-between;
    }
    .legend-panel {
        display: none;
    }
    .tooltip-panel {
        top: auto;
        bottom: 120px;
        left: 16px;
        right: 16px;
        width: auto;
    }
    .modal-content {
        padding: 20px 16px;
    }
    .city-grid {
        grid-template-columns: 1fr;
    }
}
