/* ===== CSS Variables & Reset ===== */
:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: #3b82f6;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --transition: 0.2s ease;

  /* Semantic colors for result scores */
  --score-good-bg: #dcfce7;
  --score-good-text: #15803d;
  --score-medium-bg: #fef9c3;
  --score-medium-text: #a16207;
  --score-poor-bg: #fef2f2;
  --score-poor-text: #dc2626;

  /* Topic card active gradient */
  --topic-active-bg: linear-gradient(135deg, #f0fdf4 0%, var(--bg-secondary) 100%);
  --topic-selected-bg: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);

  /* Detail items */
  --detail-correct-bg: #f0fdf4;
  --detail-correct-border: #bbf7d0;
  --detail-wrong-bg: #fef2f2;
  --detail-wrong-border: #fecaca;

  /* Flipped card / highlight */
  --highlight-bg: #dcfce7;

  /* Login gradient */
  --login-bg: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);

  /* Toggle slider off */
  --toggle-off: #cbd5e1;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #2563eb;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #f1f5f9;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: #1e3a5f;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --success: #4ade80;
  --warning: #fbbf24;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);

  --score-good-bg: #14532d;
  --score-good-text: #86efac;
  --score-medium-bg: #713f12;
  --score-medium-text: #fde68a;
  --score-poor-bg: #7f1d1d;
  --score-poor-text: #fca5a5;

  --topic-active-bg: linear-gradient(135deg, #14532d 0%, var(--bg-secondary) 100%);
  --topic-selected-bg: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);

  --detail-correct-bg: #14532d;
  --detail-correct-border: #166534;
  --detail-wrong-bg: #7f1d1d;
  --detail-wrong-border: #991b1b;

  --highlight-bg: #14532d;

  --login-bg: linear-gradient(135deg, #020617 0%, #0f172a 50%, #020617 100%);

  --toggle-off: #475569;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  /* Handy: 100vh zählt die Adressleiste mit – der untere Rand (Prüfen-Knopf)
     läge sonst unerreichbar außerhalb. dvh ist die sichtbare Höhe. */
  height: 100dvh;
  overflow: hidden;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Login Screen ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: var(--login-bg);
  z-index: 100;
}

.login-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-credit {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 8px;
  opacity: 0.7;
}

.login-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 12px;
}
.login-qr-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
}
.login-qr-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  opacity: 0.7;
}
.login-qr-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.login-qr-img-small {
  width: 80px;
  height: 80px;
}
.login-qr-url {
  font-size: 0.65rem;
  color: var(--accent);
  margin-top: 2px;
  word-break: break-all;
  text-align: center;
  opacity: 0.8;
}

.login-form {
  margin-bottom: 16px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.login-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.login-divider span {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 0 12px;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.admin-login-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  font-weight: 600;
}

/* ===== App Container ===== */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-title {
  color: var(--text-sidebar-active);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.user-info {
  margin-top: 12px;
  color: var(--text-sidebar);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-role-badge.teacher {
  background: #6366f1;
  color: white;
}

.user-role-badge.student {
  background: #22c55e;
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-sidebar);
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}

.nav-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-btn.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.setting-label {
  color: var(--text-sidebar);
  font-size: 0.8rem;
}

.setting-select {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.btn-theme-toggle {
  padding: 4px 10px !important;
  font-size: 0.9rem !important;
  min-width: auto;
  background: var(--bg-sidebar-hover) !important;
  color: var(--text-sidebar-active) !important;
  border-color: rgba(255,255,255,0.15) !important;
}

.version-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: center;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

.view-header {
  margin-bottom: 28px;
}

.view-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ===== Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== Type Grid (Dashboard) ===== */
.section-title {
  margin-bottom: 16px;
}

.section-title h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.type-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.type-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.type-card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.type-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.type-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== Topic Cards ===== */
.topic-actions-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topic-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.topic-card:hover {
  box-shadow: var(--shadow-md);
}

.topic-card.topic-active {
  border-color: var(--success);
  background: var(--topic-active-bg);
}

.topic-card.topic-inactive {
  border-color: var(--border);
}

.topic-card.topic-selected {
  border-color: var(--accent);
  background: var(--topic-selected-bg);
}

.topic-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topic-card-info {
  flex: 1;
  min-width: 0;
}

.topic-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.topic-card-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.topic-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
}

.topic-module-count {
  color: var(--accent);
  font-weight: 600;
}

.topic-status {
  font-weight: 600;
}

.topic-status.active {
  color: var(--success);
}

.topic-status.inactive {
  color: var(--text-secondary);
}

.topic-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--toggle-off);
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ===== Topic Form ===== */
.topic-form-container {
  margin-top: 20px;
}

.topic-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 600px;
}

.topic-form-card h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.breadcrumb-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--text-secondary);
}

.breadcrumb-current {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Thementitel als Überschrift der Modulübersicht – eine Zeile, Rest per … */
.modules-view-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Modules List ===== */
.header-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.search-input {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  flex: 1;
  min-width: 200px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-secondary);
  cursor: pointer;
  outline: none;
}

.modules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: box-shadow var(--transition);
}

.module-card:hover {
  box-shadow: var(--shadow-md);
}

.module-card-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
}

.module-card-info {
  flex: 1;
  min-width: 0;
}

.module-card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-card-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.module-card-type {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 8px;
}

.module-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

/* ===== Forms ===== */
/* Volle Breite: Bilder, Zonen und Hotspots brauchen den Platz neben der
   Seitenleiste. Nur einfache Eingabefelder bleiben handlich schmal. */
.module-form {
  max-width: none;
}
.module-form > .form-group > input[type="text"],
.module-form > .form-group > select {
  max-width: 720px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  background: var(--bg-secondary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.rich-text-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rich-text-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary, #f8f9fa); /* Slight background contrast like docs */
}

/* New Compact Toolbar Controls */
.form-group select.rt-select,
.rt-select {
  height: 28px;
  padding: 0 24px 0 8px;
  font-size: 13px;
  color: var(--text-primary);
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 6px top 50%;
  background-size: 8px auto;
  transition: background-color 0.15s, border-color 0.15s;
}

.rt-select:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
.rt-select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-primary);
}

.form-group select.rt-block-format,
.rt-block-format { width: 85px; }

.form-group select.rt-spacing,
.rt-spacing { width: 100px; }

.form-group select.rt-font-size,
.rt-font-size { width: 95px; }

.rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.rt-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}
.rt-btn:active {
  background-color: rgba(0, 0, 0, 0.15);
}

.rt-separator {
  width: 1px;
  height: 20px;
  background-color: var(--border);
  margin: 0 4px;
}

.rich-text-surface {
  min-height: 140px;
  padding: 14px;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.6;
}

.rich-text-surface:empty::before {
  content: 'Optionale Beschreibung...';
  color: var(--text-secondary);
}

.rich-text-surface h1,
.rich-text-surface h2,
.rich-text-surface h3,
.module-description-content h1,
.module-description-content h2,
.module-description-content h3 {
  margin: 0 0 10px;
}

.rich-text-surface p,
.module-description-content p,
.module-description-content ul,
.module-description-content ol,
.module-description-content blockquote,
.module-description-content table {
  margin: 0 0 12px;
}

.rich-text-surface blockquote,
.module-description-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
}

.rich-text-surface table,
.module-description-content table {
  width: 100%;
  border-collapse: collapse;
}

.rich-text-surface th,
.rich-text-surface td,
.module-description-content th,
.module-description-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.rich-text-surface th,
.module-description-content th {
  background: var(--bg-primary);
}

/* ===== Content Editor ===== */
.content-editor {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 8px;
  display: none;
}

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

.content-editor h4 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.editor-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.editor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.editor-item-header h5 {
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-item .form-group {
  margin-bottom: 12px;
}

.editor-item .form-group:last-child {
  margin-bottom: 0;
}

.btn-add-item {
  width: 100%;
  padding: 12px;
  background: var(--accent-light);
  color: var(--accent);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-add-item:hover {
  background: #dbeafe;
}

.exam-mode-row {
  margin: 12px 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.exam-mode-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.exam-mode-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* ===== Drag and Drop Visual Editor ===== */
.dnd-img-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dnd-img-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dnd-canvas-wrapper {
  margin-bottom: 16px;
}

.dnd-canvas {
  position: relative;
  width: 100%;
  margin: 0 auto;
  min-height: 200px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
}

.dnd-canvas.dnd-drawing {
  cursor: crosshair;
}

.dnd-canvas-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.dnd-canvas-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 24px;
  text-align: center;
}

.dnd-zone-overlay {
  position: absolute;
  border: 2px solid;
  border-radius: 4px;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.dnd-zone-overlay.selected {
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

/* Mittig wie das abgelegte Wort im Player; darf ueber kleine Zonen hinausragen. */
.dnd-zone-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

/*
 * Eckmarken: An den Ecken wird die Groesse geaendert (der Cursor wechselt
 * dort), auf der Flaeche verschoben. Die Marken sind nur Anzeige - erkannt
 * wird die Ecke in _makeDndZoneInteractive an der Zeigerposition. Weiss mit
 * Rand, damit sie auf jedem Hintergrundbild sichtbar bleiben.
 */
.dnd-zone-corner {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border: 1px solid #666;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.dnd-zone-overlay:hover .dnd-zone-corner,
.dnd-zone-overlay.selected .dnd-zone-corner {
  opacity: 1;
}
@media (hover: none) {
  .dnd-zone-corner { opacity: 1; }
}
.dnd-zone-corner-nw { top: -4px; left: -4px; }
.dnd-zone-corner-ne { top: -4px; right: -4px; }
.dnd-zone-corner-sw { bottom: -4px; left: -4px; }
.dnd-zone-corner-se { bottom: -4px; right: -4px; }

.ctx-menu {
  position: fixed;
  z-index: 10000;
  min-width: 160px;
  padding: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.ctx-menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: left;
  border-radius: 4px;
  cursor: pointer;
}

.ctx-menu-item:hover,
.ctx-menu-item:focus-visible {
  background: var(--bg-secondary);
}

.ctx-menu-item.danger {
  color: #dc2626;
}

.dnd-draw-rect {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(59, 130, 246, 0.15);
  pointer-events: none;
}

.dnd-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.dnd-draw-hint {
  font-size: 0.82rem;
  color: var(--accent);
  font-style: italic;
}

.dnd-zone-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.dnd-zone-group-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dnd-zone-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dnd-zone-label-input {
  flex: 1;
  min-width: 100px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dnd-group-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dnd-zone-right { flex-basis: 100%; font-size: 0.85rem; color: var(--success); }
.dnd-zone-warn { flex-basis: 100%; font-size: 0.85rem; color: #b45309; font-weight: 600; }
[data-theme="dark"] .dnd-zone-warn { color: #fbbf24; }
.dnd-howto { margin: 0 0 10px; }

.dnd-zone-pos {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dnd-drag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.dnd-drag-num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 24px;
}

.dnd-drag-text-input {
  flex: 1;
  min-width: 120px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dnd-drag-zone-select {
  min-width: 140px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ===== Drag and Drop Player ===== */
.dnd-player {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.dnd-player-desc {
  margin-bottom: 16px;
  line-height: 1.5;
}

.dnd-player-draggables {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 40px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
}

.dnd-player-drag {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  /* Gezogen wird per Pointer-Events (attachPointerDrag): Der Browser darf
     die Beruehrung weder zum Scrollen nutzen noch als natives Ziehen,
     Lupe oder Textauswahl deuten. */
  touch-action: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transition: opacity 0.2s, transform 0.15s;
}

/* Kopie, die waehrend des Ziehens dem Finger bzw. der Maus folgt */
.dnd-player-drag.drag-ghost {
  opacity: 0.9;
  cursor: grabbing;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transition: none;
}

.dnd-player-drag:active,
.dnd-player-drag.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.dnd-player-drag.placed {
  /* Volle Deckkraft: abgelegte Elemente liegen ueber dem Hintergrundbild und
     duerfen nichts davon durchscheinen lassen. */
  opacity: 1;
  font-size: 0.7rem;
  padding: 2px 6px;
  white-space: nowrap;
}

/*
 * Belegte Zone = Anfasser fuer ihr Element (siehe Player): Sie darf die
 * Beruehrung dann nicht zum Scrollen hergeben, sonst bricht Safari den Zug ab.
 * Leere Zonen bleiben scrollbar.
 */
.dnd-player-zone:has(.dnd-player-drag.placed) {
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Auf Touch-Geraeten ist das kleine abgelegte Element auch knapp daneben
   noch anfassbar. */
@media (pointer: coarse) {
  .dnd-player-drag.placed { position: relative; }
  .dnd-player-drag.placed::before {
    content: '';
    position: absolute;
    inset: -10px;
  }
}

.dnd-player-canvas-wrap {
  margin-bottom: 12px;
}

.dnd-player-canvas {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.dnd-player-no-img {
  padding: 16px;
}

.dnd-player-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.dnd-player-zone {
  position: absolute;
  border: 2px solid;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: background 0.2s, border-style 0.2s, box-shadow 0.2s, transform 0.15s ease-out;
}

.dnd-player-zone.dnd-zone-hover {
  filter: brightness(1.1);
  border-style: solid !important;
  box-shadow: 0 0 14px currentColor, inset 0 0 10px rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.02);
  z-index: 10;
}

/* Highlight all zones with a dashed border when a drag is in progress */
.dnd-player:has(.dragging) .dnd-player-zone {
  border-style: dashed !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
}

/*
 * Frueher standen hier pointer-events: none fuer alle Zoneninhalte waehrend
 * des Ziehens (gegen Flackern beim HTML5-dragleave) und ein vergroesserter
 * Trefferbereich per ::after. Beides entfaellt: Das traf auch das gerade
 * gezogene, bereits abgelegte Element, und Safari auf dem iPad bricht den Zug
 * dann ab. Den groesseren Fangbereich uebernimmt snapZone im Player.
 */

/* Liegt ueber der Zone statt ueber den Elementen, damit das abgelegte Wort
   mittig in der Zone sitzt; ist etwas abgelegt, verschwindet sie. */
.dnd-player-zone-label {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.dnd-player-zone:has(.dnd-player-drag.placed) .dnd-player-zone-label {
  display: none;
}

.dnd-player-zone-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 4px;
  padding: 2px;
  flex: 1;
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-icon {
  padding: 6px 10px;
  font-size: 1rem;
  min-width: 36px;
  justify-content: center;
}

/* ===== Results ===== */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Ergebnisse: Link > Schüler > Durchläufe ---- */
.result-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary, #fff);
  margin-bottom: 10px;
}

.result-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  user-select: none;
}

.result-group > summary:hover {
  background: var(--bg-secondary);
}

.result-group-title {
  font-weight: 700;
}

/* Kennzahlen rechts, damit die Namen untereinander in einer Flucht stehen. */
.result-group-meta {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.result-group-link > summary .result-group-title {
  font-size: 1.05rem;
}

/* Die Schülerebene rückt ein und wird ruhiger, damit die Schachtelung
   auf einen Blick erkennbar bleibt. */
.result-group-student {
  margin: 8px 12px 10px 20px;
  border-left: 3px solid var(--accent);
}

.result-group-student > summary {
  padding: 9px 14px;
  font-size: 0.95rem;
}

.result-group-student > .result-card {
  margin: 8px 12px 10px;
}

.result-card-origin {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.result-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-card-info strong {
  font-size: 1rem;
}

.result-topic-name {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.result-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.result-score {
  font-size: 1.1rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.result-score.good {
  background: var(--score-good-bg);
  color: var(--score-good-text);
}

.result-score.medium {
  background: var(--score-medium-bg);
  color: var(--score-medium-text);
}

.result-score.poor {
  background: var(--score-poor-bg);
  color: var(--score-poor-text);
}

.result-details {
  margin-top: 12px;
}

.result-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 4px 0;
}

.result-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.result-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.result-detail-item.correct {
  background: var(--detail-correct-bg);
  border: 1px solid var(--detail-correct-border);
}

.result-detail-item.wrong {
  background: var(--detail-wrong-bg);
  border: 1px solid var(--detail-wrong-border);
}

.result-detail-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===== Student Topics ===== */
.student-topics-list .topic-card {
  cursor: default;
}

.student-topic-card {
  transition: border-color var(--transition), background var(--transition);
}

/* ===== Quiz Mode ===== */
.quiz-topic-select {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-topic-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: box-shadow var(--transition);
}

.quiz-topic-card:hover {
  box-shadow: var(--shadow-md);
}

.quiz-topic-card-info h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.quiz-topic-card-info p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.quiz-player-area {
  margin-top: 20px;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-info {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.quiz-type-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 8px;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Quiz Result ===== */
.quiz-result-area {
  margin-top: 20px;
}

.quiz-final-result {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.quiz-result-icon {
  font-size: 4rem;
  margin-bottom: 12px;
}

.quiz-final-result h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.quiz-result-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 40px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.quiz-result-number {
  font-size: 2rem;
  font-weight: 800;
}

.quiz-result-pct {
  font-size: 1.2rem;
  font-weight: 600;
}

.quiz-result-score.good {
  background: var(--score-good-bg);
  color: var(--score-good-text);
}

.quiz-result-score.medium {
  background: var(--score-medium-bg);
  color: var(--score-medium-text);
}

.quiz-result-score.poor {
  background: var(--score-poor-bg);
  color: var(--score-poor-text);
}

.quiz-result-details {
  text-align: left;
  margin-top: 20px;
}

/* ===== H5P Player ===== */
.player-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.h5p-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 500px;
  padding: 24px;
  overflow: auto;
}

/* ===== Import/Export ===== */
.ie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.ie-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.ie-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.ie-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.ie-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.import-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.import-result.success {
  border-color: var(--success);
  background: var(--detail-correct-bg);
}

.import-result.error {
  border-color: var(--danger);
  background: var(--detail-wrong-bg);
}

/* ===== Custom Confirm Dialog ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s ease;
}

.confirm-message {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  background: var(--bg-sidebar);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 380px;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--accent);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Module selection checkbox ===== */
.module-select-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.module-card-disabled {
  opacity: 0.45;
  filter: grayscale(0.4);
}
.module-card-disabled .module-select-checkbox {
  opacity: 1;
  filter: none;
}

/* ===== Module Drag Reorder ===== */
.module-drag-handle {
  font-size: 1.3rem;
  cursor: grab;
  color: var(--text-secondary);
  user-select: none;
  flex-shrink: 0;
  padding: 4px 2px;
  line-height: 1;
  transition: color var(--transition);
}

.module-drag-handle:hover {
  color: var(--accent);
}

.module-drag-handle:active {
  cursor: grabbing;
}

.module-card-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 1.8em;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.module-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.module-card.drag-over {
  border-top: 3px solid var(--accent);
}

/* ===== Import Modules Modal ===== */
.import-modules-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s ease;
}

.import-modules-card h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.import-modules-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.import-modules-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.import-module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.import-module-item:hover {
  background: var(--bg-hover);
}

.import-module-item label {
  cursor: pointer;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-module-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.import-module-type {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Image Field ===== */
.image-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-field-preview {
  min-height: 48px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.image-field-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
}

.image-field-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Audio Field ===== */
.audio-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-field-preview {
  min-height: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.audio-field-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Dialog Cards Player ===== */
.dc-player {
  max-width: 520px;
  margin: 0 auto;
}

.dc-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.dc-image {
  margin-bottom: 12px;
}

.dc-image img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
}

.dc-audio {
  margin-bottom: 12px;
}

.dc-display {
  padding: 40px;
  min-height: 150px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dc-hint {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.dc-tip {
  margin-top: 8px;
}

.dc-tip-icon {
  font-size: 0.85rem;
  color: var(--accent);
  cursor: help;
  padding: 4px 8px;
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
  border-radius: var(--radius-sm);
}

.dc-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.dc-counter {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 36px;
}

/* ===== Flashcard Image ===== */
.flashcard-image {
  margin-bottom: 12px;
}

/* ===== Flashcard Player ===== */
.fc-player {
  max-width: 520px;
  margin: 0 auto;
}

.fc-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.fc-image {
  margin-bottom: 16px;
}

.fc-image img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
}

.fc-question {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  min-height: 1.5em;
}

.fc-answer-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.fc-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.fc-input:focus {
  border-color: var(--accent);
}

.fc-input:disabled {
  opacity: 0.6;
}

.fc-feedback {
  min-height: 1.5em;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.fc-feedback-correct {
  background: #dcfce7;
  color: #166534;
}

.fc-feedback-wrong {
  background: #fef2f2;
  color: #991b1b;
}

.fc-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.fc-counter {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.fc-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ===== True/False Player ===== */
.tf-player {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}
.tf-progress {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.tf-card {
  margin-bottom: 16px;
}
.tf-question {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.tf-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.tf-buttons .tf-btn {
  min-width: 100px;
  transition: background 0.15s, border-color 0.15s;
}
.tf-buttons .tf-btn.tf-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.tf-buttons .tf-btn:disabled:not(.tf-selected) {
  opacity: 0.5;
}
.tf-feedback {
  min-height: 1.5em;
  padding: 8px 0;
  font-weight: 600;
}
.tf-feedback-correct { color: #22c55e; }
.tf-feedback-wrong { color: #ef4444; }
.tf-correct { color: #22c55e; }
.tf-wrong { color: #ef4444; }
.tf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tf-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ===== Drag the Words ===== */
.dtw-container {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.dtw-description {
  margin-bottom: 16px;
}

.dtw-text-area {
  line-height: 2.4;
  margin-bottom: 16px;
  font-size: 1rem;
}

.dtw-static-text {
  white-space: pre-wrap;
}

.dtw-drop-zone {
  display: inline-block;
  min-width: 80px;
  min-height: 28px;
  padding: 4px 12px;
  margin: 2px 4px;
  border: 2px dashed var(--text-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  vertical-align: middle;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dtw-drop-zone.dtw-drop-hover {
  border-color: var(--accent);
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
}

.dtw-drop-zone.dtw-drop-filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
  cursor: grab;
  font-weight: 600;
  /* Gefuellte Luecken werden per attachPointerDrag gezogen (siehe .dtw-chip);
     leere bleiben scrollbar. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.dtw-drop-zone.dtw-correct {
  border-color: var(--success, #22c55e);
  background: #dcfce7;
  color: #166534;
}

.dtw-drop-zone.dtw-wrong {
  border-color: var(--danger, #ef4444);
  background: #fef2f2;
  color: #991b1b;
}

.dtw-drop-zone.dtw-missing {
  border-color: #eab308;
  background: #fef9c3;
}

.dtw-word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 44px;
}

.dtw-chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: grab;
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
  /* Gezogen wird per Pointer-Events (attachPointerDrag), siehe .dnd-player-drag */
  touch-action: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transition: opacity 0.15s, transform 0.1s;
}

/* Kopie, die waehrend des Ziehens dem Finger bzw. der Maus folgt */
.dtw-chip.drag-ghost,
.dtw-drop-zone.drag-ghost {
  opacity: 0.9;
  cursor: grabbing;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transition: none;
}

.dtw-chip.dragging,
.dtw-drop-zone.dragging {
  opacity: 0.5;
}

.dtw-chip:hover {
  transform: translateY(-1px);
}

.dtw-chip:active {
  cursor: grabbing;
}

.dtw-chip.dtw-chip-used {
  opacity: 0.25;
  pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-header .app-title,
  .sidebar-header .user-info,
  .nav-btn span:not(.nav-icon),
  .sidebar-footer .version-label,
  .sidebar-settings .setting-label {
    display: none;
  }
  .nav-btn {
    justify-content: center;
    padding: 12px;
  }
  .main-content {
    padding: 20px;
  }
  .login-card {
    margin: 16px;
  }
}

/* ===== Option group styling ===== */
.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.option-row input[type="text"] {
  flex: 1;
}

.option-row .btn-icon {
  flex-shrink: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===== Drag handle ===== */
.drag-handle {
  cursor: grab;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ===== H5P Native Preview ===== */
.h5p-native-preview {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.h5p-native-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.h5p-native-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.h5p-native-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.h5p-native-type-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.h5p-native-lib-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.h5p-native-question {
  margin-bottom: 12px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.h5p-native-extra {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.h5p-native-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* ==================== v2.0 Admin UI Styles ==================== */

/* User role badges */
.user-role-badge {
  display: inline-block;
  font-size: 0.75em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.user-role-badge.admin   { background: #8b5cf6; color: #fff; }
.user-role-badge.teacher { background: var(--accent); color: #fff; }
.user-role-badge.student { background: #10b981; color: #fff; }

/* Admin nav section */
.nav-section-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  padding: 14px 16px 4px;
}

/* Admin list */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 16px;
}
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: box-shadow 0.15s;
}
.admin-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.admin-list-item-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.admin-list-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Admin filter tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.admin-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Settings panel */
.settings-panel {
  max-width: 560px;
}
.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.settings-group h3 {
  margin: 0 0 12px;
  font-size: 1em;
  font-weight: 700;
}
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  font-size: 0.95em;
}
.settings-hint {
  font-size: 0.82em;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

/* Login error */
.login-error {
  color: #dc2626;
  font-size: 0.87em;
  margin: 4px 0 8px;
}

/* Small button variant */
.btn.btn-sm {
  font-size: 0.78em;
  padding: 4px 10px;
}

/* Topic sharing badges */
.topic-shared-badge {
  display: inline-block;
  font-size: 0.75em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: #dbeafe;
  color: #1d4ed8;
}
.topic-shared-badge.owner {
  background: #dcfce7;
  color: #166534;
}

/* ==================== Erzeugte Zugangsdaten ==================== */

.credentials-value {
  font-family: 'Courier New', monospace;
  font-size: 1.05rem;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  background: var(--bg-secondary, #f5f5f5);
  user-select: all;
  word-break: break-all;
}

.credentials-password {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-align: center;
}

/* Beim Drucken nur die Zugangsdaten-Karte ausgeben */
@media print {
  body.printing-credentials > *:not(#credentialsOverlay) { display: none !important; }
  body.printing-credentials #credentialsOverlay {
    position: static !important;
    display: block !important;
    background: none !important;
  }
  body.printing-credentials #credentialsOverlay .confirm-actions { display: none !important; }
  body.printing-credentials #credentialsCard {
    box-shadow: none !important;
    border: 1px solid #000;
    max-width: 100% !important;
  }
}

/* ==================== Quick-Link ==================== */

/*
 * Quick-Link- und Themen-Link-Dialog: fuenf Buttons in einer Reihe passen
 * nicht in die uebliche 520px-Karte. Die Karte waechst deshalb mit ihrer
 * Buttonleiste (bis zur Fensterbreite), und wird es zu eng, brechen die
 * Buttons innerhalb der Karte um, statt ueber den Rand zu ragen.
 */
.import-modules-card.quicklink-card {
  width: auto;
  min-width: min(380px, 95vw);
  max-width: min(760px, 95vw);
  max-height: 95vh;
  overflow-y: auto;
}

.quicklink-card .confirm-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.quicklink-card .confirm-actions .btn {
  white-space: nowrap;
}

.quicklink-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin: 12px 0;
  padding: 12px;
  background: #fff;                  /* QR braucht hellen Hintergrund, auch im Dark Mode */
  border-radius: 8px;
}

.quicklink-qr svg { width: 220px; height: 220px; display: block; }

/* QR-Code mit Kopierknopf daneben */
.quicklink-qr-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.quicklink-qr-row .quicklink-qr { margin: 12px 0; }

/* Link mit Kopierknopf daneben */
.quicklink-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quicklink-url-row input { flex: 1 1 auto; min-width: 0; }
.quicklink-copy { white-space: nowrap; flex: 0 0 auto; }

#quickLinkUrl {
  font-family: 'Courier New', monospace;
  cursor: text;
}

/* Schüler-Einstieg über den Quick-Link */
.quick-entry-topic { text-align: center; margin-bottom: 18px; }
.quick-entry-label { font-size: 0.85em; color: var(--text-secondary, #666); }
.quick-entry-topic h2 { margin: 6px 0 4px; }
.quick-entry-loading { text-align: center; padding: 24px 0; }

/* Beim Drucken nur QR-Code und Link ausgeben */
@media print {
  body.printing-quicklink > *:not(#quickLinkOverlay):not(#linkShareOverlay) { display: none !important; }
  body.printing-quicklink #quickLinkOverlay,
  body.printing-quicklink #linkShareOverlay {
    position: static !important;
    display: block !important;
    background: none !important;
  }
  /* Der gerade nicht geöffnete Dialog darf nicht mit aufs Blatt. */
  body.printing-quicklink #quickLinkOverlay.hidden,
  body.printing-quicklink #linkShareOverlay.hidden { display: none !important; }
  body.printing-quicklink .confirm-actions,
  body.printing-quicklink .quicklink-copy { display: none !important; }
  body.printing-quicklink #quickLinkCard,
  body.printing-quicklink #linkShareCard {
    box-shadow: none !important;
    border: 1px solid #000;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.printing-quicklink #quickLinkUrl,
  body.printing-quicklink #linkShareUrl {
    border: none;
    font-size: 1.1rem;
    text-align: center;
  }
}

/* Rollenauswahl in der Benutzerliste */
.user-role-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #ccc);
  background: var(--bg-secondary, #f5f5f5);
  color: inherit;
  font-size: 0.9em;
  margin-right: 6px;
}

/* Frisch angelegter Benutzer wird kurz hervorgehoben */
.admin-list-item-new {
  animation: adminItemNew 2.5s ease-out;
}

@keyframes adminItemNew {
  0%, 60% { background: var(--primary-light, #dbeafe); }
  100%    { background: transparent; }
}

/* ==================== Thema freigeben / kopieren ==================== */

.share-all-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--bg-secondary, #f5f5f5);
  cursor: pointer;
}

.share-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
  transition: opacity 0.15s ease;
}

.share-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  background: var(--bg-secondary, #f5f5f5);
}

.topic-card.topic-shared {
  border-left: 4px solid var(--primary, #3b82f6);
}

/* ===================================================================
   Tags, Themen-Links und die drei Abfragemodi
   =================================================================== */

/* ---- Tag-Chip: überall dieselbe Darstellung, Farbe kommt vom Tag ---- */
.tag-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.6;
  color: var(--tag-color, var(--accent));
  background: color-mix(in srgb, var(--tag-color, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color, var(--accent)) 40%, transparent);
}

.topic-card-tags,
.link-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ---- Filterleiste: Freitext, Modus-Schalter, Tag-Checkboxen ---- */
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tag-filter-bar .search-input { min-width: 220px; }
.tag-filter-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88em;
  color: var(--text-secondary);
  cursor: pointer;
}
.tag-filter-chips,
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 100%;
}
.tag-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/*
 * Themenformular hat Vorrang: Waehrend bearbeitet wird, treten Liste,
 * Filter und Werkzeugleiste zurueck. Das Formular steht im Markup ganz
 * unten - bei vielen Themen war es sonst ausserhalb des Bildschirms.
 */
#view-teacher-topics.topic-editing .topic-actions-bar,
#view-teacher-topics.topic-editing .tag-filter-bar,
#view-teacher-topics.topic-editing #topicsList,
#view-teacher-topics.topic-editing #sharedTopicsSection {
  display: none;
}

/* ---- Tag-Auswahl im Formular, inkl. Zeile zum Anlegen ---- */
.tag-picker-wrap { display: flex; flex-direction: column; gap: 10px; }
.tag-picker-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tag-picker-new .tag-picker-new-name { flex: 1 1 200px; min-width: 0; }
.tag-picker-new .tag-picker-new-color { flex: 0 0 auto; }
.tag-picker-new .btn { flex: 0 0 auto; }
.module-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---- Tag-Verwaltung ---- */
.tag-form { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }

/* ---- Farbwahl mit Hex-Feld zum Kopieren/Einfuegen ---- */
.tag-color-picker { display: flex; align-items: center; gap: 8px; }
.tag-color-picker input[type='color'] { flex: 0 0 auto; }
.tag-color-picker input[type='text'] {
  width: 9ch;
  font-family: monospace;
  text-transform: lowercase;
}
.tag-color-picker input[type='text'].invalid { border-color: var(--danger); }
.tag-color-picker .btn { flex: 0 0 auto; }
.tag-form .form-actions { grid-column: 1 / -1; }
.tags-list { display: flex; flex-direction: column; gap: 8px; }
.tag-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tag-usage { color: var(--text-secondary); font-size: 0.85em; }
.tag-row-actions { margin-left: auto; display: flex; gap: 6px; }

/* ---- Link-Karten ---- */
.links-list { display: flex; flex-direction: column; gap: 12px; }
.link-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
/* Deaktivierte Links bleiben sichtbar, treten aber zurück. */
.link-card-inactive { opacity: 0.65; border-style: dashed; }
.link-card-title { margin: 0 0 6px; font-size: 1.05rem; }
.link-card-meta { color: var(--text-secondary); font-size: 0.88em; margin: 6px 0 0; }
.link-card-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.link-card-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.link-badge { font-size: 0.8em; margin-left: 4px; }
.link-mode-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8em;
  background: var(--accent-light);
  color: var(--accent-hover);
}

/* ---- Modusauswahl (Lehrerformular und Schülereinstieg) ---- */
.link-mode-choices { display: flex; flex-direction: column; gap: 8px; }
.link-mode-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.link-mode-choice:hover { border-color: var(--accent); background: var(--accent-light); }
.link-mode-choice-text { display: flex; flex-direction: column; gap: 2px; }
.link-mode-choice-text small { color: var(--text-secondary); }

/* ---- Auswahlbaum: Thema → Modul → Submodul ---- */
.link-tree {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--bg-primary);
}
.link-tree-topic {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.link-tree-topic:last-child { border-bottom: none; }
.link-tree-topic-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-tree-count { color: var(--text-secondary); font-size: 0.85em; margin-left: auto; }
.link-tree-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.link-tree-modules { margin: 8px 0 0 22px; display: flex; flex-direction: column; gap: 6px; }
.link-tree-submodules { margin-left: 24px; display: flex; flex-direction: column; gap: 4px; }
.link-tree-subcheck { font-size: 0.9em; color: var(--text-secondary); }

/* ---- Lernen mit Lösungen: Musterlösung unter der Aufgabe ---- */
.quiz-solution-panel {
  margin: 20px auto 0;
  max-width: 800px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--detail-correct-bg);
  border: 1px solid var(--detail-correct-border);
}
.quiz-solution-head { font-weight: 700; margin-bottom: 8px; }
.quiz-solution-panel p { margin: 4px 0; }
.quiz-topic-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8em;
  background: var(--bg-primary);
  color: var(--text-secondary);
}

/* ---- Ergebnisliste: Herkunft des Durchlaufs ---- */
.result-link-name { margin-left: 8px; font-size: 0.85em; color: var(--text-secondary); }
.result-mode-badge {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.78em;
  background: var(--accent-light);
  color: var(--accent-hover);
}

/* ---- Startseite: Hinweis für Schüler ---- */
.login-hint-box {
  text-align: center;
  padding: 18px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}
.login-hint-icon { font-size: 2rem; display: block; margin-bottom: 6px; }
.login-hint-box p { margin: 4px 0; }

/* ---- Freigabe: verwenden und kopieren getrennt ---- */
.share-head-row,
.share-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
}
.share-head-row { border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.share-user-name { flex: 1; display: flex; align-items: center; gap: 6px; }
.share-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.86em;
  color: var(--text-secondary);
  cursor: pointer;
  min-width: 96px;
}
/* Gesperrte Häkchen sollen nicht wie eine Auswahl aussehen. */
.share-flag input:disabled + span { opacity: 0.45; }

.topic-shared-badge.use {
  background: var(--accent-light);
  color: var(--accent-hover);
}

/* ---- Auswahlbaum: fremde Inhalte ---- */
.link-class-section { margin: 18px 0 8px; font-size: 1.05rem; }
.link-class-section:first-child { margin-top: 0; }

.link-tree-section {
  margin: 10px 0 4px;
  padding: 6px 10px;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}
.link-tree-owner {
  font-size: 0.8em;
  color: var(--text-secondary);
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.link-card-warning {
  margin: 6px 0 0;
  font-size: 0.86em;
  color: var(--warning);
}

/* ==================== LERNMODULE-SHOP ==================== */

/* Knopf, der wie ein Link aussieht – etwa Creator-Namen im Shop. */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover); text-decoration-style: solid; }

/* ---- Bewertung ---- */
.rating-stars { color: #d97706; font-weight: 600; white-space: nowrap; }
.rating-thanks { white-space: nowrap; }
.star-input { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.star-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  padding: 2px 3px;
  cursor: pointer;
  color: var(--border);
  transition: transform 0.1s, color 0.1s;
}
.star-btn.on { color: #f59e0b; }
.star-btn:hover { transform: scale(1.15); }
.star-btn:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.star-clear { margin-left: 8px; }
.feedback-card textarea { width: 100%; box-sizing: border-box; }
.choose-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.choose-list .choose-item { text-align: left; }

/* ---- Hinweis zum Teilen, Creator-Filter ---- */
.share-hint, .creator-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--accent-light);
  border: 1px solid var(--border);
}
.share-hint-icon { font-size: 1.6rem; line-height: 1; }
.share-hint-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.creator-banner { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.creator-banner-stats { margin-left: 4px; }

/* ---- Geteilt & genutzt ---- */
.impact-h { margin: 18px 0 6px; }
.give-take { margin: 12px 0 16px; }
.give-take.nudge { padding: 10px 14px; border-radius: 10px; background: var(--accent-light); }
.impact-table td:nth-child(n+2), .impact-table th:nth-child(n+2) { text-align: center; }
.impact-comments { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.impact-comment { padding: 10px 14px; border-radius: 10px; background: var(--bg-secondary); border: 1px solid var(--border); }
.impact-comment-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.impact-comment-text { margin-top: 4px; white-space: pre-wrap; }
.points-history { margin-top: 20px; }
@media (max-width: 640px) {
  .impact-table { display: block; overflow-x: auto; }
}

.shop-card .topic-card-meta { flex-wrap: wrap; gap: 6px; }

.shop-modules { margin-top: 8px; font-size: 0.9em; color: var(--text-secondary); }
.shop-modules summary { cursor: pointer; }
.shop-modules ul { margin: 6px 0 0 18px; padding: 0; }
.shop-modules li { margin: 2px 0; }
.shop-modules li .btn { margin-left: 8px; padding: 1px 8px; }

.shop-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.shop-mode-row .share-flag { min-width: 230px; }
.shop-price { width: 90px; }

.shop-all { display: flex; margin: 6px 0; }
.share-user-list label.share-user-row { cursor: pointer; gap: 8px; justify-content: flex-start; }

.shop-pick-row { display: flex; gap: 10px; align-items: center; margin: 10px 0 16px; }

.shop-ledger {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.92em;
}
.shop-ledger th,
.shop-ledger td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.shop-delta.pos { color: var(--score-good-text); font-weight: 600; }
.shop-delta.neg { color: var(--danger); font-weight: 600; }

.nav-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.75em;
  font-weight: 700;
}
.cloud-backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.shop-mode-row select,
.shop-pick-row select { width: auto; min-width: 140px; }

/* ==================== TEXT / ARBEITSBLATT ==================== */

.worksheet-import { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.worksheet-import .hint { font-size: 0.85em; }
.worksheet-import-status { flex-basis: 100%; }

.worksheet-content { line-height: 1.55; overflow-wrap: anywhere; }
.worksheet-content h2 { margin: 1.2em 0 0.5em; font-size: 1.35em; }
.worksheet-content h3 { margin: 1.1em 0 0.4em; font-size: 1.15em; }
.worksheet-content h4 { margin: 1em 0 0.3em; font-size: 1em; }
.worksheet-content p { margin: 0 0 0.6em; }
.worksheet-content img { max-width: 100%; height: auto; vertical-align: middle; }
.worksheet-content table { border-collapse: collapse; width: 100%; margin: 0.8em 0; display: block; overflow-x: auto; }
.worksheet-content th,
.worksheet-content td { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
.worksheet-content th { background: var(--bg-primary); }
.worksheet-content td p:last-child,
.worksheet-content th p:last-child { margin-bottom: 0; }
.worksheet-content .ws-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0.8em 0;
  background: var(--bg-secondary);
}
.rich-text-surface.worksheet-content { min-height: 320px; max-height: 70vh; overflow-y: auto; }

/* Bildlage im Arbeitsblatt: umflossen links/rechts, eigene Zeile mittig, mit Rahmen */
.worksheet-content img.ws-float-right { float: right; margin: 0.2em 0 0.6em 1.2em; max-width: 50%; }
.worksheet-content img.ws-float-left { float: left; margin: 0.2em 1.2em 0.6em 0; max-width: 50%; }
.worksheet-content img.ws-img-center { display: block; margin: 0.6em auto; }
.worksheet-content img.ws-img-border { border: 1px solid var(--border); padding: 4px; background: #fff; }
/* Überschriften, Tabellen und Kästen beginnen unter einem umflossenen Bild. */
.worksheet-content h2, .worksheet-content h3, .worksheet-content h4,
.worksheet-content table, .worksheet-content .ws-box { clear: both; }
.worksheet-content::after { content: ''; display: block; clear: both; }
/* Zeichnungen haben schwarze Linien auf transparentem Grund – im dunklen Design hell hinterlegen. */
[data-theme="dark"] .worksheet-content img { background: #fff; border-radius: 4px; }

/* ---- Themengebiete: aufklappbare Abschnitte und gegliederte Tag-Auswahl ---- */
.tag-chip.area-chip {
  font-size: 0.9em;
  border-width: 2px;
  border-color: var(--tag-color, var(--accent));
}
.area-group {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.area-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.area-group-head::-webkit-details-marker { display: none; }
.area-group-head::before {
  content: '▸';
  color: var(--text-secondary);
  transition: transform var(--transition);
}
.area-group[open] > .area-group-head::before { transform: rotate(90deg); }
.area-group-title { display: inline-flex; align-items: center; gap: 10px; }
.area-group-count { color: var(--text-secondary); font-size: 0.85em; }
.area-group-head .tag-row-actions { margin-left: auto; }
.area-group-none { font-weight: 600; color: var(--text-secondary); }
.area-group-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 14px 14px 32px;
}
.area-group-body .tag-row { background: var(--bg-primary); }

.tag-area-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  flex: 1 1 100%;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.tag-area-row:last-child { border-bottom: none; padding-bottom: 0; }
.tag-area-row > .tag-filter-option,
.tag-area-row > .area-group-none { flex: 0 0 auto; min-width: 140px; }
.tag-area-children { display: flex; flex-wrap: wrap; gap: 10px; }

.tag-area-settings { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.tag-picker-new-isarea { display: inline-flex; align-items: center; gap: 4px; font-size: 0.88em; white-space: nowrap; }
.tag-picker-new .tag-picker-new-area { flex: 0 1 200px; width: auto; min-width: 0; }

/* ---- Schulen ---- */
.user-info { flex-wrap: wrap; }
.user-school { flex-basis: 100%; font-size: 0.92em; color: var(--text-sidebar); opacity: 0.85; }
.school-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.school-row .school-name { flex: 1 1 260px; min-width: 0; }
.school-block { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--border); }
.school-block h4 { margin: 0; font-size: 0.95em; }
.school-row .school-name,
.school-block textarea,
#view-school-admin textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}
.school-block textarea,
#view-school-admin textarea { font-family: monospace; }
.school-row .school-name:focus,
.school-block textarea:focus,
#view-school-admin textarea:focus { border-color: var(--accent); }
.school-conflicts { border-color: var(--warning); }
/* Vorgabe der Schule: gestrichelter Rand plus kleines Schulsymbol */
.tag-chip.school-tag { border-style: dashed; }
.tag-chip.school-tag::after { content: ' 🏫'; font-size: 0.85em; }
.tag-row-actions .hint { font-size: 0.85em; white-space: nowrap; }
#view-school-admin .settings-panel { max-width: 960px; }

/* ---- Zwei-Faktor-Anmeldung ---- */
.otp-input { font-family: monospace; font-size: 1.15em; letter-spacing: 0.15em; }
.two-factor-card { min-width: 380px; max-width: 520px; max-height: 88vh; overflow: auto; }
.two-factor-qr { display: flex; justify-content: center; margin: 8px 0; }
.two-factor-qr svg { width: 200px; height: 200px; background: #fff; padding: 6px; border-radius: var(--radius-sm); }
.two-factor-secret { font-size: 1em; letter-spacing: 0.05em; word-break: break-all; user-select: all; }
.two-factor-steps { margin: 4px 0 8px 18px; padding: 0; }
.two-factor-block { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px dashed var(--border); }
.two-factor-block h4 { margin: 0; }
.two-factor-block .otp-input, .two-factor-card .school-row .otp-input,
.two-factor-block input[type="password"] {
  flex: 1 1 160px; min-width: 0; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary);
}
.two-factor-block input[type="password"] { width: 100%; }
.two-factor-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; margin: 12px 0; }
.two-factor-codes code { font-size: 1.05em; text-align: center; padding: 4px; }

/* ---- Persönlich ausgeblendete Themengebiete ---- */
.area-group-hidden { opacity: 0.6; }
.area-group-hidden[open] { opacity: 1; }
.area-visibility-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.area-group-head .hint { font-size: 0.85em; }

/* ---- Bildwerkzeuge im Arbeitsblatt-Editor ---- */
.rich-text-surface.worksheet-content img { cursor: pointer; }
.rich-text-surface.worksheet-content img.ws-selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.ws-image-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 8px 12px; border-bottom: 1px solid var(--accent); background: var(--accent-light);
}
.ws-image-panel-title { font-weight: 600; }
.ws-image-width { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9em; }
.ws-image-width input[type="range"] { width: 140px; }
.ws-width-value { min-width: 4.5em; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.ws-image-group { display: inline-flex; gap: 4px; }
.ws-image-panel .rt-btn.active { background: var(--accent); color: #fff; }
.ws-image-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.9em; }
.ws-image-panel .ws-alt {
  flex: 1 1 180px; min-width: 0; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary);
}

/* Format-Pinsel: aktiv hervorgehoben, Zeiger zeigt den Modus */
.rt-btn.rt-btn-painter.active { background: var(--accent); color: #fff; }
.rich-text-surface.rt-painting { cursor: copy; }

/* Admin-Übersicht der Lernmodule: Lehrkräfte als zweite Ebene unter der Schule */
.admin-teacher-group { margin-bottom: 0; background: var(--bg-primary); }
.admin-teacher-group .area-group-title .hint { margin-left: 6px; font-weight: normal; }

/* Login: "Angemeldet bleiben" */
.login-remember { display: flex; align-items: center; gap: 6px; margin: 2px 0 12px; font-size: 0.9em; cursor: pointer; }
.login-remember .hint { font-size: 0.85em; }

/* Freigabe: Person einer anderen Schule per E-Mail ergänzen */
.share-lookup { display: flex; gap: 8px; margin: 8px 0 14px; }
.share-lookup input { flex: 1 1 auto; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); }

/* ---- Diktat ---- */
.dict-player { padding: 20px; background: var(--bg-primary); border-radius: var(--radius-md); }
.dict-instructions { margin: 0 0 16px; font-weight: 600; }
.dict-row { margin-bottom: 16px; }
.dict-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.dict-num { font-weight: 600; min-width: 1.6em; }
.dict-error { color: var(--danger); }
.dict-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1.05rem; font-family: inherit; resize: vertical; background: var(--bg-secondary); color: var(--text-primary);
}
.dict-result { margin-top: 6px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bg-secondary); line-height: 1.9; }
.dict-ok { color: var(--success); }
.dict-wrong s, .dict-extra s { color: var(--danger); }
.dict-wrong b { color: var(--success); }
.dict-missing { color: var(--warning); text-decoration: underline dotted; font-weight: 600; }
.dict-count { color: var(--text-secondary); font-size: 0.9em; }
.dict-actions { margin-top: 8px; }
.dict-feedback { margin-top: 12px; }

/* ---- Image Hotspots: Player ---- */
.hs-player { padding: 12px 0; }
.hs-stage { position: relative; display: block; width: fit-content; max-width: 100%; margin: 0 auto; }
.hs-img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); user-select: none; }
.hs-marker {
  position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #fff; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.35); padding: 0; line-height: 1;
  animation: hs-pulse 2.2s ease-in-out infinite;
}
.hs-marker.seen { background: #64748b; animation: none; }
.hs-marker.active { background: var(--warning); animation: none; z-index: 3; }
.hs-marker:focus-visible { outline: 3px solid var(--warning); outline-offset: 2px; }
@keyframes hs-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.55); } 50% { box-shadow: 0 0 0 8px rgba(59,130,246,0); } }
.hs-popup {
  position: absolute; z-index: 4; width: min(320px, 80%); padding: 12px 14px 10px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.hs-popup[data-h="right"] { margin-left: 24px; }
.hs-popup[data-h="left"] { transform: translateX(-100%); margin-left: -24px; }
.hs-popup[data-v="down"] { margin-top: -18px; }
.hs-popup[data-v="up"] { translate: 0 -100%; margin-top: 18px; }
.hs-popup strong { display: block; margin-right: 24px; margin-bottom: 4px; }
.hs-popup p { margin: 0; font-size: 0.92rem; line-height: 1.45; }
.hs-close { position: absolute; top: 6px; right: 8px; border: none; background: none; cursor: pointer; color: var(--text-secondary); font-size: 1rem; }
.hs-hint { text-align: center; margin-top: 10px; }

/* ---- Image Hotspots: Editor ---- */
.hs-ed-imagebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hs-ed-imagebar .hs-ed-url { flex: 1 1 260px; min-width: 0; }
.hs-ed-canvas { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-primary); padding: 10px; }
.hs-ed-stage { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; }
.hs-ed-stage .hs-img { cursor: crosshair; }
.hs-ed-marker { animation: none; cursor: grab; touch-action: none; }
.hs-ed-marker:active { cursor: grabbing; }
.hs-ed-placeholder { padding: 40px 16px; text-align: center; color: var(--text-secondary); }
.hs-ed-list { display: flex; flex-direction: column; gap: 10px; }
.hs-ed-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--bg-secondary); }
.hs-ed-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.hs-ed-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hs-ed-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.hs-ed-title { flex: 1 1 auto; min-width: 0; }
.hs-ed-pos { white-space: nowrap; }
.hs-ed-item input, .hs-ed-item textarea, .hs-ed-imagebar input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text-primary); font: inherit;
}
.hs-ed-item textarea { width: 100%; resize: vertical; }

/* ---- Video ---- */
.video-module { padding: 12px 0; }
.video-title { margin: 0 0 10px; }
.video-frame { position: relative; width: 100%; max-width: calc((100vh - 160px) * 16 / 9); margin: 0 auto; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-md); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-player { display: block; width: 100%; max-height: 75vh; background: #000; border-radius: var(--radius-md); }
.video-error { margin-top: 8px; }

/* ---- Bild zusammenstellen (image-composer.js) ---- */
.ic-card { width: min(920px, 96vw); max-height: 92vh; overflow: auto; }
.ic-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 8px 0 12px; font-size: 0.9em; }
.ic-controls label { display: inline-flex; align-items: center; gap: 6px; }
.ic-controls select { padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); }
.ic-cells { display: grid; gap: 8px; margin-bottom: 12px; }
.ic-cell { position: relative; display: flex; flex-direction: column; gap: 4px; }
.ic-pick { height: 90px; border: 2px dashed var(--border); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-secondary); cursor: pointer; overflow: hidden; padding: 0; }
.ic-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ic-clear { position: absolute; top: 4px; right: 4px; border: none; border-radius: 50%; width: 24px; height: 24px; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }
.ic-caption { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); }
.ic-preview { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
/* Bestehende Collagen */
.collage-grid { display: grid; gap: 10px; }
.collage-item { margin: 0; }
.collage-item img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.collage-item figcaption { text-align: center; font-size: 0.9em; color: var(--text-secondary); margin-top: 4px; }
.rich-text-surface.rt-with-images { min-height: 140px; max-height: 60vh; overflow-y: auto; }

/* ---- Branching Scenario: Player ---- */
.bs-player { padding: 20px; background: var(--bg-primary); border-radius: var(--radius-md); min-height: 220px; }
.bs-start { text-align: center; padding: 24px 8px; }
.bs-start h3 { margin: 0 0 8px; }
.bs-start p { color: var(--text-secondary); margin: 0 0 18px; }
.bs-step h3 { margin: 0 0 10px; }
.bs-content { margin-bottom: 16px; }
.bs-choices { display: flex; flex-direction: column; gap: 8px; }
.bs-choice { text-align: left; justify-content: flex-start; padding: 12px 16px; font-size: 1rem; white-space: normal; }
.bs-back { margin-top: 12px; }
.bs-end { border-left: 6px solid var(--border); padding-left: 16px; }
.bs-end.bs-good { border-left-color: var(--success); }
.bs-end.bs-mid { border-left-color: var(--warning); }
.bs-end.bs-bad { border-left-color: var(--danger); }
.bs-feedback { font-weight: 600; }
.bs-score { position: relative; height: 22px; border-radius: 11px; background: var(--bg-secondary); border: 1px solid var(--border); overflow: hidden; margin: 12px 0; }
.bs-score-bar { height: 100%; background: var(--accent); }
.bs-score span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.85em; font-weight: 600; }
.bs-path { margin: 8px 0 12px; }

/* ---- Branching Scenario: Editor ---- */
.br-check { margin: 12px 0; }
.br-warn { padding: 10px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warning) 14%, transparent); border: 1px solid var(--warning); }
.br-warn ul { margin: 6px 0 0 18px; padding: 0; }
.br-ok { padding: 8px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--success) 12%, transparent); border: 1px solid var(--success); }
.br-steps { display: flex; flex-direction: column; gap: 14px; }
.br-step { border: 1px solid var(--border); border-left: 5px solid var(--accent); border-radius: var(--radius-md); padding: 12px 14px; background: var(--bg-secondary); }
.br-step.br-end { border-left-color: var(--success); }
.br-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.br-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.br-end .br-num { background: var(--success); }
.br-badge { font-size: 0.75em; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--accent-light); color: var(--accent); }
.br-title { flex: 1 1 200px; min-width: 0; }
.br-step input, .br-step select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); font: inherit; }
.br-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.br-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.br-ch-label { flex: 1 1 220px; min-width: 0; }
.br-ch-next { flex: 0 1 260px; min-width: 0; }
.br-arrow { color: var(--text-secondary); }
.br-end-fields { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 8px; }
.br-end-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; flex: 1 1 220px; }

/* ---- Audio Recorder ---- */
.rec-player { padding: 20px; background: var(--bg-primary); border-radius: var(--radius-md); }
.rec-instruction { margin: 0 0 14px; font-weight: 600; }
.rec-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-time { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.rec-player.recording .rec-time { color: var(--danger); font-weight: 700; }
.rec-review { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.rec-audio { width: 100%; max-width: 480px; }
.rec-actions { display: flex; gap: 8px; }
.rec-status { margin-top: 12px; }
.upload-test { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dict-row.dict-playing .dict-num { color: var(--accent); }

/* ==================== LERNBEGLEITUNG (EULE) ==================== */

.companion-panel {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}
.companion-owl {
  font-size: 3.2rem;
  line-height: 1;
  flex: 0 0 auto;
  transition: transform var(--transition);
}
.companion-owl[data-mood="stern"] { filter: saturate(0.6); }
.companion-hop { animation: companion-hop 0.45s ease; }
@keyframes companion-hop {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-10px) rotate(-6deg); }
  70% { transform: translateY(0) rotate(4deg); }
  100% { transform: translateY(0) rotate(0); }
}
.companion-body { flex: 1 1 auto; min-width: 0; }
.companion-bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1.45;
}
.companion-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 16px;
  border: 8px solid transparent;
  border-left: 0;
  border-right-color: var(--accent-light);
}
.companion-plus { font-weight: 700; color: var(--success); white-space: nowrap; }
.companion-joker-note { font-weight: 600; }
.companion-penalty-note { color: var(--warning); font-weight: 600; }
.companion-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.companion-penalty { color: var(--warning); font-weight: 700; }
.companion-actions:empty { display: none; }
.companion-actions { margin-top: 8px; }
.companion-joker {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: none;
  animation: companion-glow 1.6s ease-in-out infinite;
}
@keyframes companion-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}
/* Gelöste Aufgabe bleibt sichtbar, lässt sich aber nicht mehr ändern. */
.companion-locked { pointer-events: none; opacity: 0.85; }
/* Denkpause: Aufgabe gedimmt, bis die Zeit um ist. */
.companion-paused { pointer-events: none; opacity: 0.45; filter: grayscale(0.4); transition: opacity var(--transition); }
.companion-summary { font-size: 1.1rem; margin: 8px 0 12px; }

.companion-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
  margin: 6px 0;
}
.companion-settings-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
#companionSettings { max-width: 1100px; }
.companion-settings-grid input,
.companion-comment-card textarea,
#companionSettings input[type="url"],
.link-contest-time input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
}
.companion-settings-grid input:focus,
.companion-comment-card textarea:focus,
#companionSettings input[type="url"]:focus { border-color: var(--accent); }
#companionSettings .quicklink-url-row input { flex: 1 1 auto; min-width: 0; }
.companion-comment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.companion-comment-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.companion-comment-card textarea { width: 100%; resize: vertical; }
.companion-fixed { display: flex; flex-wrap: wrap; gap: 4px; }
.companion-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.companion-chip.is-school { border-color: var(--accent); color: var(--text-primary); }
.companion-adopt {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.85rem;
}
.companion-colleague { padding: 10px 0; border-bottom: 1px solid var(--border); }
.companion-colleague-cat { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }

.link-mode-settings {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.link-contest-times-box { margin-top: 8px; }
.link-contest-times-box summary { cursor: pointer; color: var(--accent); }
.link-contest-times { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 320px; overflow: auto; }
.link-contest-time { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.link-contest-time span { flex: 1 1 auto; min-width: 0; }
.link-contest-time input { width: 80px; }

/* ==================== QUIZ-ARENA ==================== */

.btn-lg { padding: 14px 28px; font-size: 1.15rem; }

.contest-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: auto;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}
.contest-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
}
.contest-top-title { font-weight: 700; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contest-top-info { flex: 1 1 auto; color: var(--text-sidebar); }
.contest-me { white-space: nowrap; font-weight: 600; }

.contest-message {
  margin: auto;
  max-width: 560px;
  padding: 32px 16px;
  text-align: center;
}
.contest-message-icon { font-size: 4rem; line-height: 1.1; margin-bottom: 8px; }
.contest-bounce { animation: companion-hop 1.4s ease-in-out infinite; }

.contest-lobby {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 24px;
  padding: 24px;
}
.contest-join, .contest-waiting {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}
.contest-join { text-align: center; }
.contest-qr svg { width: min(100%, 340px); height: auto; background: #fff; border-radius: var(--radius-md); padding: 8px; }
.contest-join-url { font-size: 1.2rem; font-weight: 700; word-break: break-all; margin: 10px 0; color: var(--accent); }
.contest-join-actions, .contest-host-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

.contest-players { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.contest-players-small { justify-content: center; padding: 0 16px 16px; }
.contest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  font-weight: 600;
}
.contest-players-small .contest-chip { padding: 4px 10px; font-size: 0.85rem; font-weight: 500; }
.contest-chip.is-done { background: var(--detail-correct-bg); border-color: var(--success); }
.contest-chip.is-offline { opacity: 0.5; }
.contest-kick { border: none; background: none; cursor: pointer; color: var(--text-secondary); padding: 0 2px; }
.contest-kick:hover { color: var(--danger); }
.contest-empty { width: 100%; text-align: center; padding: 24px 0; }
@keyframes contest-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.contest-play { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.contest-play-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.contest-answered { font-size: 1.2rem; }
.contest-question { width: 100%; max-width: 1400px; margin: 0 auto; }
.contest-submit-row { display: flex; justify-content: center; padding-bottom: 24px; }

.contest-timer { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.contest-timer-num {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  flex: 0 0 auto;
}
.contest-timer-bar { flex: 1 1 auto; height: 12px; border-radius: 6px; background: var(--border); overflow: hidden; min-width: 140px; }
.contest-timer-fill { height: 100%; width: 100%; background: var(--accent); transition: width 0.2s linear; }
.contest-timer-low .contest-timer-num, .contest-timer-low .contest-timer-fill { background: var(--danger); }
.contest-message .contest-timer { justify-content: center; margin-top: 16px; }

.contest-reveal {
  align-items: start;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px;
}
.contest-reveal-left, .contest-reveal-right {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}
.contest-solution {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--detail-correct-bg);
  border: 1px solid var(--detail-correct-border);
  font-size: 1.1rem;
}
.contest-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.contest-stat { padding: 8px 14px; border-radius: var(--radius-md); background: var(--bg-primary); font-weight: 600; }
.contest-stat.ok { color: var(--score-good-text); background: var(--score-good-bg); }
.contest-stat.part { color: var(--score-medium-text); background: var(--score-medium-bg); }
.contest-stat.bad { color: var(--score-poor-text); background: var(--score-poor-bg); }

.contest-board { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.contest-board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}
.contest-board-row.is-me { outline: 2px solid var(--accent); background: var(--accent-light); }
.contest-board-rank { width: 2.2em; font-weight: 700; text-align: center; }
.contest-board-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.contest-board-last { color: var(--success); font-weight: 600; }
.contest-board-score { font-variant-numeric: tabular-nums; font-weight: 700; }

.contest-player-reveal { max-width: 640px; width: 100%; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 20px; }
.contest-result-card {
  text-align: center;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  border-top: 6px solid var(--border);
}
.contest-result-card.ok { border-top-color: var(--success); }
.contest-result-card.part { border-top-color: var(--warning); }
.contest-result-card.bad { border-top-color: var(--danger); }
.contest-gain { font-size: 2.2rem; font-weight: 800; color: var(--accent); margin: 8px 0; }

.contest-final {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px 16px;
  overflow: hidden;
}
.contest-final-board { width: 100%; max-width: 640px; }
.contest-podium-box { width: 100%; max-width: 760px; }
.contest-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.contest-confetti span {
  position: absolute;
  top: -40px;
  font-size: 1.6rem;
  animation: contest-fall 4s linear infinite;
}
@keyframes contest-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(110vh) rotate(360deg); opacity: 0.2; }
}

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; width: 100%; max-width: 760px; }
.podium-step { flex: 1 1 0; display: flex; flex-direction: column; align-items: stretch; text-align: center; }
.podium-names { min-height: 3.5em; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 8px; }
.podium-name { font-size: 1.3rem; font-weight: 800; word-break: break-word; }
.podium-score { color: var(--text-secondary); font-size: 0.95rem; }
.podium-empty { color: var(--text-secondary); }
.podium-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding-top: 12px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: #fff;
  font-size: 2rem;
  animation: podium-rise 0.9s ease-out both;
  transform-origin: bottom;
}
.podium-block strong { font-size: 2.6rem; line-height: 1; }
.podium-1 .podium-block { height: 220px; background: linear-gradient(180deg, #fbbf24, #d97706); animation-delay: 0.6s; }
.podium-2 .podium-block { height: 160px; background: linear-gradient(180deg, #cbd5e1, #64748b); animation-delay: 0.3s; }
.podium-3 .podium-block { height: 120px; background: linear-gradient(180deg, #f59e0b99, #92400e); }
.podium-1 .podium-names { animation: contest-pop 0.5s ease 1.4s both; }
.podium-2 .podium-names { animation: contest-pop 0.5s ease 1.1s both; }
.podium-3 .podium-names { animation: contest-pop 0.5s ease 0.8s both; }
@keyframes podium-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (max-width: 800px) {
  .contest-lobby, .contest-reveal { grid-template-columns: 1fr; padding: 12px; }
  .contest-top { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .podium-block { font-size: 1.4rem; }
  .podium-1 .podium-block { height: 150px; }
  .podium-2 .podium-block { height: 110px; }
  .podium-3 .podium-block { height: 80px; }
  .podium-name { font-size: 1rem; }
  .companion-owl { font-size: 2.4rem; }
}

/* Tags, die ein Modul von seinem Lernthema erbt */
.tag-chip.tag-chip-inherited { opacity: 0.7; border: 1px dashed var(--tag-color, var(--accent)); }
.module-inherited-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.module-inherited-tags:empty { display: none; }
.module-inherited-tags .module-card-tags { display: contents; }

/* Blättern in den Lernthemen */
.topics-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.topics-pager-info { color: var(--text-secondary); font-size: 0.9rem; }

/* ==================== SCHÜLERANSICHT: KOMPAKT ==================== */
/* Ziel: Die Aufgabe passt in die Bildschirmhöhe, die Knöpfe bleiben sichtbar. */

.student-run .main-content { padding: 12px 20px; }
.student-run #view-student-quiz.active { display: flex; flex-direction: column; height: 100%; }
.student-run #view-student-quiz .view-header { display: none; }
.student-run #quizPlayerArea:not(.hidden) { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin-top: 0; }
.student-run .quiz-progress-bar { margin-bottom: 8px; flex-shrink: 0; }
.student-run .quiz-info { margin-bottom: 8px; flex-shrink: 0; }
.student-run #quizModuleContainer { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 20px; }
.student-run .quiz-actions { margin-top: 10px; padding-top: 10px; flex-shrink: 0; }
.student-run #quizResultArea:not(.hidden) { flex: 1 1 auto; overflow: auto; margin-top: 0; }
.student-run .module-preview-header > div { margin-bottom: 10px !important; }
.student-run .module-preview-header span,
.student-run .module-preview-header p { display: none; }
.student-run .module-preview-header h3 { margin-top: 0 !important; }
.student-run .companion-panel:not(.companion-in-sidebar) { margin: 10px 0 0; flex-shrink: 0; }

/* Seitenleiste der Schüler: "Aufgaben" hat keine Funktion, Einstellungen gestaucht. */
.student-run #studentNav { display: none !important; }
.student-run .sidebar-header { padding: 16px 16px 10px; }
.student-run .sidebar-footer {
  order: 1;
  padding: 10px 16px;
  gap: 6px;
  border-top: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.student-run .sidebar-settings { flex-direction: row; justify-content: space-between; margin-bottom: 0; }
.student-run .sidebar-settings .setting-label,
.student-run .sidebar-footer .version-label { display: none; }
.student-run #btnLogout { padding: 4px 8px; }

/* Platz der Lerneule in der Seitenleiste */
.sidebar-companion { display: none; }
.companion-run .sidebar-companion { display: block; order: 2; flex: 1 1 auto; padding: 18px 14px; overflow-y: auto; }

/* Sprechblase deutlicher – überall */
.companion-bubble { font-size: 1.1rem; font-weight: 500; border-left: 4px solid var(--accent); }
.companion-panel[data-mood="happy"] .companion-bubble { border-left-color: var(--success); }
.companion-panel[data-mood="stern"] .companion-bubble { border-left-color: var(--warning); }

/* Eule in der Seitenleiste: groß, Sprechblase weiß auf dunkel */
.companion-panel.companion-in-sidebar {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.companion-in-sidebar .companion-owl { font-size: 4.5rem; text-align: center; }
.companion-in-sidebar .companion-bubble {
  margin-top: 10px;
  background: #ffffff;
  color: #1e293b;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  padding: 14px 16px;
  border-left: none;
  border-top: 5px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.companion-in-sidebar .companion-bubble::before {
  left: 50%;
  top: -17px;
  margin-left: -10px;
  border: 10px solid transparent;
  border-bottom-color: var(--accent);
  border-top: 0;
}
.companion-in-sidebar[data-mood="happy"] .companion-bubble { border-top-color: var(--success); }
.companion-in-sidebar[data-mood="happy"] .companion-bubble::before { border-bottom-color: var(--success); }
.companion-in-sidebar[data-mood="stern"] .companion-bubble { border-top-color: var(--warning); }
.companion-in-sidebar[data-mood="stern"] .companion-bubble::before { border-bottom-color: var(--warning); }
.companion-in-sidebar .companion-plus { color: #15803d; }
.companion-in-sidebar .companion-penalty-note { color: #b45309; }
.companion-in-sidebar .companion-status {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--text-sidebar);
  font-size: 0.95rem;
}
.companion-in-sidebar .companion-points strong { font-size: 1.5rem; color: #fbbf24; }
.companion-in-sidebar .companion-penalty { color: #fbbf24; font-size: 1.1rem; }
.companion-in-sidebar .companion-actions { margin-top: 12px; }
.companion-in-sidebar .companion-joker { width: 100%; padding: 10px; font-size: 1rem; }

/* Handy/Tablet hochkant: Für Schüler keine Seitenleiste – jede Breite zählt.
   Abbrechen bleibt über "Quiz abbrechen" erreichbar. */
@media (max-width: 800px) {
  .student-run .sidebar { display: none; }
  .student-run .main-content { padding: 10px 12px; }
  .student-run #quizModuleContainer { padding: 12px; }
  .student-run .companion-panel:not(.companion-in-sidebar) { padding: 10px 12px; gap: 10px; }
  .student-run .companion-panel:not(.companion-in-sidebar) .companion-owl { font-size: 2.2rem; }
  .student-run .companion-panel:not(.companion-in-sidebar) .companion-bubble { font-size: 1rem; padding: 8px 12px; }
  .student-run .companion-status { margin-top: 4px; font-size: 0.85rem; }
}

/* Abschluss ohne Netz: Ergebnis erneut senden */
.quiz-save-failed { margin: 16px auto; max-width: 560px; text-align: left; }
.quiz-save-failed p { margin: 0 0 10px; }
.quiz-save-ok { margin: 16px auto; color: var(--success, #16a34a); font-weight: 600; }

/* ---- Klassen ---- */
.classes-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.classes-year { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.classes-year select { min-width: 150px; }
.class-pending-note { color: var(--warning, #b7791f); font-weight: 600; }
.class-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; }
.class-detail-head h3 { margin: 0; flex: 1; }
.class-year { color: var(--text-secondary); font-weight: normal; font-size: 0.85em; margin-left: 6px; }
.class-add-student { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.class-add-student input { flex: 1 1 160px; }
.class-students { width: 100%; border-collapse: collapse; background: var(--bg-secondary); border-radius: var(--radius-md); overflow: hidden; }
.class-students th, .class-students td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.class-students th { color: var(--text-secondary); font-size: 0.85em; font-weight: 600; }
.class-students tr.is-pending td { background: rgba(214, 158, 46, 0.08); }
.class-student-actions { white-space: nowrap; text-align: right; }
.class-student-actions .btn + .btn { margin-left: 6px; }
.class-import-preview { max-height: 82vh; overflow: auto; }
.class-import-preview ul { margin: 4px 0 12px 20px; columns: 2; font-size: 0.92em; }
.form-dialog .form-group label { display: flex; flex-direction: column; gap: 4px; }
.class-picker-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.class-picker-choice.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.class-picker-choice.is-selected:hover { background: var(--accent-hover); }
.class-picker-choice.is-selected::after { content: ' ✓'; }
.class-picker-new { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.class-picker-new input { flex: 1 1 180px; }

/* ---- Schülerfreigaben: Themen | Klassen ---- */
.links-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.links-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--text-secondary); }
.links-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.link-class-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.link-class-bar label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.link-class-chip { display: inline-block; font-size: 0.8em; padding: 1px 8px; margin-left: 6px; border-radius: 999px; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary); font-weight: 600; vertical-align: middle; }
.link-legacy-note { color: var(--text-secondary); font-size: 0.88em; margin: 6px 0 0; }

/* ---- LernModule: kleine Zahlenleiste (früher Dashboard) ---- */
.stats-row { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: -4px 0 16px; color: var(--text-secondary); font-size: 0.9rem; }
.stats-row-item strong { color: var(--accent); font-size: 1.1rem; margin-right: 2px; }
.h5p-types-card { max-width: 960px; max-height: 85vh; overflow: auto; }
.ai-prompt-panel { max-width: 860px; }
.ai-prompt-form .form-group label { display: flex; flex-direction: column; gap: 4px; }
.ai-prompt-form .form-group label.tag-filter-mode, .ai-prompt-form .form-group label.tag-filter-option { flex-direction: row; align-items: center; }
.ai-prompt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ai-prompt-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.ai-prompt-types { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ai-prompt-output { width: 100%; font-family: ui-monospace, monospace; font-size: 0.85em; margin-top: 12px; }
.class-strict-toggle, .class-strict-choice { align-items: flex-start; gap: 8px; margin: 8px 0 4px; }
.class-strict-toggle span, .class-strict-choice span { font-size: 0.9em; line-height: 1.4; }

/* ---- Klassenergebnisse ---- */
.cr-missing { color: var(--danger); font-weight: 600; }
.cr-row-missing td { color: var(--text-secondary); }
.cr-table { margin: 8px 0 12px; }
.cr-table .result-score { font-size: 0.95em; padding: 2px 8px; }
.cr-subhead { margin: 20px 0 4px; font-size: 1rem; }
.class-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--radius-md); background: var(--accent-light); border: 1px solid var(--accent); }
.class-notice.warning { background: rgba(245, 158, 11, 0.12); border-color: var(--warning); }
.rollover-card { max-width: 820px; }
.rollover-card .ro-name { width: 100%; min-width: 100px; }
.share-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }

/* ---- Import-Bericht (z. B. Moodle-XML) ---- */
.import-report { max-width: 640px; max-height: 85vh; overflow: auto; }
.import-report-list { margin: 4px 0 12px 18px; padding: 0; font-size: 0.9rem; }
.import-report-list li { margin: 2px 0; }

/* ---- Hilfe ---- */
.help-panel { max-width: 980px; }
.help-group { margin-bottom: 28px; }
.help-group h3 { margin-bottom: 10px; }
.help-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.help-doc-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.help-doc-title { font-weight: 700; font-size: 1.02rem; color: var(--accent); text-decoration: none; }
.help-doc-title:hover, .help-doc-sections a:hover, .help-article a:hover, .help-back a:hover { text-decoration: underline; }
.help-doc-sections { margin: 8px 0 0; padding-left: 18px; font-size: 0.88rem; line-height: 1.6; }
.help-doc-sections a, .help-back a, .help-article a { color: var(--accent); text-decoration: none; }
.help-back { margin: 0 0 12px; }
.help-article { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 28px; line-height: 1.6; }
.help-article h1 { font-size: 1.5rem; margin: 0 0 12px; }
.help-article h2 { font-size: 1.2rem; margin: 26px 0 8px; padding-top: 6px; border-top: 1px solid var(--border); scroll-margin-top: 16px; }
.help-article h3 { font-size: 1.05rem; margin: 18px 0 6px; scroll-margin-top: 16px; }
.help-article p, .help-article ul, .help-article ol { margin: 0 0 10px; }
.help-article ul, .help-article ol { padding-left: 22px; }
.help-article code { background: var(--bg-primary); border-radius: 4px; padding: 1px 5px; font-size: 0.88em; }
.help-code { background: var(--bg-primary); border-radius: var(--radius-sm); padding: 10px 14px; overflow-x: auto; font-size: 0.86rem; }
.help-code code { background: none; padding: 0; }
.help-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.help-table { border-collapse: collapse; font-size: 0.9rem; }
.help-table th, .help-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.help-table th { background: var(--bg-primary); }
.help-article blockquote { border-left: 3px solid var(--accent); margin: 0 0 10px; padding: 4px 12px; color: var(--text-secondary); }

/* ---- Hilfe an Ort und Stelle (❓) ---- */
.help-hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; margin: 0 4px; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--accent); background: var(--bg-secondary);
  color: var(--accent); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; flex: none;
}
.help-hint:hover { background: var(--accent); color: #fff; }
.help-popup-overlay { z-index: 10050; }
.help-popup { max-width: 760px; width: 92%; max-height: 85vh; display: flex; flex-direction: column; }
.help-popup-body { overflow: auto; min-height: 80px; }
.help-popup-source { margin: 0 0 8px; }
.help-article-compact { border: none; padding: 0; background: none; }
.help-article-compact h2:first-child, .help-article-compact h3:first-child { border-top: none; margin-top: 0; padding-top: 0; }

/* ---- Drag and Drop ohne Bild (Zuordnung, z. B. aus Quizzy): Begriffe links,
   Elemente rechts – nebeneinander statt weit untereinander. ---- */
.dnd-player-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; align-items: start; }
.dnd-player-list > * { grid-column: 1 / -1; }
.dnd-player-list > .dnd-player-canvas-wrap { grid-column: 1; grid-row: 2; }
.dnd-player-list > .dnd-player-draggables { grid-column: 2; grid-row: 2; margin-bottom: 0; }
.dnd-player-list .dnd-player-zone-label { font-size: 0.92rem; padding: 4px 10px; white-space: normal; }
.dnd-player-list .dnd-player-zone { min-height: 64px !important; }
.dnd-player-list .dnd-player-drag { font-weight: 500; line-height: 1.35; }
@media (max-width: 760px) {
  .dnd-player-list { grid-template-columns: minmax(0, 1fr); }
  .dnd-player-list > .dnd-player-draggables { grid-column: 1; grid-row: 2; margin-bottom: 12px; }
  .dnd-player-list > .dnd-player-canvas-wrap { grid-column: 1; grid-row: 3; }
}

/* ---- Formelaufgabe ---- */
.formula-task { padding: 20px; background: var(--bg-primary); border-radius: var(--radius-md); }
.formula-question { margin-bottom: 16px; line-height: 1.6; }
.formula-results { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.formula-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.formula-label { min-width: 120px; font-weight: 600; }
.formula-input { width: 140px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; }
.formula-input.is-right { border-color: var(--success); }
.formula-input.is-wrong { border-color: var(--danger); }
.formula-unit { min-width: 30px; }
.formula-mark { font-size: 0.9rem; color: var(--text-secondary); }
.formula-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.formula-feedback { margin-top: 12px; }
.formula-error { border: 1px solid var(--danger); }

/* ---- Lernmodul-Notebooks: einzeiliger Baum ---- */
.nav-btn.nav-sub { padding-left: 34px; font-size: 0.9rem; }
.nb-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.nb-search { flex: 1 1 220px; min-width: 0; }
.nb-tree {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 0;
}
.nb-row {
  --depth: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 2px 8px 2px calc(8px + var(--depth) * 22px);
  border-top: 2px solid transparent;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.nb-row:hover { background: var(--accent-light); }
.nb-twisty, .nb-menu-btn, .nb-status, .nb-edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font: inherit;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.nb-twisty { width: 22px; padding: 4px 0; }
.nb-twisty-space { width: 22px; flex: none; }
.nb-twisty:hover, .nb-menu-btn:hover, .nb-edit:hover, .nb-status:hover { background: var(--border); }
.nb-icon { flex: none; }
.nb-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; cursor: pointer; }
.nb-node > .nb-title, .nb-node .nb-title { font-weight: 600; }
.nb-kind-book .nb-title { font-size: 1.02rem; }
.nb-meta { color: var(--text-secondary); font-size: 0.82rem; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nb-row .nb-menu-btn { margin-left: auto; font-weight: 700; }
.nb-status { font-size: 1rem; }
.nb-status.on { color: var(--success); }
.nb-off .nb-title { color: var(--text-secondary); }
.nb-badge { font-size: 0.78rem; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; overflow: hidden; text-overflow: ellipsis; max-width: 30%; }
.nb-module .nb-title { font-size: 0.93rem; }
.nb-hit .nb-title { background: var(--highlight-bg); border-radius: 3px; }
.nb-empty { min-height: 28px; }
.nb-dragging { opacity: 0.45; }
.nb-drop-into { background: var(--accent-light); outline: 2px dashed var(--accent); outline-offset: -2px; }
.nb-drop-before { border-top-color: var(--accent); }

.nb-menu {
  position: fixed;
  z-index: 3000;
  min-width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.nb-menu-item {
  text-align: left;
  background: none;
  border: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  color: var(--text-primary);
  cursor: pointer;
}
.nb-menu-item:hover, .nb-menu-item:focus-visible { background: var(--accent-light); outline: none; }
.nb-menu-item.danger { color: var(--danger); }
.nb-menu-sep { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.nb-dialog { min-width: min(460px, 92vw); max-width: 620px; }
.nb-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-weight: 600; font-size: 0.9rem; }
.nb-field input, .nb-field textarea { font: inherit; font-weight: normal; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-primary); }
.nb-targets { display: flex; flex-direction: column; max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.nb-target-row {
  --depth: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-left: calc(var(--depth) * 20px);
}
.nb-target {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  font: inherit;
  color: var(--text-primary);
  cursor: pointer;
}
.nb-target:hover:not(:disabled) { background: var(--accent-light); }
.nb-target:disabled { cursor: default; color: var(--text-secondary); }
.nb-target-heading { font-weight: 600; }
.nb-target-extra { margin-right: 8px; white-space: nowrap; }

@media (max-width: 640px) {
  .nb-row { padding-left: calc(4px + var(--depth) * 14px); }
  .nb-meta { display: none; }
}
.nb-chips { display: inline-flex; gap: 4px; overflow: hidden; min-width: 0; flex-shrink: 1; }
.nb-chips .tag-chip { font-size: 0.72rem; padding: 0 7px; }
@media (max-width: 800px) { .nav-btn.nav-sub { padding-left: 12px; } }
@media (max-width: 640px) { .nb-chips { display: none; } }
.stat-number.negative { color: var(--danger); }

/* ---- Notebooks: erworbene Bereiche (Spiegel) und Auswahl fürs Anbieten ---- */
.nb-mirror .nb-title { font-style: italic; }
.nb-mirror-row .nb-title { color: var(--text-secondary); }
.nb-pick { padding: 4px 0; }
.nb-pick-topic, .nb-pick-module { display: flex; gap: 8px; align-items: center; padding: 6px 10px; cursor: pointer; }
.nb-pick-topic { border-top: 1px solid var(--border); background: var(--bg-primary); }
.nb-pick-module { padding-left: 34px; font-size: 0.92rem; }
.shop-topic-head { margin: 6px 0 2px; font-weight: 600; }

/* ---- Zoom getrennt für Seitenleiste und Inhalt ---- */
.zoom-ctl { display: inline-flex; align-items: center; gap: 4px; }
.zoom-ctl .btn-sm { padding: 2px 9px; min-width: 28px; }
.zoom-value {
  min-width: 52px;
  background: none;
  border: none;
  color: var(--text-sidebar);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.zoom-value:hover { text-decoration: underline; }
/* Schmale Seitenleiste: kein Platz – dort zoomt man mit den Fingern. */
@media (max-width: 800px) { .zoom-row { display: none; } }

/* ---- Drag and Drop mit Bild: Einpassen / Vergrößern ---- */
.dnd-view-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.dnd-view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.dnd-view-toggle button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: none;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.dnd-view-toggle button + button { border-left: 1px solid var(--border); }
.dnd-view-toggle button.active { background: var(--accent); color: #fff; }
/* Die Ablage bleibt beim Scrollen über das Bild in Reichweite. */
.dnd-board > .dnd-player-draggables { position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }
/* Ablage neben dem Bild (breite Bildschirme, hohe Bilder) */
.dnd-side .dnd-board { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 16px; align-items: start; }
.dnd-side .dnd-board > .dnd-player-draggables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  align-items: start;
  margin-bottom: 0;
  overflow-y: auto;
}
/* Bild an den rechten Rand – unter den Umschalter, der Freiraum liegt dazwischen. */
.dnd-side .dnd-board { justify-content: space-between; }
.dnd-side .dnd-player-canvas-wrap { margin-bottom: 0; }
.dnd-side .dnd-player-canvas { margin: 0; }

/* Neuester Durchlauf in der kompakten Zeile – in einer Flucht rechts. */
.result-group-date {
  min-width: 128px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 640px) { .result-group-date { min-width: 0; } }
.zoom-row .setting-label { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.zoom-row .help-hint { width: 16px; height: 16px; min-width: 16px; font-size: 0.65rem; line-height: 1; padding: 0; }
.dnd-player-empty { margin: 0; font-size: 0.9rem; color: var(--text-secondary); }

/* ---- Entwürfe des Modul-Editors ---- */
.draft-status { align-self: center; font-size: 0.85rem; color: var(--text-secondary); }
.draft-badge { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
[data-theme="dark"] .draft-badge { background: #422006; color: #fde68a; border-color: #854d0e; }
.draft-notice { margin-bottom: 12px; }

/* Durchlauf (Schüler-Ansicht): Die Einstellungen stehen dort kompakt in einer
   Zeile – die beiden Zoom-Regler bekommen je eine eigene Zeile mit Beschriftung,
   sonst ragen sie aus der Seitenleiste und sind nicht zu unterscheiden. */
.student-run .sidebar-settings { flex-wrap: wrap; row-gap: 6px; }
.student-run .sidebar-settings .zoom-row { flex: 1 0 100%; order: 2; }
.student-run .sidebar-settings .zoom-row .setting-label { display: inline-flex; }

/* ---- Drag and Drop im Editor: direkt an der Zone zuordnen ---- */
.dnd-assign-picker { min-width: 220px; max-width: min(360px, 92vw); max-height: 60vh; display: flex; flex-direction: column; }
.dnd-assign-head { font-size: 0.8rem; font-weight: 700; padding: 6px 10px 4px; color: var(--text-secondary); }
.dnd-assign-search { margin: 2px 6px 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 0.85rem; background: var(--bg-secondary); color: var(--text-primary); }
.dnd-assign-list { overflow-y: auto; }
.dnd-assign-picker .ctx-menu-item.active { font-weight: 700; background: var(--accent-light); }
.dnd-assign-none { color: var(--text-secondary); }
.dnd-assign-used { font-size: 0.75rem; color: var(--text-secondary); margin-left: 4px; }
.dnd-assign-used.warn { color: #b45309; }
.dnd-assign-empty { font-size: 0.8rem; color: var(--text-secondary); margin: 4px 10px; }
/* Noch nicht zugeordnete Zonen fallen am Bild auf. */
.dnd-zone-overlay.dnd-zone-unassigned { border-style: dashed !important; }

/* ==================== KATEGORIEN (Fach, Bildungsstufe) ==================== */

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  white-space: nowrap;
}
.cat-chip.cat-subject { border-color: #93c5fd; background: rgba(59, 130, 246, 0.08); }
.cat-chip.cat-stage { border-color: #c4b5fd; background: rgba(139, 92, 246, 0.08); }
.cat-chip.cat-proposed { border-style: dashed; }
.cat-chip.cat-hidden { opacity: 0.6; text-decoration: line-through; }
.cat-chip.cat-more { font-weight: 500; }
.cat-chip-x {
  background: none;
  border: none;
  padding: 0 0 0 2px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.95em;
}
.cat-chip-x:hover { color: var(--danger, #ef4444); }
.shop-cats { margin: 4px 0 2px; }
.tag-cats { margin: 0 8px; color: var(--text-secondary); }
.cat-fixed { color: var(--text-secondary); margin-left: 4px; }

.cat-picker { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--bg-secondary); }
.cat-selected { min-height: 26px; margin-bottom: 8px; }
.cat-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.cat-facets { display: flex; gap: 4px; }
.cat-facet-btn {
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88em;
}
.cat-facet-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-search { flex: 1; min-width: 140px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-primary); color: var(--text-primary); }
.cat-tree { max-height: 260px; overflow: auto; border-top: 1px solid var(--border); padding-top: 4px; }
.cat-row { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--depth, 0) * 20px); }
.cat-toggle {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9em;
}
.cat-toggle-space { display: inline-block; width: 22px; flex: 0 0 22px; }
.cat-label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; font-size: 0.92em; }
.cat-label.cat-hit span { font-weight: 700; }
.cat-propose { margin-top: 6px; font-size: 0.9em; }
.cat-propose summary { cursor: pointer; color: var(--accent); }
.cat-propose-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cat-propose-row select, .cat-propose-row input { flex: 1; min-width: 140px; }
.shop-cat-filter { max-width: 220px; }

.cat-admin-list, .cat-admin-tree { display: flex; flex-direction: column; gap: 2px; }
.cat-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 8px;
  border-radius: 8px;
}
.cat-admin-row:hover { background: var(--accent-light); }
.cat-tree-row { padding-left: calc(8px + var(--depth, 0) * 22px); }
.cat-admin-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-admin-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.cat-admin-row.cat-hidden .cat-admin-info > span:first-of-type { opacity: 0.55; text-decoration: line-through; }
.cat-admin-new { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.cat-admin-new select, .cat-admin-new input { flex: 1; min-width: 160px; }
.cat-src { font-size: 0.72em; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-secondary); }
.cat-src-local { border-color: #fcd34d; }
.nb-dialog { max-height: 90vh; overflow: auto; }
.cat-picker .cat-label { font-weight: 400; margin: 0; }
.cat-picker .cat-label input { margin: 0; }

/* ==================== VERNETZUNG ==================== */
.shop-remote-head { margin: 22px 0 8px; font-size: 1.05em; color: var(--text-secondary); }
.shop-remote { border-left: 4px solid #a78bfa; }
.topic-shared-badge.remote-badge { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
[data-theme="dark"] .topic-shared-badge.remote-badge { color: #c4b5fd; }
.fed-request { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fed-request input { flex: 1; min-width: 240px; }
.fed-peer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.fed-peer.fed-pending { border-color: #fcd34d; }
.fed-peer.fed-inactive { opacity: 0.7; }
.fed-peer-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.fed-peer-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.fed-incoming { border-color: #fcd34d; }
.fed-fp { font-size: 1.05em; letter-spacing: 0.04em; }

/* Unter „Administration“: welcher Server das ist. */
.server-name {
  margin: 0 12px 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78em;
  line-height: 1.35;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  word-break: break-word;
}
.server-name:empty { display: none; }
.server-name span { opacity: 0.75; }
