:root {
    color-scheme: dark;
    --night: #071a25;
    --night-raised: #0d2734;
    --night-soft: #143542;
    --ice: #e9f4f5;
    --mist: #a7bec5;
    --signal: #43d9c6;
    --signal-deep: #0f9389;
    --route: #2f789d;
    --amber: #f3b95b;
    --danger: #ff7c6f;
    --ink: #06202b;
    --paper: #f4f8f7;
    --line: rgb(190 224 229 / 20%);
    --shadow: 0 20px 50px rgb(1 12 19 / 30%);
    --display: "DIN Alternate", "Arial Narrow", "Avenir Next Condensed", sans-serif;
    --body: "Avenir Next", "Segoe UI", sans-serif;
    --utility: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

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

html, body {
    width: 100%;
    min-width: 320px;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--night);
    color: var(--ice);
    font-family: var(--body);
}

button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    transform: translateY(-150%);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.rail-app {
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr) 34px;
    width: 100%;
    height: 100dvh;
    min-height: 560px;
}

.topbar {
    position: relative;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(80px, 1fr) minmax(210px, 280px);
    align-items: center;
    gap: 26px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: var(--night);
}

.brand {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    fill: none;
    stroke: var(--signal);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.brand-copy { display: grid; line-height: 1; }

.brand-name {
    font-family: var(--display);
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.brand-subtitle {
    margin-top: 5px;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .62rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.signal-track { position: relative; height: 16px; overflow: hidden; }

.signal-track__line {
    position: absolute;
    top: 7px;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line) 8%, var(--line) 92%, transparent);
}

.signal-track__line::before, .signal-track__line::after {
    position: absolute;
    top: -3px;
    width: 7px;
    height: 7px;
    content: "";
    border: 1px solid var(--mist);
    border-radius: 50%;
    background: var(--night);
}

.signal-track__line::before { left: 8%; }
.signal-track__line::after { right: 8%; }

.signal-track__pulse {
    position: absolute;
    top: 4px;
    left: 8%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 5px rgb(67 217 198 / 15%), 0 0 18px var(--signal);
    animation: travel 5.5s cubic-bezier(.45, 0, .55, 1) infinite alternate;
}

@keyframes travel { from { left: 8%; } to { left: calc(92% - 7px); } }

.service-state { display: flex; justify-self: end; align-items: center; gap: 10px; }

.service-state__dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 5px rgb(243 185 91 / 12%);
}

.service-state__dot.is-live {
    background: var(--signal);
    box-shadow: 0 0 0 5px rgb(67 217 198 / 12%);
}

.service-state__dot.is-error, .service-state__dot.is-offline {
    background: var(--danger);
    box-shadow: 0 0 0 5px rgb(255 124 111 / 12%);
}

.service-state__dot.is-partial, .service-state__dot.is-stale {
    background: var(--amber);
    box-shadow: 0 0 0 5px rgb(243 185 91 / 12%);
}

.service-state__copy { display: grid; min-width: 0; line-height: 1.15; text-align: right; }

.service-state__copy strong {
    font-family: var(--display);
    font-size: .9rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.service-state__copy span {
    margin-top: 4px;
    overflow: hidden;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: radial-gradient(circle at 68% 30%, rgb(40 103 126 / 24%), transparent 38%), linear-gradient(145deg, #0b2735, #071a25 68%);
}

.map { position: absolute; inset: 0; }

.map::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    pointer-events: none;
    content: "";
    opacity: .13;
    background-image: linear-gradient(rgb(170 214 221 / 20%) 1px, transparent 1px), linear-gradient(90deg, rgb(170 214 221 / 20%) 1px, transparent 1px);
    background-size: 72px 72px;
}

.rail-map {
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.rail-map.is-dragging { cursor: grabbing; }
.rail-map__tiles,
.rail-map__shade,
.rail-map__overlay-tiles,
.rail-map__route,
.rail-map__stations,
.rail-map__markers { position: absolute; inset: 0; }
.rail-map__tiles { z-index: 1; overflow: hidden; background: #0b2633; }

.rail-map__tiles img, .rail-map__overlay-tiles img {
    position: absolute;
    max-width: none;
    transform-origin: top left;
}

.rail-map__tiles img { opacity: .94; }
.rail-map__tiles img.has-error, .rail-map__overlay-tiles img.has-error { opacity: 0; }

.rail-map[data-base-layer="kartverket-topo"] .rail-map__tiles img {
    filter: saturate(.78) brightness(.76) contrast(1.06);
}

.rail-map[data-base-layer="kartverket-gray"] .rail-map__tiles img {
    filter: brightness(.73) contrast(1.12);
}

.rail-map[data-base-layer="kartverket-outdoor"] .rail-map__tiles img {
    filter: saturate(.68) brightness(.72) contrast(1.1);
}

.rail-map[data-base-layer="openstreetmap"] .rail-map__tiles img {
    opacity: .88;
    filter: saturate(.54) sepia(.12) hue-rotate(142deg) brightness(.62) contrast(1.18);
}

.rail-map__shade {
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(circle at 58% 36%, transparent 0, rgb(6 26 36 / 14%) 62%, rgb(6 20 29 / 38%) 100%),
        linear-gradient(rgb(17 64 78 / 10%), rgb(2 18 27 / 24%));
}

.rail-map__overlay-tiles {
    z-index: 3;
    overflow: hidden;
    pointer-events: none;
}

.rail-map__overlay-tiles[hidden] { display: none; }

.rail-map__overlay-tiles img {
    opacity: .78;
    filter: saturate(.9) brightness(1.12) contrast(1.05);
}

.rail-map__route {
    z-index: 4;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.rail-map__route[hidden], .rail-map__stations[hidden] { display: none; }

.journey-route-line {
    fill: none;
    stroke: var(--signal);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
    filter: drop-shadow(0 2px 2px rgb(1 12 19 / 90%)) drop-shadow(0 0 5px rgb(67 217 198 / 45%));
}

.journey-route-stops circle {
    fill: var(--night);
    stroke: var(--ice);
    stroke-width: 1.5;
}

.journey-route-stops circle.is-next { fill: var(--amber); stroke: var(--night); stroke-width: 2; }
.journey-route-stops circle.is-cancelled { fill: var(--danger); stroke: var(--night); }

.rail-map__stations { z-index: 5; pointer-events: none; }
.rail-map__markers { z-index: 6; pointer-events: none; }

.rail-map__controls {
    position: absolute;
    z-index: 7;
    top: 18px;
    right: 18px;
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgb(7 26 37 / 88%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.rail-map__controls button {
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    border: 0;
    background: transparent;
    color: var(--ice);
    font-family: var(--utility);
    font-size: 1.25rem;
}

.rail-map__controls button + button { border-top: 1px solid var(--line); }
.rail-map__controls button:hover { background: rgb(67 217 198 / 10%); color: var(--signal); }
.rail-map__controls button:disabled { cursor: default; opacity: .34; }
.rail-map__controls button:disabled:hover { background: transparent; color: inherit; }
.rail-map__controls button[aria-expanded="true"] { background: rgb(67 217 198 / 14%); color: var(--signal); }
.rail-map__controls button.is-active { color: var(--signal); }
.rail-map__controls button[aria-busy="true"] { cursor: progress; color: var(--amber); }
.rail-map__controls button[aria-busy="true"] svg { animation: locate-pulse 1s ease-in-out infinite alternate; }

@keyframes locate-pulse {
    from { opacity: .48; transform: scale(.88); }
    to { opacity: 1; transform: scale(1.08); }
}

.rail-map__controls svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
}

.rail-map__layer-menu {
    position: absolute;
    z-index: 8;
    top: 18px;
    right: 74px;
    width: min(280px, calc(100% - 100px));
    max-height: calc(100% - 36px);
    padding: 12px;
    overflow-y: auto;
    border: 1px solid rgb(190 224 229 / 24%);
    border-radius: 14px;
    background: rgb(7 26 37 / 96%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.rail-map__layer-menu[hidden] { display: none; }

.map-layer-section > p {
    margin: 1px 4px 10px;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.map-layer-section--overlays {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgb(190 224 229 / 16%);
}

.map-location-status {
    position: absolute;
    z-index: 9;
    top: 18px;
    left: 50%;
    width: max-content;
    max-width: min(420px, calc(100% - 220px));
    padding: 10px 14px;
    transform: translateX(-50%);
    border: 1px solid rgb(190 224 229 / 28%);
    border-radius: 999px;
    background: rgb(7 26 37 / 94%);
    box-shadow: var(--shadow);
    color: var(--ice);
    font-family: var(--utility);
    font-size: .68rem;
    line-height: 1.35;
    text-align: center;
    backdrop-filter: blur(14px);
}

.map-location-status[hidden] { display: none; }
.map-location-status[data-state="success"] { border-color: rgb(67 217 198 / 45%); }
.map-location-status[data-state="error"] { border-color: rgb(255 124 111 / 55%); color: #ffd6d1; }

.map-layer-options, .map-overlay-options { display: grid; gap: 5px; }

.map-layer-option {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 58px;
    align-items: center;
    gap: 11px;
    padding: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--mist);
}

.map-layer-option:hover { background: rgb(255 255 255 / 5%); color: var(--ice); }
.map-layer-option:has(input:checked) { border-color: rgb(67 217 198 / 38%); background: rgb(67 217 198 / 9%); color: var(--ice); }
.map-layer-option:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }

.map-layer-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.map-layer-option__preview {
    position: relative;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border: 1px solid rgb(190 224 229 / 26%);
    border-radius: 8px;
    background-color: #526d62;
    background-image:
        linear-gradient(32deg, transparent 43%, rgb(222 238 225 / 70%) 44% 48%, transparent 49%),
        radial-gradient(circle at 72% 30%, #8db594 0 12%, transparent 13%),
        linear-gradient(145deg, #314f5a, #7a927e);
}

.map-layer-option__preview::after {
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 7px;
    height: 7px;
    content: "";
    border: 2px solid var(--night);
    border-radius: 50%;
    background: transparent;
}

.map-layer-option:has(input:checked) .map-layer-option__preview::after { background: var(--signal); }
.map-layer-option[data-layer-preview="kartverket-gray"] .map-layer-option__preview { filter: grayscale(1); }
.map-layer-option[data-layer-preview="kartverket-outdoor"] .map-layer-option__preview {
    background-image:
        repeating-radial-gradient(ellipse at 72% 35%, transparent 0 5px, rgb(242 230 187 / 70%) 6px 7px),
        linear-gradient(145deg, #3d6256, #8f9e66);
}
.map-layer-option[data-layer-preview="openstreetmap"] .map-layer-option__preview {
    background-image:
        linear-gradient(75deg, transparent 38%, rgb(230 213 171 / 80%) 39% 46%, transparent 47%),
        linear-gradient(155deg, #92bca4, #6d94a6);
}
.map-layer-option[data-layer-preview="openrailwaymap"] .map-layer-option__preview {
    background-image:
        linear-gradient(72deg, transparent 42%, #f6c24a 43% 47%, #4d2b13 48% 51%, #f6c24a 52% 56%, transparent 57%),
        linear-gradient(145deg, #203b43, #526d62);
}
.map-layer-option[data-layer-preview="entur-stations"] .map-layer-option__preview {
    background-image:
        radial-gradient(circle at 28% 68%, #f4f8f7 0 4px, #43d9c6 5px 7px, transparent 8px),
        radial-gradient(circle at 70% 30%, #f4f8f7 0 4px, #43d9c6 5px 7px, transparent 8px),
        linear-gradient(145deg, #173b48, #315c63);
}

.map-layer-option strong {
    display: block;
    font-family: var(--display);
    font-size: .86rem;
    letter-spacing: .025em;
}

.map-layer-option small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #78949d;
    font-size: .62rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rail-map__attribution {
    position: absolute;
    z-index: 7;
    right: 18px;
    bottom: 62px;
    max-width: min(520px, calc(100% - 36px));
    padding: 4px 7px;
    border-radius: 5px;
    background: rgb(7 26 37 / 76%);
    color: var(--mist);
    font-size: .55rem;
    line-height: 1.2;
    text-align: right;
    backdrop-filter: blur(8px);
}

.rail-map__attribution a { text-underline-offset: 2px; }

.train-marker {
    --marker-x: 0px;
    --marker-y: 0px;
    --bearing: 0deg;
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    display: grid;
    width: 50px;
    min-height: 44px;
    padding: 0;
    pointer-events: auto;
    cursor: pointer;
    transform: translate(calc(var(--marker-x) - 25px), calc(var(--marker-y) - 22px));
    border: 0;
    outline-offset: 3px;
    background: transparent;
    place-items: center;
    transition: transform 850ms linear;
}

.rail-map.is-navigating .train-marker {
    transition: none;
}

.train-marker[hidden] { display: none; }

.train-marker__pulse {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 1px solid rgb(67 217 198 / 28%);
    border-radius: 50%;
    opacity: 0;
    animation: marker-pulse 2.6s ease-out infinite;
}

.train-marker__direction {
    position: absolute;
    z-index: 1;
    width: 52px;
    height: 52px;
    opacity: 0;
    color: var(--ice);
    filter: drop-shadow(0 2px 2px rgb(1 12 19 / 95%)) drop-shadow(0 0 3px rgb(233 244 245 / 48%));
    transform: rotate(var(--bearing));
    transition: transform 850ms linear, opacity 160ms ease;
}

.train-marker__direction svg { display: block; width: 100%; height: 100%; }
.train-marker__direction path { fill: currentColor; stroke: var(--night); stroke-linejoin: round; stroke-width: 2.5; }
.train-marker.has-direction .train-marker__direction { opacity: 1; }

@keyframes marker-pulse {
    0%, 28% { opacity: .35; transform: scale(.45); }
    75%, 100% { opacity: 0; transform: scale(1.55); }
}

.train-marker__body {
    position: relative;
    z-index: 2;
    display: grid;
    width: 24px;
    height: 24px;
    border: 2px solid var(--vehicle-border, #b9fff5);
    border-radius: 50%;
    background: var(--vehicle-background, var(--signal-deep));
    box-shadow: 0 2px 10px rgb(1 12 19 / 60%), 0 0 0 3px rgb(7 26 37 / 70%);
    place-items: center;
}

.train-marker__body svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: white;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
}

.train-marker__bus-icon,
.train-marker__tram-icon,
.train-marker__metro-icon,
.train-marker__water-icon { display: none; }
.train-marker[data-mode="bus"] .train-marker__train-icon { display: none; }
.train-marker[data-mode="bus"] .train-marker__bus-icon { display: block; }
.train-marker[data-mode="tram"] .train-marker__train-icon { display: none; }
.train-marker[data-mode="tram"] .train-marker__tram-icon { display: block; }
.train-marker[data-mode="metro"] .train-marker__train-icon { display: none; }
.train-marker[data-mode="metro"] .train-marker__metro-icon { display: block; }
.train-marker[data-mode="water"] .train-marker__train-icon { display: none; }
.train-marker[data-mode="water"] .train-marker__water-icon { display: block; }
.train-marker[data-mode="bus"] { --vehicle-border: #ffe1a3; --vehicle-background: #9d6817; }
.train-marker[data-mode="tram"] { --vehicle-border: #ffd0ca; --vehicle-background: #a8473e; }
.train-marker[data-mode="metro"] { --vehicle-border: #d6e4ff; --vehicle-background: #335d9f; }
.train-marker[data-mode="water"] { --vehicle-border: #c9f4ff; --vehicle-background: #24788c; }

.train-marker__label {
    position: absolute;
    z-index: 3;
    top: 35px;
    max-width: 80px;
    padding: 2px 5px;
    overflow: hidden;
    border: 1px solid rgb(190 224 229 / 20%);
    border-radius: 4px;
    background: rgb(7 26 37 / 88%);
    color: var(--ice);
    font-family: var(--utility);
    font-size: .52rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.train-marker.has-direction .train-marker__label { top: 48px; }
.train-marker.is-compact-local:not(:hover):not(:focus-visible):not(.is-selected) .train-marker__label {
    display: none;
}

.train-marker[data-codespace="flt"] { --vehicle-border: #fff1a6; --vehicle-background: #785e13; }
.train-marker[data-codespace="goa"] { --vehicle-border: #ffcabd; --vehicle-background: #9d473d; }
.train-marker[data-codespace="sjn"] { --vehicle-border: #d9c9ff; --vehicle-background: #634b92; }
.train-marker[data-codespace="bnr"] { --vehicle-border: #e1e9eb; --vehicle-background: #53636a; }

.train-marker.has-traffic-alert .train-marker__body::after {
    position: absolute;
    top: -9px;
    right: -9px;
    display: grid;
    width: 16px;
    height: 16px;
    border: 2px solid var(--night);
    border-radius: 50%;
    background: var(--amber);
    color: var(--ink);
    content: "!";
    font-family: var(--utility);
    font-size: .58rem;
    font-weight: 950;
    line-height: 1;
    place-items: center;
    box-shadow: 0 2px 8px rgb(1 12 19 / 55%);
}

.train-marker.is-estimated .train-marker__pulse { display: none; }
.train-marker.is-estimated .train-marker__body {
    border-style: dashed;
    box-shadow: 0 2px 10px rgb(1 12 19 / 60%), 0 0 0 3px color-mix(in srgb, var(--vehicle-border, #d9c9ff) 24%, transparent);
}
.train-marker.is-timetable .train-marker__body { border-style: dotted; opacity: .9; }

.train-marker.is-stale { opacity: .58; }
.train-marker.is-stale .train-marker__pulse { display: none; }
.train-marker.is-stale .train-marker__direction { opacity: .46; }
.train-marker.is-stale .train-marker__body {
    border-style: dashed;
    filter: grayscale(.45) saturate(.55);
}
.train-marker.is-stale .train-marker__label::after {
    color: var(--amber);
    content: " · utdatert";
}

.train-marker:hover, .train-marker:focus-visible, .train-marker.is-selected { z-index: 3; }
.train-marker:hover .train-marker__body { transform: scale(1.12); }
.train-marker:hover .train-marker__direction,
.train-marker:focus-visible .train-marker__direction { color: white; }
.train-marker.is-selected .train-marker__direction { color: white; filter: drop-shadow(0 0 5px rgb(67 217 198 / 82%)); }
.train-marker.is-selected .train-marker__body {
    border-color: #b9fff5;
    box-shadow:
        0 0 0 3px rgb(7 26 37 / 88%),
        0 0 0 6px rgb(67 217 198 / 78%),
        0 3px 14px rgb(1 12 19 / 68%);
}
.train-marker.is-selected .train-marker__label { border-color: rgb(67 217 198 / 62%); color: #b9fff5; }

.vehicle-cluster {
    --cluster-x: 0px;
    --cluster-y: 0px;
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    pointer-events: auto;
    cursor: zoom-in;
    transform: translate(calc(var(--cluster-x) - 24px), calc(var(--cluster-y) - 24px));
    border: 0;
    outline-offset: 3px;
    background: transparent;
    place-items: center;
}

.vehicle-cluster span {
    display: grid;
    min-width: 32px;
    height: 32px;
    padding: 0 7px;
    border: 2px dashed #ffe1a3;
    border-radius: 999px;
    background: #865712;
    box-shadow: 0 2px 12px rgb(1 12 19 / 72%), 0 0 0 4px rgb(243 185 91 / 18%);
    color: white;
    font-family: var(--utility);
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    place-items: center;
}

.vehicle-cluster.is-large span {
    min-width: 38px;
    height: 38px;
    background: #6f450c;
}

.vehicle-cluster:hover span,
.vehicle-cluster:focus-visible span {
    border-color: white;
    background: #9d6817;
}

.station-marker {
    --station-x: 0px;
    --station-y: 0px;
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    pointer-events: auto;
    cursor: pointer;
    transform: translate(calc(var(--station-x) - 17px), calc(var(--station-y) - 17px));
    border: 0;
    background: transparent;
    place-items: center;
}

.station-marker[hidden] { display: none; }

.station-marker__symbol {
    position: relative;
    width: 15px;
    height: 15px;
    border: 2px solid var(--signal);
    border-radius: 4px;
    background: var(--paper);
    box-shadow: 0 2px 8px rgb(1 12 19 / 72%), 0 0 0 3px rgb(7 26 37 / 66%);
    transform: rotate(45deg);
}

.station-marker__symbol::after {
    position: absolute;
    inset: 3px;
    content: "";
    border-radius: 50%;
    background: var(--signal-deep);
}

.station-marker__label {
    position: absolute;
    top: 29px;
    display: none;
    width: max-content;
    max-width: 150px;
    padding: 3px 6px;
    overflow: hidden;
    border: 1px solid rgb(190 224 229 / 24%);
    border-radius: 5px;
    background: rgb(7 26 37 / 91%);
    color: var(--ice);
    font-family: var(--utility);
    font-size: .52rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.show-station-labels .station-marker__label,
.station-marker:hover .station-marker__label,
.station-marker:focus-visible .station-marker__label,
.station-marker.is-selected .station-marker__label { display: block; }
.station-marker:hover, .station-marker:focus-visible, .station-marker.is-selected { z-index: 4; }
.station-marker.is-selected .station-marker__symbol {
    border-color: var(--amber);
    box-shadow: 0 0 0 5px rgb(243 185 91 / 23%), 0 3px 10px rgb(1 12 19 / 80%);
}
.station-marker.is-selected .station-marker__label { border-color: rgb(243 185 91 / 55%); color: #ffe0a7; }

.place-marker {
    --place-x: 0px;
    --place-y: 0px;
    position: absolute;
    z-index: 4;
    top: 0;
    left: 0;
    display: grid;
    width: 1px;
    height: 1px;
    pointer-events: none;
    transform: translate(var(--place-x), var(--place-y));
    place-items: center;
}

.place-marker[hidden] { display: none; }

.place-marker__target {
    position: absolute;
    width: 38px;
    height: 38px;
    border: 1px solid rgb(243 185 91 / 80%);
    border-radius: 50%;
    box-shadow: 0 0 0 7px rgb(243 185 91 / 11%), 0 0 24px rgb(243 185 91 / 34%);
}

.place-marker__target::before,
.place-marker__target::after {
    position: absolute;
    top: 50%;
    left: 50%;
    content: "";
    background: var(--amber);
    transform: translate(-50%, -50%);
}

.place-marker__target::before { width: 54px; height: 1px; }
.place-marker__target::after { width: 1px; height: 54px; }

.place-marker__label {
    position: absolute;
    top: 28px;
    width: max-content;
    max-width: 210px;
    padding: 5px 8px;
    overflow: hidden;
    border: 1px solid rgb(243 185 91 / 48%);
    border-radius: 6px;
    background: rgb(7 26 37 / 94%);
    color: #ffe0a7;
    font-family: var(--utility);
    font-size: .62rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-location-marker {
    --location-x: 0px;
    --location-y: 0px;
    --accuracy-size: 28px;
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
    display: grid;
    width: 1px;
    height: 1px;
    pointer-events: none;
    transform: translate(var(--location-x), var(--location-y));
    place-items: center;
}

.user-location-marker[hidden] { display: none; }

.user-location-marker__accuracy {
    position: absolute;
    width: var(--accuracy-size);
    height: var(--accuracy-size);
    border: 1px solid rgb(91 178 255 / 56%);
    border-radius: 50%;
    background: rgb(91 178 255 / 13%);
}

.user-location-marker__pulse {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 1px solid rgb(194 228 255 / 52%);
    border-radius: 50%;
    animation: user-location-pulse 2.2s ease-out infinite;
}

.user-location-marker__dot {
    position: absolute;
    width: 15px;
    height: 15px;
    border: 3px solid white;
    border-radius: 50%;
    background: #3198f3;
    box-shadow: 0 2px 10px rgb(1 12 19 / 65%);
}

@keyframes user-location-pulse {
    from { opacity: .72; transform: scale(.45); }
    to { opacity: 0; transform: scale(1.8); }
}

.control-deck, .train-sheet {
    position: absolute;
    z-index: 10;
    border: 1px solid rgb(190 224 229 / 24%);
    border-radius: 16px;
    background: rgb(7 26 37 / 92%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.control-deck {
    top: 18px;
    left: 18px;
    display: grid;
    width: min(320px, calc(100% - 36px));
    max-height: calc(100% - 36px);
    padding: 19px;
    overflow: auto;
    overscroll-behavior: contain;
    transition: padding 160ms ease, border-radius 160ms ease;
}

.control-deck.is-collapsed {
    padding: 6px 7px;
    overflow: visible;
    border-radius: 14px;
}

.control-deck__body { display: grid; min-width: 0; }
.control-deck__body[hidden] { display: none; }

.deck-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.control-deck.is-collapsed .deck-heading { margin-bottom: 0; }

.deck-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 18px;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    align-items: center;
    gap: 10px;
    padding: 0;
    cursor: pointer;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    text-align: left;
}

.deck-toggle:hover { background: rgb(255 255 255 / 4%); }
.deck-toggle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.deck-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--mist);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 160ms ease;
}

.control-deck.is-collapsed .deck-toggle {
    min-height: 42px;
    padding: 0 7px;
}

.control-deck.is-collapsed .deck-toggle svg { transform: rotate(180deg); }
.control-deck.is-collapsed .train-count > span:first-child { font-size: 1.08rem; line-height: 1; }

.deck-traffic-toggle {
    display: inline-grid;
    grid-template-columns: 22px auto;
    min-width: 46px;
    min-height: 42px;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    cursor: pointer;
    border: 1px solid rgb(243 185 91 / 34%);
    border-radius: 9px;
    background: rgb(243 185 91 / 8%);
    color: var(--amber);
}

.deck-traffic-toggle:hover { border-color: rgb(243 185 91 / 62%); background: rgb(243 185 91 / 13%); }
.deck-traffic-toggle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.deck-traffic-toggle > span {
    display: grid;
    width: 22px;
    height: 22px;
    border: 1px solid rgb(243 185 91 / 58%);
    border-radius: 50%;
    background: rgb(243 185 91 / 12%);
    font-family: var(--utility);
    font-size: .68rem;
    font-weight: 900;
    place-items: center;
}
.deck-traffic-toggle > strong { color: var(--ice); font-family: var(--utility); font-size: .62rem; }
.deck-traffic-toggle[hidden], .deck-traffic-toggle > strong[hidden] { display: none; }
.control-deck:not(.is-collapsed) .deck-traffic-toggle { display: none; }

.eyebrow {
    margin: 0;
    color: var(--signal);
    font-family: var(--utility);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.train-count { display: flex; align-items: baseline; gap: 5px; margin: 0; color: var(--mist); font-size: .72rem; }
.train-count > span:first-child { color: var(--ice); font-family: var(--display); font-size: 1.8rem; font-weight: 800; line-height: .8; }

.traffic-summary-button {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    margin: -4px 0 11px;
    padding: 6px 8px;
    cursor: pointer;
    border: 1px solid rgb(243 185 91 / 28%);
    border-radius: 10px;
    background: rgb(243 185 91 / 7%);
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease;
}

.traffic-summary-button:hover {
    border-color: rgb(243 185 91 / 58%);
    background: rgb(243 185 91 / 12%);
}

.traffic-summary-button__signal {
    display: grid;
    width: 22px;
    height: 22px;
    border: 1px solid rgb(243 185 91 / 58%);
    border-radius: 50%;
    background: rgb(243 185 91 / 12%);
    color: var(--amber);
    font-family: var(--utility);
    font-size: .68rem;
    font-weight: 900;
    place-items: center;
}

.traffic-summary-button__copy { display: grid; min-width: 0; gap: 2px; }
.traffic-summary-button__copy strong { font-family: var(--display); font-size: .7rem; letter-spacing: .025em; }
.traffic-summary-button__copy small { overflow: hidden; color: var(--mist); font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }
.traffic-summary-button__count {
    display: grid;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--amber);
    color: var(--ink);
    font-family: var(--utility);
    font-size: .58rem;
    font-weight: 900;
    place-items: center;
}
.traffic-summary-button__count[hidden] { display: none; }
.traffic-summary-button[hidden], .mobile-traffic-toggle[hidden] { display: none; }

.transport-switch {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.transport-switch legend {
    margin: 0 2px 7px;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .58rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.transport-switch__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgb(1 12 19 / 38%);
}

.transport-switch__option { position: relative; min-width: 0; cursor: pointer; }
.transport-switch__option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.transport-switch__option span {
    display: inline-flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 8px;
    border-radius: 8px;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .68rem;
    font-weight: 800;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.transport-switch__option span::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    content: "";
    border: 1px solid var(--signal);
    border-radius: 50%;
}

.transport-switch__option input[value="bus"] + span::before {
    border-color: var(--amber);
    border-radius: 2px;
}

.transport-switch__option input[value="tram"] + span::before { border-color: #ff8f83; border-radius: 2px; }
.transport-switch__option input[value="metro"] + span::before { border-color: #8fb6ff; }
.transport-switch__option input[value="water"] + span::before { border-color: #76d9ef; border-radius: 2px 2px 50% 50%; }

.transport-switch__option input[value="all"] + span::before {
    border: 0;
    background: linear-gradient(135deg, var(--signal) 0 48%, var(--amber) 52% 100%);
}

.transport-switch__option:hover span { color: var(--ice); background: rgb(255 255 255 / 6%); }
.transport-switch__option input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 3px; }
.transport-switch__option input:checked + span { background: var(--signal); color: var(--ink); box-shadow: 0 5px 18px rgb(67 217 198 / 16%); }
.transport-switch__option input:checked + span::before { border-color: var(--ink); background: var(--ink); }
.transport-switch__option input[value="bus"]:checked + span { background: var(--amber); box-shadow: 0 5px 18px rgb(243 185 91 / 16%); }
.transport-switch__option input[value="tram"]:checked + span { background: #a8473e; color: white; }
.transport-switch__option input[value="metro"]:checked + span { background: #335d9f; color: white; }
.transport-switch__option input[value="water"]:checked + span { background: #4d9db0; color: var(--ink); }
.transport-switch__option input[value="all"]:checked + span { background: linear-gradient(110deg, var(--signal), #9cd7b6 52%, var(--amber)); }
.transport-switch__option input[value="all"]:checked + span::before { background: var(--ink); }
.transport-switch--deck { margin: 12px 0 10px; }

.place-search { position: relative; z-index: 12; min-width: 0; }

.place-search__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 7px;
}

.place-search__label-row label {
    color: var(--ice);
    font-family: var(--display);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.place-search__label-row span {
    color: #78949d;
    font-family: var(--utility);
    font-size: .56rem;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.place-search__combobox {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 18px;
    min-height: 46px;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid rgb(67 217 198 / 34%);
    border-radius: 10px;
    background: rgb(67 217 198 / 7%);
}

.place-search__combobox:focus-within {
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgb(67 217 198 / 12%);
}

.place-search__combobox svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--signal);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
}

.place-search__combobox input {
    min-width: 0;
    height: 44px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ice);
}

.place-search__combobox input::placeholder { color: #78949d; }

.place-search__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgb(67 217 198 / 18%);
    border-top-color: var(--signal);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.place-search__spinner[hidden] { display: none; }

.place-search__status {
    margin: 6px 2px 0;
    color: #89a5ad;
    font-size: .64rem;
    line-height: 1.35;
}

.place-search__status[hidden] { display: none; }

.place-search__results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    display: grid;
    max-height: min(320px, calc(100dvh - 250px));
    padding: 6px;
    overflow: auto;
    border: 1px solid rgb(190 224 229 / 26%);
    border-radius: 12px;
    background: rgb(7 26 37 / 98%);
    box-shadow: 0 18px 46px rgb(1 12 19 / 58%);
    backdrop-filter: blur(20px);
}

.place-search__results[hidden] { display: none; }

.place-search__option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    min-height: 54px;
    padding: 9px 10px;
    cursor: pointer;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 7px;
    background: transparent;
    text-align: left;
}

.place-search__option:hover,
.place-search__option[aria-selected="true"] {
    border-left-color: var(--signal);
    background: rgb(67 217 198 / 10%);
}

.place-search__option strong {
    overflow: hidden;
    font-family: var(--display);
    font-size: .84rem;
    letter-spacing: .02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-search__option-type {
    align-self: start;
    padding: 3px 5px;
    border: 1px solid rgb(190 224 229 / 22%);
    border-radius: 4px;
    color: var(--signal);
    font-family: var(--utility);
    font-size: .52rem;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.place-search__option-area {
    grid-column: 1 / -1;
    overflow: hidden;
    color: #89a5ad;
    font-size: .64rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-divider {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 15px 0 10px;
    color: #78949d;
    font-family: var(--utility);
    font-size: .55rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.deck-divider::before,
.deck-divider::after { height: 1px; flex: 1; content: ""; background: var(--line); }

.search-field {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgb(255 255 255 / 5%);
}

.search-field:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px rgb(67 217 198 / 12%); }

.search-field svg, .quiet-button svg, .icon-button svg, .mobile-filter-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.search-field svg { color: var(--mist); }

.search-field input {
    min-width: 0;
    height: 44px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ice);
}

.search-field input::placeholder { color: #78949d; }

.operator-disclosure {
    min-width: 0;
    margin-top: 10px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.operator-disclosure summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 18px;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--mist);
    list-style: none;
}

.operator-disclosure summary::-webkit-details-marker { display: none; }
.operator-disclosure summary:hover { color: var(--ice); }
.operator-disclosure summary:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.operator-disclosure__label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    font-family: var(--utility);
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.operator-disclosure__label i {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 4px rgb(67 217 198 / 10%);
}

.operator-disclosure__count {
    overflow: hidden;
    color: #78949d;
    font-size: .62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operator-disclosure summary svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 160ms ease;
}

.operator-disclosure[open] summary svg { transform: rotate(180deg); }
.operator-filter { min-width: 0; margin: 0; padding: 4px 0 10px; overflow: visible; border: 0; }
.operator-options { display: flex; flex-wrap: wrap; gap: 7px; }
.operator-chip { position: relative; }
.operator-chip[hidden] { display: none; }
.operator-chip input { position: absolute; opacity: 0; }

.operator-chip label {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--mist);
    font-size: .75rem;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.operator-chip label::before { width: 7px; height: 7px; content: ""; border: 1px solid currentColor; border-radius: 50%; }
.operator-chip input:checked + label { border-color: rgb(67 217 198 / 45%); background: rgb(67 217 198 / 10%); color: var(--ice); }
.operator-chip input:checked + label::before { border-color: var(--signal); background: var(--signal); box-shadow: 0 0 0 3px rgb(67 217 198 / 12%); }
.operator-chip input:focus-visible + label { outline: 3px solid var(--amber); outline-offset: 3px; }
.filter-placeholder { color: var(--mist); font-size: .78rem; }

.deck-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

.quiet-button, .icon-button, .mobile-filter-toggle {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 0;
    background: transparent;
}

.quiet-button { gap: 8px; padding: 0 4px; color: var(--mist); font-size: .75rem; }
.quiet-button:hover { color: var(--ice); }

.icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--mist);
}

.icon-button:hover { border-color: rgb(67 217 198 / 45%); color: var(--signal); }
.mobile-filter-toggle, .mobile-traffic-toggle, .mobile-filters { display: none; }

.map-message {
    position: absolute;
    z-index: 8;
    top: 50%;
    left: 50%;
    display: flex;
    max-width: min(390px, calc(100% - 40px));
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    transform: translate(-50%, -50%);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgb(7 26 37 / 88%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.map-message[hidden] { display: none; }
.map-message__spinner { width: 22px; height: 22px; flex: 0 0 auto; border: 2px solid rgb(67 217 198 / 18%); border-top-color: var(--signal); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.map-message div { display: grid; gap: 3px; }
.map-message strong { font-family: var(--display); letter-spacing: .025em; }
.map-message div span { color: var(--mist); font-size: .76rem; line-height: 1.4; }

.map-legend {
    position: absolute;
    z-index: 6;
    right: 18px;
    bottom: 18px;
    display: flex;
    max-width: min(560px, calc(100% - 36px));
    min-height: 36px;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgb(7 26 37 / 78%);
    color: var(--mist);
    font-family: var(--utility);
    font-size: .6rem;
    backdrop-filter: blur(12px);
}

.map-legend__toggle { display: none; }
.map-legend__content { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.map-legend__content > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot, .legend-ring, .legend-target, .legend-bus, .legend-station, .legend-estimated, .legend-timetable { width: 8px; height: 8px; }
.legend-dot, .legend-ring, .legend-target { border-radius: 50%; }
.legend-dot--live { background: var(--signal); box-shadow: 0 0 8px var(--signal); }
.legend-direction {
    display: inline-grid;
    width: 10px;
    height: 12px;
    color: var(--ice);
    font-size: .86rem;
    font-style: normal;
    font-weight: 900;
    line-height: 12px;
    place-items: center;
    text-shadow: 0 1px 2px var(--night);
}
.legend-ring { border: 2px solid var(--signal); box-shadow: 0 0 0 2px rgb(67 217 198 / 18%); }
.legend-target { border: 1px solid var(--amber); box-shadow: 0 0 0 3px rgb(243 185 91 / 16%); }
.legend-bus { border: 1px dashed #ffe1a3; border-radius: 2px; background: #9d6817; }
.legend-cluster {
    display: inline-grid;
    width: 20px;
    height: 20px;
    border: 1px dashed #ffe1a3;
    border-radius: 50%;
    background: #865712;
    color: white;
    font-size: .48rem;
    font-style: normal;
    font-weight: 800;
    place-items: center;
}
.legend-estimated { border: 2px dashed #d9c9ff; border-radius: 50%; background: #6a4d83; }
.legend-timetable { border: 2px dotted #d6e4ff; border-radius: 50%; background: #335d9f; }
.legend-alert {
    display: inline-grid;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--amber);
    color: var(--ink);
    font-size: .52rem;
    font-style: normal;
    font-weight: 950;
    place-items: center;
}
.legend-station { border: 2px solid var(--signal); border-radius: 2px; background: var(--paper); transform: rotate(45deg); }

.train-sheet {
    top: 18px;
    right: 18px;
    width: min(360px, calc(100% - 36px));
    max-height: calc(100% - 36px);
    padding: 20px;
    overflow: auto;
    overscroll-behavior: contain;
}
.train-sheet[hidden] { display: none; }
.train-sheet__controls { position: absolute; z-index: 4; top: 14px; right: 14px; display: flex; }
.train-sheet__close { position: static; }
.sheet-size-toggle { display: none; }
.train-sheet__body { min-width: 0; }
.train-sheet__identity { display: flex; max-width: calc(100% - 54px); align-items: center; gap: 10px; }

.line-badge {
    display: inline-flex;
    min-width: 48px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border-radius: 7px;
    background: var(--signal);
    color: var(--ink);
    font-family: var(--display);
    font-size: .9rem;
    font-weight: 900;
}
.line-badge--station { background: var(--amber); }

.utility-label { overflow: hidden; color: var(--mist); font-family: var(--utility); font-size: .65rem; letter-spacing: .08em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.train-sheet h2 { margin: 18px 0 20px; font-family: var(--display); font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1.08; }
.train-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; }
.train-facts div { display: grid; gap: 4px; min-width: 0; }
.train-facts dt { color: var(--mist); font-family: var(--utility); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; }
.train-facts dd { overflow: hidden; margin: 0; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.train-facts dd.is-stale { color: var(--amber); }
#detail-position { white-space: normal; }
.station-sheet .train-facts dd { white-space: normal; }

.enrichment-status {
    margin: 18px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--signal);
    border-radius: 0 7px 7px 0;
    background: rgb(67 217 198 / 8%);
    color: #b8d3d8;
    font-size: .7rem;
    line-height: 1.45;
}

.enrichment-status[data-state="loading"] { border-color: var(--amber); }
.enrichment-status[data-state="error"] { border-color: var(--danger); color: #ffd1cd; }
.enrichment-status[data-state="empty"] { border-color: #78949d; }

.detail-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.detail-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.detail-section h3 {
    margin: 0 0 11px;
    font-family: var(--display);
    font-size: .76rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.text-button {
    min-height: 32px;
    margin: -8px 0 4px;
    padding: 0;
    cursor: pointer;
    border: 0;
    background: none;
    color: var(--signal);
    font-size: .68rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.transit-alert-list { display: grid; gap: 8px; }
.transit-alert {
    padding: 10px 11px;
    border-left: 3px solid var(--amber);
    border-radius: 0 7px 7px 0;
    background: rgb(243 185 91 / 10%);
}
.transit-alert[data-severity="severe"], .transit-alert[data-severity="verysevere"] {
    border-color: var(--danger);
    background: rgb(255 124 111 / 10%);
}
.transit-alert strong { display: block; font-size: .75rem; line-height: 1.35; }
.transit-alert p { margin: 5px 0 0; color: #b8cbd0; font-size: .68rem; line-height: 1.48; }
.transit-alert__meta { display: block; margin-top: 4px; color: var(--amber); font-family: var(--utility); font-size: .55rem; line-height: 1.4; }
.transit-alert a { display: inline-block; margin-top: 7px; color: var(--signal); font-size: .64rem; font-weight: 800; text-underline-offset: 3px; }

.call-list, .departure-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.call-list__item, .departure-list__item {
    display: grid;
    align-items: start;
    gap: 9px;
    padding: 9px 0;
    border-bottom: 1px solid rgb(190 224 229 / 12%);
}
.call-list__item { grid-template-columns: 44px minmax(0, 1fr); }
.departure-list__item { grid-template-columns: 42px 40px minmax(0, 1fr); }
.call-list__item:last-child, .departure-list__item:last-child { border-bottom: 0; }
.call-list__item time, .departure-list__item time {
    color: var(--signal);
    font-family: var(--utility);
    font-size: .72rem;
    font-weight: 800;
}
.call-list__item > span, .departure-list__item > span { display: grid; gap: 3px; min-width: 0; }
.call-list__item strong, .departure-list__item > span strong {
    overflow: hidden;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.call-list__item small, .departure-list__item small { color: #89a5ad; font-size: .63rem; line-height: 1.35; }
.call-list__item.is-next { padding-left: 8px; border-left: 2px solid var(--amber); }
.call-list__item.is-cancelled, .departure-list__item.is-cancelled { opacity: .7; text-decoration: line-through; }
.departure-list__line {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    justify-content: center;
    padding: 3px 5px;
    border-radius: 4px;
    background: var(--signal);
    color: var(--ink);
    font-family: var(--display);
    font-size: .68rem;
}

.train-sheet__notice {
    margin: 18px -20px -20px;
    padding: 13px 20px;
    border-radius: 0 0 16px 16px;
    background: rgb(243 185 91 / 10%);
    color: #e7c991;
    font-size: .68rem;
    line-height: 1.45;
}

.source-rail {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-top: 1px solid var(--line);
    background: var(--night);
    color: #78949d;
    font-family: var(--utility);
    font-size: .58rem;
    letter-spacing: .03em;
}

.source-rail__divider { width: 1px; height: 12px; background: var(--line); }

.source-rail button {
    min-height: 30px;
    margin-left: auto;
    padding: 0;
    cursor: pointer;
    border: 0;
    background: none;
    color: var(--mist);
    font-family: var(--utility);
    font-size: .58rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.data-dialog {
    width: min(600px, calc(100% - 28px));
    max-height: min(720px, calc(100dvh - 28px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 30px 90px rgb(0 0 0 / 45%);
    color: var(--ink);
}

.data-dialog::backdrop { background: rgb(1 12 19 / 70%); backdrop-filter: blur(5px); }
.data-dialog__head { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 24px; border-bottom: 1px solid rgb(6 32 43 / 12%); }
.data-dialog__head .eyebrow { color: var(--signal-deep); }
.data-dialog__head h2 { margin: 7px 0 0; font-family: var(--display); font-size: 1.7rem; }
.data-dialog__head .icon-button { flex: 0 0 auto; border-color: rgb(6 32 43 / 16%); color: var(--ink); }
.data-dialog__content { display: grid; gap: 16px; max-height: calc(100dvh - 220px); padding: 24px; overflow: auto; }
.data-dialog__content p { margin: 0; color: #35505a; font-size: .9rem; line-height: 1.58; }
.data-dialog__content h3 { margin: 0 0 10px; font-family: var(--display); font-size: 1rem; text-transform: uppercase; }
.source-status-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.source-status-list li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; min-height: 36px; padding: 7px 10px; border-radius: 8px; background: rgb(6 32 43 / 6%); font-size: .78rem; }
.source-status-list i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.source-status-list i.is-live { background: var(--signal-deep); }
.source-status-list i.is-error { background: #cc5048; }
.source-status-list small { color: #5a727b; font-family: var(--utility); }
.data-dialog__content .safety-note { padding: 13px 15px; border-left: 3px solid var(--amber); background: #fff4df; color: #694d1e; }
.data-dialog__links { display: flex; flex-wrap: wrap; gap: 18px; padding: 15px 24px 18px; border-top: 1px solid rgb(6 32 43 / 12%); }
.data-dialog__links a { color: #245f79; font-size: .76rem; font-weight: 700; text-underline-offset: 3px; }

.traffic-dialog {
    position: fixed;
    top: 90px;
    right: 18px;
    bottom: 52px;
    left: auto;
    width: min(430px, calc(100% - 36px));
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgb(190 224 229 / 26%);
    border-radius: 18px;
    background: rgb(7 26 37 / 98%);
    box-shadow: 0 30px 90px rgb(0 0 0 / 55%);
    color: var(--ice);
}

.traffic-dialog::backdrop { background: rgb(1 12 19 / 58%); backdrop-filter: blur(4px); }
.traffic-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }

.traffic-dialog__head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.traffic-dialog__head h2 {
    margin: 4px 0 2px;
    font-family: var(--display);
    font-size: 1.4rem;
    letter-spacing: .015em;
}

.traffic-dialog__head p:last-child { margin: 0; color: var(--mist); font-size: .7rem; line-height: 1.4; }
.traffic-dialog__head .icon-button { flex: 0 0 auto; }

.traffic-dialog__status {
    margin: 9px 18px 0;
    padding: 7px 10px;
    border-left: 3px solid var(--amber);
    border-radius: 0 7px 7px 0;
    background: rgb(243 185 91 / 9%);
    color: #e8d2a9;
    font-size: .62rem;
    line-height: 1.45;
}

.traffic-dialog__status[data-state="live"] { border-color: var(--signal); background: rgb(67 217 198 / 8%); color: #b9ddd9; }
.traffic-dialog__status[data-state="error"],
.traffic-dialog__status[data-state="partial"] { border-color: var(--danger); background: rgb(255 124 111 / 9%); color: #ffd1cd; }

.traffic-situation-list {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 0;
    padding: 10px 18px 16px;
    overflow: auto;
    overscroll-behavior: contain;
}

.traffic-situation {
    display: grid;
    gap: 7px;
    padding: 10px 11px;
    border: 1px solid rgb(190 224 229 / 16%);
    border-left: 3px solid var(--amber);
    border-radius: 4px 10px 10px 4px;
    background: rgb(255 255 255 / 4%);
}

.traffic-situation[data-severity="severe"],
.traffic-situation[data-severity="verysevere"] { border-left-color: var(--danger); }
.traffic-situation[data-status="upcoming"] { border-left-style: dashed; }

.traffic-situation__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.traffic-situation__source,
.traffic-situation__status,
.traffic-situation__planned {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-family: var(--utility);
    font-size: .53rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.traffic-situation__source { border: 1px solid rgb(67 217 198 / 32%); color: var(--signal); }
.traffic-situation__status { background: rgb(243 185 91 / 13%); color: var(--amber); }
.traffic-situation__planned { color: var(--mist); }
.traffic-situation h3 { margin: 0; font-family: var(--display); font-size: .84rem; line-height: 1.3; }
.traffic-situation p { margin: 0; color: #b8cbd0; font-size: .7rem; line-height: 1.5; }

.traffic-situation details summary {
    min-height: 32px;
    padding-top: 7px;
    cursor: pointer;
    color: var(--mist);
    font-size: .65rem;
    font-weight: 700;
}
.traffic-situation details p { padding: 4px 0 2px; }
.traffic-situation__lines { color: #8faab2; font-family: var(--utility); font-size: .58rem; line-height: 1.45; }
.traffic-situation__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.traffic-situation__actions button,
.traffic-situation__actions a {
    min-height: 38px;
    padding: 0;
    cursor: pointer;
    border: 0;
    background: none;
    color: var(--signal);
    font-size: .66rem;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.traffic-dialog__foot {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px;
    border-top: 1px solid var(--line);
    color: #78949d;
    font-family: var(--utility);
    font-size: .55rem;
}

@media (max-width: 900px) {
    .topbar { grid-template-columns: minmax(190px, 1fr) auto; }
    .signal-track { display: none; }
    .control-deck { width: 292px; }
}

@media (max-width: 767px) {
    .rail-app { grid-template-rows: 62px minmax(0, 1fr) 30px; min-height: 480px; }
    .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 0 12px; }
    .brand { gap: 8px; }
    .brand-mark { width: 32px; height: 32px; }
    .brand-name { font-size: 1.1rem; }
    .brand-subtitle { display: none; }
    .service-state { gap: 7px; }
    .service-state__copy strong { font-size: .72rem; }
    .service-state__copy span { max-width: 124px; font-size: .56rem; }
    .service-state__dot { width: 8px; height: 8px; }
    .control-deck { display: none; }

    .mobile-filter-toggle {
        position: absolute;
        z-index: 10;
        top: 12px;
        left: 12px;
        display: inline-flex;
        gap: 8px;
        min-width: 126px;
        padding: 0 14px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: rgb(7 26 37 / 90%);
        box-shadow: var(--shadow);
        font-size: .75rem;
        backdrop-filter: blur(14px);
    }

    .mobile-traffic-toggle {
        position: absolute;
        z-index: 10;
        top: 64px;
        left: 12px;
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        gap: 7px;
        padding: 0 13px;
        cursor: pointer;
        border: 1px solid rgb(243 185 91 / 34%);
        border-radius: 999px;
        background: rgb(7 26 37 / 90%);
        box-shadow: var(--shadow);
        color: var(--ice);
        font-size: .69rem;
        backdrop-filter: blur(14px);
    }

    .mobile-traffic-toggle > span {
        display: grid;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: rgb(243 185 91 / 14%);
        color: var(--amber);
        font-family: var(--utility);
        font-size: .64rem;
        font-weight: 950;
        place-items: center;
    }

    .mobile-traffic-toggle > strong {
        display: grid;
        min-width: 22px;
        height: 22px;
        padding: 0 5px;
        border-radius: 999px;
        background: var(--amber);
        color: var(--ink);
        font-family: var(--utility);
        font-size: .58rem;
        place-items: center;
    }
    .mobile-traffic-toggle > strong[hidden] { display: none; }

    .mobile-filters {
        position: absolute;
        z-index: 30;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        gap: 16px;
        max-height: calc(100% - 12px);
        padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
        overflow: auto;
        border-top: 1px solid var(--line);
        border-radius: 18px 18px 0 0;
        background: rgb(7 26 37 / 97%);
        box-shadow: 0 -20px 50px rgb(1 12 19 / 38%);
        backdrop-filter: blur(20px);
    }

    .mobile-filters[hidden] { display: none; }
    .mobile-filters__head { display: flex; align-items: center; justify-content: space-between; }
    .mobile-filters__head strong { font-family: var(--display); font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
    .mobile-filters .place-search__results { position: static; max-height: 220px; margin-top: 7px; }
    .mobile-filters .deck-divider { margin-top: 2px; }
    .transport-switch--mobile .transport-switch__option span { min-height: 44px; }
    .operator-disclosure--mobile { margin-top: 0; }
    .operator-disclosure summary { min-height: 44px; }
    .operator-chip label { min-height: 44px; }
    .map-message { top: auto; bottom: 58px; width: calc(100% - 24px); transform: translateX(-50%); }
    .map-legend {
        right: 12px;
        bottom: 12px;
        display: grid;
        width: auto;
        max-width: calc(100% - 24px);
        min-height: 44px;
        gap: 0;
        padding: 0;
        overflow: hidden;
        border-radius: 999px;
        background: rgb(7 26 37 / 92%);
    }

    .map-legend__toggle {
        display: inline-flex;
        min-width: 118px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 12px;
        touch-action: manipulation;
        cursor: pointer;
        border: 0;
        background: transparent;
        color: var(--ice);
        font-family: var(--utility);
        font-size: .63rem;
        font-weight: 700;
        letter-spacing: .04em;
    }

    .map-legend__toggle:hover { background: rgb(67 217 198 / 9%); color: var(--signal); }
    .map-legend__toggle svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-width: 1.7;
    }
    .map-legend__toggle circle { fill: var(--night); }
    .map-legend__chevron { transition: transform 160ms ease; }
    .map-legend__content { display: none; }

    .map-legend.is-expanded {
        width: min(350px, calc(100vw - 24px));
        padding: 0 10px 10px;
        border-radius: 14px;
    }
    .map-legend.is-expanded .map-legend__toggle {
        width: 100%;
        justify-content: flex-start;
        padding: 0 4px;
        border-bottom: 1px solid var(--line);
    }
    .map-legend.is-expanded .map-legend__chevron { margin-left: auto; transform: rotate(180deg); }
    .map-legend.is-expanded .map-legend__content { display: flex; gap: 10px 14px; padding: 10px 2px 0; }
    .map-stage.is-map-legend-expanded .rail-map__attribution { bottom: 118px; }
    .rail-map__controls { top: 12px; right: 12px; }
    .rail-map__layer-menu { top: 198px; right: 12px; width: min(280px, calc(100% - 24px)); }
    .map-location-status {
        top: auto;
        bottom: 76px;
        max-width: calc(100% - 24px);
        border-radius: 12px;
    }
    .rail-map__attribution { right: 12px; bottom: 54px; max-width: calc(100% - 24px); }
    .train-marker__label { display: none; }

    .train-sheet {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: min(46%, 420px);
        padding: 0 18px calc(18px + env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 18px 18px 0 0;
    }

    .train-sheet.is-expanded { max-height: min(78%, 660px); }
    .train-sheet__controls {
        position: sticky;
        top: 0;
        right: auto;
        min-height: 56px;
        align-items: center;
        justify-content: center;
        margin: 0 -8px 8px;
        padding: 0 8px;
        border-bottom: 1px solid rgb(190 224 229 / 16%);
        background: rgb(7 26 37);
        backdrop-filter: blur(18px);
    }
    .train-sheet__close { position: absolute; top: 6px; right: 0; }
    .sheet-size-toggle {
        display: inline-flex;
        min-width: 104px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 12px;
        touch-action: manipulation;
        cursor: pointer;
        border: 0;
        border-radius: 999px;
        background: rgb(67 217 198 / 9%);
        color: var(--signal);
        font-family: var(--utility);
        font-size: .62rem;
        font-weight: 800;
        letter-spacing: .04em;
    }
    .sheet-size-toggle:hover { background: rgb(67 217 198 / 15%); color: var(--ice); }
    .sheet-size-toggle svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-width: 1.8;
        transition: transform 160ms ease;
    }
    .train-sheet.is-expanded .sheet-size-toggle svg { transform: rotate(180deg); }
    .train-sheet__identity { max-width: 100%; }

    .station-marker__label { display: none; }
    .station-marker:hover .station-marker__label,
    .station-marker:focus-visible .station-marker__label,
    .station-marker.is-selected .station-marker__label { display: block; }

    .train-sheet__notice {
        margin-right: -18px;
        margin-bottom: calc(-18px - env(safe-area-inset-bottom));
        margin-left: -18px;
        padding-right: 18px;
        padding-bottom: calc(13px + env(safe-area-inset-bottom));
        padding-left: 18px;
        border-radius: 0;
    }

    .source-rail { gap: 7px; padding: 0 12px; font-size: .52rem; }
    .source-rail span:nth-of-type(2), .source-rail span:nth-of-type(3) { display: none; }
    .source-rail button { font-size: .52rem; }

    .traffic-dialog {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: min(74dvh, 680px);
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 20px 20px 0 0;
    }
    .traffic-dialog__head { padding: 14px 16px 11px; }
    .traffic-dialog__head h2 { font-size: 1.35rem; }
    .traffic-dialog__status { margin-right: 16px; margin-left: 16px; }
    .traffic-situation-list { padding-right: 16px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); padding-left: 16px; }
    .traffic-dialog__foot { padding-right: 16px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); padding-left: 16px; }
}

@media (max-width: 360px) {
    .brand-name { font-size: 1rem; }
    .service-state__copy span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
