/* huelle.css – Kopfleiste, Stand-Punkt, schwebende Tab-Leiste, Meldungen, Einstellungen (Teil A).
   Kopf und Leiste nach Startvorlage 2 / Controller, aber flach und neutral (kein Glas-Hintergrund, keine Verläufe). */
@layer module {
  /* ---------- Kopfleiste: Titel links, Stand-Punkt + Zahnrad rechts; klebt oben, Seitengrund leicht durchscheinend ---------- */
  .kopf {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: var(--a2);
    max-inline-size: 640px; margin-inline: auto;
    padding-block: calc(env(safe-area-inset-top) + var(--oben-frei) + var(--a2)) var(--a2);
    margin-block-end: var(--a2);
    background: color-mix(in srgb, var(--hg) 92%, transparent);
    -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
  }
  /* Streifen bis an den Bildschirmrand (body hat seitlichen Rand) */
  .kopf::before { content: ""; position: absolute; inset: 0 calc(-1 * max(var(--rand), env(safe-area-inset-left))); background: inherit; z-index: -1; }
  .kopf-titel { font-size: var(--fs-titel); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin-inline-end: auto; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
  .kopf-zurueck { flex: none; display: inline-flex; align-items: center; gap: 2px; min-block-size: var(--tipp); margin-inline-start: -6px; padding-inline-end: var(--a2); color: var(--akzent-text); font-size: var(--fs-text); }
  .kopf-zurueck svg { flex: none; inline-size: 24px; block-size: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  .kopf-zurueck:not([hidden]) + .kopf-titel { font-size: var(--fs-abschnitt); }
  .kopf-knopf {
    flex: none; inline-size: var(--tipp); block-size: var(--tipp); border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fuellung); color: var(--text-2);
  }
  .kopf-knopf svg { inline-size: 22px; block-size: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .kopf-knopf:active { opacity: .6; }

  /* ---------- Stand-Punkt: Licht + Wort + Uhrzeit (nie nur Farbe) ---------- */
  .stand-punkt {
    flex: none; display: inline-flex; align-items: center; gap: var(--a2);
    min-block-size: var(--tipp); padding: 4px var(--a3) 4px 10px; border-radius: 999px;
    background: var(--fuellung); text-align: start;
  }
  .stand-punkt:active { opacity: .6; }
  .stand-licht { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--ruhig); flex: none; }
  .stand-texte { display: grid; line-height: 1.15; }
  .stand-wort { font-size: var(--fs-fussnote); font-weight: 600; color: var(--text); white-space: nowrap; }
  .stand-zeit { font-size: var(--fs-fussnote); color: var(--text-2); white-space: nowrap; }
  .stand-punkt[data-zustand="frisch"] .stand-licht { background: var(--gut); }
  .stand-punkt[data-zustand="alt"] .stand-licht { background: var(--knapp); }
  .stand-punkt[data-zustand="sammelt"] .stand-licht { background: var(--sammelt); animation: stand-puls 1.2s ease-in-out infinite; }
  .stand-punkt[data-zustand="fehler"] .stand-licht { background: var(--fehler); }
  .stand-punkt[data-laedt] .stand-licht { animation: stand-puls 1.2s ease-in-out infinite; }
  @keyframes stand-puls { 50% { opacity: .35; } }
  @media (prefers-reduced-motion: reduce) { .stand-punkt .stand-licht { animation: none !important; } }

  /* ---------- Hinweis-Streifen (Mac schläft, keine Verbindung, kein Zugang) ---------- */
  .lage-hinweis {
    max-inline-size: 640px; margin: 0 auto var(--a4); padding: var(--a3) var(--a4);
    border-radius: var(--r-klein); background: var(--karte-2); border: 1px solid var(--trenner);
    font-size: var(--fs-neben); color: var(--text-2);
  }
  .lage-hinweis b { color: var(--text); font-weight: 600; }
  .lage-hinweis button { color: var(--akzent-text); font-weight: 600; min-block-size: var(--tipp); }

  /* ---------- Tab-Leiste: schwebende Pille unten, deckend genug zum Lesen ---------- */
  .tab-leiste {
    position: fixed; z-index: 30;
    inset-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    bottom: max(var(--a3), calc(env(safe-area-inset-bottom) - 10px));
    max-inline-size: 460px; margin-inline: auto;
    display: flex; padding: 4px; border-radius: 999px;
    background: var(--leiste); border: 1px solid var(--kontur);
    -webkit-backdrop-filter: var(--unschaerfe); backdrop-filter: var(--unschaerfe);
    box-shadow: var(--schatten-leiste);
  }
  .tab {
    position: relative; flex: 1 1 0; min-inline-size: 0; min-block-size: 54px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 999px; color: var(--text-2); text-decoration: none;
    font-size: var(--fs-tab); font-weight: 600; letter-spacing: .01em;
    transition: background-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve);
  }
  .tab svg { inline-size: 24px; block-size: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-current="page"] { color: var(--akzent-text); background: var(--akzent-weich); }
  .tab:active { opacity: .6; }
  .tab-zahl {
    position: absolute; inset-block-start: 3px; inset-inline-start: calc(50% + 6px);
    min-inline-size: 18px; block-size: 18px; padding-inline: 5px; border-radius: 9px;
    background: var(--zaehler); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  }

  /* ---------- Kurze Meldung über der Tab-Leiste ---------- */
  .meldung {
    position: fixed; z-index: 40; inset-inline: var(--rand); margin-inline: auto; max-inline-size: 440px;
    bottom: calc(var(--leiste-hoehe) + max(var(--a3), env(safe-area-inset-bottom)) + var(--a4));
    padding: var(--a3) var(--a4); border-radius: 14px;
    background: var(--text); color: var(--hg); font-size: var(--fs-neben); font-weight: 500; text-align: center;
    box-shadow: var(--schatten-leiste);
  }

  /* ---------- Offline-Modul: „Neue Version – jetzt laden“ ---------- */
  .offline-hinweis { max-inline-size: 640px; margin: 0 auto var(--a4); }
  .offline-hinweis button { inline-size: 100%; min-block-size: var(--tipp); padding-inline: var(--a4); border-radius: 12px; background: var(--akzent-weich); color: var(--akzent-text); font-size: var(--fs-neben); font-weight: 600; }
  .offline-hinweis button:active { opacity: .6; }

  /* ---------- Einstellungen: Segment Hell | Automatisch | Dunkel, Schalter ---------- */
  .einstellung { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--a3); min-block-size: 60px; padding-block: var(--a2); border-bottom: 1px solid var(--trenner); }
  .einstellung .beschriftung { font-weight: 600; color: var(--text); font-size: var(--fs-text); }
  .segment { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fuellung); }
  .segment label { display: inline-flex; align-items: center; justify-content: center; min-block-size: var(--tipp); padding: 0 var(--a3); border-radius: 999px; font-size: var(--fs-neben); font-weight: 600; white-space: nowrap; cursor: pointer; }
  .segment input { position: absolute; opacity: 0; pointer-events: none; }
  .segment label:has(input:checked) { background: var(--karte); color: var(--akzent-text); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
  .segment label:has(input:focus-visible) { outline: 3px solid var(--akzent-text); outline-offset: 2px; }
  .schalter-zeile input { appearance: none; flex: none; inline-size: 51px; block-size: 31px; border-radius: 999px; background: var(--fuellung); position: relative; cursor: pointer; transition: background-color var(--dauer); }
  .schalter-zeile input::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; inline-size: 27px; block-size: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .2); transition: transform var(--dauer) var(--kurve); }
  .schalter-zeile input:checked { background: var(--gut); }
  .schalter-zeile input:checked::after { transform: translateX(20px); }
  #einstellungen .fussnote { margin-block-start: var(--a3); }
}
