/* ==========================================================================
   GOJICAMPUS — KI-LERNPLATTFORM
   Layout-Fixes, Animationen, Klassenbuch & Auth-Styles
   ========================================================================== */

:root {
  --bg-app: #f4f7fc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --border-line: #e2e8f0;

  --text-dark: #1e293b;
  --text-medium: #475569;
  --text-soft: #64748b;

  --c-bio: #00b894;
  --c-bio-light: #e6faf5;
  --c-chemie: #fd79a8;
  --c-chemie-light: #fef0f5;
  --c-physik: #0984e3;
  --c-physik-light: #eaf4fd;
  --c-mathe: #6c5ce7;
  --c-mathe-light: #f0effe;
  --c-deutsch: #e17055;
  --c-deutsch-light: #fdf1ee;
  --c-geschichte: #d68e24;
  --c-geschichte-light: #fdf5e8;
  --c-memory: #a29bfe;
  --c-memory-light: #f4f3ff;

  --primary-knete: #6c5ce7;
  --primary-knete-hover: #5849d4;
  --accent-pink: #fd79a8;
  --accent-yellow: #ffeaa7;

  --font-knete: 'Fredoka', cursive, system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --shadow-soft: 0 4px 20px rgba(108, 92, 231, 0.08);
  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 28px rgba(108, 92, 231, 0.16);
}

/* ==========================================================================
   Altersstufen-Themes
   ========================================================================== */
body.mode-kids {
  --bg-app: #fffbf0;
  --text-dark: #1a1a2e;
  font-size: 17px;
}
body.mode-kids .mosaic-card { border-width: 3px; }

body.mode-senioren {
  --bg-app: #f9f8f6;
  --text-dark: #111827;
  --text-medium: #374151;
  font-size: 19px;
  line-height: 1.75;
}
body.mode-senioren .app-name { font-size: 1.5rem; }
body.mode-senioren .tab-btn { padding: 0.9rem 1.6rem; font-size: 1.1rem; }

body.dark-theme {
  --bg-app: #0f1422;
  --bg-card: #182033;
  --bg-card-subtle: #1f2942;
  --border-line: #2e3a59;
  --text-dark: #f8fafc;
  --text-medium: #cbd5e1;
  --text-soft: #94a3b8;
  --c-bio-light: rgba(0, 184, 148, 0.15);
  --c-chemie-light: rgba(253, 121, 168, 0.15);
  --c-physik-light: rgba(9, 132, 227, 0.15);
  --c-mathe-light: rgba(108, 92, 231, 0.15);
  --c-deutsch-light: rgba(225, 112, 85, 0.15);
  --c-geschichte-light: rgba(214, 142, 36, 0.15);
  --c-memory-light: rgba(162, 155, 254, 0.15);
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.3);
}

body.font-sm { font-size: 14px; }
body.font-std { font-size: 16px; }
body.font-lg { font-size: 19px; }
body.font-xl { font-size: 22px; }

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   Layout-Grundstruktur — FIX: kein horizontales Überlaufen
   ========================================================================== */
html, body {
  overflow-x: hidden;  /* BUGFIX: verhindert horizontales Abschneiden */
}

body {
  background-color: var(--bg-app);
  color: var(--text-dark);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--primary-knete);
  outline-offset: 2px;
}

/* ==========================================================================
   Animationen (Keyframes)
   ========================================================================== */
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.7; }
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-line);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none !important;
  color: inherit !important;
  border-bottom: none !important;
  outline: none !important;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 14px;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-group:hover,
.brand-group:focus,
.brand-group:active,
.brand-group:visited {
  text-decoration: none !important;
  color: inherit !important;
  border-bottom: none !important;
  outline: none !important;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.08);
}

.brand-group *,
.brand-group *:hover,
.brand-group *:focus,
.brand-group *:active,
.brand-group *:visited {
  text-decoration: none !important;
  border-bottom: none !important;
}

.brand-avatar {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(108, 92, 231, 0.08);
  border-radius: 16px;
  overflow: visible;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  box-shadow: 0 8px 18px rgba(108, 92, 231, 0.08);
}

.brand-avatar:hover {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 12px 22px rgba(108, 92, 231, 0.14);
}

.brand-logo,
.banner-logo,
.mascot-logo,
.footer-logo,
.modal-logo,
.kb-login-logo,
.kb-zeugnis-logo,
.kb-banner-logo,
.memory-logo,
.final-logo {
  display: block;
  object-fit: contain;
  background: transparent;
}

.brand-logo { width: 100%; height: 100%; }

.banner-logo {
  width: 160px;
  height: 160px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.mascot-logo {
  width: 132px;
  height: 132px;
  margin: 0 auto;
  background: transparent;
  border-radius: 0;
}

.footer-logo {
  width: 36px;
  height: 36px;
  background: transparent;
  border-radius: 0;
}

.footer-copy {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-logo {
  width: 36px;
  height: 36px;
  display: inline-block;
  vertical-align: middle;
  background: transparent;
  border-radius: 0;
  margin-right: 0.35rem;
}

.kb-login-logo,
.kb-zeugnis-logo,
.kb-banner-logo,
.memory-logo {
  width: 88px;
  height: 88px;
  background: transparent;
  border-radius: 0;
  flex-shrink: 0;
}

.kb-login-logo { width: 120px; height: 120px; margin: 0 auto 0.75rem; }

.final-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
  background: transparent;
  border-radius: 0;
}

.knete-logo-svg { width: 100%; height: 100%; }

.brand-titles {
  display: flex;
  flex-direction: column;
}

.app-name {
  font-family: var(--font-knete);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
}

.badge-pop {
  font-size: 0.75rem;
  background: linear-gradient(135deg, #fd79a8, #6c5ce7);
  color: #ffffff;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.08em;
  animation: pulse-dot 2.5s ease-in-out infinite;
}

.app-sub {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* Altersgruppen-Pills */
.age-mode-selector {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-line);
  gap: 0.25rem;
}

.age-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.age-btn:hover { color: var(--text-dark); transform: scale(1.04); }

.age-btn.active {
  background: var(--primary-knete);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.35);
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.font-scaler {
  display: flex;
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tool-btn {
  padding: 0.35rem 0.65rem;
  border: none;
  background: var(--bg-card-subtle);
  color: var(--text-medium);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.tool-btn.active, .tool-btn:hover {
  background: var(--border-line);
  color: var(--text-dark);
}

.btn-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.btn-round:hover { transform: rotate(15deg) scale(1.1); }

.btn-api-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-login-pill {
  background: linear-gradient(135deg, #fd79a8, #6c5ce7);
  color: #ffffff;
  border: none;
}
.btn-login-pill:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(108,92,231,0.3); }

.api-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
}

.api-dot.active {
  background: #00b894;
  box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ==========================================================================
   Dashboard Tabs Bar
   ========================================================================== */
.dashboard-tabs-bar {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-line);
  position: sticky;
  top: 73px;
  z-index: 90;
}

.tabs-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  overflow-x: auto;
}

.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.3rem;
  background: var(--bg-card-subtle);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-knete);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-dark); background: var(--border-line); transform: translateY(-1px); }

.tab-btn.active {
  background: #ffffff;
  color: var(--primary-knete);
  border-color: var(--primary-knete);
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.12);
}

body.dark-theme .tab-btn.active { background: var(--bg-card-subtle); }

.tab-pulse-badge {
  font-family: var(--font-body);
  font-size: 0.7rem;
  background: #ff7675;
  color: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  animation: pulse-dot 2s ease-in-out infinite;
}

.tab-badge-warm {
  font-family: var(--font-body);
  font-size: 0.75rem;
  background: #ffeaa7;
  color: #d63031;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.tab-badge-new {
  font-family: var(--font-body);
  font-size: 0.7rem;
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
}

/* ==========================================================================
   Haupt-Dashboard — FIX: overflow-x: hidden verhindert rechts-Abschneiden
   ========================================================================== */
.dashboard-main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  overflow-x: hidden; /* BUGFIX */
}

.tab-content {
  display: none;
  animation: tabFadeIn 0.28s ease-out;
}

.tab-content.active { display: block; }

/* ==========================================================================
   TAB 1: LERN-WELTEN
   ========================================================================== */
.greeting-banner {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.4s ease-out;
}

.greeting-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

.banner-illu { width: 140px; flex-shrink: 0; }
.illu-svg { width: 100%; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15)); }

.banner-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.banner-title {
  font-family: var(--font-knete);
  font-size: 2.1rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.banner-desc {
  font-size: 1.05rem;
  opacity: 0.95;
  max-width: 700px;
}

.subjects-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.mosaic-card {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 1.25rem;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  animation: cardEntrance 0.35s ease-out both;
}

.mosaic-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-hover);
}

.mosaic-illu { width: 70px; height: 70px; flex-shrink: 0; }
.mosaic-illu svg { width: 100%; height: 100%; }

.mosaic-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.card-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.theme-bio .card-kicker     { color: var(--c-bio); }
.theme-chemie .card-kicker  { color: var(--c-chemie); }
.theme-physik .card-kicker  { color: var(--c-physik); }
.theme-mathe .card-kicker   { color: var(--c-mathe); }
.theme-deutsch .card-kicker { color: var(--c-deutsch); }
.theme-geschichte .card-kicker { color: var(--c-geschichte); }

/* Theme-Farben für Kartenränder on hover */
.theme-bio:hover     { border-color: var(--c-bio); }
.theme-chemie:hover  { border-color: var(--c-chemie); }
.theme-physik:hover  { border-color: var(--c-physik); }
.theme-mathe:hover   { border-color: var(--c-mathe); }
.theme-deutsch:hover { border-color: var(--c-deutsch); }
.theme-geschichte:hover { border-color: var(--c-geschichte); }

.mosaic-info h3 {
  font-family: var(--font-knete);
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
  color: var(--text-dark);
}

.mosaic-info p {
  font-size: 0.92rem;
  color: var(--text-medium);
  line-height: 1.55;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.mosaic-meta {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.mini-tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card-subtle);
  color: var(--text-medium);
  font-weight: 600;
}

.btn-card-action {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-line);
  background: var(--bg-card-subtle);
  color: var(--text-dark);
  font-family: var(--font-knete);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card-action:hover {
  background: var(--primary-knete);
  color: #ffffff;
  border-color: var(--primary-knete);
  transform: translateY(-1px);
}

/* ==========================================================================
   TAB 2: TUTOR KNETE (CHAT) — BUGFIX: Scroll & kein Text-Abschneiden
   ========================================================================== */
.chat-dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  /* BUGFIX: feste Höhe mit calc, kein Overflow nach rechts */
  height: min(660px, calc(100vh - 190px));
  min-height: 480px;
  overflow: hidden;
  animation: fadeInUp 0.3s ease-out;
}

.chat-sidebar {
  background: var(--bg-card-subtle);
  border-right: 2px solid var(--border-line);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto; /* Sidebar scrollbar wenn nötig */
}

.knete-mascot-card {
  text-align: center;
  background: var(--bg-card);
  border: 2px dashed var(--border-line);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
}

.knete-big-badge {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.5rem;
  background: transparent;
}

.knete-big-badge .mascot-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.knete-icon-huge {
  display: inline-block;
}

.sidebar-tutor-name {
  font-family: var(--font-knete);
  font-size: 1.4rem;
  color: var(--text-dark);
}

.sidebar-tutor-desc {
  font-size: 0.85rem;
  color: var(--text-medium);
  font-style: italic;
  margin-top: 0.35rem;
}

.control-box label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.form-control-knete {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
}
.form-control-knete:focus { border-color: var(--primary-knete); }

.btn-outline-knete {
  background: transparent;
  border: 2px solid var(--primary-knete);
  color: var(--primary-knete);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-knete);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-outline-knete:hover { background: var(--primary-knete); color: #ffffff; }

.btn-full { width: 100%; margin-top: auto; }

/* Chat Hauptbereich — FIX: striktes flex-Layout damit kein Überlauf */
.chat-main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;   /* BUGFIX: flex-child darf schrumpfen */
  overflow: hidden;
}

.chat-scroll-window {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;   /* BUGFIX: scrollbar im Chat-Fenster */
  overflow-x: hidden; /* BUGFIX: keine horizontale Scrollbar */
  padding: 1.5rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Scrollbar schön stylen */
.chat-scroll-window::-webkit-scrollbar { width: 6px; }
.chat-scroll-window::-webkit-scrollbar-track { background: transparent; }
.chat-scroll-window::-webkit-scrollbar-thumb { background: var(--border-line); border-radius: 3px; }

/* BUGFIX: Bubble-Breite auf max-width begrenzen, word-wrap erzwingen */
.bubble {
  width: fit-content;
  max-width: min(82%, 52rem);
  min-width: 0;
  padding: 1.15rem 1.4rem;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  line-height: 1.65;
  animation: bubblePop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  word-wrap: break-word;      /* BUGFIX: Wortumbruch */
  overflow-wrap: break-word;  /* BUGFIX: moderner Standard */
  word-break: break-word;
}

.bubble-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.bubble-body img,
.bubble-body table,
.bubble-body pre {
  max-width: 100%;
}

.bubble-knete {
  align-self: flex-start;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-line);
  border-left: 5px solid var(--primary-knete);
  color: var(--text-dark);
}

.chat-welcome {
  max-width: 100%;
}

.chat-welcome-dashboard {
  width: 100%;
  max-width: 58rem;
  min-width: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeInUp 0.3s ease-out;
}

.chat-welcome-intro {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-welcome-mascot {
  width: clamp(5.25rem, 10vw, 6.5rem);
  height: clamp(5.25rem, 10vw, 6.5rem);
  flex: 0 0 auto;
  object-fit: contain;
}

.chat-welcome-speech {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.chat-welcome-speech::before {
  content: "";
  position: absolute;
  left: -0.4rem;
  top: 1.2rem;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--bg-card);
  border-left: 1px solid var(--border-line);
  border-bottom: 1px solid var(--border-line);
  transform: rotate(45deg);
}

.chat-welcome-speech h3 {
  margin: 0 0 0.25rem;
  color: var(--text-dark);
  font-family: var(--font-knete);
  font-size: 1.05rem;
}

.chat-welcome-speech p {
  margin: 0;
  color: var(--text-medium);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-welcome-selection {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 0.74rem;
}

.chat-welcome-topics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.chat-welcome-topic {
  min-width: 0;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  text-align: left;
  color: var(--text-dark);
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-welcome-topic:hover {
  border-color: var(--primary-knete);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.chat-welcome-topic-icon {
  grid-row: 1 / 3;
  font-size: 1.35rem;
  text-align: center;
}

.chat-welcome-topic-title {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-welcome-topic-action {
  margin-top: 0.2rem;
  color: var(--primary-knete);
  font-size: 0.68rem;
  font-weight: 700;
}

.chat-welcome-fact {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-line);
  border-left: 4px solid var(--primary-knete);
  border-radius: var(--radius-sm);
}

.chat-welcome-fact-icon {
  font-size: 1.25rem;
  line-height: 1.2;
}

.chat-welcome-fact strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--text-dark);
  font-size: 0.76rem;
}

.chat-welcome-fact p {
  margin: 0;
  color: var(--text-medium);
  font-size: 0.78rem;
  line-height: 1.4;
}

.bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6c5ce7, #5849d4);
  color: #ffffff;
  border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.8;
}

.bubble-body p { margin-bottom: 0.75rem; }
.bubble-body p:last-child { margin-bottom: 0; }
.bubble-body ul, .bubble-body ol { margin: 0.5rem 0 0.75rem 1.5rem; }

/* Chips */
.knete-chips-deck {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-line);
  min-width: 0;
  overflow: hidden;
  flex-shrink: 0; /* BUGFIX: chips-Leiste darf nicht wachsen */
}

.knete-chip {
  min-width: 0;
  padding: 0.35rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: normal;
  overflow-wrap: anywhere;
}
.knete-chip:hover { background: var(--primary-knete); color: #ffffff; border-color: var(--primary-knete); transform: translateY(-2px); }

/* Eingabezeile — FIX: flex-shrink: 0 */
.chat-form-knete {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 2px solid var(--border-line);
  background: var(--bg-card);
  flex-shrink: 0; /* BUGFIX: Form geht nicht unter Bildschirmrand */
}

.chat-form-knete textarea {
  flex: 1;
  min-width: 0; /* BUGFIX: flex-child kann schrumpfen */
  padding: 0.8rem 1rem;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dark);
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}
.chat-form-knete textarea:focus { border-color: var(--primary-knete); }

.btn-knete-send {
  background: linear-gradient(135deg, #fd79a8, #6c5ce7);
  border: none;
  color: #ffffff;
  font-family: var(--font-knete);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 1.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-knete-send:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(108,92,231,0.35); }
.chat-send-col { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 0.4rem; flex-shrink: 0; }
.chat-send-col .btn-knete-send { flex: 1; justify-content: center; padding: 0.5rem 1.4rem; }

/* ==========================================================================
   TAB 3: WISSENS-QUIZ
   ========================================================================== */
.quiz-shell {
  max-width: 840px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.3s ease-out;
}

.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.quiz-subject-select-wrap { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.quiz-meters { display: flex; gap: 0.6rem; }

.badge-round {
  padding: 0.35rem 0.85rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-score { background: #fff9e6; color: #b7791f; border-color: #fbd38d; }

.quiz-meter-line {
  width: 100%;
  height: 8px;
  background: var(--bg-card-subtle);
  border-radius: 4px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.quiz-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #fd79a8, #6c5ce7);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-category-tag {
  display: inline-block;
  font-family: var(--font-knete);
  font-size: 0.9rem;
  color: var(--primary-knete);
  margin-bottom: 0.4rem;
}

.quiz-prompt-title {
  font-family: var(--font-knete);
  font-size: 1.55rem;
  line-height: 1.35;
  color: var(--text-dark);
  margin-bottom: 1.75rem;
}

.quiz-choices-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.quiz-choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-choice-btn:hover:not(:disabled) {
  border-color: var(--primary-knete);
  background: #ffffff;
  transform: translateX(5px);
}

.choice-marker {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--primary-knete);
  flex-shrink: 0;
}

.quiz-choice-btn.correct-pick { border-color: #00b894; background: #e6faf5; color: #006241; }
.quiz-choice-btn.correct-pick .choice-marker { background: #00b894; color: #ffffff; }
.quiz-choice-btn.wrong-pick   { border-color: #d63031; background: #ffebee; color: #b71c1c; }
.quiz-choice-btn.wrong-pick .choice-marker   { background: #d63031; color: #ffffff; }

.quiz-explanation-bubble {
  background: var(--bg-card-subtle);
  border-left: 4px solid var(--primary-knete);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  animation: tabFadeIn 0.25s ease-out;
}
.quiz-explanation-bubble h4 { font-family: var(--font-knete); font-size: 1.15rem; margin-bottom: 0.35rem; }
.quiz-explanation-bubble p { font-size: 0.95rem; line-height: 1.6; }

.quiz-footer-actions { display: flex; justify-content: flex-end; }

.quiz-final-frame { text-align: center; padding: 2.5rem 1rem; }
.final-celebration { font-size: 4rem; margin-bottom: 0.5rem; animation: pulse-dot 1.5s ease-in-out infinite; }
.final-title { font-family: var(--font-knete); font-size: 2.2rem; margin-bottom: 0.5rem; }
.final-desc { font-size: 1.15rem; color: var(--text-medium); margin-bottom: 1.5rem; }
.final-advice {
  background: var(--bg-card-subtle);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  max-width: 550px;
  margin: 0 auto 2rem auto;
  font-size: 0.95rem;
}

/* ==========================================================================
   TAB 4: GEDÄCHTNIS-STUBE
   ========================================================================== */
.memory-chamber-layout { max-width: 960px; margin: 0 auto; }

.memory-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #ffeaa7, #fab1a0);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  color: #2d3436;
  animation: fadeInUp 0.35s ease-out;
}
.memory-heart-icon { font-size: 3.5rem; flex-shrink: 0; }
.memory-hero h2 { font-family: var(--font-knete); font-size: 1.85rem; margin-bottom: 0.35rem; }
.memory-hero p  { font-size: 1.05rem; line-height: 1.6; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.memory-card {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  animation: cardEntrance 0.35s ease-out both;
  transition: transform 0.2s ease;
}
.memory-card:hover { transform: translateY(-4px); }

.mem-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #e17055;
  background: #fdece8;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.75rem;
  align-self: flex-start;
}

.memory-card h3 { font-family: var(--font-knete); font-size: 1.35rem; margin-bottom: 0.6rem; color: var(--text-dark); }
.memory-card p  { font-size: 0.98rem; color: var(--text-medium); line-height: 1.65; margin-bottom: 1.25rem; flex-grow: 1; }

.mem-riddle { font-family: var(--font-knete); font-size: 1.25rem !important; color: var(--primary-knete) !important; font-weight: 600; }

.mem-options { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }

.btn-mem-opt {
  padding: 0.75rem 1rem;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-mem-opt:hover { border-color: var(--primary-knete); background: #ffffff; }
.btn-mem-opt.correct-mem { background: #e6faf5; border-color: #00b894; color: #006241; }
.btn-mem-opt.wrong-mem   { background: #ffebee; border-color: #d63031; color: #b71c1c; }

.mem-feedback {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.5;
  background: #e6faf5;
  border: 1px solid #00b894;
  color: #006241;
}

/* ==========================================================================
   TAB 5: KLASSENBUCH (NEU)
   ========================================================================== */
.klassenbuch-layout {
  max-width: 960px;
  margin: 0 auto;
  animation: fadeInUp 0.3s ease-out;
}

.kb-header-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  color: #ffffff;
}

.kb-banner-icon { font-size: 3.5rem; flex-shrink: 0; }
.kb-header-banner h2 { font-family: var(--font-knete); font-size: 1.85rem; margin-bottom: 0.35rem; }
.kb-header-banner p  { font-size: 1rem; opacity: 0.9; }

/* Login-Prompt */
.kb-login-prompt {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.kb-login-card {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 540px;
  box-shadow: var(--shadow-soft);
  animation: cardEntrance 0.4s ease-out;
}

.kb-login-icon { font-size: 4rem; margin-bottom: 1rem; }
.kb-login-card h3 { font-family: var(--font-knete); font-size: 1.6rem; margin-bottom: 0.75rem; }
.kb-login-card p  { color: var(--text-medium); line-height: 1.65; margin-bottom: 2rem; }

.kb-login-btns { display: flex; flex-direction: column; gap: 0.75rem; }

/* Stats-Karten */
.kb-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kb-stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease;
}
.kb-stat-card:hover { transform: translateY(-4px); }

.kb-stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.kb-stat-value { font-family: var(--font-knete); font-size: 2rem; font-weight: 700; color: var(--primary-knete); }
.kb-stat-label { font-size: 0.82rem; color: var(--text-soft); font-weight: 600; margin-top: 0.25rem; }

/* Noten-Sektionen */
.kb-section { margin-bottom: 2rem; }
.kb-section-title {
  font-family: var(--font-knete);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.kb-grades-table, .kb-activity-list {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kb-empty-hint {
  padding: 2rem;
  text-align: center;
  color: var(--text-soft);
  font-style: italic;
}

.kb-data-status {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e5a3a3;
  border-radius: var(--radius-sm);
  background: #fff1f1;
  color: #8a1c1c;
  line-height: 1.5;
}

.kb-pending-notice {
  margin: 1rem 0;
  padding: 1.25rem 1.4rem;
  border: 1px solid #e0a22b;
  border-left: 4px solid #e0a22b;
  border-radius: var(--radius-sm);
  background: #fff8e8;
  color: #4c3b16;
  line-height: 1.5;
}
.kb-pending-notice label { display: block; margin: 1.1rem 0 0.5rem; font-weight: 700; }
.kb-pending-notice input[type="email"] {
  display: block;
  width: 100%;
  max-width: 520px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text-dark);
  background: #ffffff;
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
}
.kb-pending-notice input[type="email"]:focus { border-color: var(--primary-knete); outline: none; }

.kb-grade-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-line);
}
.kb-grade-row:last-child { border-bottom: none; }
.kb-grade-subject { flex: 1; font-weight: 700; }
.kb-grade-badge {
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-family: var(--font-knete);
  font-size: 1rem;
}
.grade-1 { background: #e6faf5; color: #006241; }
.grade-2 { background: #eaf7ff; color: #0060a8; }
.grade-3 { background: #fff9e6; color: #b7791f; }
.grade-4 { background: #fff3e0; color: #d86028; }
.grade-5, .grade-6 { background: #ffebee; color: #b71c1c; }

.kb-activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-line);
}
.kb-activity-item:last-child { border-bottom: none; }
.kb-activity-icon { font-size: 1.5rem; flex-shrink: 0; }
.kb-activity-text { flex: 1; font-size: 0.9rem; }
.kb-activity-date { font-size: 0.8rem; color: var(--text-soft); }

/* Zeugnis */
.kb-zeugnis-section { margin-top: 2rem; }

.kb-zeugnis-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #fff9e6, #fdf0d5);
  border: 2px solid #fbd38d;
  border-radius: var(--radius-lg);
  padding: 2rem;
  flex-wrap: wrap;
}
.kb-zeugnis-icon { font-size: 3rem; }
.kb-zeugnis-card div { flex: 1; min-width: 200px; }
.kb-zeugnis-card h3 { font-family: var(--font-knete); font-size: 1.35rem; margin-bottom: 0.35rem; }
.kb-zeugnis-card p { font-size: 0.92rem; color: var(--text-medium); }

/* ==========================================================================
   Auth Modal Styles
   ========================================================================== */
.modal-wide { max-width: 540px !important; }

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card-subtle);
}

.auth-tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-medium);
  transition: all 0.2s ease;
}
.auth-tab-btn.active {
  background: linear-gradient(135deg, var(--primary-knete), #8a7af7);
  color: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,0.2);
}

.form-group-k input,
.form-group-k select,
.form-control-knete,
.key-row input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1.5px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

.form-group-k input::placeholder,
.form-control-knete::placeholder {
  color: #94a3b8;
}

.form-group-k input:focus,
.form-group-k select:focus,
.form-control-knete:focus,
.key-row input:focus {
  border-color: var(--primary-knete);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.btn-knete-send {
  background: linear-gradient(135deg, var(--primary-knete), #8a7af7);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-knete-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(108, 92, 231, 0.28);
}

.btn-ghost {
  background: #f8fafc;
  border: 1px solid var(--border-line);
  color: var(--text-medium);
  font-weight: 700;
}

/* ==========================================================================
   Fußzeile & Modals
   ========================================================================== */
.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-line);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
}

.footer-wrap {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-sublinks { display: flex; gap: 1rem; }
.footer-sublinks a { color: var(--text-medium); text-decoration: underline; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: tabFadeIn 0.2s ease-out;
}

.modal-dialog-box {
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.22);
  overflow: hidden;
  animation: cardEntrance 0.25s ease-out;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-line);
}
.modal-head h3 { font-family: var(--font-knete); font-size: 1.2rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--text-soft);
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-dark); }

.modal-body-pad { padding: 1.5rem; max-height: 70vh; overflow-y: auto; }
.modal-info-p { font-size: 0.9rem; color: var(--text-medium); margin-bottom: 1.25rem; }

.form-group-k { margin-bottom: 1.15rem; }
.form-group-k label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.35rem; }

.auth-child-registration-notice {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e0a22b;
  border-left: 4px solid #e0a22b;
  border-radius: var(--radius-sm);
  background: #fff8e8;
  color: #4c3b16;
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-child-registration-notice p {
  margin: 0.4rem 0 0;
}

.key-row { display: flex; gap: 0.5rem; }
.key-row input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: monospace;
  background: var(--bg-card);
  color: var(--text-dark);
}

.btn-ghost {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-line);
  color: var(--text-dark);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.btn-sm { font-size: 0.85rem; padding: 0.4rem 0.75rem; }

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 86px;
}

.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #5f6c7b;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
}

.password-toggle-btn:hover {
  background: rgba(15, 23, 42, 0.04);
}

.auth-session-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 184, 148, 0.1);
  border: 1px solid rgba(0, 184, 148, 0.25);
  color: #0f766e;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.auth-session-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.auth-toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(420px, calc(100vw - 2rem));
  background: #1f2937;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
  padding: 0.8rem 0.85rem 0.8rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.auth-toast-message {
  flex: 1;
  overflow-wrap: anywhere;
}

.auth-toast-close {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.auth-toast.success { background: #0d7a59; }
.auth-toast.error { background: #c62828; }

.modal-banner-status {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: none;
  margin-top: 0.75rem;
}
.modal-banner-status.success { display: block; background: #e6faf5; color: #006241; border: 1px solid #00b894; }
.modal-banner-status.error   { display: block; background: #ffebee; color: #b71c1c; border: 1px solid #d63031; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-line);
}

.legal-flow h4 { font-family: var(--font-knete); font-size: 1.1rem; margin: 1rem 0 0.4rem; }
.legal-flow h4:first-child { margin-top: 0; }
.legal-flow p { font-size: 0.9rem; line-height: 1.6; color: var(--text-medium); }
.legal-flow code { background: var(--bg-card-subtle); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }

.hidden { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .chat-dashboard-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 600px;
  }
  .chat-scroll-window {
    height: min(420px, 65vh);
    flex: none;
  }
  .bubble { max-width: 100%; }
  .chat-welcome-dashboard { gap: 0.7rem; }
  .chat-welcome-mascot { width: 5rem; height: 5rem; }
  .chat-welcome-intro { gap: 0.65rem; }
  .chat-welcome-topics { gap: 0.4rem; }
  .chat-welcome-topic { padding: 0.5rem; }
  .chat-sidebar {
    border-right: none;
    border-bottom: 2px solid var(--border-line);
  }
  .greeting-banner {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }
  .banner-illu { width: 100px; }
  .subjects-mosaic { grid-template-columns: 1fr; }
  .age-mode-selector { flex-wrap: wrap; }
  .kb-stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .header-inner { gap: 0.5rem; }
  .age-text { display: none; }
  .dashboard-main { padding: 1rem; }
  .quiz-shell { padding: 1.25rem; }
  .kb-login-card { padding: 2rem 1.25rem; }
  .kb-zeugnis-card { flex-direction: column; text-align: center; }
}

/* ==========================================================================
   BILDMODUS — Antworten als Schrittkarten mit großen Symbolen
   ========================================================================== */
.visual-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  cursor: pointer;
  margin: 0;
}
.visual-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.visual-toggle-track {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  background: #94a3b8;
  border-radius: var(--radius-pill);
  transition: background 0.2s ease;
}
.visual-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.visual-toggle input:checked + .visual-toggle-track { background: #16a34a; }
.visual-toggle input:checked + .visual-toggle-track::after { transform: translateX(16px); }
.visual-toggle input:focus-visible + .visual-toggle-track { outline: 3px solid var(--primary-knete); outline-offset: 2px; }
.visual-toggle-text { font-weight: 700; font-size: 0.9rem; color: var(--text-dark); line-height: 1.25; }
.visual-toggle-logo { display: block; width: 64px; height: auto; }
.visual-toggle-text small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--text-soft); }

.visual-answer { display: flex; flex-direction: column; gap: 0.75rem; }

.va-core {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.1rem;
  background: linear-gradient(135deg, var(--c-mathe-light), var(--c-chemie-light));
  border: 2px solid var(--primary-knete);
  border-radius: var(--radius-md);
}
.va-core-icon { font-size: 2.4rem; line-height: 1; flex: 0 0 auto; }
.va-core p { margin: 0; font-family: var(--font-knete); font-size: 1.15rem; line-height: 1.35; color: #1e293b; }

.va-sketch { margin: 0; padding: 0.4rem; background: var(--bg-card); border: 1px solid var(--border-line); border-radius: var(--radius-lg); box-shadow: 0 2px 10px rgba(30, 41, 59, 0.06); }
.va-sketch svg { display: block; width: 100%; max-width: 300px; max-height: 130px; height: auto; margin: 0 auto; font-family: var(--font-body, system-ui, sans-serif); }
.va-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; counter-reset: va; }
.bubble-body .va-steps { margin: 0; }
.va-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1rem 0.75rem 0.85rem;
  background: var(--bg-card);
  border: 2px solid var(--border-line);
  border-left: 6px solid var(--primary-knete);
  border-radius: var(--radius-md);
  counter-increment: va;
  animation: va-in 0.35s ease both;
}
.va-step:nth-child(2) { animation-delay: 0.08s; border-left-color: var(--c-physik); }
.va-step:nth-child(3) { animation-delay: 0.16s; border-left-color: var(--c-bio); }
.va-step:nth-child(4) { animation-delay: 0.24s; border-left-color: var(--c-geschichte); }
.va-step:nth-child(5) { animation-delay: 0.32s; border-left-color: var(--c-chemie); }
.va-icon {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  font-size: 2rem;
  line-height: 1;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
}
.va-icon::after {
  content: counter(va);
  position: absolute;
  top: -0.45rem;
  left: -0.45rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  font-family: var(--font-knete);
  font-size: 0.8rem;
  color: #ffffff;
  background: var(--primary-knete);
  border-radius: 50%;
}
.va-body { min-width: 0; }
.va-title { display: block; font-family: var(--font-knete); font-size: 1.05rem; color: var(--text-dark); margin-bottom: 0.15rem; }
.va-body p { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--text-medium); }
.va-key { background: var(--accent-yellow); color: #1e293b; padding: 0.05rem 0.3rem; border-radius: 4px; font-weight: 700; }

.va-remember {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  background: var(--accent-yellow);
  border-radius: var(--radius-md);
  color: #1e293b;
}
.va-remember > span { font-size: 1.5rem; line-height: 1.2; }
.va-remember p { margin: 0; line-height: 1.45; }
.va-rest { padding-top: 0.25rem; }

@keyframes va-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .va-step { animation: none; }
}

.kb-anon-hint { background:#fff7e0; border:1px solid #f0d58a; color:#6b5200; border-radius:12px; padding:10px 14px; margin-bottom:14px; font-size:.9rem; line-height:1.4; }

/* Klasse beitreten (Schüler) */
.kb-join-card { background: var(--bg-card); border: 2px solid var(--border-line); border-radius: var(--radius-md); padding: 18px 20px; margin-top: 18px; }
.kb-join-copy { color: var(--text-medium); font-size: .92rem; margin: 0 0 12px; }
.kb-join-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.kb-join-row input { flex: 1 1 220px; min-width: 0; padding: 12px 14px; font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; border: 2px solid var(--border-line); border-radius: 12px; background: var(--bg-card-subtle); color: var(--text-dark); }
.kb-join-status { margin: 10px 0 0; font-size: .9rem; color: var(--text-medium); }
.kb-join-status.is-error { color: #c0392b; }
.kb-my-classes { margin-top: 10px; display: grid; gap: 8px; }
.kb-class-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--c-mathe-light); border-radius: 12px; }
.kb-class-name { font-weight: 600; color: var(--text-dark); }

/* ===== GojiCampus Pro: Lehrer-Bereich ===== */
.tab-btn-pro .tab-badge-pro { background: linear-gradient(135deg, #1e1b4b, #4338ca); color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .08em; padding: 2px 7px; border-radius: 999px; margin-left: 4px; }
.pro-layout { max-width: 1180px; margin: 0 auto; padding: 8px 4px 32px; }
.pro-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 26px 30px; border-radius: 22px; color: #fff; background: radial-gradient(circle at 85% 0%, rgba(162,155,254,.45), transparent 55%), linear-gradient(135deg, #1e1b4b 0%, #3730a3 60%, #4f46e5 100%); box-shadow: 0 14px 34px rgba(55,48,163,.25); }
.pro-hero-logo { width: 74px; height: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.pro-hero-text { flex: 1 1 320px; }
.pro-eyebrow { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #c7d2fe; background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 999px; }
.pro-hero h2 { margin: 8px 0 4px; font-size: 1.7rem; color: #fff; }
.pro-hero p { margin: 0; color: #e0e7ff; font-size: .95rem; max-width: 560px; }
.pro-new-class { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 340px; justify-content: flex-end; }
.pro-new-class input { flex: 1 1 220px; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.95); color: #1e1b4b; font-size: .98rem; }
.pro-status { min-height: 1.2em; margin: 12px 4px 0; font-size: .92rem; color: var(--text-medium); }
.pro-status.is-error { color: #c0392b; }
.pro-grid { display: grid; grid-template-columns: 250px 1fr; gap: 22px; margin-top: 14px; align-items: start; }
.pro-sidebar { background: var(--bg-card); border: 1px solid var(--border-line); border-radius: 18px; padding: 16px; box-shadow: 0 6px 18px rgba(30,41,59,.05); }
.pro-sidebar h3 { margin: 0 0 12px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); }
.pro-class-list { display: grid; gap: 8px; }
.pro-class-item { text-align: left; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border-line); background: var(--bg-card-subtle); color: var(--text-dark); font-weight: 600; cursor: pointer; transition: all .15s ease; }
.pro-class-item:hover { border-color: #a5b4fc; background: #eef2ff; }
.pro-class-item.active { background: linear-gradient(135deg, #4338ca, #6c5ce7); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(67,56,202,.3); }
.pro-main { min-width: 0; }
.pro-empty { text-align: center; background: var(--bg-card); border: 2px dashed var(--border-line); border-radius: 18px; padding: 56px 24px; color: var(--text-medium); }
.pro-empty-icon { font-size: 2.6rem; }
.pro-empty h3 { margin: 10px 0 6px; color: var(--text-dark); }
.pro-detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.pro-detail-head h3 { margin: 0; font-size: 1.4rem; color: var(--text-dark); }
.pro-muted { color: var(--text-soft); font-size: .88rem; margin: 2px 0 0; }
.pro-code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pro-code { font-family: "Consolas", "Courier New", monospace; font-size: 1.35rem; font-weight: 700; letter-spacing: .22em; padding: 8px 16px; border-radius: 12px; background: #eef2ff; color: #3730a3; border: 1px dashed #818cf8; }
.pro-danger { color: #c0392b; border-color: #f1b0a8; }
.pro-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.pro-kpi { background: var(--bg-card); border: 1px solid var(--border-line); border-radius: 16px; padding: 16px 18px; box-shadow: 0 6px 18px rgba(30,41,59,.05); display: flex; flex-direction: column; gap: 4px; }
.pro-kpi-value { font-size: 1.9rem; font-weight: 800; color: #3730a3; line-height: 1; }
.pro-kpi-label { font-size: .8rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; }
.pro-panels { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.pro-panel { background: var(--bg-card); border: 1px solid var(--border-line); border-radius: 18px; padding: 18px 20px; box-shadow: 0 6px 18px rgba(30,41,59,.05); min-width: 0; }
.pro-panel h4 { margin: 0 0 14px; font-size: 1rem; color: var(--text-dark); }
.pro-table-wrap { overflow-x: auto; }
.pro-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.pro-table th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-soft); padding: 8px 10px; border-bottom: 2px solid var(--border-line); }
.pro-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-line); color: var(--text-dark); }
.pro-table tr:last-child td { border-bottom: 0; }
.pro-name { font-weight: 600; }
.pro-pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pro-pill-good { background: #e6faf5; color: #007a63; }
.pro-pill-warn { background: #fff4d6; color: #9a6b00; }
.pro-pill-bad { background: #fdebe8; color: #b3392a; }
.pro-pill-none { background: #eef0f4; color: #64748b; }
.pro-bars { display: grid; gap: 14px; }
.pro-bar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: .9rem; }
.pro-bar-name { font-weight: 600; color: var(--text-dark); }
.pro-bar-track { height: 10px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.pro-bar-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
.pro-bar-good { background: linear-gradient(90deg, #00b894, #55efc4); }
.pro-bar-warn { background: linear-gradient(90deg, #f0a500, #ffd166); }
.pro-bar-bad { background: linear-gradient(90deg, #e17055, #fab1a0); }
@media (max-width: 900px) {
  .pro-grid, .pro-panels { grid-template-columns: 1fr; }
  .pro-new-class { justify-content: flex-start; }
}

@media (min-width: 701px) { .tabs-container { flex-wrap: wrap; justify-content: center; overflow-x: visible; } }
