/* CC-BY-SA bildungssprit.de | Falk Szyba @medienrocker */
/* =========================================================
   Gestaltung: "Werkbank"
   Die App ist eine Werkbank in einer Werkstatt. Dunkle violette
   Arbeitsflaeche unter einem Lichtkegel; darauf liegen helle
   Papierkarten - das, woran gearbeitet wird. Werkzeuge (Editor)
   sind dunkel und praezise, Belohnungen sind Sticker.
   Bewusst kein Blau-Grau-Standard.
   ========================================================= */
@font-face {
  /* Bricolage Grotesque = "Selbermachen". Eine Datei, nur Latin,
     nur fuer Ueberschriften und Zahlen. Offline im Cache. */
  font-family: "Bricolage";
  src: url("fonts/bricolage-grotesque-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- Werkbank (dunkel, violett) ---
     Ein Lichtkegel: hell oben in der Mitte, nach allen Seiten ins Dunkle.
     Alle Werte gegen den HELLSTEN Punkt geprueft, denn dort wird heller
     Text am schwaechsten. */
  --bench: #1c1030;
  --bench-deep: #120a1e;
  --bench-line: #3a2a55;
  --bench-ink: #f3eefb;
  --bench-ink-dim: #cfc2e4;
  --bench-hell: #45276f;   /* hellster Punkt des Verlaufs, oben MITTE */

  /* --- Papier (hell, warm) --- */
  --paper: #fdfbf5;
  --bg: #efebe1;
  --card: var(--paper);
  --ink: #1c1a17;
  --muted: #5c554a;
  --line: #ddd6c7;

  /* --- Signalfarben --- */
  --lime: #c3ec3c;        /* Aktion und Energie, immer mit dunklem Text */
  --lime-deep: #2f6b1f;   /* dieselbe Familie, aber lesbar auf Papier */
  --coral: #ff6a3d;       /* Feiern und Belohnung */
  --green: var(--lime-deep);
  --green-light: #4b9e2f;
  --accent: var(--coral);

  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 6px 16px rgba(28, 26, 23, 0.07);

  /* Typografie: Display-Schrift mit Charakter fuer Titel und Zahlen,
     Monospace fuer Werkzeug-Labels, Systemschrift fuer Fliesstext. */
  --font-display: "Bricolage", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --phase-a: #16a34a;
  --phase-b: #2563eb;
  --phase-c: #9333ea;
  --phase-d: #ea580c;

  /* Werkzeug-Optik: der Editor ist die Werkbank selbst */
  --tool-bg: #1a1129;
  --tool-panel: #221735;
  --tool-line: var(--bench-line);
  --tool-ink: var(--bench-ink);
  --tool-ink-dim: var(--bench-ink-dim);
  --header-bg: var(--bench-deep);

  /* === bildungssprit Brand-Tokens (fuer den Footer-Banner) === */
  --bs_color-primary: #031627;
  --bs_color-teal: #019798;
  --bs_color-pink: #ff4080;
  --bs_color-bg-alt: #f9f9f9;
  --bs_color-text-secondary: #072e3d;
  --bs_radius-sm: 4px;
  --bs_spacing-sm: 0.5rem;
  --bs_spacing-md: 1rem;
  --bs_spacing-lg: 1.5rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bench);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  /* Der hellste Punkt sitzt oben in der Mitte und faellt nach allen Seiten ins
     Dunkle ab - wie ein Buehnenlicht ueber der Werkbank. Zwei Ebenen, null
     Kilobyte. "fixed" haelt alles beim Scrollen still.
     Der Lichtschein liegt bewusst nur bei 0.22: staerker gemischt haette
     --bench-ink-dim am hellsten Punkt keine 4.5:1 mehr. */
  background-image:
    radial-gradient(85% 60% at 50% -8%, rgba(178, 130, 245, 0.22), transparent 70%),
    radial-gradient(135% 110% at 50% 0%, var(--bench-hell) 0%, #341c58 34%, #22123c 64%, #140b20 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* ===== Barrierefreiheit ===== */
/* Sichtbarer Tastatur-Fokus: Limette schlaegt auf hell wie dunkel durch */
:focus-visible {
  outline: 3px solid var(--lime-deep);
  outline-offset: 2px;
  border-radius: 4px;
}
.app-header :focus-visible,
.editor-dark :focus-visible,
.map-section :focus-visible { outline-color: var(--lime); }
/* Programmatischer Fokus auf den Inhalt soll keinen Rahmen zeigen */
.view:focus { outline: none; }

/* Skip-Link: erscheint nur bei Tastatur-Fokus */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  background: #ffffff;
  color: #0f172a;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: top 0.15s;
}
.skip-link:focus { top: 8px; }

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Einblenden beim Seitenaufbau: die Zettel legen sich auf die Werkbank.
   Ein orchestrierter Moment statt vieler kleiner Zappeleien. */
@media (prefers-reduced-motion: no-preference) {
  .view > * { animation: legen 0.42s cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
  .view > *:nth-child(1) { animation-delay: 0.02s; }
  .view > *:nth-child(2) { animation-delay: 0.07s; }
  .view > *:nth-child(3) { animation-delay: 0.12s; }
  .view > *:nth-child(n+4) { animation-delay: 0.17s; }
  /* Im Editor stoert Bewegung beim Tippen - dort nicht animieren. */
  .view > .editor-page { animation: none; }
}
@keyframes legen {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  /* Leicht durchscheinend, damit der Verlauf durchschimmert. 0.78 ist die
     Grenze: darunter faellt der Nav-Text unter 4.5:1, sobald eine helle
     Papierkarte darunter durchscrollt. */
  background: rgba(18, 10, 30, 0.78);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  color: #fff;
  border-bottom: 1px solid rgba(243, 238, 251, 0.12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 2px 4px;
  min-height: 40px;
}
.brand-logo {
  width: 34px;
  height: 34px;
  background: #fff;
  padding: 3px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}
.brand { font-family: var(--font-display); letter-spacing: -0.03em; }
.brand-accent { color: var(--lime); } /* "WEB" hervorheben */
.app-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.app-nav button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 40px;
  transition: background 0.15s, color 0.15s;
}
.app-nav button:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.app-nav button.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 700; }
/* Icons in der Navigation: schlank, gleiche optische Groesse */
.ico { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.9; }

/* Burger-Toggle: nur auf Mobil sichtbar */
.nav-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.3); }

/* Auf schmalen Screens: Navigation hinter einem Burger-Menü verstecken */
@media (max-width: 720px) {
  .app-header { flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; }
  .app-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 14px 14px;
    background: var(--green);
    box-shadow: var(--shadow);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 20;
  }
  .app-header.nav-open .app-nav { display: flex; }
  .app-nav button {
    width: 100%;
    text-align: left;
    font-size: 1rem;
    padding: 12px 16px;
  }
}

/* Lehrkraft-Modus */
.teacher-banner {
  background: #fffbeb; border: 1px solid #f59e0b; color: #92400e;
  border-radius: 10px; padding: 8px 14px; margin-bottom: 14px; font-size: 0.9rem;
}
.teacher-sheet {
  border: 2px solid #f59e0b; background: #fffbeb;
  border-radius: var(--radius); padding: 6px 18px 16px; margin-top: 20px;
}
.teacher-sheet > summary {
  cursor: pointer; font-weight: 700; color: #b45309; padding: 8px 0; font-size: 1.05rem;
}
.teacher-sheet .md { margin-top: 6px; }

/* ===== Layout ===== */
.view { max-width: 880px; margin: 0 auto; padding: 20px 16px 60px; }
.loading { color: var(--muted); text-align: center; padding: 40px; }
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 16px;
}

/* === bildungssprit Footer-Banner === */
.bs_footer_banner {
  display: flex;
  align-items: center;
  gap: var(--bs_spacing-md);
  max-width: 900px;
  margin: var(--bs_spacing-lg) auto 0;
  padding: var(--bs_spacing-sm) var(--bs_spacing-md);
  border: 1px solid var(--bs_color-pink);
  border-radius: 4px;
  background: var(--bs_color-bg-alt);
  font-size: 0.78rem;
  color: var(--bs_color-text-secondary);
  margin-bottom: 20px;   /* klebt sonst in manchen Ansichten am unteren Rand */
}
.bs_footer_center { flex: 1; text-align: center; }
.bs_footer_title { font-weight: 600; color: var(--bs_color-primary); }
.bs_footer_right {
  display: flex;
  align-items: center;
  gap: var(--bs_spacing-sm);
  white-space: nowrap;
}
.bs_footer_license a {
  color: var(--bs_color-teal);
  text-decoration: none;
  font-weight: 600;
}
.bs_footer_license a:hover { color: var(--bs_color-pink); }
.bs_footer_logo {
  width: 36px;
  height: 36px;
  border-radius: var(--bs_radius-sm);
  transition: transform 0.2s ease;
  display: block;
  flex-shrink: 0;
}
.bs_footer_logo:hover { transform: scale(1.1); }
/* Logo und Schriftzug sind ein gemeinsamer Link zur Website */
.bs_footer_logo_link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.bs_footer_powered {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--bs_color-text-secondary);
  white-space: nowrap;
}
.bs_footer_logo_link:hover .bs_footer_powered { color: var(--bs_color-pink); }
/* Lehrkraft-Umschalter: bewusst im Footer, nicht in der Schueler-Navigation */
.bs_footer_teacher {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 0.74rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}
.bs_footer_teacher:hover { background: #fff; color: var(--ink); }
.bs_footer_teacher.active { background: #fffbeb; border-color: #f59e0b; color: #92400e; font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .bs_footer_logo { transition: none; }
}
@media (max-width: 560px) {
  .bs_footer_banner { flex-wrap: wrap; justify-content: center; row-gap: var(--bs_spacing-sm); }
  .bs_footer_center { flex-basis: 100%; order: -1; }
}

/* ===== Übersicht ===== */
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--bench-ink);
  margin: 6px 0 18px;
}
.page-title-logo { height: 1.5rem; width: auto; vertical-align: -0.25em; margin-right: 6px; }
.page-title .ico { width: 22px; height: 22px; vertical-align: -0.15em; color: var(--lime); }
/* Alles, was direkt auf der Werkbank liegt, braucht helle Schrift. */
.page-sub { color: var(--bench-ink-dim); margin: 0 0 20px; max-width: 62ch; }
.page-sub strong { color: var(--bench-ink); }
.page-sub code { background: var(--bench-deep); color: var(--lime); padding: 1px 5px; border-radius: 4px; }

/* Der eine primaere naechste Schritt: die oberste Karte auf der Werkbank,
   leicht angehoben. Bewusst der einzige farbige Button der Seite. */
.start-cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  margin: 0 0 22px;
  overflow: hidden;
}
/* Phasenfarbe als Klebestreifen an der Kante */
.start-cta::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--phase-color, var(--lime-deep));
}
.start-cta-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.start-cta-text strong {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.start-cta-lesson {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.start-cta-text small { color: var(--muted); font-size: 0.9rem; }
.start-cta-btn .ico { margin-left: 6px; vertical-align: -0.2em; }
/* Limette mit dunklem Text: das Signal der App, hoher Kontrast, unverwechselbar */
.start-cta-btn {
  border: none;
  border-radius: 8px;
  padding: 13px 22px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  background: var(--lime);
  color: var(--ink);
  min-height: 48px;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--lime-deep);
  transition: transform 0.12s, box-shadow 0.12s;
}
.start-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--lime-deep); }
.start-cta-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lime-deep); }
@media (max-width: 520px) {
  .start-cta { flex-direction: column; align-items: stretch; }
  .start-cta-btn { width: 100%; }
}

/* Fortschritt direkt auf der Werkbank, ohne Karte drumherum */
.progress-wrap {
  padding: 0 2px;
  margin-bottom: 26px;
  color: var(--bench-ink-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.progress-wrap strong { color: var(--bench-ink); font-weight: 700; }
.progress-bar {
  height: 10px;
  background: var(--bench-deep);
  border: 1px solid var(--bench-line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--lime);
  width: 0;
  transition: width 0.4s ease;
}

.phase-block { margin-bottom: 26px; }
/* Phasen-Ueberschrift auf der Werkbank: gerissene Trennlinie statt Kasten */
.phase-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bench-ink-dim);
}
.phase-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--bench-line) 0 6px, transparent 6px 12px);
}
.phase-dot { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
/* Lektionskarte: ein Zettel auf der Werkbank. Die Wochennummer ist
   Grafikelement, nicht Kleingedrucktes. */
.lesson-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lesson-card::after {
  /* grosse Nummer als Wasserzeichen in der Ecke */
  content: attr(data-nr);
  position: absolute;
  right: -6px;
  bottom: -22px;
  font-family: var(--font-display);
  font-size: 4.6rem;
  line-height: 1;
  color: var(--ink);
  opacity: 0.06;
  pointer-events: none;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }
.lesson-card .nr {
  font-family: var(--font-mono);
  font-size: 0.72rem; color: var(--muted); font-weight: 700; letter-spacing: 0.08em;
}
.lesson-card .titel {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.lesson-card .badge-row {
  display: flex; align-items: center; gap: 6px; font-size: 0.86rem;
  margin-top: 6px; color: var(--muted); position: relative; z-index: 1;
}
.lesson-card .done { color: var(--lime-deep); font-weight: 700; }
.lesson-card.is-showcase { background: linear-gradient(180deg, #fff8e6, var(--paper) 60%); }
.lesson-card .star { font-size: 0.8rem; }

/* "Nächster Schritt": der Zettel liegt obenauf, mit Limetten-Kante */
.lesson-card.is-next {
  border-color: var(--lime-deep);
  box-shadow: 0 0 0 3px rgba(195, 236, 60, 0.5), 0 8px 22px rgba(0, 0, 0, 0.32);
}
.lesson-card.is-next .nr { color: var(--lime-deep); }

/* ===== Detail ===== */
/* Der Zurueck-Link sitzt immer auf der Werkbank, also helle Akzentfarbe. */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; color: var(--lime);
  cursor: pointer; font-family: var(--font-mono); font-size: 0.84rem; font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 0; margin-bottom: 6px; min-height: 40px;
}
.back-link:hover { color: var(--bench-ink); }
.detail-head { margin-bottom: 14px; }
.detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-head .nr { color: var(--muted); font-weight: 700; }
.detail-head h1 { font-size: 1.5rem; margin: 4px 0; }
.detail-goal { font-size: 1.05rem; color: #334155; }
/* Kleiner "geschafft"-Status oben (Badge-Button selbst sitzt am Seitenende) */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-status.is-hidden { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  background: #eef2ff; color: #3730a3;
  padding: 5px 12px; border-radius: 999px; font-size: 0.85rem;
  font-family: "Courier New", monospace;
}

/* Lektions-Hero (Editor-first) */
.lesson-hero { padding-top: 14px; }
.lesson-hero-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.lesson-hero-text { display: flex; flex-direction: column; gap: 2px; }
.lesson-hero-text small { color: var(--muted); }
.lesson-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lesson-tools { margin-top: 10px; }
.lesson-tools > summary { cursor: pointer; font-weight: 800; color: var(--muted); }

.res-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.res-btn {
  background: var(--green); color: #fff; border: none;
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  font-size: 0.95rem; text-decoration: none; display: inline-block;
  transition: background 0.2s, transform 0.15s;
}
.res-btn:hover { background: var(--green-light); transform: scale(1.04); }
.res-btn.secondary { background: #475569; }
.res-btn.secondary:hover { background: #334155; }

.try-btn { font-size: 1.1rem; font-weight: 700; padding: 13px 22px; box-shadow: var(--shadow); }

/* ===== Editor ===== *
   Der Editor ist die Lektion: links die eine aktuelle Aufgabe,
   rechts Code und Live-Vorschau. Dunkle Werkzeug-Optik. */
.editor-page {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  margin-bottom: 12px;
}
.editor-dark {
  background: var(--tool-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--tool-ink);
}
.editor-dark .back-link { color: var(--tool-ink-dim); font-weight: 600; }
.editor-dark .back-link:hover { color: #fff; }
.editor-head .editor-title {
  font-weight: 700;
  flex: 1;
  min-width: 140px;
  font-size: 0.98rem;
  margin: 0;
}
.editor-head .ed-status { color: #86efac; font-size: 0.85rem; font-weight: 600; }

.editor-body {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 12px;
  align-items: start;
}
.editor-workspace {
  position: relative;
  height: min(calc(100vh - 260px), 560px);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* --- Schritt-Panel: genau eine Aufgabe pro Moment --- */
/* Das Blatt, an dem gerade gearbeitet wird: echtes Papier auf der Werkbank */
.step-panel {
  background: var(--paper);
  border-radius: 10px;
  padding: 16px 18px 18px;
  /* Die Aufgabe waechst mit ihrem Inhalt, aber nie ueber den Bildschirm hinaus.
     Die frueher feste Grenze (560px) hat auch dann zum Scrollen gezwungen, wenn
     darunter noch Platz war - und der Weiter-Button lag dann unter der Kante. */
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.step-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.step-count {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Fortschritt als gestapelte Bausteine, nicht als glatter Balken:
   passt zum Bauen und macht einzelne Schritte sichtbar. */
.step-bar {
  height: 8px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 14px, transparent 14px 18px);
  mask-image: repeating-linear-gradient(90deg, #000 0 14px, transparent 14px 18px);
}
.step-bar-fill { height: 100%; width: 0; transition: width 0.3s ease; }
.step-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 2px 0 10px;
  line-height: 1.15;
}
.step-md { font-size: 0.95rem; }
.step-md > *:first-child { margin-top: 0; }
.step-md h2, .step-md h3, .step-md h4 { font-size: 1rem; border: none; padding: 0; margin: 12px 0 4px; }
.step-md pre { font-size: 0.85rem; padding: 10px 12px; }
.step-md blockquote { font-size: 0.9rem; }
.step-bonus {
  margin-top: 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.step-bonus > summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 0.9rem; }

/* Kurs-Auswahl: nur sichtbar, wenn es mehr als einen Kurs gibt. Steht auf der
   Werkbank, also helle Schrift auf dunklem Grund. */
.kurs-waehler-wrap {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px;
}
.kurs-waehler-label {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--bench-ink-dim);
}
.kurs-waehler {
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; max-width: 100%;
}
.kurs-waehler:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

/* Bausteine: die noetigen Tags als einzelne Werkzeuge, bewusst NICHT als
   zusammenhaengende Codezeile - sonst wird wieder nur kopiert. */
.step-bausteine {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 10px 0;
}
.step-bausteine-label {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.tag-chip {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; white-space: nowrap;
}

/* Das Beispiel bleibt erreichbar, nur eben eine Interaktion entfernt.
   Neutrale Beschriftung: Nachschauen ist kein Schummeln. */
.step-example {
  margin: 10px 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.step-example > summary {
  cursor: pointer; font-weight: 700; font-size: 0.9rem; color: var(--muted);
}
.step-example[open] > summary { margin-bottom: 6px; }
.step-example pre { margin: 0; }

.step-status {
  margin: 12px 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
/* Erfolgstext dunkler als --green-light: auf Weiss braucht Text 4.5:1 (WCAG AA). */
.step-status.is-ok { color: var(--green); }
.step-status.is-hidden { display: none; }

/* Hinweis nach einem nur eingefuegten Schritt. Bewusst leise: kein Warnton,
   keine Farbe aus der Signalfamilie, der Schritt gilt ja trotzdem. */
.step-tipp {
  margin: 4px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
  border-left: 3px solid var(--line);
  padding-left: 10px;
}
.step-tipp.is-hidden { display: none; }

/* Muss eine besonders lange Aufgabe doch scrollen, klebt die Aktionszeile
   unten fest. Der primaere Button ist damit immer sichtbar, statt hinter der
   Panel-Kante zu verschwinden (eine Aktion pro Screen, aber nur wenn man sie
   auch sieht). */
.step-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px;
  position: sticky;
  bottom: -18px;
  padding: 10px 0 18px;
  background: var(--paper);
}
.step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 11px 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 46px;
}
.step-btn:hover { background: var(--bg); }
.step-btn.primary {
  font-family: var(--font-display);
  background: var(--lime);
  border-color: transparent;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--lime-deep);
  transition: transform 0.12s, box-shadow 0.12s;
}
.step-btn.primary:hover { transform: translateY(-1px); background: var(--lime); box-shadow: 0 4px 0 var(--lime-deep); }
.step-btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lime-deep); }
.step-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.step-btn.ghost:hover { background: var(--bg); color: var(--ink); }
/* Check bestanden: der Weiter-Button holt sich die Aufmerksamkeit */
.step-btn.primary.is-ready { animation: step-ready 1.8s ease-in-out infinite; }
@keyframes step-ready {
  0%, 100% { box-shadow: 0 3px 0 var(--lime-deep), 0 0 0 0 rgba(195, 236, 60, 0.6); }
  50%      { box-shadow: 0 3px 0 var(--lime-deep), 0 0 0 10px rgba(195, 236, 60, 0); }
}

/* --- Abschluss der Woche: der Badge kommt als Sticker --- */
.step-done { text-align: center; padding: 10px 4px; }
.step-done-emoji {
  font-size: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin-bottom: 10px;
  background: var(--lime);
  border: 3px solid var(--ink);
  border-radius: 50%;
  transform: rotate(-7deg);
  box-shadow: 0 6px 0 var(--ink);
}
.step-done h2 {
  font-family: var(--font-display);
  margin: 4px 0 6px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.step-done-badge { margin: 0 0 8px; }
.step-done-text { color: var(--muted); font-size: 0.92rem; margin: 0 0 14px; }
.step-done-actions { display: flex; flex-direction: column; gap: 8px; }
/* Sicherung nach jedem Badge: angeboten, nicht verlangt. Steht deshalb unter
   den Aktionen und tritt nicht gegen den primaeren Button an. */
.step-done-save {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step-done-save p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}
.editor-pane { position: relative; }
.editor-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  cursor: nwse-resize;
  z-index: 6;
  opacity: 0.7;
  box-shadow: 0 0 0 1px var(--line);
}
.editor-resize-handle::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 10px;
  height: 10px;
  border-right: 3px solid var(--muted);
  border-bottom: 3px solid var(--muted);
  border-radius: 0 0 2px 0;
}
.editor-resize-handle:hover,
.editor-resize-handle:focus-visible { opacity: 1; background: #fff; }
.editor-more { position: relative; }
.editor-more > summary { list-style: none; cursor: pointer; }
.editor-more > summary::-webkit-details-marker { display: none; }
.editor-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 8;
  display: flex; flex-direction: column; gap: 4px; min-width: 200px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; box-shadow: var(--shadow);
}
.editor-more-menu .ed-btn { width: 100%; text-align: left; }
.view:has(.editor-page) { max-width: 1180px; padding-bottom: 40px; }
.ed-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 13px; font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; min-height: 40px;
  transition: background 0.15s;
}
.ed-btn:hover { background: #f1f5f9; }
.ed-btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.ed-btn.primary:hover { background: var(--green-light); }
.ed-btn.active { background: #dcfce7; border-color: var(--green-light); color: var(--green); }

.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; }
.editor-pane, .preview-pane {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--tool-line); border-radius: 10px; overflow: hidden;
  background: var(--tool-panel);
}
.editor-pane { overflow: visible; }
.editor-pane .CodeMirror { flex: 1; height: 100%; font-size: 14px; line-height: 1.55; border-radius: 0 0 10px 10px; }
.pane-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; font-size: 0.8rem; font-weight: 700; color: var(--tool-ink-dim);
  background: var(--tool-panel); border-bottom: 1px solid var(--tool-line);
  letter-spacing: 0.02em;
}
/* Auf hellem Grund das dunklere Gruen (Kontrast), im dunklen Editor-Kopf
   wird es weiter oben auf ein helles Gruen umgestellt. */
.ed-status { font-weight: 600; color: var(--green); }
.preview-pane iframe { flex: 1; border: none; width: 100%; background: #fff; }

/* CodeMirror im dunklen Werkzeug-Look */
.editor-dark .CodeMirror {
  background: var(--tool-panel);
  color: #f1f5f9;
}
.editor-dark .CodeMirror-gutters { background: var(--tool-bg); border-right: 1px solid var(--tool-line); }
.editor-dark .CodeMirror-linenumber { color: #94a3b8; }
.editor-dark .CodeMirror-cursor { border-left: 2px solid #ffd75e; }
.editor-dark .CodeMirror-selected { background: #3f4a5a; }
.editor-dark .CodeMirror-line::selection,
.editor-dark .CodeMirror-line > span::selection { background: #3f4a5a; }

/* Farben folgen der Kurslogik aus Woche 5: wer? (Selektor) was? (Eigenschaft)
   wie? (Wert). Gleiche Rolle = gleiche Farbe, in HTML wie in CSS.
   Alle Werte gegen #24211c geprueft, mindestens 6:1.
   Wichtig: CodeMirrors Standardfarben sind fuer HELLEN Grund gedacht
   (cm-property 2.2:1, cm-atom 1.2:1). Jede Klasse, die hier fehlt, wird
   auf der dunklen Werkbank unlesbar - deshalb ist die Liste vollstaendig. */
.editor-dark .CodeMirror .cm-tag,                 /* <h1>, <div> ... */
.editor-dark .CodeMirror .cm-qualifier,           /* .karte im CSS  */
.editor-dark .CodeMirror .cm-builtin,             /* #id im CSS     */
.editor-dark .CodeMirror .cm-variable-2,
.editor-dark .CodeMirror .cm-variable-3,
.editor-dark .CodeMirror .cm-def,
.editor-dark .CodeMirror .cm-variable { color: #8fd9ff; }

.editor-dark .CodeMirror .cm-attribute,           /* src, alt, class */
.editor-dark .CodeMirror .cm-property { color: #ffd75e; }   /* color, padding ... */

.editor-dark .CodeMirror .cm-string,              /* "mein-thema.svg" */
.editor-dark .CodeMirror .cm-string-2,
.editor-dark .CodeMirror .cm-atom,                /* lightyellow, flex */
.editor-dark .CodeMirror .cm-number,              /* 20px, 0.3s */
.editor-dark .CodeMirror .cm-unit,
.editor-dark .CodeMirror .cm-keyword { color: #9df5b9; }

.editor-dark .CodeMirror .cm-meta { color: #ffabdc; }       /* <!DOCTYPE html> */
.editor-dark .CodeMirror .cm-bracket,
.editor-dark .CodeMirror .cm-punctuation,
.editor-dark .CodeMirror .cm-operator { color: #cbd5e1; }
.editor-dark .CodeMirror .cm-comment { color: #a3b1c2; }
.editor-dark .CodeMirror .cm-error { color: #ff9d9d; }
.editor-dark .CodeMirror-matchingbracket { color: #fff07a !important; font-weight: 700; }

/* Werkzeug-Buttons im dunklen Kopf */
.editor-dark .ed-btn {
  background: var(--tool-panel); border-color: var(--tool-line); color: var(--tool-ink);
}
.editor-dark .ed-btn:hover { background: #334155; }
.editor-dark .editor-more-menu { background: var(--tool-panel); border-color: var(--tool-line); }
.editor-dark .editor-resize-handle { background: rgba(30, 41, 59, 0.9); box-shadow: 0 0 0 1px var(--tool-line); }
.editor-dark .editor-resize-handle::after { border-right-color: #94a3b8; border-bottom-color: #94a3b8; }

@media (max-width: 900px) {
  .editor-body { grid-template-columns: 1fr; }
  .step-panel { max-height: none; }
  /* Ohne Hoehenbegrenzung scrollt das Panel nicht mehr - dann braucht es auch
     keine klebende Aktionszeile, die sonst ueber dem Text schweben wuerde. */
  .step-actions { position: static; padding: 0; }
  .editor-workspace { height: auto; min-height: 0; }
  .editor-split { grid-template-columns: 1fr; }
  .editor-pane, .preview-pane { height: 42vh; min-height: 200px; }
}
/* Auf dem Handy soll die Handlung direkt auf die Aufgabe folgen:
   Aufgabe, dann Code, dann Ergebnis. */
@media (max-width: 560px) {
  .editor-dark { padding: 8px; }
  .step-panel { padding: 12px 13px 14px; }
  .editor-pane, .preview-pane { height: 38vh; min-height: 180px; }
}

/* ===== Update-Hinweis =====
   Unten quer, ueber allem, aber nicht modal: wer weiterarbeiten will, kann.
   Erscheint nur, wenn wirklich eine neue Fassung bereitliegt. */
.update-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px 10px 16px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 0.92rem;
}
.update-bar-text { font-weight: 600; }
.update-bar-btn {
  font: inherit; font-weight: 700;
  background: var(--lime); color: var(--ink);
  border: 1px solid var(--lime-deep);
  border-radius: 9px; padding: 8px 14px; cursor: pointer;
  white-space: nowrap; min-height: 40px;
}
.update-bar-btn:disabled { opacity: 0.65; cursor: default; }
.update-bar-close {
  font: inherit; background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 6px 8px; border-radius: 8px;
  min-width: 36px; min-height: 36px;
}
.update-bar-close:hover { background: var(--bg); color: var(--ink); }
@media (max-width: 480px) {
  .update-bar { flex-wrap: wrap; left: 12px; right: 12px; transform: none; max-width: none; }
  .update-bar-text { flex-basis: 100%; }
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); font-weight: 600;
  z-index: 9999; opacity: 0; pointer-events: none; max-width: 90vw; text-align: center;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .ed-btn, .res-btn { transition: none; }
}

.ziel-bild {
  width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
  margin: 8px 0 20px;
}

.badge-toggle {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin: 20px 0;
}
.badge-toggle .txt { flex: 1; }
.badge-toggle .txt strong { display: block; }
.badge-toggle .txt small { color: var(--muted); }
.toggle-btn {
  border: none; border-radius: 999px; padding: 10px 18px;
  cursor: pointer; font-size: 0.95rem; font-weight: 700; transition: 0.2s;
}
.toggle-btn.off { background: var(--line); color: #334155; }
.toggle-btn.on { background: var(--green-light); color: #fff; }

.sheet {
  background: var(--card); border-radius: var(--radius);
  padding: 4px 20px 20px; box-shadow: var(--shadow); margin-top: 14px;
}
.sheet h2 { color: var(--green); }

/* ===== Markdown ===== */
.md h1 { font-size: 1.5rem; }
.md h2 { font-size: 1.25rem; color: var(--green); border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.md h3 { font-size: 1.05rem; }
.md code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 5px;
  font-family: "Courier New", monospace; font-size: 0.9em;
}
.md pre {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px;
  border-radius: 10px; overflow-x: auto;
}
.md pre code { background: none; color: inherit; padding: 0; }
.md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.92rem; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md th { background: #f8fafc; }
.md blockquote {
  border-left: 4px solid var(--green-light); margin: 12px 0;
  padding: 6px 14px; background: #f0fdf4; border-radius: 0 8px 8px 0;
}
.md details {
  background: #f8fafc; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px; margin: 12px 0;
}
.md summary { cursor: pointer; font-weight: 700; color: var(--green); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md ul.task { list-style: none; padding-left: 4px; }
.md ul.task li { display: flex; align-items: flex-start; gap: 8px; padding: 4px 6px; border-radius: 6px; transition: background 0.15s, color 0.15s; }
.md ul.task input { margin-top: 5px; cursor: pointer; width: 18px; height: 18px; accent-color: var(--green); }
.md ul.task input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.md ul.task li.is-checked { background: #ecfdf5; color: #475569; }
.md ul.task li.is-checked > * { text-decoration: line-through; text-decoration-thickness: 1px; }
.md ul.task li.is-checked input { text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
  .md ul.task li { transition: none; }
}

/* ===== Guided Flow (Schritt-für-Schritt) ===== */
.guide-hud {
  position: sticky;
  top: 74px; /* unter dem Header */
  z-index: 6;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  margin: 10px 0 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.guide-title { font-size: 0.98rem; }
.guide-sub { color: var(--muted); font-size: 0.85rem; display: block; }
.guide-hud-right { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.guide-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
  min-height: 44px;
}
.guide-btn:hover { background: var(--bg); }
.guide-btn.primary {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}
.guide-btn.primary:hover { background: var(--green-light); }
.guide-btn:disabled { opacity: 0.5; cursor: default; }
.guide-bar {
  grid-column: 1 / -1;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.guide-bar-fill { height: 100%; width: 0; transition: width 0.25s ease; }
.guide-step.is-hidden { display: none; }
.guide-extra { margin-top: 10px; }
.guide-extra > summary { cursor: pointer; font-weight: 800; color: var(--muted); }

@media (max-width: 720px) {
  .guide-hud { top: 66px; grid-template-columns: 1fr; }
  .guide-hud-right { justify-content: stretch; }
  .guide-btn { flex: 1 1 auto; }
}

/* ===== Hilfe-Dialog (Lektion) ===== */
.help-dlg {
  border: none; border-radius: 16px; padding: 20px 22px;
  max-width: 520px; width: calc(100% - 32px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  position: relative;
}
.help-dlg::backdrop { background: rgba(15, 23, 42, 0.45); }
.help-dlg-close {
  position: absolute; top: 10px; right: 12px;
  border: none; background: transparent; font-size: 1.1rem; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px;
}
.help-dlg-close:hover { background: var(--bg); }
.help-dlg h2 { margin: 0 0 4px; font-size: 1.2rem; }
.help-dlg-sub { color: var(--muted); margin: 0 0 14px; font-size: 0.9rem; }
.help-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.help-tab {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 14px; font-weight: 700; cursor: pointer; font-size: 0.88rem;
}
.help-tab.aktiv { background: var(--green); color: #fff; border-color: var(--green); }
.help-panel { max-height: 50vh; overflow-y: auto; }
.help-panel.is-hidden { display: none; }
.help-ziel { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.help-loes-btn {
  margin-top: 10px; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; width: 100%;
}
.help-loes-btn:hover { background: var(--bg); }
.help-leer { color: var(--muted); }

/* ===== Coder-Pass ===== */
.pass-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}
/* Badges sind Sticker: leicht schief, dicke Kante, sammelbar */
.pass-badge {
  background: var(--paper); border-radius: var(--radius); padding: 14px 12px;
  text-align: center; cursor: pointer; font-family: inherit;
  border: 2px solid var(--line); transition: transform 0.15s, box-shadow 0.15s;
}
.pass-badge:hover { transform: translateY(-2px) rotate(-1.5deg); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.pass-badge.earned {
  border-color: var(--ink);
  background: var(--lime);
  transform: rotate(-2deg);
  box-shadow: 0 4px 0 var(--ink);
}
.pass-badge.earned:nth-child(even) { transform: rotate(1.8deg); }
.pass-badge .emoji { font-size: 2rem; filter: grayscale(1) opacity(0.35); }
.pass-badge.earned .emoji { filter: none; }
.pass-badge .name {
  font-family: var(--font-display); font-size: 0.9rem; margin-top: 6px;
  line-height: 1.1; letter-spacing: -0.01em;
}
.pass-badge .wk { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; }
.pass-badge.earned .wk { color: var(--lime-deep); }

.reset-btn {
  margin-top: 20px; background: none; border: 1px solid var(--bench-line);
  color: var(--bench-ink-dim); padding: 10px 14px; border-radius: 8px; cursor: pointer;
  font-family: inherit; min-height: 40px;
}
.reset-btn:hover { color: var(--bench-ink); border-color: var(--bench-ink-dim); }
.celebrate {
  text-align: center; background: var(--paper); border: 2px dashed var(--coral);
  border-radius: var(--radius); padding: 18px; margin-top: 18px; font-size: 1.1rem;
}

/* ===== Aufbau einer HTML-Seite ===== */
.aufbau-list {
  background: #0f172a; border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); overflow-x: auto; margin: 16px 0;
}
.aufbau-row {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.2fr);
  gap: 10px; align-items: baseline; padding: 5px 0;
}
.aufbau-code {
  color: #93c5fd; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.92rem; white-space: pre; display: block;
}
.aufbau-erkl { color: #cbd5e1; font-size: 0.86rem; }
.aufbau-erkl code { background: #1e293b; color: #fde68a; padding: 1px 5px; border-radius: 4px; }
.aufbau-merke {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.aufbau-merke h2 { margin-top: 4px; color: var(--green); }
.aufbau-merke code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }
@media (max-width: 640px) {
  .aufbau-row { grid-template-columns: 1fr; gap: 2px; }
  .aufbau-erkl { padding-left: 0.6rem; padding-bottom: 6px; }
}

/* ===== Lexikon / Glossar ===== */
.glossar-tools { margin: 16px 0; }
.glossar-suche {
  width: 100%; padding: 11px 14px; font-size: 1rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); box-shadow: var(--shadow);
}
.glossar-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.glossar-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 0.88rem; font-weight: 600; cursor: pointer; color: var(--muted);
}
.glossar-chip:hover { background: #f1f5f9; }
.glossar-chip.aktiv { background: var(--green); color: #fff; border-color: var(--green); }
.glossar-liste {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 6px;
}
.glossar-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.glossar-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.glossar-begriff { font-size: 1.05rem; font-weight: 700; color: var(--ink); background: #eef2f7; padding: 3px 8px; border-radius: 6px; }
.glossar-typ { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.typ-tag       { background: #dcfce7; color: #166534; }
.typ-attribut  { background: #dbeafe; color: #1e40af; }
.typ-css       { background: #f3e8ff; color: #6b21a8; }
.typ-selektor  { background: #ffedd5; color: #9a3412; }
.glossar-kurz { margin: 0; }
.glossar-lang { margin: 0; font-size: 0.9rem; color: var(--muted); }
.glossar-bsp {
  background: #0f172a; color: #93c5fd; border-radius: 8px; padding: 8px 10px;
  margin: 4px 0 0; font-size: 0.82rem; overflow-x: auto;
}
.glossar-bsp code { background: none; color: inherit; padding: 0; }
.glossar-woche {
  font-size: 0.8rem; font-weight: 600; color: var(--green); text-decoration: none; align-self: flex-start;
}
.glossar-woche:hover { text-decoration: underline; }
.glossar-leer { color: var(--bench-ink-dim); padding: 20px 4px; }
