/* ============================================================
   LernPy — Retro-/Pixel-Layer (nach app.css geladen).
   Look: dunkler Navy-Grund, gelbe XP/CTA-Akzente, runde 2px-Karten,
   chunky Buttons mit Druck-Effekt, Silkscreen als Pixel-Titelschrift.
   Farben/Radien/Schatten kommen aus tokens.css.
   ============================================================ */

/* ---- Pixel-Chrome ---- */
.brand-name {
  font-family: var(--font-pixel); font-weight: 700; font-size: 20px; letter-spacing: 0.02em;
}
.topbar { border-bottom: 2px solid var(--border); }
.topbar .brand-name { font-size: 18px; }

/* HUD-Zahlen (Coins, Fortschritt) in Mono — wie im Vorbild */
.coin-chip, .progress-chip { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }

/* ---- Buttons: chunky, drücken sich beim Klick runter ---- */
.btn { border-radius: var(--radius); font-weight: 700; }
.btn-primary {
  background: var(--primary); color: var(--primary-contrast);
  border: 0; border-bottom: 4px solid var(--primary-dark);
  box-shadow: 0 4px 20px rgba(250, 204, 21, 0.25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); filter: none; }
.btn-primary:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border: 2px solid var(--border-strong); box-shadow: none;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--text-muted); color: var(--text); background: var(--surface-2); }
.btn-secondary:active:not(:disabled) { transform: translateY(1px); }

/* ---- Karten ---- */
.card, .panel { border-width: 2px; border-radius: var(--radius-lg); }
.lesson-card { border-width: 2px; border-radius: var(--radius-lg); }
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* ---- XP-/Fortschrittsleiste ---- */
.progressbar {
  height: 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.45); padding: 2px; overflow: hidden;
}
.progressbar::after { content: none; }
.progressbar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.45);
}

/* ---- Hero-Banner mit Pixel-Art ---- */
.hero-banner {
  position: relative; width: 100%; height: clamp(280px, 34vw, 440px);
  overflow: hidden; border-bottom: 4px solid #111111; user-select: none;
}
.hero-banner__img {
  position: absolute; inset: 0;
  background: url("/images/hero-bg.png") center / cover no-repeat;
  image-rendering: pixelated;
  /* Skalierung/Drift an der UNTERKANTE verankern: das Bild wächst nur nach oben
     (dort ist der Schleier durchsichtig) und ragt unten NICHT unter dem Schleier
     hervor — sonst schien dort ein heller Streifen durch (v.a. unter der Abdunklung
     des Rundgangs). */
  transform-origin: center bottom; transform: scale(1.02);
}
.hero-banner__veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, #1f1f1f 0%, rgba(31, 31, 31, 0.85) 42%, transparent 100%),
    linear-gradient(to right, rgba(31, 31, 31, 0.92) 0%, rgba(31, 31, 31, 0.45) 48%, transparent 100%);
}
/* Gleiche Kante wie der Dashboard-Inhalt, damit „Python“ mit der ersten Karte fluchtet. */
.hero-banner__inner {
  position: relative; height: 100%; max-width: none; margin: 0;
  padding: 0 var(--sp-5); display: flex; flex-direction: column; justify-content: center; gap: var(--sp-3);
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.3); color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
}
.hero-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: block; }
.hero-banner .hero-title {
  font-family: var(--font-pixel); font-weight: 700; color: #fff;
  font-size: clamp(34px, 6.5vw, 64px); line-height: 1.05; letter-spacing: 0.02em;
  text-shadow: 0 4px 0 #111111;
}
.hero-banner .hero-sub { color: #d4d4d4; max-width: 52ch; font-size: 15px; margin: 0; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); margin-top: var(--sp-2); }
.hero-cta .btn-primary { padding: 13px 24px; }
.hero-progress { min-width: 190px; }
.hero-progress-head {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.hero-banner .hero-meta { color: #9d9d9d; margin-top: var(--sp-2); }
.hero-banner .progressbar { max-width: 220px; }

@media (prefers-reduced-motion: no-preference) {
  .hero-banner__img { animation: heroDrift 26s ease-in-out infinite alternate; }
  /* Login-Hintergrund driftet genauso wie das Hero-Bild nach dem Einloggen.
     Das Bild bedeckt immer mehr als das Fenster (Skalierung ≥ 1), darum werden
     beim Zoomen nie Kanten frei — kein Streifen. */
  .login-wrap::before { animation: heroDrift 26s ease-in-out infinite alternate; }
}
@keyframes heroDrift { from { transform: scale(1.02); } to { transform: scale(1.09); } }

/* Schnellzugriffe stehen in der linken Spalte, damit die Sidebar oben beginnt. */
/* Nur so breit wie die Knöpfe (nicht die volle Spalte) — sonst ist der Rundgang-
   Scheinwerfer unnötig lang. max-width hält das Umbrechen auf schmalen Fenstern. */
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; width: fit-content; max-width: 100%; }

/* ---- Login: Pixel-Art als Hintergrund ---- */
.login-wrap::before {
  content: ""; position: fixed; inset: 0; z-index: -3;
  background: url("/images/hero-bg.png") center / cover no-repeat; image-rendering: pixelated;
}
/* Der letzte Farbstopp muss bei 100 % liegen: endet er früher, ist der Verlauf ab
   dort konstant und die Kante wird als harter Schnitt sichtbar. */
.login-wrap::after {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(
    130% 105% at 50% 0%,
    rgba(31, 31, 31, 0.35) 0%,
    rgba(31, 31, 31, 0.72) 55%,
    rgba(31, 31, 31, 0.94) 100%
  );
}
.login-split { border: 2px solid var(--border-strong); border-radius: var(--radius-lg); }
.login-title {
  font-family: var(--font-pixel); font-weight: 700;
  font-size: clamp(20px, 4vw, 28px); line-height: 1.25; letter-spacing: 0.01em;
}

/* Linke Seite: Pixel-Art statt Farbverlauf — Gelb bleibt CTA/XP vorbehalten. */
.login-aside {
  background: url("/images/hero-bg.png") center / cover no-repeat;
  image-rendering: pixelated; color: #e6e6e6;
}
.login-aside::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(31, 31, 31, 0.96) 0%, rgba(31, 31, 31, 0.72) 100%);
}
.login-aside > * { position: relative; z-index: 1; }
.login-aside::after { opacity: 0.18; }
.login-aside-sub { color: #cccccc; }
.login-aside-meta { color: #9d9d9d; }

/* ---- Dashboard: Timeline links, Profil-Sidebar rechts ---- */
/* Volle Fensterbreite (statt der 1080px des Standard-Containers), damit die
   Sidebar rechts am Rand steht. Nur das Dashboard nutzt das. */
.container--breit { max-width: none; }

.dash-layout { display: grid; gap: var(--sp-5); align-items: start; margin-top: var(--sp-5); }
/* Einspaltig (schmal): Profil/XP zuerst, sonst landet es ganz unten. */
.sidebar { order: -1; }
@media (min-width: 1000px) {
  /* Sidebar mit fester Breite: sonst wüchse sie auf großen Monitoren mit. */
  .dash-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .sidebar { order: 0; }
}
/* Linke Spalte: Schnellzugriffe über den Kapiteln. */
.dash-main { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }

.chapters { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.chapter {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.chapter.is-open { border-color: var(--border-strong); }
.chapter-head {
  width: 100%; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); background: transparent; border: 0; cursor: pointer; text-align: left;
  color: var(--text); font-family: inherit;
}
.chapter-head:hover { background: var(--surface-2); }
.chapter-num {
  flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--border-strong);
  font-family: var(--font-pixel); font-weight: 700; font-size: 15px; color: var(--text-muted);
}
.chapter.is-open .chapter-num { border-color: var(--primary); color: var(--primary); }
.chapter-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chapter-title { font-family: var(--font-pixel); font-weight: 700; font-size: 16px; letter-spacing: 0.01em; }
.chapter-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.chapter-chevron { color: var(--text-muted); transition: transform var(--transition); }
.chapter.is-open .chapter-chevron { transform: rotate(180deg); }

.chapter-body { display: none; padding: 0 var(--sp-4) var(--sp-4); }
.chapter.is-open .chapter-body { display: block; }
.ex-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 10px var(--sp-3); border-top: 1px solid var(--border);
}
.ex-idx {
  flex: 0 0 82px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
}
.ex-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; }
.ex-row.is-done .ex-title { color: var(--text-muted); }
.ex-opt {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--warning); background: var(--warning-weak); padding: 3px 8px; border-radius: 999px;
}
.ex-btn { flex: 0 0 auto; min-width: 104px; padding: 8px 14px; font-size: 12.5px; }
.ex-btn.is-done { color: var(--success); border-color: var(--success); background: transparent; }

/* ---- Profil-Sidebar ---- */
.sidebar { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.side-card {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.side-profile { display: flex; align-items: center; gap: var(--sp-3); }
.side-avatar {
  flex: 0 0 auto; padding: 3px; border-radius: var(--radius);
  border: 2px solid var(--border-strong); background: var(--surface-2);
}
.pixel-avatar { display: block; image-rendering: pixelated; }
.side-ident { min-width: 0; }
.side-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-level { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-top: 2px; }
.side-xp { display: flex; flex-direction: column; gap: 6px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); font-size: 13px; }
.side-row-label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-weight: 600; }
.side-row-num { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.side-row--coins .side-row-num { color: var(--coin); }
.side-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.side-head-row { display: flex; align-items: center; justify-content: space-between; }
.side-head-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 700; }
.progressbar--blau .progressbar-fill {
  background: linear-gradient(90deg, #0e639c, #007acc); box-shadow: 0 0 8px rgba(0, 122, 204, 0.4);
}

/* ---- Abzeichen ---- */
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px;
  padding: 12px 8px; border-radius: var(--radius); border: 2px solid var(--border);
  background: rgba(0, 0, 0, 0.2); opacity: 0.5;
}
.badge-tile.is-earned {
  opacity: 1; border-color: rgba(250, 204, 21, 0.4); background: rgba(250, 204, 21, 0.06);
}
.badge-icon { display: inline-flex; align-items: center; justify-content: center; }

/* Pixel-Emojis (Herzen, Level-Stern, Abzeichen) — eigene Farben, harte Kanten. */
.pixel-icon { display: block; image-rendering: pixelated; }
.kj-heart-off .pixel-icon { filter: grayscale(1); opacity: 0.35; }
.badge-name { font-size: 11.5px; font-weight: 700; }
.badge-desc { font-size: 9.5px; color: var(--text-muted); line-height: 1.35; }

/* ---- Piktogramme statt Emojis (app-weit) ---- */
.game-emoji { display: flex; align-items: center; justify-content: center; color: var(--accent); }
.fb-emoji { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.fb-opt.is-sel .fb-emoji { color: var(--accent); }
.fb-thanks-emoji { display: flex; justify-content: center; color: var(--danger); }
.levelup-star { color: var(--primary); }
.tipp summary { display: flex; align-items: center; gap: 8px; }
.tipp summary .icon { color: var(--accent); flex: 0 0 auto; }
.ide-item-action { display: inline-flex; align-items: center; justify-content: center; }
.lb-medal { display: inline-flex; align-items: center; justify-content: center; }
.lb-medal-1 { color: #d4af37; }
.lb-medal-2 { color: #b8bcc2; }
.lb-medal-3 { color: #c07a3e; }

/* ---- Level-Up-Overlay ---- */
.levelup-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--sp-5);
  background: rgba(0, 0, 0, 0.78);
}
.levelup-card {
  width: 100%; max-width: 340px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-4);
  background: var(--surface); border: 4px solid var(--primary); border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-5); box-shadow: 0 0 50px rgba(250, 204, 21, 0.35);
}
.levelup-star {
  width: 66px; height: 66px; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--primary); background: rgba(250, 204, 21, 0.12);
  color: var(--primary); font-size: 30px; line-height: 1;
}
.levelup-title { font-family: var(--font-pixel); font-weight: 700; font-size: 24px; letter-spacing: 0.02em; }
.levelup-sub { font-size: 13px; color: var(--text-muted); }
.levelup-levels {
  display: flex; align-items: center; justify-content: space-around; gap: var(--sp-4); width: 100%;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
}
.levelup-col { display: flex; flex-direction: column; gap: 2px; }
.levelup-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.levelup-old { font-family: var(--font-mono); font-size: 20px; color: var(--text-muted); }
.levelup-new { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--primary); }
.levelup-arrow { color: var(--primary); font-size: 18px; }

/* ---- Lektionstext: Überschriften, Listen, kopierbare Codeblöcke ---- */
.lessontext { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.lessontext p { font-size: 14px; line-height: 1.65; color: var(--text); }
.lt-h {
  font-family: var(--font-pixel); font-weight: 700; font-size: 13px;
  letter-spacing: 0.02em; color: var(--accent); margin-top: var(--sp-2);
}
.lt-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.lt-list li { font-size: 14px; line-height: 1.55; color: var(--text); }
.lt-code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1px 5px; color: var(--accent);
}
/* **bold** — restrained: weight change only, no accent colour (would compete
   with .lt-code for attention). Real weight jump (600) so a screen reader
   voice or bold-detector CSS accessibility tool still sees it as emphasis. */
.lt-bold { font-weight: 600; color: var(--text); }
/* [[Lektionstitel]] — Querverweis auf eine frühere Lektion. Bewusst ein Textlink
   mit Unterstrich statt Knopf/Chip: der Verweis steht MITTEN im Satz („die
   Mehrfachzuweisung aus Variablen“), ein Knopf würde den Lesefluss zerreißen.
   Kein Leuchten, kein Rahmen — siehe Feedback_UI_Zurueckhaltend_Professionell. */
.lt-lektionlink {
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.lt-lektionlink:hover { text-decoration-thickness: 2px; }
/* Derselbe Verweis ohne Sprungziel: der Index ist noch nicht geladen. Der Name
   bleibt lesbar, nur ohne Link — niemals „[[…]]“. */
.lt-lektionref { font-style: italic; color: var(--text); }
.lt-codeblock {
  border: 2px solid var(--border); border-radius: var(--radius);
  background: #1e1e1e; overflow: hidden;
}
.lt-codebar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 5px 8px 5px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.lt-lang {
  font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
}
.lt-copy {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; cursor: pointer;
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted);
}
.lt-copy:hover { color: var(--text); border-color: var(--text-muted); }
.lt-copy.is-copied { color: var(--success); border-color: var(--success); }
.lt-pre {
  margin: 0; padding: 12px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--text);
}

/* Schreibmaschinen-Effekt: Blöcke erscheinen erst beim ersten Zeichen. */
.lt-verborgen { display: none; }
.lt-typing { cursor: pointer; }
.lt-caret {
  display: inline-block; width: 0.5em; height: 1em; vertical-align: -0.14em;
  margin-left: 2px; background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .lt-caret { animation: ltBlink 1s steps(1) infinite; }
}
@keyframes ltBlink { 50% { opacity: 0; } }

/* ---- Intro-Cutscene ---- */
.intro-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  padding: var(--sp-5); background: rgba(0, 0, 0, 0.85);
}
.intro-panel {
  position: relative; width: 100%; max-width: 640px; min-height: 380px;
  border: 3px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden;
  display: flex; box-shadow: var(--shadow-lg);
}
.intro-bild {
  position: absolute; inset: 0;
  background: url("/images/hero-bg.png") center / cover no-repeat; image-rendering: pixelated;
}
.intro-schleier {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(31, 31, 31, 0.97) 30%, rgba(31, 31, 31, 0.55) 100%);
}
.intro-inhalt {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  gap: var(--sp-3); padding: var(--sp-6) var(--sp-5) var(--sp-5); width: 100%;
}
.intro-titel {
  font-family: var(--font-pixel); font-weight: 700; color: #fff;
  font-size: clamp(18px, 3.4vw, 26px); line-height: 1.25; letter-spacing: 0.02em;
  text-shadow: 0 3px 0 #111111;
}
.intro-text { font-size: 15px; line-height: 1.7; color: #cccccc; min-height: 5.1em; }
/* Der noch nicht getippte Rest belegt seinen Platz, bleibt aber unsichtbar. */
.intro-rest { visibility: hidden; }
.intro-punkte { display: flex; gap: 7px; }
.intro-punkt {
  width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border-strong);
}
.intro-punkt.is-aktiv { background: var(--primary); border-color: var(--primary); }
.intro-aktionen { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.intro-weiter { min-width: 132px; }

@media (prefers-reduced-motion: no-preference) {
  .intro-panel.is-rein { animation: introRein 0.35s ease-out both; }
}
@keyframes introRein {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---- Lektion / IDE ---- */
.lesson-title { font-family: var(--font-pixel); font-weight: 700; font-size: clamp(18px, 3.5vw, 24px); line-height: 1.3; }
.ide-task-title { font-family: var(--font-pixel); font-weight: 700; font-size: 18px; line-height: 1.3; letter-spacing: 0.01em; }
/* Der Aufgabentext ist jetzt gerenderter DOM-Inhalt, kein Rohtext mehr. */
.ide-task-desc { white-space: normal; }
/* Etwas mehr Luft für erklärende Lektionen mit Codeblöcken. */
.ide-shell.ide-with-task { grid-template-columns: 210px 1fr 380px; }
/* At Chromebook / school-tablet widths (walker Run 3 BUG-22, 929x861) the
   3-column grid crushes the editor pane and the task aside overlaps the
   editor toolbar; pointer events land on the aside's `<p>` and the run/save
   buttons are unreachable. Match the media query in app.css so the retro
   theme's aside-width override cannot re-introduce the collapse. */
@media (max-width: 1024px) {
  .ide-shell.ide-with-task { grid-template-columns: 1fr; }
}
/* Statusleiste dezent halten — Gelb ist CTA/XP vorbehalten. */
.ide-statusbar { background: var(--surface-2); color: var(--text-muted); border-top: 2px solid var(--border); }
.ide-status-brand { font-family: var(--font-pixel); font-weight: 700; font-size: 12px; color: var(--accent); }
