/* Atlas-Karte — Seitenstil, ausgelagert aus map.php (siehe assets/map.js). */
    #globalMap {
      width: 100%;
      height: 100svh;
      min-height: 100svh;
      background-color: #c7d2d9;
    }

    :root[data-theme='dark'] #globalMap { background-color: #232628; }

    /* Three elevation steps for the whole map UI — one-off shadows made the
       page read restless. Dark theme deepens all three in one place. */
    :root {
      --elev-1: 0 2px 8px rgba(0,0,0,.16);
      --elev-2: 0 6px 16px rgba(0,0,0,.24);
      --elev-3: 0 12px 28px rgba(0,0,0,.36);
    }
    :root[data-theme='dark'] {
      --elev-1: 0 2px 8px rgba(0,0,0,.35);
      --elev-2: 0 6px 16px rgba(0,0,0,.45);
      --elev-3: 0 12px 28px rgba(0,0,0,.55);
    }

    .map-topbar {
      position: fixed;
      top: 12px;
      left: 14px;
      z-index: 1150;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      gap: 12px;
      width: min(680px, calc(100vw - 158px));
      max-width: min(680px, calc(100vw - 158px));
      /* No box around the box: the search input carries its own outline,
         a second container outline around it was pure chrome. The now
         invisible container must not eat clicks meant for the map below —
         only its children stay interactive. */
      padding: 0;
      background: transparent;
      border: 0;
      box-sizing: border-box;
      overflow: visible;
      pointer-events: none;
    }

    .map-logo-link,
    .map-search-wrap { pointer-events: auto; }

    .map-logo-link img {
      height: 46px;
      width: auto;
      display: block;
      transition: transform .2s;
    }

    .map-logo-link:hover img { transform: scale(1.04); }

    .map-search-wrap {
      position: relative;
      width: 100%;
      min-width: 0;
      max-width: 430px;
    }

    .map-theme-btn,
    .timeline-btn {
      position: fixed;
      top: 14px;
      z-index: 1200;
      border: 2px solid var(--brand-gold);
      background: var(--bg-card);
      color: var(--text-main);
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: .95rem;
      box-shadow: var(--elev-1);
      text-decoration: none;
      line-height: 1;
    }

    .map-theme-btn { right: 58px; }
    .timeline-btn { right: 14px; }
    .map-info-btn { right: 102px; font-style: italic; font-family: Georgia, serif; }

    .map-theme-btn:hover,
    .timeline-btn:hover,
    .map-info-btn:hover {
      transform: scale(1.08);
      text-decoration: none;
    }

    .map-info-popover {
      position: fixed;
      top: 58px;
      right: 14px;
      z-index: 1300;
      width: min(290px, calc(100vw - 28px));
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border-color);
      border-radius: 14px;
      box-shadow: var(--elev-2, 0 8px 24px rgba(0,0,0,.18));
      padding: 14px 16px;
      font-size: .92rem;
      line-height: 1.45;
    }
    .map-info-popover p { margin: 0 0 10px; }
    .map-info-popover a {
      font-weight: 600;
      color: var(--brand-gold);
      text-decoration: none;
    }
    .map-info-popover a:hover { text-decoration: underline; }
    .map-info-popover .map-info-mobile-hint { display: none; margin-bottom: 0; color: var(--text-muted, #6b7280); font-size: .85rem; }

    .map-search-input {
      width: 100%;
      padding: 11px 42px 11px 42px;
      border-radius: 999px;
      border: 1px solid var(--border-color);
      background: var(--bg-card);
      color: var(--text-main);
      font-size: .98rem;
      outline: none;
      transition: all .2s;
      box-shadow: var(--elev-1);
    }

    .map-search-input:focus {
      border-color: var(--brand-gold);
      box-shadow: 0 0 0 3px rgba(230,166,28,.2);
    }

    .map-search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-meta);
      pointer-events: none;
      font-size: 1.05rem;
    }

    .map-search-clear {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      width: 26px;
      height: 26px;
      border: 0;
      border-radius: 999px;
      background: transparent;
      color: var(--text-meta);
      cursor: pointer;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      line-height: 1;
    }

    .map-search-clear.is-visible {
      display: inline-flex;
    }

    /* Neueste Folgen: klappt bei Fokus auf das leere Suchfeld auf. */
    .atlas-recent {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      right: 0;
      z-index: 5;
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border-color);
      border-radius: 16px;
      box-shadow: var(--elev-2, 0 8px 24px rgba(0,0,0,.18));
      padding: 6px;
    }
    .atlas-recent[hidden] { display: none; }
    /* Serienlisten können länger sein als die fünf neuesten Folgen. */
    .atlas-recent { max-height: min(62vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
    .atlas-recent-head {
      padding: 6px 10px 4px;
      font-size: .7rem;
      font-weight: 700;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--text-meta);
    }
    .atlas-recent-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 6px 8px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
    }
    .atlas-recent-item:hover,
    .atlas-recent-item.is-active { background: rgba(230,166,28,.16); }
    .atlas-recent-thumb {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      object-fit: cover;
      flex: 0 0 auto;
      background: var(--border-color);
    }
    .atlas-recent-text { min-width: 0; display: grid; gap: 1px; }
    .atlas-recent-gag { font-size: .7rem; font-weight: 700; color: var(--text-meta); }
    .atlas-recent-title {
      font-size: .9rem;
      font-weight: 600;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .map-pin {
      background: #fff;
      border-radius: 10px;
      box-shadow: var(--elev-2);
      padding: 4px;
      width: 86px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      box-sizing: border-box;
      position: relative;
      transition: transform .15s ease, opacity .18s ease, box-shadow .18s ease;
      /* Subtle gold: episode pins carry the gold identity (like selection
         and the action bar), place pills keep their violet border — without
         thumbs on mobile the two looked identical. Variants override. */
      border: 1px solid color-mix(in srgb, var(--brand-gold) 55%, transparent);
      overflow: visible;
    }
    .map-pin:hover { transform: scale(1.05); }
    .map-pin-hover { transform: scale(1.04); box-shadow: var(--elev-2); }

    .map-pin-title {
      font-size: 10px;
      font-weight: 700;
      line-height: 1.2;
      white-space: normal;
      overflow: visible;
      text-overflow: clip;
      color: #111827;
      text-align: center;
      display: block;
      word-break: break-word;
    }

    /* The wrap reserves the two-line box and centers shorter titles in it
       ("Federn" stuck to the top otherwise); the inner span keeps the
       clamp. (-webkit-box-pack does not center clamped boxes in Blink.) */
    .map-pin-title-collapsed-wrap {
      min-height: 24px;
      max-height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .map-pin-title-collapsed {
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      overflow: hidden;
      text-overflow: ellipsis;
      max-height: 24px;
      white-space: normal;
      word-break: break-word;
    }

    .map-pin-img {
      width: 100%;
      height: 58px;
      object-fit: cover;
      border-radius: 6px;
      display: block;
      background: #e5e7eb;
    }

    .map-pin::after {
      content: "";
      position: absolute;
      left: 50%;
      bottom: -8px;
      transform: translateX(-50%);
      border-width: 8px 7px 0;
      border-style: solid;
      border-color: #fff transparent transparent transparent;
      filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
    }

    /* Visible feedback for switching places within the same episode: the
       new card pops in — image and title are identical, so without this the
       switch was easy to miss. */
    @keyframes mapPinCardSwap {
      0% { transform: scale(.9); opacity: .3; }
      100% { transform: scale(1); opacity: 1; }
    }
    /* Sheet content pops on intra-episode place switches (class is set in
       expandMarker). The desktop card animates via el.animate() there
       instead — a CSS animation on .map-pin-expanded re-ran on every
       Leaflet layer re-add (cluster->overlay move, moveend re-highlights)
       and made the card visibly double-pop. */
    .map-sheet-content.map-sheet-swap { animation: mapPinCardSwap .38s ease-out; }

    /* Focus sibling pills never get the down-pointing tail: declutter may
       move them off their real spot and the tail would lie about the
       location. The dashed leader + dot (when displaced) or the pill's own
       position (when not) tell the truth instead. */
    .map-pin-near::after,
    .map-pin-far::after { display: none; }

    .map-pin-expanded {
      width: 230px;
      min-height: 208px;
      max-height: 340px;
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 0;
      border-radius: 12px;
      border-color: color-mix(in srgb, var(--brand-gold) 58%, #b45309 42%);
      box-shadow: var(--elev-3);
    }

    /* Pointer from the active card to its anchor point: a hairline stem
       ending in a small dot — same visual language as the violet true-point
       dots of sibling pills, but in the card's own gold. (The old version, a
       fat gold-to-red gradient bar plus big red dot, read like an
       exclamation mark and used red, which exists nowhere else in the
       palette.) The dot must stay at bottom -36px: that is where the
       marker's iconAnchor sits. */
    .map-pin-expanded > .map-pin-actions {
      flex: 0 0 auto;
      margin: 0 8px 8px;
    }

    /* Card head: small uncropped square cover beside the title (like the
       mobile sheet) instead of a full-width cropped strip. */
    .map-pin-card-head {
      display: flex;
      gap: 8px;
      align-items: flex-start;
    }
    .map-pin-expanded .map-pin-card-head .map-pin-img {
      width: 48px;
      height: 48px;
      min-width: 48px;
      border-radius: 6px;
      object-fit: cover;
    }
    /* Override the flat-layout flex:0 0 auto — in the head row the title
       must shrink and wrap instead of running out of the card. */
    .map-pin-expanded .map-pin-card-head .map-pin-title {
      flex: 1 1 auto;
      min-width: 0;
    }
    .map-pin-expanded-scroll { overflow-x: hidden; }

    /* Area-place cards carry no stem+dot: their outline marks the place. */
    .map-pin-expanded-area::before,
    .map-pin-expanded-area::after { display: none; }

    .map-pin-expanded::before {
      content: "";
      position: absolute;
      left: 50%;
      bottom: -31px;
      transform: translateX(-50%);
      width: 2px;
      height: 29px;
      border-radius: 999px;
      background: color-mix(in srgb, var(--brand-gold) 58%, #b45309 42%);
      opacity: .85;
      pointer-events: none;
      z-index: 3;
    }

    .map-pin-expanded::after {
      width: 10px;
      height: 10px;
      left: 50%;
      bottom: -36px;
      transform: translateX(-50%);
      border: 2px solid #fff;
      border-radius: 999px;
      background: color-mix(in srgb, var(--brand-gold) 58%, #b45309 42%);
      box-shadow: 0 1px 4px rgba(0,0,0,.3);
      pointer-events: none;
      z-index: 3;
    }

    .map-pin-expanded-scroll {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      scrollbar-width: thin;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 8px;
      border-radius: 12px;
      box-sizing: border-box;
    }

    .map-pin-near {
      width: 118px;
      min-height: 48px;
      padding: 6px 8px;
      justify-content: center;
      border-color: rgba(124,58,237,.58);
      box-shadow: var(--elev-2);
      transform: translateY(-1px);
      opacity: 1;
    }

    .map-pin-far {
      width: 118px;
      min-height: 48px;
      padding: 6px 8px;
      justify-content: center;
      opacity: 1;
      border-color: rgba(124,58,237,.58);
      box-shadow: var(--elev-2);
    }

    /* Off-screen places of the focused episode (desktop): the pill itself
       waits translucent and softly pulsing at the viewport edge, tied to the
       card by its (equally pulsing) connector line. Both settle into the
       normal pill + leader once the real spot is panned into view. */
    @keyframes mapEdgeHintPulse {
      0%, 100% { opacity: .45; }
      50% { opacity: .95; }
    }
    .map-pin-edge,
    .map-offscreen-connector-line {
      animation: mapEdgeHintPulse 2400ms ease-in-out infinite;
    }
    @media (prefers-reduced-motion: reduce) {
      .map-pin-edge,
      .map-offscreen-connector-line {
        animation: none;
        opacity: .65;
      }
    }

    /* Dark basemap swallows the muted violet — lift the sibling outlines.
       Stroke only: a CSS fill would override the fill="none" attribute on
       LINE geometries (routes) and fill the open path into a giant wedge. */
    :root[data-theme='dark'] .map-sibling-area-outline {
      stroke: #a78bfa;
      stroke-opacity: .7;
    }

    .map-line-ride {
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      /* Halo keeps the vehicle readable on both basemap themes. */
      filter: drop-shadow(0 0 3px rgba(255,255,255,.65)) drop-shadow(0 2px 3px rgba(0,0,0,.4));
    }

    .map-pin-background {
      opacity: .22;
      box-shadow: var(--elev-1);
    }

    /* Focus mode: foreign episodes as small dots (replaces dimmed cards). */
    .map-ghost-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: rgba(124, 58, 237, .26);
      border: 2px solid rgba(124, 58, 237, .42);
      box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    }
    :root[data-theme='dark'] .map-ghost-dot {
      background: rgba(167, 139, 250, .28);
      border-color: rgba(167, 139, 250, .48);
    }

    .map-pin-related {
      border-color: rgba(124,58,237,.58);
      box-shadow: var(--elev-2);
      transform: translateY(-1px);
    }

    .map-pin-related .map-pin-title {
      color: #111827;
      font-weight: 800;
    }

    .map-pin-place-only {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      min-height: 30px;
      font-size: 11px;
      font-weight: 800;
      line-height: 1.2;
      text-align: center;
      color: #111827;
      white-space: normal;
      word-break: break-word;
    }

    .map-pin-expanded .map-pin-title {
      font-size: 13px;
      text-align: left;
      white-space: normal;
      line-height: 1.22;
      overflow: visible;
      max-height: none;
      flex: 0 0 auto;
    }

    .map-pin-expanded .map-pin-img {
      height: 94px;
      border-radius: 8px;
    }

    .map-pin-meta {
      display: grid;
      gap: 6px;
      font-size: 12px;
      color: #374151;
      line-height: 1.32;
    }

    .map-pin-event-title {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .01em;
      color: #7c2d12;
    }

    .map-pin-place-line {
      font-size: 11px;
      font-weight: 700;
      color: #1f2937;
    }

    .map-pin-place {
      font-size: 10px;
      font-weight: 700;
      color: #1f2937;
      text-align: center;
      margin-top: 2px;
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .map-pin-place-chip {
      align-self: stretch;
      /* Centered like the title above it — the grid layout was a leftover
         from the removed pin glyph column. */
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      gap: 4px;
      width: 100%;
      min-height: 24px;
      padding: 4px 7px;
      border-radius: 10px;
      background: rgba(15,23,42,.07);
      color: #1f2937;
      font-size: 10px;
      font-weight: 700;
      line-height: 1.15;
      white-space: normal;
      overflow: hidden;
      text-overflow: clip;
      box-sizing: border-box;
    }

    .map-pin-place-chip-text {
      min-width: 0;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      overflow: hidden;
      word-break: break-word;
    }

    .map-pin-tag {
      display: inline-block;
      width: fit-content;
      background: color-mix(in srgb, var(--brand-gold) 86%, #fff 14%);
      color: #111827;
      font-size: 11px;
      font-weight: 700;
      border-radius: 999px;
      padding: 2px 8px;
    }

    .map-pin-related-places {
      display: grid;
      gap: 6px;
      margin-top: 4px;
      padding-top: 6px;
      border-top: 1px solid rgba(0,0,0,.08);
    }

    .map-pin-related-places-label {
      font-size: 10px;
      font-weight: 800;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: .04em;
    }

    .map-pin-related-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .map-pin-related-chip {
      appearance: none;
      border: 1px solid rgba(124,58,237,.28);
      background: rgba(124,58,237,.08);
      color: #1f2937;
      border-radius: 999px;
      padding: 3px 8px;
      font-size: 11px;
      line-height: 1.2;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .map-pin-related-chip:hover {
      background: rgba(124,58,237,.14);
    }

    /* Card footer: one segmented bar, actions as equal halves. */
    .map-pin-actions {
      display: flex;
      margin-top: 10px;
      border: 1px solid rgba(230,166,28,.55);
      border-radius: 999px;
      overflow: hidden;
    }

    .map-pin-action-link {
      flex: 1 1 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      background: rgba(230,166,28,.14);
      color: #1f2937;
      padding: 6px 8px;
      font-size: 11px;
      font-weight: 600;
      line-height: 1.2;
      text-decoration: none;
      white-space: nowrap;
    }

    .map-pin-action-link + .map-pin-action-link {
      border-left: 1px solid rgba(230,166,28,.45);
    }

    .map-pin-action-link:hover {
      background: rgba(230,166,28,.26);
    }

    .map-pin-related-chip.is-active {
      background: rgba(230,166,28,.18);
      border-color: rgba(230,166,28,.55);
      font-weight: 700;
    }

    .map-pin-related-chip-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: rgba(107,63,209,.88);
      flex: 0 0 auto;
    }

    .map-pin-related-chip.is-far .map-pin-related-chip-dot {
      box-shadow: 0 0 0 0 rgba(107,63,209,.28);
      animation: atlasChipPulse 2.6s ease-out infinite;
    }

    .map-pin-snippet {
      color: #1f2937;
      display: block;
      overflow: visible;
      white-space: normal;
      padding: 8px 9px;
      border-radius: 10px;
      background: rgba(15,23,42,.06);
      line-height: 1.4;
      font-size: 12px;
    }

    .marker-cluster-small,
    .marker-cluster-medium,
    .marker-cluster-large {
      background: color-mix(in srgb, var(--brand-gold) 28%, transparent) !important;
    }

    .marker-cluster-small div,
    .marker-cluster-medium div,
    .marker-cluster-large div {
      background: color-mix(in srgb, var(--brand-gold) 78%, #fff 22%) !important;
      color: #1f2937 !important;
      font-weight: 800;
      border: 1px solid rgba(0,0,0,.12);
      box-shadow: var(--elev-1);
    }

    :root[data-theme='dark'] .map-pin {
      background: #171a20;
      border-color: rgba(230,166,28,.48);
      box-shadow: var(--elev-3);
    }
    :root[data-theme='dark'] .map-pin-near,
    :root[data-theme='dark'] .map-pin-far {
      border-color: rgba(167,139,250,.55);
    }
    :root[data-theme='dark'] .map-pin::after {
      border-color: #171a20 transparent transparent transparent;
    }
    :root[data-theme='dark'] .map-pin-title {
      color: #e5e7eb;
    }
    :root[data-theme='dark'] .map-pin-img {
      background: #2a303b;
    }
    :root[data-theme='dark'] .map-pin-related-chip {
      color: #e5e7eb;
      background: rgba(124,58,237,.16);
      border-color: rgba(167,139,250,.38);
    }
    :root[data-theme='dark'] .map-pin-actions {
      border-color: rgba(230,166,28,.45);
    }
    :root[data-theme='dark'] .map-pin-action-link {
      color: #f3f4f6;
      background: rgba(230,166,28,.18);
    }
    :root[data-theme='dark'] .map-pin-action-link + .map-pin-action-link {
      border-left-color: rgba(230,166,28,.4);
    }
    :root[data-theme='dark'] .map-pin-action-link:hover {
      background: rgba(230,166,28,.3);
    }
    :root[data-theme='dark'] .map-pin-expanded::after {
      border-color: #171a20;
    }
    :root[data-theme='dark'] .map-pin-place-only {
      color: #f3f4f6;
    }
    :root[data-theme='dark'] .map-pin-related-chip.is-active {
      background: rgba(230,166,28,.18);
      border-color: rgba(230,166,28,.48);
    }
    :root[data-theme='dark'] .map-pin-related-places {
      border-top-color: rgba(255,255,255,.08);
    }
    :root[data-theme='dark'] .map-pin-related-places-label {
      color: #aeb6c5;
    }
    :root[data-theme='dark'] .map-pin-meta {
      color: #c7cfda;
    }
    :root[data-theme='dark'] .map-pin-event-title {
      color: #fdba74;
    }
    :root[data-theme='dark'] .map-pin-place-line {
      color: #eef2ff;
    }
    :root[data-theme='dark'] .map-pin-place {
      color: #e8ecf4;
    }
    :root[data-theme='dark'] .map-pin-place-chip {
      background: rgba(255,255,255,.08);
      color: #e8ecf4;
    }
    :root[data-theme='dark'] .map-pin-snippet {
      color: #d7ddea;
      background: rgba(255,255,255,.06);
    }
    :root[data-theme='dark'] .map-pin-related {
      border-color: rgba(167,139,250,.55);
      box-shadow: var(--elev-2);
    }
    :root[data-theme='dark'] .marker-cluster-small,
    :root[data-theme='dark'] .marker-cluster-medium,
    :root[data-theme='dark'] .marker-cluster-large {
      background: rgba(124,58,237,.32) !important;
    }
    :root[data-theme='dark'] .marker-cluster-small div,
    :root[data-theme='dark'] .marker-cluster-medium div,
    :root[data-theme='dark'] .marker-cluster-large div {
      background: color-mix(in srgb, #7c3aed 60%, #0b1220 40%) !important;
      color: #e9e7ff !important;
      border-color: rgba(167,139,250,.55);
      box-shadow: var(--elev-2);
    }

    .map-area-overlay {
      pointer-events: none;
    }

    .map-offscreen-connector-line,
    .map-visible-sibling-connector-line {
      pointer-events: none;
      animation: atlasOffscreenConnectorPulse 1.45s ease-in-out infinite;
      filter: drop-shadow(0 0 3px rgba(107,63,209,.32));
    }

    .map-visible-sibling-connector-line {
      animation-duration: 1.7s;
      filter: drop-shadow(0 0 2px rgba(107,63,209,.22));
    }

    @keyframes atlasOffscreenConnectorPulse {
      0%, 100% {
        opacity: .26;
        stroke-width: 2.2;
        stroke-dashoffset: 0;
      }
      50% {
        opacity: .98;
        stroke-width: 3.6;
        stroke-dashoffset: -8;
      }
    }

    #globalMap.map-focus-mode .marker-cluster {
      opacity: 0 !important;
      pointer-events: none !important;
      transition: opacity .18s ease;
    }

    .map-pin-pulse-ring {
      position: absolute;
      inset: -10px;
      border-radius: 999px;
      border: 1.5px solid rgba(124,58,237,.34);
      opacity: 0;
      transform: scale(1);
      pointer-events: none;
    }

    .map-pin-far.is-pulsing .map-pin-pulse-ring {
      animation: atlasPulse 2400ms ease-out infinite;
      animation-delay: var(--pulse-delay, 0ms);
    }

    @keyframes atlasPulse {
      0% { opacity: 0; transform: scale(1); }
      18% { opacity: .2; }
      100% { opacity: 0; transform: scale(1.18); }
    }

    @keyframes atlasChipPulse {
      0% { box-shadow: 0 0 0 0 rgba(107,63,209,.28); }
      100% { box-shadow: 0 0 0 7px rgba(107,63,209,0); }
    }

    /* Selected PLACE pill stays in the place color (violet, stronger +
       ring) — gold now marks episodes, and a gold selected pill read as
       just another episode pin. */
    .map-pin-selected {
      border-color: rgba(124,58,237,.9);
      box-shadow: 0 0 0 2px rgba(124,58,237,.32), var(--elev-2);
    }
    :root[data-theme='dark'] .map-pin-selected {
      border-color: rgba(167,139,250,.9);
      box-shadow: 0 0 0 2px rgba(167,139,250,.32), var(--elev-3);
    }

    .map-sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 1300;
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      color: var(--text-main);
      border-top: 1px solid var(--border-color);
      border-radius: 16px 16px 0 0;
      box-shadow: 0 -12px 34px rgba(0,0,0,.3);
      max-height: min(52svh, 480px);
      padding-bottom: max(10px, env(safe-area-inset-bottom));
      transform: translateY(105%);
      visibility: hidden;
      transition: transform .28s cubic-bezier(.32,.72,.28,1), visibility 0s .28s;
    }

    .map-sheet.is-open {
      transform: translateY(0);
      visibility: visible;
      transition: transform .28s cubic-bezier(.32,.72,.28,1);
    }

    .map-sheet-grip {
      flex: 0 0 auto;
      padding: 10px 0 8px;
      display: flex;
      justify-content: center;
      touch-action: none;
      cursor: grab;
    }

    .map-sheet-grip::before {
      content: "";
      width: 44px;
      height: 5px;
      border-radius: 999px;
      background: color-mix(in srgb, var(--text-meta) 45%, transparent);
    }

    .map-sheet-close {
      position: absolute;
      top: 10px;
      right: 12px;
      width: 36px;
      height: 36px;
      border: 0;
      border-radius: 50%;
      background: color-mix(in srgb, var(--text-meta) 16%, transparent);
      color: var(--text-main);
      font-size: 15px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .map-sheet-content {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 2px 16px 14px;
      display: grid;
      gap: 10px;
    }

    .map-sheet .map-pin-title {
      font-size: 16px;
      font-weight: 800;
      line-height: 1.25;
      text-align: left;
      padding-right: 40px;
    }

    /* Sheet head: small thumb left with the episode title inline next to
       it (mirrors the timeline cards) instead of a full-width hero image. */
    .map-sheet-content {
      grid-template-columns: 72px minmax(0, 1fr);
      align-items: start;
    }
    .map-sheet-content > .map-pin-img {
      grid-column: 1;
      grid-row: 1;
      width: 72px;
      height: 72px;
      object-fit: contain;
      border-radius: 10px;
      align-self: center;
    }
    .map-sheet-content > .map-pin-title {
      grid-column: 2;
      grid-row: 1;
      align-self: center;
    }
    .map-sheet-content > .map-pin-meta { grid-column: 1 / -1; }

    .map-sheet .map-pin-meta { font-size: 13px; }
    .map-sheet .map-pin-event-title { font-size: 12px; }
    .map-sheet .map-pin-place-line { font-size: 13px; }
    .map-sheet .map-pin-snippet { font-size: 13px; }
    .map-sheet .map-pin-related-chip { padding: 7px 12px; font-size: 13px; }

    .map-pin:focus-visible {
      outline: 3px solid var(--brand-gold);
      outline-offset: 2px;
    }

    .map-sheet-close:focus-visible,
    .map-theme-btn:focus-visible,
    .timeline-btn:focus-visible,
    .map-pin-related-chip:focus-visible {
      outline: 3px solid var(--brand-gold);
      outline-offset: 2px;
    }

    @media (prefers-reduced-motion: reduce) {
      .map-pin,
      .map-sheet,
      .map-logo-link img {
        transition: none !important;
      }
      .map-pin-far.is-pulsing .map-pin-pulse-ring,
      .map-offscreen-connector-line,
      .map-visible-sibling-connector-line,
      .map-pin-related-chip.is-far .map-pin-related-chip-dot {
        animation: none !important;
      }
    }

    .embedded-mode .theme-toggle-global { display: none !important; }
    .embedded-mode .map-topbar { display: none !important; }
    /* Standalone round buttons (theme, timeline switch) are noise inside an
       embed — and the timeline link would navigate the iframe itself. */
    .embedded-mode .map-theme-btn { display: none !important; }
    .embedded-mode .timeline-btn { display: none !important; }

    /* Atlas-Quiz (Easter Egg): Suche/Chronik/Info weichen dem Spielpanel. */
    .is-quiz .map-search-wrap,
    .is-quiz .timeline-btn:not(.map-info-btn),
    .is-quiz .map-info-btn,
    .is-quiz .map-info-popover { display: none !important; }
    .map-quiz-pin {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--brand-gold, #e6a61c);
      color: #1a1a1a;
      font: 800 20px/1 var(--font-body, Georgia, serif);
      border: 3px solid #fff;
      box-shadow: 0 3px 10px rgba(0,0,0,.35);
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      animation: map-quiz-pin-pulse 1.8s ease-in-out infinite;
    }
    @keyframes map-quiz-pin-pulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.12); }
    }
    @media (prefers-reduced-motion: reduce) { .map-quiz-pin { animation: none; } }
    .leaflet-tooltip.map-quiz-tooltip {
      white-space: normal;
      width: min(300px, calc(100vw - 40px));
      padding: 12px 14px;
      border-radius: 14px;
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow-lift);
      line-height: 1.4;
      font-family: var(--font-ui);
    }
    .leaflet-tooltip-top.map-quiz-tooltip::before { border-top-color: var(--bg-card); }
    .map-quiz-tip-title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
    .map-quiz-tip-text { font-family: var(--font-body); font-size: .9rem; color: var(--text-meta); margin-bottom: 10px; }
    .map-quiz-tip-count {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: .82rem;
      font-weight: 600;
      color: var(--brand-gold);
      padding-top: 8px;
      border-top: 1px solid var(--border-color);
    }
    .map-quiz-tip-dots { display: inline-flex; gap: 4px; }
    .map-quiz-tip-dots i {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      border: 1.5px solid var(--brand-gold);
      background: transparent;
    }
    .map-quiz-tip-dots i.is-on { background: var(--brand-gold); }
    .embedded-mode .map-info-btn { display: none !important; }

    /* Static attribution (replaces Leaflet's control — see PHP head comment).
       Styled like leaflet-control-attribution, painted with the first frame. */
    .map-attribution {
      position: fixed;
      bottom: 0;
      right: 0;
      z-index: 900;
      background: rgba(255, 255, 255, 0.8);
      padding: 0 5px;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
      font-size: 11px;
      line-height: 1.4;
      color: #333;
    }
    .map-attribution a { color: #0078a8; }
    /* Das Große Erdbeben: Vor- und Hauptstöße, dann Abklingen. */
    @keyframes map-quake {
      0% { transform: translate3d(0,0,0); }
      5% { transform: translate3d(-4px,2px,0) rotate(-0.15deg); }
      10% { transform: translate3d(6px,-4px,0) rotate(0.3deg); }
      16% { transform: translate3d(-11px,6px,0) rotate(-0.5deg); }
      22% { transform: translate3d(12px,-7px,0) rotate(0.55deg); }
      28% { transform: translate3d(-10px,5px,0) rotate(-0.45deg); }
      36% { transform: translate3d(8px,4px,0) rotate(0.35deg); }
      44% { transform: translate3d(-6px,-4px,0) rotate(-0.25deg); }
      54% { transform: translate3d(5px,3px,0) rotate(0.2deg); }
      64% { transform: translate3d(-4px,-2px,0) rotate(-0.15deg); }
      74% { transform: translate3d(3px,2px,0) rotate(0.1deg); }
      84% { transform: translate3d(-2px,-1px,0); }
      92% { transform: translate3d(1px,1px,0); }
      100% { transform: translate3d(0,0,0); }
    }
    #globalMap.map-quake { animation: map-quake 2.7s cubic-bezier(.36,.07,.19,.97); }
    /* Das Zoom-Control weicht dem Episoden-Sheet aus (mobil): hochsliden
       wenn das Sheet öffnet, zurück wenn es schließt. */
    .leaflet-control-zoom { transition: transform .28s ease; }
    .map-attribution .leaflet-attribution-flag {
      display: inline !important;
      vertical-align: baseline !important;
      width: 1em;
      height: 0.6669em;
    }

    @media (max-width: 700px) {
      #globalMap {
        height: 100svh;
        min-height: 100svh;
      }
      /* Long credits wrap across the whole bottom on phones and painted
         over the Maptoolkit logo (bottom-left) — keep that corner clear. */
      .map-attribution {
        max-width: calc(100vw - 104px);
      }

      .map-topbar {
        top: 8px;
        left: 8px;
        right: 148px;
        width: auto;
        max-width: none;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px;
      }
      .map-logo-link img { height: 38px; }
      .map-search-wrap { min-width: 0; }
      /* 16px input font prevents iOS Safari zoom-on-focus */
      .map-search-input { padding: 10px 14px 10px 39px; font-size: 16px; }
      .map-theme-btn,
      .timeline-btn {
        top: 10px;
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
      }
      .map-theme-btn { right: 54px; }
      .timeline-btn { right: 8px; }
      .map-info-btn { right: 100px; }
      .map-info-popover .map-info-mobile-hint { display: block; }
      .map-pin-expanded { width: 190px; min-height: 194px; max-height: 320px; }
      .map-pin-expanded .map-pin-img { height: 74px; }
      .map-pin-expanded .map-pin-title { font-size: 12px; line-height: 1.2; max-height: none; }
      .map-pin-meta { font-size: 11px; }
    }
