:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #ffffff;
  --panel: #f8fafc;
  --panel-2: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --bot: #f1f5f9;
  --user: #2563eb;
  --ok: #16a34a;
  --line: #e2e8f0;
  --radius: 18px;
  font-synthesis: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

/* Shell: mobil = nur die Chat-App (zentriert, schmal). Desktop/Querformat =
   zweispaltig, links Chat, rechts das Live-Cockpit. */
.shell { height: 100dvh; display: flex; }

.app {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  min-width: 0;
}

/* ---- Embed-Modus (iframe in der rallyeapp.de-Hero) ----
   Eigene Marketing-Navi weg (die Eltern-Seite hat schon einen Header); die App
   füllt den iframe komplett (kein reservierter Header-Platz auf Mobil). */
.embed #homeHeader { display: none !important; }
.embed #welcomeScrollBtn { display: none !important; }
/* html.embed + !important, damit die 0 die Basis-Definition (gleiche Specificity) sicher schlägt. */
html.embed { --mobile-header-space: 0px !important; }

/* ---- Inline-Auth-Karte (Account-Übergabe im Chat) ---- */
.authcard { align-self: stretch; margin: 6px 0 2px; }
.authcard__form { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid rgba(15,23,42,.1); border-radius: 16px; padding: 14px; box-shadow: 0 8px 28px rgba(15,23,42,.10); }
.authcard__tabs { display: flex; gap: 6px; }
.authcard__tab { flex: 1; padding: 8px 10px; border: 0; border-radius: 10px; background: #eef2f7; color: #475569; font-weight: 700; font-size: 13px; cursor: pointer; }
.authcard__tab.is-active { background: var(--blue, #1f6feb); color: #fff; }
.authcard__input { width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid rgba(15,23,42,.16); border-radius: 10px; font-size: 15px; background: #fff; color: #0f172a; }
.authcard__input:focus { outline: none; border-color: var(--blue, #1f6feb); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.authcard__terms { font-size: 12px; color: #64748b; display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; }
.authcard__terms a { color: var(--blue, #1f6feb); }
.authcard__submit { padding: 12px; border: 0; border-radius: 12px; background: var(--blue, #1f6feb); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.authcard__submit:disabled { opacity: .6; cursor: default; }
.authcard__link { background: none; border: 0; color: #64748b; font-size: 12px; cursor: pointer; text-decoration: underline; align-self: center; }
.authcard__err { font-size: 13px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; }
.authcard__err.is-ok { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.authcard.is-done .authcard__form { opacity: .55; }

/* ---- Live-Cockpit (nur Desktop/Querformat) ---- */
.cockpit { display: none; }

@media (min-width: 940px) {
  .shell {
    width: 100vw;
    max-width: none;
    margin: 0;
    height: 100vh;
    position: relative;
    overflow: hidden;
  }
  .app {
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 20px;
    height: auto !important;
    width: clamp(380px, 30vw, 480px);
    z-index: 10;
    background: transparent !important;
    border-right: none !important;
    display: flex;
    flex-direction: column;
    pointer-events: none;
  }
  .app > * {
    pointer-events: auto;
  }
  .cockpit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    gap: 0;
  }
}

.cockpit__head { display: flex; align-items: center; min-height: 76px; padding: 0 clamp(22px, 3vw, 48px); border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(9,13,18,.86); backdrop-filter: blur(14px); }
.cockpit__titles { flex: 1; min-width: 0; }
.cockpit__titles strong { display: block; font-size: clamp(24px, 2.1vw, 34px); line-height: 1.08; letter-spacing: 0; }

.cockpit__mapslot {
  position: relative; height: 290px; overflow: hidden;
  border: 0; background: #0b1016; flex-shrink: 0;
}
@media (min-width: 940px) {
  .cockpit__mapslot { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 0; }
}
.cockpit__mapempty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 0 24px; color: var(--muted); font-size: 13px;
}
.cockpit__mapslot:has(.mappanel.open) .cockpit__mapempty { display: none; }
/* Karte füllt den Cockpit-Slot (statt der mobilen 230px-Banner-Höhe). */
.cockpit .mappanel { border-bottom: none; }
.cockpit .mappanel:not(.open) { display: none; }
.cockpit .mappanel.open { position: absolute; inset: 0; height: 100% !important; }

.cockpit__section { display: flex; flex-direction: column; gap: 10px; }
.cockpit__section[hidden] { display: none; }
.cockpit__hd {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.cockpit__bar { width: 4px; height: 15px; border-radius: 2px; background: var(--blue); }

.cockpit__scopes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.scope {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  background: rgba(22,27,34,.72); border: 1px solid var(--line); border-radius: 10px; animation: pop .3s ease both;
}
.scope__icon { font-size: 17px; line-height: 1.3; flex-shrink: 0; }
.scope__body { min-width: 0; }
.scope__k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.scope__v { font-size: 14px; font-weight: 700; margin-top: 1px; overflow-wrap: anywhere; }
.scope--accent { border-color: rgba(31,111,235,.5); background: rgba(31,111,235,.1); }

.cockpit__stations { display: flex; flex-direction: column; gap: 0; }
.cockpit__empty {
  padding: 16px; text-align: center; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line); border-radius: 13px;
}

/* Interaktive Stations-Karten im Cockpit */
.ck-st { align-items: flex-start; transition: opacity .2s; }
.ck-st--struck { opacity: .45; }
.ck-st--dragging { opacity: .4; outline: 2px dashed var(--blue); outline-offset: -2px; }
.ck-grip {
  align-self: center; flex-shrink: 0; background: none; border: none; color: var(--muted);
  font-size: 15px; line-height: 1; cursor: grab; padding: 0 2px; touch-action: none;
}
.ck-grip:active { cursor: grabbing; }
.ck-st--struck .scard__title { text-decoration: line-through; text-decoration-color: var(--muted); }
.ck-st__btns { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.ck-ibtn {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; cursor: pointer; display: grid; place-items: center; transition: all .12s;
}
.ck-ibtn:hover { color: var(--text); border-color: #3a4656; background: var(--panel-2); }
.ck-ibtn--del:hover { color: #ff6b81; border-color: #ff6b81; background: rgba(224,69,123,.12); }
.ck-ibtn--play { color: #9ec5ff; font-size: 11px; }
.ck-ibtn--play:hover { color: #fff; border-color: var(--blue); background: rgba(31,111,235,.18); }
.ck-ibtn:active { transform: scale(.9); }
.ck-st__blurb { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; animation: pop .2s ease; }
.ck-st__muted { font-style: italic; opacity: .8; }

/* Stationstyp-Dropdown (am fertigen Entwurf) */
.ck-st__ctrl { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ck-typesel {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 8px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.ck-typesel:focus { outline: none; border-color: var(--blue); }
.ck-typesel--changed { border-color: #d6a01f; color: #f0c34c; }
.ck-st--changed { border-color: rgba(214,160,31,.5); }
.ck-st__chg { font-size: 10.5px; font-weight: 700; color: #f0c34c; text-transform: uppercase; letter-spacing: .04em; }
.ck-letter { font-size: 11px; font-weight: 800; color: #9ec5ff; background: rgba(31,111,235,.16); border: 1px solid rgba(31,111,235,.4); border-radius: 6px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }

/* Wegstück zwischen zwei Stationen */
.ck-leg { display: flex; justify-content: center; padding: 3px 0; }
.ck-leg span {
  font-size: 11px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}

/* Aktionsleiste fürs gebündelte Streichen */
.ck-actionbar {
  position: sticky; bottom: 0; margin-top: 10px; display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); animation: pop .25s ease;
}
.ck-actionbar__txt { flex: 1; font-size: 13px; font-weight: 700; }
.ck-send {
  background: var(--blue); border: 1px solid var(--blue); color: #fff; font-weight: 700;
  font-size: 13.5px; padding: 9px 14px; border-radius: 11px; cursor: pointer;
}
.ck-send:active { transform: scale(.96); }
.ck-reset {
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  width: 36px; height: 36px; border-radius: 11px; font-size: 15px; cursor: pointer;
}

/* ---- Stationsvorschau: echte Spiel-Vorschau im iframe (Telefon-Rahmen) ---- */
.sp-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.sp-backdrop { position: absolute; inset: 0; background: rgba(6,9,13,.72); backdrop-filter: blur(3px); animation: pop .15s ease; }
.sp-phone { position: relative; width: min(430px, 94vw); height: min(840px, 92vh); border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0,0,0,.55); background: #fff; animation: pop .2s ease; }
.sp-iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Split-Vorschau: Karte links, echte Stationsvorschau rechts (Marker-Klick) */
.cockpit__mapslot--split { flex: 1 1 auto; height: auto; min-height: 0; }
.cockpit__mapslot--split .mappanel.open { position: absolute; inset: 0; height: 100% !important; }
.sp-mapside { position: relative; flex: 0 0 46%; min-width: 280px; border-left: 1px solid var(--line); background: #fff; animation: pop .2s ease; }
.sp-mapside__frame { width: 100%; height: 100%; border: 0; display: block; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px calc(14px); gap: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar strong { display: block; font-size: 16px; letter-spacing: 0; }
.topbar__reset {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  width: 36px; height: 36px; border-radius: 10px; font-size: 17px; cursor: pointer;
}
.topbar__reset:active { transform: scale(.94); }

/* Map */
.mappanel { position: relative; height: 0; overflow: hidden; transition: height .45s cubic-bezier(.2,.8,.2,1); border-bottom: 1px solid var(--line); }
.mappanel.open { height: clamp(220px, 36dvh, 310px); }
#map { width: 100%; height: 100%; background: #f8fafc; }
.leaflet-container { background: #f8fafc; }
.mapchip {
  position: absolute; left: 10px; bottom: 10px; z-index: 500;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--text);
  padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.manual-tools {
  position: absolute; top: 92px; right: 18px; z-index: 620;
  width: min(360px, calc(100vw - 40px)); display: flex; flex-direction: column; gap: 10px;
  background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15,23,42,.16); padding: 12px; backdrop-filter: blur(12px);
}
.manual-search { display: flex; gap: 8px; min-width: 0; }
.manual-search__input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 11px; font: inherit; color: var(--text); background: #fff; outline: none;
}
.manual-search__input:focus { border-color: var(--blue); }
.manual-search__btn,
.manual-finish,
.manual-editor button {
  border: 1px solid var(--blue); background: var(--blue); color: #fff;
  border-radius: 10px; font-weight: 800; cursor: pointer;
}
.manual-search__btn { padding: 0 12px; }
.manual-tools__hint { color: var(--muted); font-size: 12px; line-height: 1.35; }
.manual-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.manual-list__empty {
  border: 1px dashed var(--line); border-radius: 10px; color: var(--muted);
  font-size: 12.5px; padding: 12px; text-align: center;
}
.manual-list__item {
  display: flex; align-items: stretch; gap: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.manual-list__main {
  flex: 1; min-width: 0; text-align: left; border: 0; background: transparent;
  padding: 9px 10px; color: var(--text); cursor: pointer;
}
.manual-list__main b, .manual-list__main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manual-list__main span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.manual-list__delete {
  width: 38px; border: 0; border-left: 1px solid var(--line); background: #fff;
  color: var(--muted); font-size: 20px; cursor: pointer;
}
.manual-list__delete:hover { color: #dc2626; }
.manual-finish { padding: 11px 12px; font-size: 14px; }

.manual-editor {
  position: absolute; right: 18px; bottom: 58px; z-index: 630;
  width: min(360px, calc(100vw - 40px)); background: rgba(255,255,255,.96);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 44px rgba(15,23,42,.18);
  padding: 14px; display: flex; flex-direction: column; gap: 11px; backdrop-filter: blur(12px);
}
.manual-editor[hidden] { display: none; }
.manual-editor label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 13px; }
.manual-editor input,
.manual-editor textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  font: inherit; color: var(--text); background: #fff; outline: none; resize: vertical;
}
.manual-editor input:focus,
.manual-editor textarea:focus { border-color: var(--blue); }
.manual-editor p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.manual-editor__actions { display: flex; gap: 8px; justify-content: flex-end; }
.manual-editor__actions button { padding: 10px 12px; }
.manual-editor__actions button[type="button"] { background: #fff; color: var(--text); border-color: var(--line); }

@media (max-width: 939px) {
  .manual-tools { top: 12px; left: 12px; right: 12px; width: auto; }
  .manual-editor { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* Chat Card Container (Mobile default: full-height, Desktop: floating panel) */
.chat-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-card__header {
  display: none;
}
@media (min-width: 940px) {
  .chat-card {
    background: var(--bg);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--line);
    overflow: hidden;
  }
}

/* Chat */
.chat { flex: 1; overflow-y: auto; padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 84%; padding: 11px 14px; border-radius: var(--radius); font-size: 15px; line-height: 1.42; animation: pop .28s ease; white-space: pre-wrap; overflow-wrap: anywhere; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.msg--bot { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 6px; }
.msg--user { align-self: flex-end; background: var(--user); color: #fff; border-bottom-right-radius: 6px; }
.msg--info { align-self: center; background: transparent; color: var(--muted); font-size: 12.5px; text-align: center; max-width: 100%; }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.typing span { width: 7px; height: 7px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay: .2s; } .typing span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,60%,100%{ opacity:.3; transform: translateY(0);} 30%{ opacity:1; transform: translateY(-3px);} }

/* Persistenter „arbeite gerade“-Indikator: Text + dauerhaft animierte Punkte */
.msg--working { display: inline-flex; align-items: center; }
.typing--inline { padding: 0; margin-left: 2px; vertical-align: middle; }
.typing--inline span { width: 6px; height: 6px; background: var(--blue); }

/* Composer */
.composer { min-width: 0; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
  overflow-x: visible; padding-bottom: 0;
}
.chips:empty { margin-bottom: 0; }
.chip {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 7px 11px; border-radius: 999px; font-size: 12.5px; cursor: pointer; font-weight: 700;
  transition: transform .08s, background .15s; animation: pop .25s ease;
  flex: 0 0 auto; white-space: nowrap;
}
.chip:hover { background: #e2e8f0; }
.chip:active { transform: scale(.95); }
.chip--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip--ghost { background: transparent; color: var(--muted); }

@media (max-width: 939px) {
  .shell { width: 100vw; max-width: 100vw; overflow-x: hidden; }
  .app { flex: 0 0 100vw; width: 100vw; max-width: 100vw; min-width: 0; }
  .topbar { padding: 10px 12px; }
  .mappanel.open { height: clamp(240px, 40dvh, 340px); }
  .chat { padding-top: 12px; }
  .msg { max-width: 92%; font-size: 14.5px; }
  .chips {
    flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 2px;
    scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: 9px 14px; font-size: 13.5px; font-weight: 600; scroll-snap-align: start; }
}

.inputrow { display: flex; gap: 8px; align-items: center; min-width: 0; }
.inputrow__field {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 14px; font-size: 15px; outline: none;
}
.inputrow__field:focus { border-color: var(--blue); }
.inputrow__field:disabled { opacity: .5; }
.inputrow__send {
  width: 46px; height: 46px; border-radius: 14px; border: none; background: var(--blue); color: #fff;
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.inputrow__send:active { transform: scale(.94); }
.inputrow__send:disabled { opacity: .4; }

/* POI-Liste in der Chat-Bubble */
.poigrid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.poitag { background: rgba(37,99,235,.08); border: 1px solid rgba(37,99,235,.25); color: var(--blue); padding: 4px 9px; border-radius: 999px; font-size: 12px; }

/* Stations-Vorschau */
.preview { align-self: stretch; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; animation: pop .3s ease; }
.preview__head { padding: 14px 16px; background: var(--blue); color: #fff; }
.preview__head h3 { margin: 0 0 3px; font-size: 17px; }
.preview__head p { margin: 0; font-size: 12.5px; opacity: .9; }
.preview__list { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.scard { display: flex; gap: 11px; padding: 11px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; animation: pop .3s ease both; }
.scard__num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.scard__body { flex: 1; min-width: 0; }
.scard__title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.scard__type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: #3b455a; padding: 1px 7px; border-radius: 999px; }
.scard__type.quiz { background: #2563eb; } .scard__type.estimate { background: #0284c7; }
.scard__type.task { background: #db8a1f; } .scard__type.photo { background: #e0457b; }
.scard__type.info { background: #3b455a; } .scard__type.lastStation { background: var(--ok); }
.scard__meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.scard__info { font-size: 12px; margin-top: 6px; color: var(--muted); font-style: italic; }
.scard__q { font-size: 13px; margin-top: 6px; color: var(--text); }
.scard__a { font-size: 12px; margin-top: 4px; color: var(--muted); }
.scard__a b { color: #5ad07a; }

.preview__actions { display: flex; gap: 8px; padding: 10px 12px 14px; flex-wrap: wrap; }
.btn { flex: 1; min-width: 130px; padding: 12px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; }
.btn--primary { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:active { transform: scale(.97); }

.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* Leaflet Marker-Nummern */
/* Custom Leaflet Map Pins (red by default, gold for current) */
.station-pin-wrapper {
  background: transparent !important;
  border: none !important;
}

.station-pin {
  position: relative;
  width: 32px;
  height: 32px;
  pointer-events: auto;
  transform-origin: 50% 90%;
  animation: pop .25s ease both;
}

.station-pin__glow {
  position: absolute;
  inset: 4px;
  background: radial-gradient(circle at center, rgba(239, 68, 68, .55), rgba(239, 68, 68, 0));
  filter: blur(2px);
  opacity: .8;
  transition: opacity .24s ease;
}

.station-pin__inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  box-shadow: 0 4px 10px rgba(239, 68, 68, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(15, 23, 42, .4);
  transition: all 0.25s ease;
}

.station-pin__inner::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: linear-gradient(180deg, #b91c1c, #7f1d1d);
  transform: translate(-50%, 0) rotate(45deg);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.station-pin__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(15, 23, 42, .3);
  font-size: 11px;
  line-height: 1;
}

/* Gold variant for active/current pin */
.station-pin--current {
  animation: stationPinGold 1.6s ease-in-out infinite alternate;
}

.station-pin--current .station-pin__inner {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.35), 0 0 0 2px rgba(251, 191, 36, 0.4);
}

.station-pin--current .station-pin__inner::after {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

.station-pin--current .station-pin__glow {
  background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.4), rgba(249, 115, 22, 0.0));
  opacity: 1;
}

@keyframes stationPinGold {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.poimarker--dim { background: #ef4444; opacity: .95; width: 18px; height: 18px; font-size: 10px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.poimarker--must { background: #e0457b; opacity: .9; width: 20px; height: 20px; font-size: 11px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

/* Walkthrough Container Styling */
.sp-walkthrough {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: transparent;
  color: var(--text);
  border-left: none;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* On desktop split view, it floats on top of the map on the right side */
.sp-walkthrough--split {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 440px;
  z-index: 1000;
  animation: pop .25s ease both;
  height: auto;
  max-height: calc(100vh - 110px);
}

/* Header with Progress Bar */
.sp-walkthrough__header {
  padding: 12px 16px;
  background: #1e293b;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-walkthrough__header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sp-walkthrough__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sp-walkthrough__close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.sp-walkthrough__close:hover {
  color: #ff6b81;
}

/* Progress bar container and fill */
.sp-walkthrough__progress-track {
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.sp-walkthrough__progress-fill {
  background: var(--blue);
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Iframe area */
.sp-walkthrough__iframe-slot {
  flex: 1;
  min-height: 0;
  background: transparent;
  position: relative;
}

.sp-walkthrough__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

/* Walkthrough footer styling removed */

/* Mobile popup overlay container */
.sp-mobile-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: #0b1016;
  animation: pop .25s ease both;
}

/* Mobile map preview button */
.mobile-preview-btn {
  position: absolute;
  right: 12px;
  bottom: 48px;
  z-index: 1000;
  background: var(--blue);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-preview-btn:active {
  transform: scale(0.95);
}

@media (min-width: 940px) {
  .mobile-preview-btn {
    display: none !important;
  }
}

/* Light Theme Cockpit (Desktop) */
@media (min-width: 940px) {
  .cockpit {
    background: transparent !important;
    color: #0f172a !important;
  }
  .cockpit__head {
    display: none !important;
  }
  .cockpit__mapslot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc !important;
  }
  .topbar {
    background: transparent !important;
    border-bottom: none !important;
    height: 70px !important;
    padding: 0 16px !important;
    box-shadow: none !important;
  }
  .topbar__brand {
    display: none !important;
  }
  .topbar__reset {
    display: none !important;
  }
  .chat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
  }
  .chat-card__title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.015em;
  }
  .chat-card__reset {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.12s;
  }
  .chat-card__reset:hover {
    color: var(--text);
    background: var(--panel);
    border-color: var(--muted);
  }
  .chat-card__reset:active {
    transform: scale(0.92);
  }
  .mapchip {
    left: clamp(420px, 32vw, 520px) !important;
    bottom: 20px !important;
  }
  .cockpit__mapwelcome {
    padding-left: calc(clamp(380px, 30vw, 480px) + 48px) !important;
  }
}

/* Light Theme Welcome Overlay */
.cockpit__mapwelcome {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
  z-index: 1000;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.5s ease;
  padding: clamp(24px, 4vw, 48px);
}
.cockpit__mapwelcome.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-card {
  width: 100%;
  max-width: 500px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: clamp(32px, 4vw, 44px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
  animation: welcomePop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  text-align: center;
}

@keyframes welcomePop {
  0% { transform: scale(0.97) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.welcome-card h1 {
  font-size: clamp(28px, 2.5vw, 34px);
  font-weight: 800;
  margin: 0 0 12px 0;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.welcome-tagline {
  font-size: clamp(15px, 1.4vw, 17px);
  font-weight: 600;
  color: #334155;
  margin: 0 0 18px 0;
  line-height: 1.4;
}

.welcome-desc {
  font-size: clamp(13px, 1.1vw, 14.5px);
  line-height: 1.6;
  color: #475569;
  margin: 0 0 28px 0;
}

.welcome-prompt {
  width: 100%;
  margin: 0 0 16px 0;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  text-align: left;
}

.welcome-prompt__bar {
  display: flex;
  gap: 6px;
  padding: 11px 13px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.welcome-prompt__bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.welcome-prompt__bar span:nth-child(1) { background: #ef4444; }
.welcome-prompt__bar span:nth-child(2) { background: #f59e0b; }
.welcome-prompt__bar span:nth-child(3) { background: #22c55e; }

.welcome-prompt__text {
  min-height: 104px;
  margin: 0;
  padding: 16px 18px 18px;
  color: #e2e8f0;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.55;
  font-weight: 650;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.welcome-prompt__text::before {
  content: "> ";
  color: #60a5fa;
}

.welcome-prompt__cursorline {
  white-space: pre-wrap;
}

.welcome-prompt__cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  background: #60a5fa;
  vertical-align: -0.16em;
  animation: welcomeCursorBlink 0.9s steps(1) infinite;
}

@keyframes welcomeCursorBlink {
  0%, 52% { opacity: 1; }
  53%, 100% { opacity: 0; }
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

@media (min-width: 480px) {
  .welcome-actions {
    flex-direction: row;
    gap: 16px;
  }
}

.welcome-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 100%;
}

@media (min-width: 480px) {
  .welcome-btn {
    width: auto;
  }
}

.welcome-btn--primary {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.welcome-btn--primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.welcome-btn--primary:active {
  transform: translateY(0);
}

.welcome-btn--secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

.welcome-btn--secondary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.welcome-btn--secondary:active {
  transform: translateY(0);
}

/* Map Fade In on Desktop */
@media (min-width: 940px) {
  .mappanel {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .mappanel.open {
    opacity: 1;
  }
}

/* Map Blur when welcome overlay is active */
.cockpit__mapslot:has(.cockpit__mapwelcome:not(.hidden)) #map {
  filter: blur(8px) brightness(0.9);
  transition: filter 0.8s ease;
}

.cockpit__mapslot:has(.cockpit__mapwelcome.hidden) #map {
  filter: blur(0) brightness(1);
  transition: filter 0.8s ease;
}

/* Input field glow highlight animation */
@keyframes inputHighlightGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    border-color: var(--line);
  }
  20% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.65);
    border-color: var(--blue);
  }
  40% {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
    border-color: var(--blue);
  }
  60% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.75);
    border-color: var(--blue);
  }
  85% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.75);
    border-color: var(--blue);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    border-color: var(--line);
  }
}

.inputrow__field.highlight-glow {
  animation: inputHighlightGlow 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Welcome overlay pop-up hint style */
.welcome-hint {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--blue);
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-sizing: border-box;
}

.welcome-hint.visible {
  opacity: 1;
  max-height: 60px;
  margin-top: 20px;
  padding: 10px 16px;
}

/* ---- Navigation Bar from rallyeapp.de (Dark/Transparent Theme) ---- */
.home-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: transparent;
  z-index: 1100;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Fading frosted-glass blur backdrop. Verlauf bewusst kräftig + bis über die
   volle Header-Höhe deckend, damit die weiße Navi auch dann lesbar bleibt, wenn
   backdrop-filter über der Leaflet-Karte nicht greift (Safari/negativer z-index). */
.home-header::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 130px;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.72) 45%, rgba(15, 23, 42, 0.35) 72%, rgba(15, 23, 42, 0) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

.home-header .brand-name,
.home-header .brand-slogan,
.home-header .nav-links a,
.home-header .nav-link-dropdown-trigger {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
}

.brand a {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-decoration: none;
  color: #ffffff;
}

.brand-name {
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.brand-slogan {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.8);
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  font-weight: 600;
  align-items: center;
}

.nav-links a {
  color: #ffffff;
  opacity: 0.85;
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  opacity: 1;
  color: #ffffff;
  border-color: #ffffff;
}

/* Dropdown */
.nav-item-dropdown {
  position: relative;
  display: inline-block;
}

.nav-link-dropdown-trigger {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  opacity: 0.85;
  cursor: pointer;
  padding: 0 0 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link-dropdown-trigger:hover,
.nav-item-dropdown:hover .nav-link-dropdown-trigger {
  opacity: 1;
  color: #ffffff;
  border-color: #ffffff;
}

.nav-item-dropdown:hover .nav-link-dropdown-trigger svg {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #ffffff;
  min-width: 240px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  z-index: 1010;
}

.nav-item-dropdown:hover .nav-dropdown-menu,
.nav-item-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #0f172a !important;
  font-size: 0.92rem;
  white-space: nowrap;
  border-bottom: none !important;
  text-decoration: none;
  opacity: 1 !important;
}

.nav-dropdown-menu a:hover {
  background: #f1f5f9;
  color: #2563eb !important;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* CTA Buttons */
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #2563eb;
  color: #ffffff !important;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid #2563eb;
  transition: all 0.15s ease;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

.cta-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

.cta-btn.ghost {
  background: transparent;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

.cta-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
  transform: translateY(-1px);
}

.nav-profile {
  position: relative;
  display: inline-flex;
}

.nav-profile__button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
  transition: all 0.15s ease;
  padding: 0;
}

.nav-profile__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.32);
  background: rgba(255, 255, 255, 0.2);
}

.nav-profile__initials {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.nav-profile__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: white;
  color: var(--text) !important;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  width: min(260px, 80vw);
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.25);
  z-index: 1200;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-profile__name {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a !important;
  text-align: left;
}

.nav-profile__email {
  margin: 4px 0 12px 0;
  font-size: 12px;
  color: var(--muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  text-align: left;
}

.nav-profile__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.nav-profile__actions .cta-btn {
  flex: 1 1 100%;
  justify-content: center;
  box-sizing: border-box;
}

.nav-profile__actions .cta-btn.ghost {
  color: var(--blue-dark) !important;
  border: 1px solid var(--blue-dark);
  background: transparent;
}

.nav-profile__actions .cta-btn.ghost:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue-dark) !important;
  border-color: var(--blue-dark);
}

.nav-profile__login {
  background: var(--blue);
  color: white !important;
  border: 1px solid var(--blue);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-profile__login:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.nav-toggle {
  display: none;
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: inline-flex !important;
}

/* Desktop Sidebar Position & Nav Links Centering Adjustments */
@media (min-width: 940px) {
  .app {
    top: 90px !important; /* 70px header + 20px spacer */
  }
  .primary-nav .nav-links {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    margin: 0;
  }
}

/* Mobile responsive styles */
@media (max-width: 939px) {
  :root {
    --mobile-header-space: calc(72px + env(safe-area-inset-top));
  }
  .mobile-only {
    display: inline-flex !important;
  }
  .desktop-only {
    display: none !important;
  }
  .shell {
    flex-direction: column !important;
    height: 100dvh;
    overflow: hidden;
    padding-top: var(--mobile-header-space);
  }
  .app {
    height: calc(100dvh - var(--mobile-header-space)) !important;
    max-width: 100vw !important;
    flex: 0 0 calc(100dvh - var(--mobile-header-space)) !important;
  }
  .home-header {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-header-space);
    padding-top: env(safe-area-inset-top);
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
    z-index: 1100;
  }
  .home-header::before {
    height: 100px !important;
  }
  .primary-nav {
    padding: 0 16px;
  }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 0 8px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  .nav-toggle__bar {
    display: block;
    width: 18px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
  .primary-nav.is-open .nav-toggle__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .primary-nav.is-open .nav-toggle__bar:nth-child(2) {
    opacity: 0;
  }
  .primary-nav.is-open .nav-toggle__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
  /* Mobile Links Drawer */
  .primary-nav .nav-links {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 60px);
    background: #ffffff;
    border-left: 1px solid var(--line);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 24px 0;
    transition: right 0.25s ease;
    z-index: 2000;
    overflow-y: auto;
  }
  .primary-nav.is-open .nav-links {
    right: 0;
  }
  .primary-nav .nav-links a {
    padding: 14px 24px;
    border-bottom: 1px solid var(--panel);
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    color: var(--text);
  }
  .primary-nav .nav-links a:hover,
  .primary-nav .nav-links a.active {
    color: var(--blue);
    border-bottom-color: var(--panel);
  }
  .primary-nav .nav-links a.cta-btn {
    width: calc(100% - 48px);
    margin: 16px 24px;
    border-radius: 999px;
    text-align: center;
    color: #ffffff !important;
  }
  /* Dropdown inside Mobile menu */
  .nav-item-dropdown {
    width: 100%;
  }
  .nav-link-dropdown-trigger {
    width: 100%;
    padding: 14px 24px;
    border-bottom: 1px solid var(--panel);
    justify-content: space-between;
    box-sizing: border-box;
    color: var(--text);
    opacity: 1;
  }
  .nav-link-dropdown-trigger:hover {
    color: var(--blue);
  }
  .nav-dropdown-menu {
    position: static;
    transform: none !important;
    box-shadow: none;
    border: none;
    background: var(--panel);
    width: 100%;
    opacity: 1;
    visibility: visible;
    display: block;
    padding: 0;
    border-radius: 0;
  }
  .nav-dropdown-menu a {
    padding: 10px 36px;
    font-size: 0.88rem;
  }
  #resetBtn {
    margin-right: 4px;
  }
  .home-header .topbar__reset {
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: rgba(255, 255, 255, 0.8) !important;
  }
  .home-header .topbar__reset:hover {
    border-color: #ffffff !important;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
  }
}

@media (min-width: 940px) {
  #resetBtn {
    display: none !important;
  }
}

/* ---- Login Modal Styles (aligned with rallyeapp.de) ---- */
.forum-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.forum-modal[hidden] {
  display: none;
}

.forum-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
}

.forum-modal__dialog {
  position: relative;
  background: #ffffff;
  background-image: none;
  border-radius: 1.25rem;
  padding: 1.75rem;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 35px 65px rgba(15, 23, 42, 0.3);
  z-index: 1;
}

.forum-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  background: none;
  padding: 0;
  position: static;
  box-shadow: none;
  color: var(--text);
}

.forum-modal__header::after {
  content: none;
}

.forum-modal__header h2 {
  margin: 0.2rem 0;
  color: var(--text);
  font-size: 1.5rem;
}

.forum-modal__close {
  background: rgba(15, 23, 42, 0.06);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.forum-modal-open {
  overflow: hidden;
}

.forum-modal__divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #576574;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.forum-modal__divider::before,
.forum-modal__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.forum-modal__divider span {
  padding: 0 1rem;
}

.forum-modal__oauth-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.forum-modal__oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.forum-modal__oauth:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.forum-modal__oauth-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.forum-modal__legal-notice {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #64748b;
  margin: 0.5rem 0 1rem;
  text-align: left;
}

.forum-modal__legal-notice a {
  color: var(--primary);
  text-decoration: underline;
}

.forum-modal__legal-notice a:hover {
  color: var(--primary-dark);
}

.forum-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.forum-form label {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.45rem !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  color: #475569 !important;
  margin-bottom: 0.25rem;
  text-align: left;
}

.forum-form label span {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.forum-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  font: inherit;
  color: #1e293b !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

.forum-form input::placeholder {
  color: #576574;
}

.forum-modal .forum-form-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.forum-modal .forum-form-hint a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.forum-alert {
  margin: 0;
  font-size: 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.03);
  color: var(--muted);
  text-align: left;
}

.forum-alert.is-error {
  background: rgba(248, 113, 113, 0.1);
  color: #b91c1c;
}

.forum-alert.is-success {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.forum-alert.is-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-dark);
}

.forum-eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.25rem;
  text-align: left;
}
