/* Vereins-Widget (embed.html). Eigenes, schlankes Blatt statt style.css:
   das Widget lebt in einem fremden Iframe und braucht von der Karte nur
   Tokens, Reiter und die Anzeige am Zeiger. --brand setzt embed.js aus der
   Vereinsfarbe. */
:root {
  --bg: #fff;
  --fg: #1c1f23;
  --dim: #6a7178;
  --line: rgba(0, 0, 0, .12);
  --brand: #2f6fb0;
  --brand-fg: #fff;
  --shadow: 0 2px 14px rgba(0, 0, 0, .22);
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1e22;
    --fg: #e9edf1;
    --dim: #9aa3ab;
    --line: rgba(255, 255, 255, .15);
    --shadow: 0 2px 16px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #1b1e22;
  --fg: #e9edf1;
  --dim: #9aa3ab;
  --line: rgba(255, 255, 255, .15);
  --shadow: 0 2px 16px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.dim { color: var(--dim); }
.small { font-size: 12px; }

.em-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 10px; border-bottom: 3px solid var(--brand);
}
.em-brand {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  color: inherit; text-decoration: none; font-weight: 600; font-size: 15px;
}
.em-brand:not([href]) { cursor: default; }
.em-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Logos kommen in jedem Seitenverhältnis — die Höhe ist fest, die Breite
   gedeckelt, damit ein Querformat nicht den Namen verdrängt. */
.em-brand img { height: 34px; max-width: 140px; object-fit: contain; flex: none; }
.em-brand img[hidden] { display: none; }

.em-views { display: flex; gap: 2px; flex: none; }
.em-views[hidden] { display: none; }

.em-tabs { flex: none; display: flex; gap: 4px; flex-wrap: wrap; padding: 6px 10px 0; }
.em-tabs[hidden] { display: none; }
.em-tabs button, .em-views button {
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  border-radius: 7px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer;
  display: flex; gap: 4px; align-items: baseline;
}
.em-tabs button:hover, .em-views button:hover { border-color: var(--brand); }
.em-tabs button[aria-selected="true"], .em-views button[aria-selected="true"] {
  background: var(--brand); border-color: var(--brand); color: var(--brand-fg); font-weight: 600;
}
.em-tabs button[aria-selected="true"] .dim { color: inherit; opacity: .75; }

main { flex: 1 1 0; min-height: 0; position: relative; display: flex; }
.em-pane { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.em-pane[hidden] { display: none; }

.em-site { flex: none; padding: 4px 10px 0; }
.em-canvas-box { flex: 1 1 0; min-height: 0; position: relative; margin: 0 6px; }
#em-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.em-legend {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 3px 10px 4px;
}
.em-scale { display: inline-flex; border-radius: 3px; overflow: hidden; }
.em-scale i { font-style: normal; color: #fff; font-size: 10px; padding: 1px 5px;
  text-shadow: 0 0 2px rgba(0, 0, 0, .45); }
.em-scale[hidden], .em-legend [hidden] { display: none; }

/* Anzeige am Zeiger — dieselbe wie auf der Karte (style.css). */
.mg-tip {
  position: absolute; z-index: 3; pointer-events: none;
  width: max-content; max-width: min(320px, 80vw); padding: 6px 9px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  line-height: 1.4; font-variant-numeric: tabular-nums;
}
.mg-tip[hidden] { display: none; }
.mg-tip > div:empty { display: none; }
.mg-tip-head { font-weight: 600; display: flex; gap: 7px; align-items: baseline; }
.mg-tip-head .dim { font-weight: 400; }
.mg-tip-wind { display: flex; align-items: baseline; gap: 5px; margin: 1px 0 2px; }
.mg-tip-wind b { font-size: 15px; }
.mg-tip-wind i { width: 9px; height: 9px; border-radius: 2px; flex: none; align-self: center; }
#mg-cursor { position: absolute; top: 0; bottom: 0; z-index: 2; width: 1px;
  pointer-events: none; background: var(--brand); opacity: .45; }
#mg-cursor[hidden] { display: none; }

/* ---- Windpfeile ---- */
.em-map-box { flex: 1 1 0; min-height: 0; position: relative; display: flex; }
#em-map { flex: 1 1 0; min-width: 0; background: #dde2e6; }
.basemap-shade { mix-blend-mode: multiply; }
/* Farbskala auf der Karte statt als eigene Zeile darunter — oben rechts,
   gegenüber dem Zoom; unten bleibt der Platz der Quellenangabe. */
.em-map-legend {
  position: absolute; right: 8px; top: 8px; z-index: 500; pointer-events: none;
  display: flex; align-items: center; gap: 5px; padding: 3px 6px 3px 3px;
  background: rgba(255, 255, 255, .85); color: #1c1f23; border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.em-wind-bar { flex: none; padding-bottom: 6px; }
/* Flächen links, Tage rechts in einer Zeile; wird es eng, bricht sie um. */
.em-wind-sel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 12px; padding: 6px 10px 0;
}
.em-wind-sel .em-tabs { padding: 0; }
/* Flächen als zusammenhängender Umschalter */
.em-seg { gap: 0; }
.em-seg button { border-radius: 0; margin-left: -1px; }
.em-seg button:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.em-seg button:last-child { border-radius: 0 7px 7px 0; }
.em-seg button:only-child { border-radius: 7px; }
.em-seg button:hover, .em-seg button[aria-selected="true"] { position: relative; }
.em-slider { display: flex; align-items: center; gap: 8px; padding: 6px 10px 0; }
.em-slider input { flex: 1 1 auto; accent-color: var(--brand); min-width: 0; margin: 0; }
.em-slider output { flex: none; min-width: 7.5em; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 600; }
.em-play { flex: none; width: 28px; height: 28px; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--fg); cursor: pointer; }
.em-play svg { width: 12px; height: 12px; fill: currentColor; }
.em-play:hover { border-color: var(--brand); }
.em-play[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: var(--brand-fg); }
.em-play:focus-visible, .em-tabs button:focus-visible, .em-views button:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; }
/* Schalter Live-Verkehr: roter Punkt wie bei einer Übertragung, aus = grau */
.em-chip { flex: none; display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: transparent; color: var(--dim);
  border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer;
  font-variant-numeric: tabular-nums; }
.em-chip[hidden] { display: none; }
.em-chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }
.em-chip:hover { border-color: var(--brand); }
.em-chip[aria-pressed="true"] { color: var(--fg); border-color: var(--brand); }
.em-chip[aria-pressed="true"] i { background: #d63b2f; opacity: 1;
  animation: em-live 2s ease-in-out infinite; }
@keyframes em-live { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .em-chip[aria-pressed="true"] i { animation: none; } }
.em-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Tagesreiter des Meteogramms mit Abspielknopf davor */
.em-row { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px 0; }
.em-row .em-tabs { padding: 0; }
.em-3d { margin-left: auto; text-decoration: none; color: var(--fg); }
/* 3D-Ansicht: die Seite wind3d.html im eigenen Rahmen, unter Kopf und Logo */
.em-3d-frame { flex: 1 1 0; min-height: 0; width: 100%; border: 0; display: block;
  background: #0e141b; }
/* Beim Durchschalten: Strich unter dem gewählten Tag, bis der nächste kommt */
.em-days.playing button[aria-selected="true"] { position: relative; overflow: hidden; }
.em-days.playing button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px;
  width: calc(var(--progress, 0) * 100%); background: var(--brand-fg); opacity: .7;
}
/* Die Strömung (windlayer.js) liegt als Canvas in der Overlay-Ebene. */
.wind-canvas { pointer-events: none; }

.em-place-label {
  background: rgba(255, 255, 255, .92); border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  color: #1c1f23; font: 11px/1.2 system-ui, sans-serif; padding: 2px 5px;
  font-variant-numeric: tabular-nums;
}
.em-place-label b { display: block; font-weight: 600; }
.em-place-label span { display: block; font-size: 10px; color: #4a5158; }
.em-place-label.em-label-diag::before { display: none; }
/* Kein Platz frei (layoutLabels in embed.js): erst am Zeiger sichtbar.
   !important, weil Leaflet die Deckkraft als Inline-Stil setzt. */
.em-place-label.em-label-hidden { opacity: 0 !important; }
.em-place-label.em-label-hidden.em-label-hover { opacity: 1 !important; z-index: 1; }

.em-msg { position: absolute; inset: 0; margin: 0; display: flex; align-items: center;
  justify-content: center; text-align: center; padding: 20px; color: var(--dim);
  background: var(--bg); }
.em-msg[hidden] { display: none; }

.em-foot {
  flex: none; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 3px 10px 5px; border-top: 1px solid var(--line);
}
.em-foot a { color: inherit; text-decoration: none; }
.em-foot a:hover { color: var(--brand); }

/* Sehr schmale Einbettungen (Seitenleiste): Name kürzer, Legende knapper */
@media (max-width: 420px) {
  .em-brand { font-size: 13px; }
  .em-brand img { height: 28px; max-width: 96px; }
  #em-window-label { display: none; }
  .em-slider output { min-width: 0; }
}
