:root {
    --bg: #08111f;
    --bg-2: #0d1930;
    --panel: rgba(255,255,255,.08);
    --panel-strong: rgba(255,255,255,.12);
    --text: #f7fbff;
    --muted: #aebcd0;
    --line: rgba(255,255,255,.14);
    --accent: #5eead4;
    --accent-2: #38bdf8;
    --danger: #f59e0b;
    --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 20% 10%, rgba(56,189,248,.20), transparent 32rem),
        radial-gradient(circle at 80% 0%, rgba(94,234,212,.16), transparent 34rem),
        linear-gradient(135deg, var(--bg), #050813 70%);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px clamp(18px, 4vw, 48px);
    background: rgba(5,8,19,.78);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand--image {
    min-width: 0;
    flex: 0 1 auto;
}
.brand-logo-img {
    display: block;
    height: 58px;
    width: auto;
    max-width: min(540px, 46vw);
    object-fit: contain;
}
.top-nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav a {
    color: var(--muted);
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
}
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--text); border-color: var(--line); background: var(--panel); }

main { width: min(1220px, calc(100% - 32px)); margin: 0 auto; }

.hero {
    min-height: 420px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) 360px;
    gap: 28px;
    align-items: center;
    padding: clamp(52px, 8vw, 92px) 0 34px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .16em;
    font-weight: 800;
    font-size: .8rem;
}

h1 {
    margin: 0;
    font-size: clamp(2.45rem, 7vw, 5.5rem);
    line-height: .96;
    letter-spacing: -.07em;
    max-width: 940px;
}

.lead {
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.65;
    max-width: 760px;
    margin: 22px 0 0;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 13px 18px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    color: var(--text);
}
.button.primary { color: #06111d; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.button.secondary:hover, .button.compact:hover { background: var(--panel-strong); }
.button.compact { padding: 11px 15px; }

.status-card {
    padding: 24px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.08);
    box-shadow: var(--shadow);
    border-radius: 28px;
}
.status-card strong { display: block; font-size: 1.15rem; margin: 10px 0 6px; }
.status-card p { color: var(--muted); line-height: 1.5; margin: 0; }
.status-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 8px rgba(245,158,11,.14);
}
body.is-live .status-dot { background: var(--accent); box-shadow: 0 0 0 8px rgba(94,234,212,.14); }

.map-shell {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.07);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.map-toolbar {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}
.map-toolbar div { min-width: 170px; }
.map-toolbar label {
    display: block;
    color: var(--muted);
    font-weight: 800;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0 0 6px;
}
.map-toolbar select,
.map-toolbar input {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(5,8,19,.72);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 13px;
    outline: none;
}
.updated-text { color: var(--muted); margin-left: auto; padding-bottom: 12px; font-size: .92rem; }
.live-map { height: min(68vh, 680px); min-height: 480px; background: #d9e3ea; }
.leaflet-container { font-family: inherit; background: #d9e3ea; }
.leaflet-container img { max-width: none !important; }

/* Leaflet safety CSS.
   Some webbhotell/CDN/cache combinations can make the external Leaflet CSS arrive late or fail.
   These rules keep tiles, markers and controls positioned correctly even then. */
.leaflet-container {
    position: relative;
    overflow: hidden;
    touch-action: pan-x pan-y;
    outline-offset: 1px;
}
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}
.leaflet-tile {
    filter: inherit;
    visibility: hidden;
}
.leaflet-tile-loaded { visibility: inherit; }
.leaflet-zoom-box {
    width: 0;
    height: 0;
    box-sizing: border-box;
    z-index: 800;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-control { position: relative; z-index: 800; pointer-events: visiblePainted; pointer-events: auto; }
.leaflet-top,
.leaflet-bottom { position: absolute; z-index: 1000; pointer-events: none; }
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control { float: left; clear: both; }
.leaflet-right .leaflet-control { float: right; }
.leaflet-top .leaflet-control { margin-top: 10px; }
.leaflet-bottom .leaflet-control { margin-bottom: 10px; }
.leaflet-left .leaflet-control { margin-left: 10px; }
.leaflet-right .leaflet-control { margin-right: 10px; }
.leaflet-control-zoom a {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    color: #06111d;
    background: #fff;
    border-bottom: 1px solid #ccc;
    font-weight: 800;
}
.leaflet-control-zoom a:first-child { border-radius: 4px 4px 0 0; }
.leaflet-control-zoom a:last-child { border-radius: 0 0 4px 4px; border-bottom: 0; }
.leaflet-control-attribution {
    background: rgba(255,255,255,.82);
    padding: 0 5px;
    font-size: 11px;
    color: #333;
}
.leaflet-control-attribution a { color: #0078a8; }
.leaflet-popup { position: absolute; text-align: center; margin-bottom: 20px; }
.leaflet-popup-content-wrapper { padding: 1px; text-align: left; border-radius: 12px; }
.leaflet-popup-content { min-width: 170px; }
.leaflet-popup-tip-container { width: 40px; height: 20px; position: absolute; left: 50%; margin-left: -20px; overflow: hidden; pointer-events: none; }
.leaflet-popup-tip { width: 17px; height: 17px; padding: 1px; margin: -10px auto 0; transform: rotate(45deg); }
.leaflet-interactive { cursor: pointer; }
.leaflet-grab { cursor: grab; }
.leaflet-dragging .leaflet-grab { cursor: move; cursor: grabbing; }


.vehicle-div-icon {
    background: transparent;
    border: 0;
}
.vehicle-marker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 52px;
    height: 34px;
    padding: 0 8px 0 7px;
    border-radius: 999px;
    color: #06111d;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 2px solid rgba(255,255,255,.96);
    box-shadow: 0 8px 22px rgba(0,0,0,.28);
    font-weight: 900;
    font-size: .8rem;
    letter-spacing: -.02em;
}
.vehicle-marker--bus { background: linear-gradient(135deg, #93c5fd, #2563eb); color: #fff; }
.vehicle-marker--train { background: linear-gradient(135deg, #c4b5fd, #7c3aed); color: #fff; }
.vehicle-marker--tram { background: linear-gradient(135deg, #fdba74, #ea580c); color: #fff; }
.vehicle-marker--ferry { background: linear-gradient(135deg, #67e8f9, #0891b2); color: #fff; }
.vehicle-marker__icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
}
.vehicle-marker__icon svg {
    width: 16px;
    height: 16px;
    display: block;
}
.vehicle-marker__line {
    line-height: 1;
    white-space: nowrap;
    font-size: .82rem;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 18px;
    padding: 26px 0 0;
}
.panel, .notice {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(255,255,255,.07);
    padding: 24px;
}
.panel h2 { margin: 0 0 10px; font-size: 1.45rem; letter-spacing: -.03em; }
.panel p, .notice { color: var(--muted); line-height: 1.6; }
.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    margin-top: 18px;
}
.city-link {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.06);
    border-radius: 20px;
    padding: 15px;
}
.city-link:hover { background: rgba(255,255,255,.11); transform: translateY(-1px); }
.city-link strong { display: block; }
.city-link span { display: block; color: var(--muted); margin-top: 5px; font-size: .9rem; }
.checklist { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.checklist li { color: var(--muted); }
.checklist li::before { content: "✓"; color: var(--accent); font-weight: 900; margin-right: 8px; }
.notice { margin: 18px 0 0; }
.notice strong { color: var(--text); }
.site-footer {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 44px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #06111d; color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; line-height: 1.45; }
.popup-muted { color: #aebcd0; }

@media (max-width: 860px) {
    .site-header { align-items: flex-start; gap: 14px; flex-direction: column; }
    .top-nav { justify-content: flex-start; }
    .hero { grid-template-columns: 1fr; padding-top: 42px; }
    .status-card { max-width: none; }
    .content-grid { grid-template-columns: 1fr; }
    .updated-text { width: 100%; margin-left: 0; padding-bottom: 0; }
    .live-map { min-height: 460px; height: 65vh; }
}

.small-muted {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 16px 0 0;
}

.button.compact[aria-pressed="true"] {
    color: #06111d;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
}

.map-shell { position: relative; }

.follow-panel {
    position: absolute;
    z-index: 1200;
    right: 18px;
    top: 84px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(460px, calc(100% - 36px));
    padding: 11px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(6,17,29,.88);
    color: var(--text);
    box-shadow: 0 16px 42px rgba(0,0,0,.35);
    backdrop-filter: blur(12px);
}
.follow-panel[hidden] { display: none; }
.follow-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 6px rgba(94,234,212,.14);
    flex: 0 0 auto;
}
.follow-panel.is-lost .follow-dot {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(245,158,11,.14);
}
.follow-panel span { font-weight: 800; font-size: .92rem; }
.follow-panel button {
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: var(--text);
    padding: 7px 10px;
    font-weight: 800;
    cursor: pointer;
}
.follow-panel button:hover { background: rgba(255,255,255,.18); }

.vehicle-marker.tracked {
    z-index: 2;
    transform: scale(1.18);
    border-color: #06111d;
    box-shadow: 0 0 0 5px rgba(94,234,212,.34), 0 12px 30px rgba(0,0,0,.38);
}
.popup-hint,
.popup-following {
    display: block;
    margin-top: 8px;
    font-size: .82rem;
    font-weight: 800;
}
.popup-hint { color: #aebcd0; }
.popup-following { color: var(--accent); }

.map-shell.map-fullscreen,
.map-shell:fullscreen {
    position: fixed;
    inset: 0;
    z-index: 3000;
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: 0;
    background: #050813;
}
.map-shell.map-fullscreen .map-toolbar,
.map-shell:fullscreen .map-toolbar {
    min-height: 74px;
    background: rgba(5,8,19,.94);
    backdrop-filter: blur(16px);
}
.map-shell.map-fullscreen .live-map,
.map-shell:fullscreen .live-map {
    height: calc(100vh - 74px);
    min-height: 0;
}
.map-shell.map-fullscreen .follow-panel,
.map-shell:fullscreen .follow-panel {
    top: 90px;
}
body.map-is-fullscreen { overflow: hidden; }

@media (max-width: 720px) {
    .brand-logo-img { height: 46px; max-width: 72vw; }
    .follow-panel {
        left: 12px;
        right: 12px;
        top: 96px;
        border-radius: 18px;
        justify-content: space-between;
    }
    .map-shell.map-fullscreen .map-toolbar,
    .map-shell:fullscreen .map-toolbar {
        max-height: 42vh;
        overflow: auto;
    }
    .map-shell.map-fullscreen .live-map,
    .map-shell:fullscreen .live-map {
        height: calc(100vh - 190px);
    }
    .map-shell.map-fullscreen .follow-panel,
    .map-shell:fullscreen .follow-panel {
        top: auto;
        bottom: 16px;
    }
}

/* v0.1.5 smooth live map */
.leaflet-marker-icon {
    transition: opacity .22s ease;
}
.vehicle-marker {
    will-change: transform;
    transform: translateZ(0);
}
.vehicle-marker__line[data-short="0"] { font-size: .75rem; }
