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

/* GPU-accelerated smooth marker movement — duration set by JS per marker */
.leaflet-marker-icon.smooth-move {
    will-change: transform;
}

body {
    background: #1a1a2e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
}

#map {
    width: 100vw;
    height: 100vh;
}

/* ---- Toolbar ---- */
.toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 14px;
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.toolbar-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.toolbar-title:hover { color: #ccc; }

.toolbar-sub {
    font-weight: 400;
    font-size: 0.75rem;
    color: #888;
    margin-left: 6px;
}


.toolbar-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    flex: 1;
    min-width: 0;
}

.toolbar-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e0e0e0;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.toolbar-chip:hover { background: rgba(255,255,255,0.12); }

.toolbar-chip.off {
    opacity: 0.35;
}

.toolbar-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.toolbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.toolbar-nav a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.toolbar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.nav-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 3px;
}

.toolbar-menu {
    display: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px 6px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toolbar-menu:hover { color: #fff; }

/* ---- Toolbar dropdown ---- */
.toolbar-dropdown {
    position: absolute;
    top: 54px;
    right: 8px;
    z-index: 1001;
    background: rgba(20, 20, 40, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 10px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toolbar-dropdown.hidden { display: none; }

.dropdown-chips {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px 10px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 0;
}

.dropdown-nav a,
.dropdown-actions button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    color: #d0d0d0;
    text-decoration: none;
    font-size: 0.88rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.dropdown-nav a:hover,
.dropdown-actions button:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* Mobile/tablet: chips + nav in dropdown, hamburger visible */
@media (max-width: 1024px) {
    .toolbar-sub { display: none; }
    .toolbar-chips { display: none; }
    .toolbar-nav { display: none; }
    .toolbar-menu { display: block; margin-left: auto; }
    .dropdown-chips { display: flex; }
}

/* ---- Footer bar ---- */
.status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    padding: 0 14px;
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -2px 16px rgba(0,0,0,0.3);
    color: #aaa;
    font-size: 0.78rem;
}

.status-bar .count {
    color: #e0e0e0;
    font-weight: 600;
}

.status-bar .separator {
    color: #555;
}

.status-bar a {
    color: #888;
    text-decoration: none;
}

.status-bar a:hover {
    color: #bbb;
    text-decoration: underline;
}


/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    background: rgba(20, 20, 40, 0.95) !important;
    color: #e0e0e0 !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
    background: rgba(20, 20, 40, 0.95) !important;
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
    font-size: 0.85rem !important;
    line-height: 1.6 !important;
}

.leaflet-popup-close-button {
    color: #888 !important;
}

.popup-line {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.popup-detail {
    color: #aaa;
}

/* Leaflet attribution */
.leaflet-control-attribution {
    background: rgba(20, 20, 40, 0.7) !important;
    color: #666 !important;
    font-size: 0.65rem !important;
}

.leaflet-control-attribution a {
    color: #888 !important;
}

/* Zoom control — fixed position, above share button */
.leaflet-control-zoom {
    position: fixed !important;
    bottom: 148px;
    right: 12px;
    z-index: 1000;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 1.3rem !important;
    background: rgba(20, 20, 40, 0.85) !important;
    color: #ccc !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 10px !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.leaflet-control-zoom a:hover {
    background: rgba(40, 40, 70, 0.95) !important;
    color: #fff !important;
}

/* Tooltip styling */
.vehicle-tooltip {
    background: rgba(20, 20, 40, 0.9) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

.vehicle-tooltip::before {
    border-top-color: rgba(20, 20, 40, 0.9) !important;
}

/* ---- Vehicle dot markers ---- */
.veh-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.veh-dot .veh-body {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.8);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}
.veh-dot .veh-line {
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1;
}
.veh-dot.minimal-bus .veh-body {
    width: 8px;
    height: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: none;
}
.veh-dot.minimal-rail .veh-body {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.veh-dot.rail .veh-body {
    border: 2.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.veh-dot.large .veh-body {
    width: 28px;
    height: 28px;
}
.veh-dot.large.rail .veh-body {
    border: 3px solid #fff;
}
.veh-dot.large .veh-line {
    font-size: 11px;
}
.veh-dot.mobile .veh-body {
    width: 16px;
    height: 16px;
}
.veh-dot.mobile .veh-line {
    font-size: 7px;
}
.veh-dot.mobile.large .veh-body {
    width: 22px;
    height: 22px;
}
.veh-dot.mobile.large .veh-line {
    font-size: 9px;
}

/* ---- Geolocation button ---- */
.locate-btn {
    position: absolute;
    bottom: 48px;
    right: 12px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ccc;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    transition: background 0.2s, color 0.2s;
}

.locate-btn:hover {
    background: rgba(40, 40, 70, 0.95);
    color: #fff;
}

.locate-btn.active {
    color: #60a5fa;
}

/* ---- Share button ---- */
.share-btn {
    position: absolute;
    bottom: 98px;
    right: 12px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    transition: background 0.2s, color 0.2s;
}

.share-btn:hover {
    background: rgba(40, 40, 70, 0.95);
    color: #fff;
}

.share-btn.copied {
    color: #4ade80;
}


/* ---- Station markers ---- */
.station-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    font-size: 9px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
    border: 2px solid;
}

.station-tooltip {
    background: rgba(20, 20, 40, 0.92) !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4) !important;
}

.station-tooltip::before {
    border-top-color: rgba(20, 20, 40, 0.92) !important;
}

/* ---- Update banner ---- */
.update-banner {
    position: absolute;
    top: 62px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(20, 20, 40, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    color: #d0d0d0;
    font-size: 0.82rem;
    white-space: nowrap;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.update-banner button {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #4ade80;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.update-banner button:hover {
    background: rgba(74, 222, 128, 0.25);
}

/* ---- Screensaver mode ---- */
body.screensaver .toolbar-chips,
body.screensaver .toolbar-nav,
body.screensaver .toolbar-menu,
body.screensaver .toolbar-dropdown,
body.screensaver .share-btn,
body.screensaver .locate-btn,
body.screensaver .leaflet-control-zoom,
body.screensaver .leaflet-control-attribution { display: none !important; }
body.screensaver { cursor: none; }
body.screensaver #map { box-shadow: inset 0 0 120px 40px rgba(0,0,0,0.5); }