/* ### AUSBAUSTAND 2026-10-24-A (Bilder, Umdreh-Animation, Scroll-Fix) ### */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ===== Große, übersichtliche Druckknöpfe ===== */

.btn-gross {
  min-height: 3.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
}

.btn-riesig {
  min-height: 6rem;
  font-size: 2rem;
  font-weight: 700;
  padding: 1.25rem 3rem;
  border-radius: 1.25rem;
}

.btn-riesig.btn-success,
.btn-riesig.btn-danger,
.btn-riesig.btn-primary {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ===== Karteikasten-Optik (Lernmodus) mit Umdreh-Animation =====
   Aufbau: .lern-bereich > .karteikarte > .karte-innen > zwei .karte-seite.
   Die Vorder- und Rückseite liegen übereinander; gedreht wird der Behälter
   .karte-innen um die Y-Achse. Die Klasse "aufgedeckt" sitzt auf .lern-bereich,
   damit auch die Druckknöpfe darunter mitgesteuert werden können. */

.karteikarte {
  width: min(900px, 100%);
  margin: 0 auto;
  perspective: 1800px;
}

.karte-innen {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;          /* klassisches Karteikartenformat */
  min-height: 18rem;
  max-height: 60vh;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  cursor: pointer;
}

.lern-bereich.aufgedeckt .karte-innen {
  transform: rotateY(180deg);
}

/* Wer Animationen abgeschaltet hat, bekommt den Wechsel ohne Bewegung. */
@media (prefers-reduced-motion: reduce) {
  .karte-innen {
    transition: none;
  }
}

.karte-seite {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow-y: auto;
  background: #fff;
  border: 2px solid #cfe2ff;
  border-radius: 1.25rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.karte-seite.rueckseite {
  transform: rotateY(180deg);
  background: #f8f9fa;
  border-color: #c7c7c7;
  border-style: dashed;
}

.karte-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6c757d;
  margin-bottom: 0.75rem;
}

.karte-inhalt {
  font-size: 2rem;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Knöpfe umschalten – gesteuert über .schon-gesehen, nicht über .aufgedeckt.
   Wichtig: Die Karte lässt sich beliebig oft hin- und herdrehen. Hängten die
   Knöpfe an .aufgedeckt, würden sie beim Zurückdrehen wieder zurückspringen. */
.lern-bereich:not(.schon-gesehen) .aktion-einstufen {
  display: none;
}

.lern-bereich.schon-gesehen .aktion-aufdecken {
  display: none;
}

/* Die Karte ist anklickbar – Fokusrahmen für die Tastaturbedienung. */
.karte-innen:focus-visible {
  outline: 3px solid #0d6efd;
  outline-offset: 4px;
  border-radius: 1.25rem;
}

/* ===== Stapel-Kacheln auf der Startseite ===== */

.kachel {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

a:hover .kachel {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ===== Reiter in der blauen Navigationsleiste ===== */

.navbar .nav-tab {
  font-weight: 600;
  font-size: 1.25rem;
  padding: 0.55rem 1.6rem;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.85);
}

.navbar .nav-tab:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.12);
}

.navbar .nav-tab.active {
  color: #0d6efd;
  background-color: #fff;
}

/* ===== Retro-Taschenrechner ===== */

.rechner-seite {
  min-height: calc(100dvh - 190px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background-color: #e9ece7;
  background-image: linear-gradient(rgba(27, 45, 38, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(27, 45, 38, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
}

.rechner-geraet {
  width: min(100%, 760px);
  padding: 1.3rem;
  border: 2px solid #748b8d;
  border-radius: 12px 12px 18px 18px;
  background-color: #082d52;
  background-image:
    linear-gradient(90deg, transparent 49.1%, rgba(95, 184, 241, 0.78) 49.4%, rgba(95, 184, 241, 0.78) 50.6%, transparent 50.9%),
    linear-gradient(0deg, transparent 49.1%, rgba(95, 184, 241, 0.78) 49.4%, rgba(95, 184, 241, 0.78) 50.6%, transparent 50.9%),
    linear-gradient(135deg, rgba(92, 177, 231, 0.28), transparent 48%, rgba(2, 13, 35, 0.48)),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(2, 17, 39, 0.75) 48px 50px),
    repeating-linear-gradient(90deg, #1265a0 0 68px, #062448 69px 72px);
  background-size: 72px 50px, 72px 50px, 100% 100%, 100% 100%, 72px 50px;
  box-shadow: 0 24px 50px rgba(18, 34, 40, 0.34), inset 0 2px 2px rgba(211, 237, 234, 0.32), inset 0 -5px 10px rgba(8, 20, 27, 0.35);
}

.rechner-marke {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0.1rem 0 0.75rem;
  color: #e6f0e9;
  font-family: "Trebuchet MS", sans-serif;
}

.rechner-logo {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0;
}

.rechner-modell {
  color: #bbcfcb;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rechner-display {
  min-height: 350px;
  padding: 0.9rem 1rem 0.8rem;
  border: 8px solid #637d81;
  border-radius: 5px;
  background: #b8c8a5;
  box-shadow: inset 0 3px 9px rgba(20, 36, 22, 0.32), 0 2px 2px rgba(255, 255, 255, 0.7);
  color: #1d3020;
  font-family: "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.display-status {
  display: flex;
  justify-content: space-between;
  min-height: 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.display-ausdruck {
  min-height: 9.2rem;
  overflow: hidden;
  color: #435846;
  font-size: 8.5rem;
  font-weight: 700;
  line-height: 1.08;
  white-space: nowrap;
}

.display-ergebnis {
  display: block;
  overflow: hidden;
  min-height: 9.8rem;
  font-size: 8.5rem;
  font-weight: 700;
  line-height: 1.08;
  white-space: nowrap;
}

.rechner-modus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 1rem 0 0.7rem;
  padding: 0.25rem;
  border-radius: 5px;
  background: rgba(8, 25, 34, 0.72);
  box-shadow: inset 0 1px 2px rgba(179, 220, 217, 0.22);
}

.modus-knopf {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #d0dfdc;
  font-size: 0.78rem;
  font-weight: 800;
}

.modus-knopf.aktiv {
  border-color: #82a9aa;
  background: linear-gradient(#c5dbd5, #8eaaa5);
  box-shadow: 0 1px 2px rgba(28, 37, 29, 0.18);
  color: #18333b;
}

.rechner-tasten {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.rechner-tasten button {
  min-width: 0;
  min-height: 52px;
  border: 1px solid #737970;
  border-radius: 5px;
  background: linear-gradient(#f5f6f2, #d9ddd6);
  box-shadow: 0 3px 0 #8c9289, 0 4px 5px rgba(33, 43, 35, 0.16);
  color: #29322b;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  touch-action: manipulation;
}

.rechner-tasten button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #8c9289;
}

.rechner-tasten .taste-funktion {
  background: linear-gradient(#e3e6df, #c8cdc4);
  font-size: 0.9rem;
}

.rechner-tasten .taste-operator {
  background: linear-gradient(#e8c17a, #d6a64e);
  color: #352b1a;
}

.rechner-tasten .taste-loeschen {
  background: linear-gradient(#cb6c51, #ae4a36);
  color: #fffaf1;
}

.rechner-tasten .taste-gleich {
  grid-row: span 2;
  background: linear-gradient(#79a9a1, #50857b);
  color: #fff;
  font-size: 1.5rem;
}

.rechner-tasten .taste-null {
  grid-column: span 2;
}

.rechner-clipboard {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
  margin: 0.3rem 0 0.1rem;
}

.clipboard-knopf,
.historie-leeren {
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(177, 207, 203, 0.55);
  border-radius: 4px;
  background: rgba(7, 23, 31, 0.64);
  color: #e4eeea;
  font-size: 0.75rem;
  font-weight: 700;
}

.clipboard-knopf:hover,
.historie-leeren:hover {
  background: rgba(52, 93, 99, 0.9);
}

#clipboard-status {
  margin-left: auto;
  color: #e4eeea;
  font-size: 0.72rem;
}

.rechner-historie {
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid rgba(198, 223, 218, 0.42);
  color: #e4eeea;
}

.historie-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.historie-kopf h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.historie-leeren {
  font-size: 0.68rem;
}

.historie-liste {
  display: grid;
  gap: 0.25rem;
  max-height: 190px;
  overflow-y: auto;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
}

.historie-eintrag {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid rgba(172, 204, 199, 0.18);
  border-radius: 3px;
  background: rgba(5, 20, 29, 0.54);
  color: #d7e5e0;
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  text-align: left;
}

.historie-eintrag:hover {
  border-color: rgba(172, 204, 199, 0.6);
  background: rgba(48, 83, 91, 0.8);
}

.historie-eintrag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.historie-eintrag strong {
  flex: 0 0 auto;
  color: #f3d28f;
}

.historie-leer {
  padding: 0.35rem 0;
  color: #bdcfca;
  font-size: 0.78rem;
}

.historie-liste li {
  display: flex;
  gap: 0.3rem;
}

.historie-liste .historie-eintrag {
  flex: 1 1 auto;
  min-width: 0;
}

.historie-ausdruck-laden {
  flex: 0 0 auto;
  border: 1px solid rgba(172, 204, 199, 0.3);
  border-radius: 3px;
  background: rgba(5, 20, 29, 0.54);
  color: #d7e5e0;
  font-size: 0.7rem;
}

.historie-ausdruck-laden:hover {
  background: rgba(48, 83, 91, 0.8);
}

.rechner-umrechner {
  width: min(100%, 720px);
  margin: 1.5rem auto;
  padding: 1rem;
  border: 1px solid rgba(35, 68, 75, 0.25);
  border-radius: 0.75rem;
  background: var(--bs-body-bg);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

.umrechner-kopf h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.umrechner-kopf p {
  margin: 0.25rem 0 1rem;
  color: var(--bs-secondary-color);
}

.umrechner-ergebnis {
  display: block;
  min-height: 1.8rem;
  font-size: 1.2rem;
  font-weight: 700;
}

@media (max-width: 480px) {
  .rechner-seite {
    min-height: auto;
    padding: 1rem 0.25rem;
  }

  .rechner-geraet {
    padding: 0.9rem;
  }

  .rechner-display {
    min-height: 305px;
    padding: 0.75rem;
  }

  .display-ausdruck {
    min-height: 7.85rem;
    font-size: 7.25rem;
  }

  .display-ergebnis {
    min-height: 8.1rem;
    font-size: 7.25rem;
  }

  .rechner-tasten {
    gap: 0.38rem;
  }

  .rechner-tasten button {
    min-height: 48px;
  }
}

/* ===== Notiz-Editor (Writer-ähnliches Blatt) ===== */

.notiz-editor {
  max-width: 900px;
}

.titel-feld {
  border: none;
  font-size: 1.9rem;
  font-weight: 700;
  background: transparent;
}

.titel-feld:focus {
  box-shadow: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #f1f3f5;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem 0.5rem 0 0;
}

.toolbar .tb {
  min-width: 2.4rem;
  font-weight: 600;
}

.toolbar .sep {
  width: 1px;
  background: #ced4da;
  margin: 0.25rem;
}

.editor-area {
  min-height: 70vh;
  padding: 1.5rem 2rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  outline: none;
  font-size: 1.15rem;
  line-height: 1.6;
}

.editor-area h1 { font-size: 2rem; }
.editor-area h2 { font-size: 1.6rem; }
.editor-area h3 { font-size: 1.3rem; }
.editor-area ul { padding-left: 1.5rem; }
.editor-area ol { padding-left: 1.5rem; }

.editor-area:empty::before {
  content: "Hier tippen …";
  color: #adb5bd;
}

/* ===== AI API Chat ===== */

/* Der Chat füllt die Fensterhöhe aus – nur die Nachrichtenliste und die
   Seitenleiste scrollen intern. So springt die Seite nach einem Prompt
   nicht mehr nach oben. Die Klasse "chat-seite" wird serverseitig nur auf
   der Chat-Seite gesetzt (zuverlässiger als :has(), läuft in jedem Browser). */
body.chat-seite {
  display: flex;
  flex-direction: column;
  height: 100vh;   /* Rückfall für Browser ohne dvh-Einheit */
  height: 100dvh;
  overflow: hidden; /* Das Fenster selbst kann gar nicht mehr scrollen */
  margin-bottom: 0;
}

body.chat-seite > header,
body.chat-seite > footer {
  flex: 0 0 auto;
}

body.chat-seite > .container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.chat-seite > .container > main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.chat-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar {
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  height: 100%;
  overflow-y: auto;
}

.main-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Die Nachrichtenliste ist umgekehrt aufgebaut (neueste Nachricht steht im
   HTML zuerst). Dadurch liegt der Scroll-Nullpunkt unten: Die Liste zeigt
   nach jedem Neuladen von sich aus die neueste Nachricht – ganz ohne
   JavaScript. Genau das verhindert das Springen zum Seitenanfang. */
.nachrichten {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
}

/* Nachrichten behalten ihre volle Höhe – die Liste scrollt, statt die
   einzelnen Blasen zusammenzustauchen. */
.nachrichten > * {
  flex: 0 0 auto;
}

/* Auf schmalen Bildschirmen stehen Seitenleiste und Chat untereinander.
   Dort muss die Seite scrollbar bleiben, sonst wäre der Chat nicht erreichbar. */
@media (max-width: 767.98px) {
  body.chat-seite {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .sidebar {
    height: auto;
    max-height: 45vh;
  }

  .nachrichten {
    max-height: 60vh;
  }
}

.chat-link {
  display: block;
  flex-grow: 1;
  text-decoration: none;
  color: #333;
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-link:hover {
  background: #e9ecef;
  color: #000;
}

.chat-link.active {
  background: #0d6efd;
  color: #fff;
}

.nachricht {
  margin-bottom: 0.9rem;
}

.nachricht .inhalt {
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.nachricht.user .inhalt {
  background: #0d6efd;
  color: #fff;
  margin-left: 3rem;
}

.nachricht.assistent .inhalt {
  background: #f1f3f5;
  margin-right: 3rem;
}

.nachricht-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0 3rem 0.25rem;
}

.nachricht.user .nachricht-kopf {
  margin-left: 3rem;
  margin-right: 0;
}

.nachricht.assistent .nachricht-kopf {
  margin-left: 0;
  margin-right: 3rem;
}

.nachricht-rolle {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

.kopier-btn {
  border: 1px solid #dee2e6;
  background: #fff;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
  color: #495057;
}

.kopier-btn:hover {
  background: #e9ecef;
}

.nachricht-aktionen {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kopier-btn-loeschen {
  color: #dc3545;
}

.kopier-btn-loeschen:hover {
  background: #fdecec;
  border-color: #f5c2c7;
}

.modell-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.modell-leiste-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c757d;
  margin-right: 0.25rem;
}

.modell-select {
  max-width: 460px;
}

.modell-tab {
  border: 1px solid #ced4da;
  background: #f8f9fa;
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: #333;
  text-align: left;
}

.modell-tab .modell-tab-modell {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: #6c757d;
}

.modell-tab:hover {
  background: #e9ecef;
}

.modell-tab.aktiv {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.modell-tab.aktiv .modell-tab-modell {
  color: rgba(255, 255, 255, 0.85);
}

/* ===== Bildersuche im AI-Chat ===== */

.nachricht-bilder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 3rem 0 0;
}

.nachricht-bild {
  height: 120px;
  border-radius: 0.5rem;
  object-fit: cover;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
}

.nachricht-bild:hover {
  opacity: 0.85;
}

.websuche-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0d6efd;
  background: #e7f1ff;
  border: 1px solid #b6d4fe;
  border-radius: 0.4rem;
  padding: 0.1rem 0.55rem;
  margin: 0 3rem 0.25rem 0;
}

/* ===== Lern-Gruppen (Neu → Verstanden) ===== */

/* Gruppenfarben als CSS-Variablen – alle Bausteine nutzen dieselben Farben. */
.gruppe-1 { --gruppe-farbe: #6c757d; --gruppe-text: #ffffff; }
.gruppe-2 { --gruppe-farbe: #0dcaf0; --gruppe-text: #07303b; }
.gruppe-3 { --gruppe-farbe: #0d6efd; --gruppe-text: #ffffff; }
.gruppe-4 { --gruppe-farbe: #198754; --gruppe-text: #ffffff; }
.gruppe-5 { --gruppe-farbe: #ffc107; --gruppe-text: #433800; }

.gruppen-badge {
  background: var(--gruppe-farbe);
  color: var(--gruppe-text);
}

/* Große Einstufen-Buttons im Lernmodus */
.gruppen-btn {
  background: var(--gruppe-farbe);
  color: var(--gruppe-text);
  border: none;
  border-radius: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.7rem 1.1rem;
}

.gruppen-btn:hover,
.gruppen-btn:focus {
  background: var(--gruppe-farbe);
  color: var(--gruppe-text);
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.gruppen-bewertung-label {
  font-size: 1.05rem;
  color: #495057;
}

/* Kleine Gruppen-Anzeige auf den Stapel-Kacheln */
.gruppen-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.gruppen-mini-badge {
  background: var(--gruppe-farbe);
  color: var(--gruppe-text);
  font-size: 0.72rem;
  border-radius: 0.4rem;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}

/* Verteilungs-Badges auf der Stapel-Detailseite */
.gruppen-uebersicht {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gruppen-uebersicht .badge {
  font-size: 0.95rem;
}

/* Gruppen-Überschriften in der Kartenliste */
.gruppen-ueberschrift {
  border-left: 5px solid var(--gruppe-farbe);
  padding-left: 0.6rem;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Klickbare Gruppen-Badges + Gruppen-Auswahl im Lernmodus */
a.gruppen-badge {
  opacity: 0.78;
}

a.gruppen-badge:hover {
  opacity: 1;
}

.gruppen-wahl {
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  opacity: 0.78;
}

.gruppen-wahl:hover {
  opacity: 1;
}

.gruppen-wahl-aktiv {
  opacity: 1;
  outline: 2px solid #212529;
  outline-offset: 1px;
}

/* Aufklappbare CSV-Anleitung */
.csv-anleitung-summary {
  cursor: pointer;
}

.csv-anleitung-summary:hover {
  color: #0d6efd;
}

/* ===== Community-Chat ===== */

.community-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.community-autor {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.community-autor:hover {
  text-decoration: underline;
}

.community-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.community-avatar-gross {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 2rem;
  display: flex;
}

/* Stabile Avatar-Farben (Index 0–5) */
.avatar-f0 { background: #0d6efd; }
.avatar-f1 { background: #198754; }
.avatar-f2 { background: #6f42c1; }
.avatar-f3 { background: #d63384; }
.avatar-f4 { background: #fd7e14; }
.avatar-f5 { background: #0aa2c0; }

.community-zeit {
  font-weight: 400;
  color: #adb5bd;
  margin-left: 0.35rem;
}

/* ===== Bilder auf Karteikarten ===== */

/* Umrahmung der Bild-Felder im Formular */
.bild-feld {
  background: #f8f9fa;
  border: 1px dashed #ced4da;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
}

/* Vorschau-Rahmen im Karteikartenformat (3:2) – zeigt genau das, was
   auch gespeichert wird. */
.bild-rahmen {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 3 / 2;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  background: #fff;
  overflow: hidden;
}

.bild-rahmen .bild-vorschau {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  max-height: none;
}

/* Vorschau im Formular (gewähltes bzw. gespeichertes Bild) */
.bild-vorschau {
  display: block;
  max-height: 160px;
  max-width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
  background: #fff;
  object-fit: contain;
}

/* Großes Bild im Lernmodus – teilt sich den Platz mit dem Text und
   bleibt dabei immer vollständig sichtbar (kein Beschnitt). */
.karte-bild {
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 70%;
  max-width: 100%;
  margin: 0 auto 0.75rem auto;
  border-radius: 0.6rem;
  object-fit: contain;
}

/* Miniaturbilder in der Kartenliste des Stapels */
.karten-liste-bilder {
  display: flex;
  gap: 0.25rem;
  flex: 0 0 auto;
}

/* ===== Ausbau 2026-10-25-A: Chat-Parameter ===== */
.parameter-panel { border: 1px solid #dee2e6; border-radius: 0.5rem; background: #f8f9fa; }
.parameter-panel > summary { cursor: pointer; padding: 0.4rem 0.75rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.parameter-inhalt { padding: 0.75rem; border-top: 1px solid #dee2e6; max-height: 45vh; overflow-y: auto; }
.parameter-chip { font-size: 0.75rem; background: #e7f1ff; color: #0a58ca; border-radius: 1rem; padding: 0.05rem 0.55rem; }
.parameter-label { font-size: 0.85rem; font-weight: 600; color: #495057; margin-bottom: 0.25rem; display: block; }
.denk-stufen { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.parameter-zahl { max-width: 5.5rem; }
.denkprozess { margin: 0 3rem 0.35rem 0; font-size: 0.85rem; }
.denkprozess > summary { cursor: pointer; color: #6f42c1; font-weight: 600; }
.denkprozess-text { white-space: pre-wrap; background: #f6f2ff; border-left: 3px solid #6f42c1; padding: 0.5rem 0.75rem; border-radius: 0.4rem; color: #495057; max-height: 300px; overflow-y: auto; }
.nachricht-meta { font-size: 0.72rem; color: #adb5bd; margin: 0.2rem 3rem 0 0.25rem; }

/* ===== Notizen ===== */
.tag-chip { display: inline-block; font-size: 0.8rem; background: #f1f3f5; border: 1px solid #dee2e6; color: #495057; border-radius: 1rem; padding: 0.05rem 0.6rem; text-decoration: none; position: relative; z-index: 2; }
.tag-chip:hover { background: #e7f1ff; }
.tag-chip.aktiv { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.tag-chip.aktiv .text-muted { color: rgba(255,255,255,.8) !important; }
.tag-chip.klein { font-size: 0.72rem; }
.notiz-kachel { border-top: 5px solid transparent; }
.notiz-farbe-gelb { --notiz-farbe: #ffd43b; }
.notiz-farbe-gruen { --notiz-farbe: #69db7c; }
.notiz-farbe-blau { --notiz-farbe: #74c0fc; }
.notiz-farbe-rosa { --notiz-farbe: #faa2c1; }
.notiz-farbe-lila { --notiz-farbe: #b197fc; }
.notiz-kachel[class*="notiz-farbe-"] { border-top-color: var(--notiz-farbe); }
.farb-punkt { width: 1.4rem; height: 1.4rem; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px #ced4da; background: var(--notiz-farbe, #fff); margin: 0; }
.farb-keine { background: repeating-linear-gradient(45deg, #fff, #fff 3px, #dee2e6 3px, #dee2e6 5px); }
.btn-check:checked + .farb-punkt { box-shadow: 0 0 0 2px #0d6efd; }
.anheft-btn { opacity: 0.3; padding: 0 0.3rem; }
.anheft-btn:hover, .anheft-btn.aktiv { opacity: 1; }
.editor-status { font-size: 0.8rem; color: #6c757d; padding: 0.35rem 0.25rem; }
.editor-area blockquote { border-left: 4px solid #ced4da; padding-left: 1rem; color: #495057; }
.editor-area pre { background: #f1f3f5; padding: 0.75rem; border-radius: 0.4rem; white-space: pre-wrap; }
.editor-area ul.checkliste { list-style: none; padding-left: 0.25rem; }
.editor-area ul.checkliste > li { position: relative; padding-left: 1.8rem; }
.editor-area ul.checkliste > li::before { content: "☐"; position: absolute; left: 0; cursor: pointer; font-size: 1.2em; line-height: 1.3; }
.editor-area ul.checkliste > li.erledigt { text-decoration: line-through; color: #868e96; }
.editor-area ul.checkliste > li.erledigt::before { content: "☑"; color: #198754; }
@media print {
  header, footer, .toolbar, .notiz-meta, .editor-status, .notiz-editor .btn, .notiz-meldung { display: none !important; }
  .editor-area { border: none; box-shadow: none; min-height: 0; }
}

.karten-liste-bild {
  height: 48px;
  width: 48px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
}

/* ===== Appweiter Dark Mode ===== */

html[data-bs-theme="dark"] {
  color-scheme: dark;
}

html[data-bs-theme="dark"] body {
  background-color: #171c20;
  color: #e2e7e9;
}

html[data-bs-theme="dark"] .rechner-seite {
  background-color: #171c20;
  background-image: linear-gradient(rgba(113, 151, 165, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(113, 151, 165, 0.045) 1px, transparent 1px);
}

html[data-bs-theme="dark"] .footer {
  border-color: #39434a !important;
}

html[data-bs-theme="dark"] .karte-seite {
  background: #242b30;
  border-color: #46525a;
  color: #edf1f2;
}

html[data-bs-theme="dark"] .karte-seite.rueckseite {
  background: #1d2429;
  border-color: #59646b;
}

html[data-bs-theme="dark"] .kachel,
html[data-bs-theme="dark"] .notiz-kachel {
  background-color: #252d32;
  color: #e2e7e9;
}

html[data-bs-theme="dark"] .kachel.text-dark,
html[data-bs-theme="dark"] .kachel.text-dark h2,
html[data-bs-theme="dark"] .notiz-kachel.text-dark,
html[data-bs-theme="dark"] .notiz-kachel .stretched-link-titel {
  color: #f1f5f6 !important;
}

html[data-bs-theme="dark"] .toolbar,
html[data-bs-theme="dark"] .parameter-panel,
html[data-bs-theme="dark"] .bild-feld,
html[data-bs-theme="dark"] .sidebar {
  background-color: #20272c;
  border-color: #414c53;
  color: #e2e7e9;
}

html[data-bs-theme="dark"] .editor-area,
html[data-bs-theme="dark"] .bild-rahmen,
html[data-bs-theme="dark"] .bild-vorschau,
html[data-bs-theme="dark"] pre.bg-white {
  background-color: #171d21;
  border-color: #465159;
  color: #e4e9eb;
}

html[data-bs-theme="dark"] .card .bg-light.rounded {
  background-color: #293238 !important;
  color: #e4e9eb;
}

html[data-bs-theme="dark"] .toolbar .sep {
  background-color: #58636a;
}

html[data-bs-theme="dark"] .chat-link {
  color: #dce3e6;
}

html[data-bs-theme="dark"] .chat-link:hover,
html[data-bs-theme="dark"] .modell-tab,
html[data-bs-theme="dark"] .tag-chip {
  background-color: #303a40;
  border-color: #4c5a62;
  color: #e0e6e8;
}

html[data-bs-theme="dark"] .nachricht.assistent .inhalt,
html[data-bs-theme="dark"] .kopier-btn,
html[data-bs-theme="dark"] .editor-area pre,
html[data-bs-theme="dark"] .tag-chip {
  background-color: #293238;
  color: #e0e6e8;
}

html[data-bs-theme="dark"] .kopier-btn {
  border-color: #4c5960;
}

html[data-bs-theme="dark"] .kopier-btn:hover,
html[data-bs-theme="dark"] .modell-tab:hover,
html[data-bs-theme="dark"] .tag-chip:hover {
  background-color: #39464d;
}

html[data-bs-theme="dark"] .parameter-inhalt {
  border-color: #414c53;
}

html[data-bs-theme="dark"] .parameter-chip {
  background: #173b57;
  color: #a9d6fa;
}

html[data-bs-theme="dark"] .parameter-label,
html[data-bs-theme="dark"] .editor-area blockquote {
  color: #c4cdd1;
}

html[data-bs-theme="dark"] .denkprozess-text {
  background: #2b2937;
  color: #e4e0f1;
}

html[data-bs-theme="dark"] .farb-punkt {
  border-color: #171c20;
}

html[data-bs-theme="dark"] .karten-liste-bild {
  border-color: #465159;
  background: #20272c;
}

.entdecken-suche {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  max-width: 900px;
}

.entdecken-karten {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 1rem;
}

.entdecken-karte {
  border-color: var(--bs-border-color);
}

.entdecken-karte .card-header {
  min-height: 46px;
}

.entdecken-label {
  margin: 0 0 0.45rem;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.entdecken-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.entdecken-antwort > summary {
  color: var(--bs-primary);
  cursor: pointer;
  font-weight: 700;
}

.entdecken-bild {
  display: block;
  width: 100%;
  max-height: 240px;
  margin-bottom: 1rem;
  border-radius: 4px;
  object-fit: contain;
}

@media (max-width: 480px) {
  .entdecken-suche {
    grid-template-columns: minmax(0, 1fr);
  }

  .entdecken-suche .btn {
    width: 100%;
  }
}
