/* bausteine.css – wiederverwendbare Bausteine aus js/bausteine.js: Abschnitt mit „?“, Liste/Karte, Eintrags-Zeile, App-Symbol, Balken, leerer Zustand, Chips.
   Teil D (Apps) und E (Verlauf) benutzen diese Klassen mit; eigene Gestaltung in css/ansicht-apps.css bzw. css/ansicht-verlauf.css. */
@layer module {
  /* ---------- Abschnitt: Überschrift 20 halbfett + „?“ + optional Verweis rechts ---------- */
  .abschnitt { margin-block-end: var(--a8); scroll-margin-block-start: calc(env(safe-area-inset-top) + var(--oben-frei) + 72px); }
  .abschnitt-kopf { display: flex; align-items: center; gap: var(--a1); margin-block-end: var(--a2); min-block-size: var(--tipp); }
  .abschnitt-titel { font-size: var(--fs-abschnitt); font-weight: 600; letter-spacing: -.005em; }
  .abschnitt-zahl { font-size: var(--fs-abschnitt); font-weight: 400; color: var(--text-2); margin-inline-start: .3em; }
  .frage-knopf {
    inline-size: var(--tipp); block-size: var(--tipp); flex: none; display: inline-flex; align-items: center; justify-content: center; margin-inline-start: -6px;
    color: var(--text-3);
  }
  .frage-knopf span { inline-size: 20px; block-size: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1; }
  .frage-knopf:active { opacity: .5; }
  .abschnitt-verweis { margin-inline-start: auto; }

  /* ---------- Karte (gruppierte Liste wie in iOS-Einstellungen) ---------- */
  .karte { background: var(--karte); border-radius: var(--r-karte); box-shadow: var(--schatten); }
  .karte.innen { padding: var(--a4); }
  .liste > * + * { border-block-start: 1px solid var(--trenner); }
  .karte + .karte { margin-block-start: var(--a3); }

  /* ---------- Eintrags-Zeile: Symbol | Art · Alter / Titel / Zusatz | Pfeil ---------- */
  .zeile {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--a3);
    inline-size: 100%; min-block-size: 64px; padding: var(--a3) var(--a3) var(--a3) var(--a4);
    text-align: start; text-decoration: none; color: inherit;
  }
  button.zeile:active, a.zeile:active { background: var(--karte-2); }
  .liste > .zeile:first-child { border-start-start-radius: var(--r-karte); border-start-end-radius: var(--r-karte); }
  .liste > .zeile:last-child { border-end-start-radius: var(--r-karte); border-end-end-radius: var(--r-karte); }
  .zeile-mitte { display: grid; gap: 2px; min-inline-size: 0; }
  .zeile-oben { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-fussnote); color: var(--text-2); min-inline-size: 0; }
  .zeile-art { font-weight: 600; color: var(--text-2); white-space: nowrap; }
  .zeile-alter { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .zeile-titel { font-size: var(--fs-text); font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .zeile-zusatz { font-size: var(--fs-neben); color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .pfeil { inline-size: 16px; block-size: 16px; fill: none; stroke: var(--text-3); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

  /* Marken: kleine Wort-Schilder für Zustände (immer Wort, Farbe nur zusätzlich) */
  .marke { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-fussnote); font-weight: 600; white-space: nowrap; }
  .marke::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; flex: none; }
  .marke.hoch { color: var(--hoch-text); }
  .marke.gut { color: var(--gut-text); }
  .marke.knapp { color: var(--knapp-text); }
  .marke.ruhig { color: var(--text-2); }
  .marke.ohne-punkt::before { display: none; }

  /* ---------- App-Symbol: iOS-Rundung, feine Kontur (weiße Symbole verschwinden nicht), Zähler-Marke, Lauf-Punkt ---------- */
  .app-symbol { --g: 40px; position: relative; flex: none; inline-size: var(--g); block-size: var(--g); }
  .app-symbol-bild { inline-size: 100%; block-size: 100%; border-radius: var(--r-symbol); overflow: hidden; background: var(--fuellung); display: grid; place-items: center; }
  .app-symbol-bild img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .app-symbol-bild::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-symbol); box-shadow: inset 0 0 0 .5px var(--kontur); pointer-events: none; }
  .app-symbol-ersatz { font-size: calc(var(--g) * .38); font-weight: 600; color: var(--text-2); letter-spacing: -.02em; }
  .app-symbol-zahl {
    position: absolute; inset-block-start: -6px; inset-inline-end: -7px;
    min-inline-size: 20px; block-size: 20px; padding-inline: 6px; border-radius: 10px;
    background: var(--zaehler); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
    box-shadow: 0 0 0 2px var(--hg);
  }
  .app-symbol-lauf {
    position: absolute; inset-block-end: -3px; inset-inline-end: -3px; inline-size: 12px; block-size: 12px; border-radius: 50%;
    background: var(--gut); box-shadow: 0 0 0 2px var(--karte);
  }

  /* ---------- Balken mit Soll-Strich (aus dem alten Controller, Version 29) ---------- */
  .balken { display: grid; gap: 6px; }
  .balken-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: var(--a2); }
  .balken-name { font-size: var(--fs-neben); color: var(--text-2); }
  .balken-wert { font-size: var(--fs-abschnitt); font-weight: 700; line-height: 1; }
  .balken-bahn { position: relative; block-size: 10px; border-radius: 5px; background: var(--fuellung); }
  .balken-bahn i { display: block; block-size: 100%; border-radius: 5px; background: var(--balken-farbe, var(--akzent)); transition: inline-size .8s var(--kurve); }
  .balken-bahn[data-stufe="gut"] { --balken-farbe: var(--gut); }
  .balken-bahn[data-stufe="knapp"] { --balken-farbe: var(--knapp); }
  .balken-bahn[data-stufe="hoch"] { --balken-farbe: var(--hoch); }
  .balken-bahn[data-stufe="ruhig"] { --balken-farbe: var(--ruhig); }
  .balken-soll { position: absolute; inset-block: -4px; inline-size: 2px; margin-inline-start: -1px; border-radius: 1px; background: var(--text); }

  /* ---------- Leerer Zustand: ruhiges Symbol, ein Satz, was hier erscheinen wird ---------- */
  .leer { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--a3); align-items: center; padding: var(--a4); }
  .leer-symbol { grid-row: span 2; inline-size: 36px; block-size: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--fuellung); color: var(--text-2); }
  .leer-symbol.gut { background: color-mix(in srgb, var(--gut) 16%, transparent); color: var(--gut-text); }
  .leer-symbol svg { inline-size: 20px; block-size: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .leer-titel { font-weight: 600; }
  .leer-text { font-size: var(--fs-neben); color: var(--text-2); }
  .leer-titel:only-of-type { grid-row: span 2; }

  /* ---------- Chips (Springen/Filtern), waagrecht rollbar ---------- */
  .chips { display: flex; gap: var(--a2); overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--rand)); padding: 2px var(--rand) var(--a1); scroll-padding-inline: var(--rand); }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-block-size: var(--tipp); padding-inline: var(--a3);
    border-radius: 999px; background: var(--karte); border: 1px solid var(--trenner); font-size: var(--fs-neben); font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text);
  }
  .chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--text); color: var(--hg); border-color: transparent; }
  .chip-zahl { color: var(--text-2); font-weight: 400; }
  .chip[aria-pressed="true"] .chip-zahl { color: inherit; opacity: .75; }
}
