@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

body.advent-page {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: #070b1f linear-gradient(180deg, #070b1f 0%, #0f1a40 52%, #2a3e75 100%); background-size: auto;
}
#sky { position: fixed; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 0; }
.advent-page .site-header { background: rgba(7, 11, 31, 0.78); color: #eef1f8; --hair: rgba(238, 241, 248, 0.2); }
.advent-page .logo--on-light { display: none; }
.advent-page .logo--on-dark { display: block; }
.advent-page main { position: relative; z-index: 1; }
.advent-page .tools .tool { display: grid; }
.landscape { position: relative; z-index: 1; margin-top: auto; height: clamp(170px, 26vw, 330px); pointer-events: none; }
.landscape svg { width: 100%; height: 100%; }
.advent-page .site-footer { position: relative; z-index: 1; margin-top: -1px; border: 0; background: #eef3ff; color: #1a2340; --muted: #3d4766; --ink: #1a2340; --hair: rgba(26, 35, 64, 0.16); }

.advent { --tueren: 1040px; padding-block: clamp(24px, 5vw, 48px) 8px; color: #eef1f8; }
.advent h1 { font-size: var(--title-fs); line-height: 1.1; text-wrap: balance; hyphens: manual; }
.advent-lead { margin-top: 12px; color: #c3cdea; max-width: 40em; }
.advent h1, .advent-lead, .testbar { margin-left: max(0px, (100% - var(--tueren)) / 2); }
.testbar { margin-right: max(0px, (100% - var(--tueren)) / 2); }

.doorwrap { container-type: inline-size; width: min(100%, var(--tueren)); margin: 28px auto 0; }
.doors { --cols: 8; --gap: 14px; list-style: none; display: grid; gap: var(--gap); grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.doors li { grid-column: var(--c) / span var(--w); grid-row: var(--r) / span var(--h); container-type: size; }
@media (max-width: 640px) {
  .doors { --cols: 4; --gap: 10px; }
  .doors li { grid-column: var(--mc) / span var(--mw); grid-row: var(--mr) / span var(--mh); }
}
.door {
  --line: #9462b1; --on-line: #fff; --wood: #1c3566; --text: #fff; --trim: #e9c46a;
  position: relative; display: block; width: 100%; height: 100%; border-radius: 14px; perspective: 900px;
}
.door--rot { --wood: #9c2032; }
.door--gruen { --wood: #175a43; }
.door--blau { --wood: #234487; }
.door--beere { --wood: #5d2a66; }
.door--gold { --wood: #e3b04b; --text: #2a1c05; --trim: #fff6d8; }
.door-leaf, .door-inside { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; border-radius: 14px; }
.door-leaf {
  background: linear-gradient(155deg, color-mix(in srgb, var(--wood) 82%, #fff) 0%, var(--wood) 45%, color-mix(in srgb, var(--wood) 78%, #000) 100%);
  color: var(--text); transform-origin: left center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.8s cubic-bezier(0.6, 0, 0.2, 1), box-shadow 0.8s; backface-visibility: hidden;
}
.door-leaf::before { content: ""; position: absolute; inset: 7%; border: 1.5px solid color-mix(in srgb, var(--trim) 70%, transparent); border-radius: 9px; pointer-events: none; }
.door-leaf::after { content: ""; position: absolute; right: calc(7% + 5px); top: 50%; width: clamp(6px, 6cqmin, 12px); aspect-ratio: 1; border-radius: 50%; background: var(--trim); }
.door-num { font-size: clamp(1.5rem, 42cqmin, 7rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.door-hint { font-size: clamp(0.7rem, 11cqmin, 1.05rem); line-height: 1.3; opacity: 0.85; }
.door-star { width: 26cqmin; height: 26cqmin; fill: #fff8e1; margin-bottom: 2cqmin; }
.door:not(.is-open):hover .door-leaf { filter: brightness(1.12); }
.door.is-open .door-leaf { transform: rotateY(-112deg); box-shadow: 12px 0 24px rgba(0, 0, 0, 0.3); }
.door.is-restored .door-leaf, .door.is-restored .door-line { transition: none; }
.door.is-nope .door-leaf { animation: nope 0.4s; }
@keyframes nope { 25% { transform: translateX(-6px) rotate(-1deg); } 75% { transform: translateX(6px) rotate(1deg); } }
.door-inside { background: radial-gradient(circle, #fff7df 0%, #ffd97a 100%); }
.door-line {
  display: grid; place-items: center; min-width: 2.1em; height: 1.6em; padding-inline: 0.3em; border-radius: 0.5em;
  background: var(--line); color: var(--on-line, #fff); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18); font-size: clamp(1.1rem, 28cqmin, 3.4rem); font-weight: 700;
  transform: scale(0.3); opacity: 0; transition: transform 0.5s 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.3s 0.35s;
}
.door.is-open .door-line { transform: none; opacity: 1; }
@media (max-width: 700px) { .advent { padding-top: 68px; } }
.testbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 20px; padding: 12px 16px; border: 2px dashed #ffd97a; border-radius: 16px; background: rgba(7, 11, 31, 0.7); font-size: 0.95rem; }
.testbar[hidden], .testnav[hidden] { display: none; }
.testbar strong { color: #ffd97a; }
.testbar select { min-height: 44px; margin-left: 6px; padding: 6px 10px; border: 0; border-radius: 10px; background: #fff; color: #0f1422; font: inherit; }
.testbar .chip-btn { background: transparent; color: #eef1f8; box-shadow: inset 0 0 0 2px rgba(238, 241, 248, 0.4); }
.card-foot { display: flex; align-items: center; border-top: 1px solid var(--hair); }
.card-foot .card-source { flex: 1; border: 0; }
.testnav { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; font-size: 0.85rem; white-space: nowrap; }
.testnav .chip-btn { min-height: 36px; min-width: 40px; padding: 0 10px; }
.door-msg {
  position: fixed; left: 50%; top: 50%; z-index: 60; transform: translate(-50%, -50%);
  width: max-content; max-width: min(360px, 100% - 32px); padding: 22px 26px; border-radius: 20px;
  background: #fff8e1; color: #2a1c05; box-shadow: 0 0 0 3px #e9c46a, 0 20px 60px rgba(0, 0, 0, 0.55);
  text-align: center; text-wrap: balance; white-space: pre-line; hyphens: manual; font-size: 1.1rem; font-weight: 500; line-height: 1.45;
  animation: msg-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.door-msg .part { display: block; }
.door-msg .part + .part { margin-top: 0.7em; }
.door-msg .tram { position: relative; top: -0.14em; }
.door-msg:empty { padding: 0; box-shadow: none; background: none; animation: none; pointer-events: none; }
@keyframes msg-in { from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; } }
html[data-motion="reduced"] .door-msg { animation: none; }

.card {
  --line: #9462b1; --on-line: #fff;
  margin: auto; width: min(1120px, 100% - 24px); height: min(760px, 100% - 24px); max-width: none; max-height: none;
  padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.card[open] { display: flex; flex-direction: column; animation: card-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.card::backdrop { background: rgba(8, 11, 20, 0.6); }
@keyframes card-in { from { transform: scale(0.85); opacity: 0; } }

.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 18px 76px 14px 22px; border-bottom: 5px solid var(--line); position: relative; }
.card-ref { display: grid; place-items: center; min-width: 76px; height: 56px; padding-inline: 10px; border-radius: 18px; background: var(--line); color: var(--on-line); font-size: 2.3rem; font-weight: 700; line-height: 1; }
.card-titles { flex: 1 1 260px; min-width: 0; }
.card-place { color: var(--muted); font-size: 1rem; line-height: 1.3; }
.card h2 { font-size: 1.45rem; line-height: 1.25; }
.ziel { display: inline-block; }
.card-latin { color: var(--muted); font-size: 0.95rem; line-height: 1.3; }
.card-latin[hidden] { display: none; }
small.latin { display: block; font-size: 0.8em; font-weight: 400; line-height: 1.25; color: var(--muted); }
.chip-btn[aria-pressed="true"] small.latin { color: inherit; opacity: 0.8; }
.label tspan.latin { fill: var(--muted); font-weight: 400; }
.card-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; }
.card-total { font-size: 0.95rem; color: var(--muted); }
.card-range { display: none; }
.card-total > b { display: block; font-size: 1.6rem; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.card-facts table { border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.card-facts th { text-align: left; font-weight: 600; padding-right: 16px; }
.card-table { max-height: 5.9em; overflow-y: auto; max-width: 100%; }
.card-facts td { white-space: nowrap; padding-right: 14px; color: var(--muted); }
.card-facts td b { color: var(--ink); }
.zahl { display: inline-flex; flex-direction: column; align-items: flex-end; }
.zahl::after { content: attr(data-full); height: 0; overflow: hidden; visibility: hidden; }
.card-close { position: absolute; right: 16px; top: 18px; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; box-shadow: inset 0 0 0 2px var(--hair); }
.card-close:hover { background: var(--hair); }

.card-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.card-map { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.card-tools { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 8px; }
.zoom { position: absolute; right: 12px; top: 12px; display: grid; gap: 8px; }
.zoom .chip-btn { width: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.legend { position: absolute; left: 14px; top: 12px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 90px); padding: 4px 12px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); font-size: 0.8rem; line-height: 1.35; color: var(--muted); pointer-events: none; }
.legend[hidden] { display: none; }
.legend svg { width: 34px; height: 6px; flex: none; stroke: var(--muted); stroke-width: 3; stroke-dasharray: 6 5; }
.chip-btn { min-height: 44px; min-width: 44px; padding: 6px 16px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--hair); font-size: 0.95rem; font-weight: 600; }
.chip-btn:hover { background: color-mix(in srgb, var(--ink) 10%, var(--surface)); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip-btn:disabled { opacity: 0.35; cursor: default; }

.net { fill: none; stroke: color-mix(in srgb, var(--muted) 40%, var(--surface)); stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.8s; }
.net--closed { stroke: color-mix(in srgb, var(--muted) 75%, var(--surface)); stroke-linecap: butt; }
.card-place { hyphens: manual; }
.route, .casing { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.route { stroke: var(--line); }
html[data-theme="light"] .card--pale .casing { stroke: color-mix(in srgb, var(--ink) 55%, var(--surface)); }
html[data-theme="light"] .card--pale .pearl::before { box-shadow: inset 1.5px 0 0 rgba(15, 20, 34, 0.55), inset -1.5px 0 0 rgba(15, 20, 34, 0.55); }
html[data-theme="light"] .card--pale .stop:not(.stop--xfer) .stop-dot { stroke: color-mix(in srgb, var(--ink) 65%, var(--line)); }
html[data-theme="light"] .card--pale .pearl:not(.pearl--xfer) button::before { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 65%, var(--line)); }
.route-closed { fill: none; stroke: var(--surface); stroke-linecap: butt; stroke-linejoin: round; pointer-events: none; }
.casing { stroke: var(--surface); }
.stop { cursor: pointer; outline: none; }
.stop-dot { fill: var(--surface); stroke: var(--line); }
.stop--xfer .stop-dot { stroke: var(--ink); }
.stop-halo { fill: none; stroke: var(--line); opacity: 0; }
.stop:hover .stop-halo, .stop:focus-visible .stop-halo { opacity: 0.45; }
.stop:focus-visible .stop-halo { stroke: var(--focus); opacity: 1; }
.stop.is-active .stop-halo { opacity: 0.8; }
.stop.is-active .stop-dot { fill: var(--line); }
.stop-pop { transform: scale(0); transform-box: fill-box; transform-origin: center; }
.stop.is-in .stop-pop { transform: scale(1); animation: pop 0.45s cubic-bezier(0.3, 1.7, 0.5, 1); }
@keyframes pop { from { transform: scale(0); } }
.label { fill: var(--ink); font-weight: 500; stroke: var(--surface); paint-order: stroke; stroke-linejoin: round; opacity: 0; transition: opacity 0.35s; cursor: pointer; hyphens: manual; }
.label--end { font-weight: 800; }
.label.is-in { opacity: 1; }
.label.is-hidden { opacity: 0; pointer-events: none; }
.train { fill: var(--ink); stroke: var(--surface); }

.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--hair); background: var(--surface); }
#panelBody { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 16px; }
.sheet-handle, .panel-nav { display: none; }
.dirs { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 4px 10px; background: var(--surface); border-bottom: 1px solid var(--hair); }
.dirs .chip-btn { flex: 1 1 auto; line-height: 1.25; border-radius: 22px; }
.dir-facts { flex: 1 0 100%; text-align: center; font-size: 0.85rem; line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip { list-style: none; padding-top: 6px; }
.dir-select { width: 100%; min-height: 44px; padding: 8px 12px; border: 2px solid var(--hair); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.95rem; font-weight: 600; text-overflow: ellipsis; }
.pearl { position: relative; opacity: 0.3; transition: opacity 0.35s; }
.pearl.is-in { opacity: 1; }
.pearl::before { content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 8px; background: var(--line); }
.pearl:first-child::before { top: 50%; }
.pearl:last-child::before { bottom: 50%; }
.pearl button { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; width: 100%; min-height: 48px; padding: 8px 8px 8px 44px; border-radius: 12px; text-align: left; line-height: 1.3; }
.pearl button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pearl button[aria-current="true"] { background: color-mix(in srgb, var(--line) 22%, transparent); }
.pearl button:focus-visible { outline-offset: -3px; }
.pearl button::before { content: ""; position: absolute; left: 13px; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--line); transform: translateY(-50%); }
.pearl--xfer button::before { left: 11px; width: 16px; height: 16px; box-shadow: 0 0 0 3px var(--ink); }
.pearl button[aria-current="true"]::before { background: var(--line); }
.pearl-name { font-size: 0.96rem; font-weight: 500; min-width: 0; }
.pearl--end .pearl-name { font-weight: 800; font-size: 1.05rem; }
.modes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.mode { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--m, #3d4458); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); font-size: 0.74rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.mode--metro { --m: #6b2f9e; }
.mode--sbahn { --m: #0f6e37; }
.mode--tram { --m: #b3261e; }
.mode--bus { --m: #1a54ad; }
.mode--obus { --m: #0b666d; }
.mode--nachtbus { --m: #2e2a66; }
.mode--faehre { --m: #0a5f7f; }
.mode--seilbahn { --m: #7a5000; }

.card-source { padding: 6px 18px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--hair); }
@media (max-width: 820px) {
  .card { width: 100%; height: 100%; border-radius: 0; }
  .card-head { padding: 12px 64px 10px 14px; gap: 8px 12px; }
  .card-ref { min-width: 58px; height: 44px; font-size: 1.8rem; border-radius: 14px; }
  .card-titles { flex-basis: 160px; }
  .card h2 { font-size: 1.12rem; }
  .card-close { right: 10px; top: 10px; }
  .card-facts { gap: 4px 14px; }
  .card-total { display: none; }
  .card-facts table { font-size: 0.82rem; }
}
@media (max-width: 820px) and (orientation: portrait), (max-width: 820px) and (min-height: 521px) {
  .card-body { --peek: 104px; display: block; position: relative; }
  .card-map { position: absolute; inset: 0 0 var(--peek) 0; }
  .panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: var(--peek); padding: 0; border: 0; border-top: 1px solid var(--hair); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.22); transition: height 0.3s var(--ease); overflow: hidden; }
  .panel.is-open { height: 80%; }
  .panel.is-dragging { transition: none; }
  .sheet-handle { display: grid; place-items: center; flex: none; width: 100%; height: 26px; touch-action: none; cursor: grab; }
  .sheet-handle:focus-visible { outline-offset: -3px; }
  .sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.55; }
  .panel-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; min-height: 78px; padding: 0 12px 8px; color: var(--muted); touch-action: none; cursor: grab; }
  .panel-where { flex: 1; min-width: 0; text-align: center; line-height: 1.25; }
  .panel-where b { display: block; font-size: 1rem; line-height: 1.2; color: var(--ink); text-wrap: balance; }
  .panel-where #stopModes { display: block; min-height: 1.5rem; }
  .panel-where #stopPos { display: block; font-size: 0.72rem; line-height: 1.3; }
  #panelBody { padding: 0 10px 18px; border-top: 1px solid var(--hair); visibility: hidden; }
  .dirs { padding-top: 8px; }
  .panel.is-open #panelBody, .panel.is-dragging #panelBody { visibility: visible; }
  .card-source { padding: 3px 12px; font-size: 0.66rem; }
  .card-table { display: none; }
  .card-facts { flex: 1 0 100%; }
  .card-total { display: block; font-size: 0.9rem; }
  .card-total > b { display: inline-block; min-width: 2ch; text-align: right; font-size: 1rem; }
  .card-range { display: inline; }
  .card-range b { color: var(--ink); }
  .card-place { font-size: 0.8rem; }
  .card h2 { font-size: 1.05rem; }
  .card-latin { font-size: 0.8rem; }
}
@media (max-width: 600px) and (orientation: portrait), (max-width: 600px) and (min-height: 521px) {
  .card-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 10px; padding: 8px 10px 6px; border-bottom-width: 3px; }
  .card-titles { display: contents; }
  .card-ref { grid-area: 1 / 1; min-width: 40px; height: 30px; padding-inline: 8px; border-radius: 9px; font-size: 1.1rem; }
  .card-place { grid-area: 1 / 2; min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; align-content: center; column-gap: 0.25em; padding-right: 46px; font-size: 0.72rem; line-height: 1.3; }
  .card-mode { display: none; }
  .card h2 { grid-area: 2 / 1 / auto / -1; margin-top: 2px; font-size: 0.9rem; line-height: 1.25; text-wrap: balance; }
  .card-latin { grid-area: 3 / 1 / auto / -1; font-size: 0.72rem; line-height: 1.3; text-wrap: balance; }
  .card-facts { grid-area: 4 / 1 / auto / -1; }
  .card-total { font-size: 0.75rem; line-height: 1.35; }
  .card-total > b { font-size: 0.8rem; }
  .card-close { top: 8px; right: 8px; width: 40px; height: 40px; font-size: 1rem; }

  .advent-page .bar { min-height: 56px; }
  .advent-page .logo { width: 36px; height: 36px; }
  .advent { padding-top: 14px; }
  .advent h1 { font-size: 1.45rem; line-height: 1.2; padding-right: 40px; }
  .advent-lead { margin-top: 4px; font-size: 0.88rem; line-height: 1.4; }
  .doorwrap { margin-top: 14px; }
  .testbar { gap: 6px 12px; margin-top: 10px; padding: 8px 10px; font-size: 0.82rem; border-radius: 12px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .card { width: 100%; height: 100%; border-radius: 0; }
  .card-head { padding: 6px 60px 5px 12px; gap: 4px 12px; flex-wrap: nowrap; }
  .card-ref { min-width: 46px; height: 36px; font-size: 1.4rem; border-radius: 11px; }
  .card h2 { font-size: 1rem; }
  .card-place { font-size: 0.8rem; }
  .card-total { display: none; }
  .card-facts table { font-size: 0.76rem; }
  .card-close { top: 5px; right: 8px; }
  .card-body { grid-template-columns: minmax(0, 1fr) minmax(220px, 34%); grid-template-rows: minmax(0, 1fr); }
  #panelBody { padding-inline: 8px; }
  .dirs { padding-top: 8px; }
  .pearl button { min-height: 44px; }
  .card-source { padding-block: 2px; font-size: 0.68rem; }
}
@media (max-width: 360px) {
  .card-facts table { font-size: 0.76rem; }
  .card-facts th, .card-facts td { padding-right: 8px; }
  .chip-btn { padding-inline: 12px; font-size: 0.88rem; }
  .legend { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="normal"]) :is(.card[open], .stop.is-in .stop-pop, .door.is-nope .door-leaf, .door-msg) { animation: none; }
}
