:root {
  --green: #58cc02;
  --green-dark: #46a302;
  --green-soft: #d7ffb8;
  --red: #ea2b2b;
  --red-soft: #ffdfe0;
  --blue: #1cb0f6;
  --blue-soft: #ddf4ff;
  --text: #3c3c3c;
  --muted: #777;
  --line: #e5e5e5;
  --bg: #ffffff;
  --card: #ffffff;
  --locked: #e5e5e5;
  --accent: #58cc02;      /* Hauptfarbe, ändert sich mit dem Farbthema */
  --accent-dark: #46a302;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f1f7fb;
    --muted: #a6b4bd;
    --line: #37464f;
    --bg: #131f24;
    --card: #1b2b32;
    --green-soft: #1f3a12;
    --red-soft: #3d1a1c;
    --blue-soft: #16364a;
    --locked: #37464f;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.loading { text-align: center; margin-top: 40vh; color: var(--muted); }

.screen { flex: 1; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.screen.center { align-items: center; justify-content: center; text-align: center; gap: 12px; }

h1 { font-size: 1.6rem; margin: 0.2em 0; }
h2 { font-size: 1.35rem; margin: 0.4em 0 0.8em; }
.logo { font-size: 4.5rem; }
.sub { color: var(--muted); margin: 0; }

/* Kopfzeile */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.lang-switch { font-size: 1.8rem; background: none; border: 2px solid var(--line); border-radius: 12px; padding: 2px 10px; }
.stats { display: flex; gap: 16px; font-weight: 800; }
.stat { white-space: nowrap; }

/* Sprachauswahl */
.lang-list { display: grid; gap: 12px; width: 100%; max-width: 360px; margin-top: 12px; }
.lang-card {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; font-size: 1.25rem; font-weight: 800;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px; text-align: left;
}
.lang-card:hover { background: var(--blue-soft); border-color: var(--blue); }
.lang-card .flag { font-size: 2.4rem; }

/* Kursübersicht */
.course-head { margin-bottom: 8px; }
.course-progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.course-progress .bar { flex: 1; }

.bar { height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }

.path { list-style: none; padding: 16px 0 40px; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.node { display: flex; flex-direction: column; align-items: center; gap: 6px; transform: translateX(calc(var(--offset) * 44px)); }
.node button {
  width: 76px; height: 76px; border-radius: 50%; border: none; font-size: 2rem;
  background: var(--accent); box-shadow: 0 7px 0 var(--accent-dark); transition: transform 0.1s;
}
.node button:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 var(--accent-dark); }
.node.done button { background: #ffc800; box-shadow: 0 7px 0 #e0a800; }
.node.locked button { background: var(--locked); box-shadow: 0 7px 0 #c4c4c4; filter: grayscale(1); }
.node.open button { animation: bounce 1.6s ease-in-out infinite; }
.node .label { font-weight: 800; font-size: 0.95rem; }
.node.locked .label { color: var(--muted); }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Lektion */
.lesson-top { display: flex; align-items: center; gap: 14px; padding-top: env(safe-area-inset-top); }
.lesson-top .bar { flex: 1; }
.close { background: none; border: none; font-size: 1.4rem; color: var(--muted); padding: 4px 8px; border-radius: 10px; white-space: nowrap; }
.close.armed { font-size: 0.9rem; font-weight: 800; color: var(--red); background: var(--red-soft); }

.exercise { flex: 1; display: flex; flex-direction: column; gap: 16px; }

.card-word { display: flex; align-items: center; gap: 12px; font-size: 1.4rem; font-weight: 700; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; }
.speaker { background: var(--blue); color: #fff; border: none; border-radius: 12px; font-size: 1.3rem; padding: 6px 10px; box-shadow: 0 4px 0 #1899d6; }
.speaker.big { font-size: 3rem; padding: 20px 34px; border-radius: 20px; align-self: center; margin: 10px 0; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; font-size: 1.1rem; font-weight: 700;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
}
.option .key { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 8px; font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.option.selected { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.option.matched { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); opacity: 0.6; }
.option.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .option { justify-content: center; text-align: center; min-height: 56px; }

.answer-line { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 8px 0; border-bottom: 2px solid var(--line); }
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 8px; }
.chip { padding: 10px 14px; font-size: 1.05rem; font-weight: 700; background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; }
.chip.used { color: transparent; background: var(--line); border-color: var(--line); pointer-events: none; }
.chip.small { padding: 6px 10px; font-size: 1rem; }

.text-input { width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); }
.text-input:focus { outline: none; border-color: var(--blue); }
.accent-keys { display: flex; flex-wrap: wrap; gap: 6px; }

.check-area { margin: 16px -16px -16px; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); display: grid; gap: 12px; }
.check-area.good { background: var(--green-soft); border-color: transparent; }
.check-area.bad { background: var(--red-soft); border-color: transparent; }
.feedback strong { font-size: 1.25rem; }
.feedback p { margin: 6px 0 0; }
.check-area.good .feedback { color: var(--green-dark); }
.check-area.bad .feedback { color: var(--red); }
.check-area.bad .btn.primary { background: var(--red); box-shadow: 0 5px 0 #b81f1f; }

.btn { width: 100%; padding: 14px; font-size: 1.1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border: none; border-radius: 14px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 5px 0 var(--accent-dark); }
.btn.primary:disabled { background: var(--line); color: var(--muted); box-shadow: none; }
.btn.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }
.check-area.good .btn.primary { background: var(--green); box-shadow: 0 5px 0 var(--green-dark); }

/* Ergebnis */
.result .btn { max-width: 360px; margin-top: 20px; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 420px; margin-top: 12px; }
.pill { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 12px 6px; border: 2px solid var(--line); border-radius: 16px; text-align: center; }
.pill span { font-size: 1.8rem; }
.pill b { font-size: 1.2rem; }
.pill small { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }

@media (min-width: 700px) {
  .check-area { margin: 16px 0 0; border-radius: 16px; border: 2px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Teile des Kurses */
.unit { margin-top: 18px; }
.unit-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 16px; background: var(--accent); color: #fff;
  box-shadow: 0 4px 0 var(--accent-dark);
}
.unit-c1 .unit-head { background: #ce82ff; box-shadow: 0 4px 0 #a568cc; }
.unit-c2 .unit-head { background: var(--blue); box-shadow: 0 4px 0 #1899d6; }
.unit-c3 .unit-head { background: #ff9600; box-shadow: 0 4px 0 #cc7800; }
.unit-c4 .unit-head { background: #ff4b4b; box-shadow: 0 4px 0 #cc3c3c; }
.unit-no { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.unit-title { font-size: 1.15rem; font-weight: 800; flex: 1; }
.unit-stars { font-size: 0.95rem; letter-spacing: 1px; }

/* Wiederholen */
.review-card {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; padding: 12px 16px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px;
}
.review-card:hover { background: var(--blue-soft); border-color: var(--blue); }
.review-card .icon { font-size: 1.8rem; }
.review-card b { display: block; font-size: 1.05rem; }
.review-card small { color: var(--muted); }

.badge { align-self: flex-start; margin-top: 12px; padding: 4px 10px; border-radius: 99px; font-size: 0.85rem; font-weight: 800; background: #f3e5ff; color: #a568cc; }
.hint { margin: -6px 0 0; color: var(--muted); font-size: 0.95rem; }

/* Einstieg wählen */
.lang-card.level { text-align: left; }
.lang-card.level b { display: block; font-size: 1.15rem; }
.lang-card.level small { display: block; font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.link { background: none; border: none; color: var(--blue); font-weight: 700; margin-top: 8px; text-decoration: underline; }

/* Chinesisch: Zeichen mit Pinyin darunter */
.zh-line { display: inline-flex; flex-wrap: wrap; gap: 2px 6px; align-items: flex-end; vertical-align: middle; }
.tw { position: relative; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.tw .hz { font-size: 1.15em; }
.tw .py { font-size: 0.62em; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.option .tw .py, .chip .tw .py { font-size: 0.7em; }
.hz.blank { color: var(--blue); }

/* Antippen für Übersetzung */
.tw.g { cursor: pointer; border-bottom: 2px dashed var(--muted); display: inline-flex; }
span.tw.g:not(:has(.hz)) { display: inline; }
.tw.g.open { border-bottom-color: var(--blue); }
.tw.g.open::after {
  content: attr(data-g); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 0.85rem; font-weight: 700; line-height: 1.3;
  padding: 6px 10px; border-radius: 10px; white-space: nowrap; z-index: 5; pointer-events: none;
}

/* Lernkarten vor einer Lektion */
.intro-body { justify-content: center; }
.flashcard {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
  padding: 28px 16px; border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 20px;
}
.flashcard .speaker.big { margin: 0; }
.fc-target { font-size: 2.4rem; font-weight: 800; }
.fc-target .tw .py { font-size: 0.45em; }
.fc-german { font-size: 1.3rem; color: var(--muted); font-weight: 700; }
.tip-text { font-size: 1.15rem; line-height: 1.55; background: #fff8e1; color: #5c4a00; padding: 16px; border-radius: 16px; margin: 0; }
.examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.examples li { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--line); border-radius: 14px; }
.ex-target { font-size: 1.15rem; font-weight: 700; }
.ex-german { color: var(--muted); margin-top: 4px; }
.skip { background: none; border: none; color: var(--blue); font-weight: 800; white-space: nowrap; padding: 4px 6px; }

/* Tipp während der Lektion */
.tip-btn { background: none; border: 2px solid var(--line); border-radius: 12px; font-size: 1.1rem; padding: 2px 8px; }
.tip-box { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #fff8e1; color: #5c4a00; line-height: 1.5; }

.badge.new { background: var(--green-soft); color: var(--green-dark); }
.badge.tip { background: #fff3cd; color: #8a6d00; }
.hint.center { text-align: center; margin-top: 0; }
.feedback .small { font-size: 0.9rem; opacity: 0.85; }
.card-text { flex: 1; }

@media (prefers-color-scheme: dark) {
  .tip-text, .tip-box { background: #3a3215; color: #ffe7a0; }
  .badge.tip { background: #3a3215; color: #ffe7a0; }
}

/* ---------- Version 4 ---------- */

/* Kopfzeile: Tagesziel und Einstellungen */
.stats { gap: 12px; }
.stat.goal-done { color: var(--green-dark); }
.gear { background: none; border: 2px solid var(--line); border-radius: 12px; font-size: 1.2rem; padding: 4px 8px; }
@media (max-width: 380px) { .stats { gap: 8px; font-size: 0.9rem; } }

/* Weiterlernen */
.continue-card {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; padding: 14px 16px; text-align: left;
  background: var(--accent); color: #fff; border: none; border-radius: 16px; box-shadow: 0 5px 0 var(--accent-dark);
}
.continue-card:active:not(.all-done) { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }
.continue-card .icon { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: rgba(255,255,255,0.25); border-radius: 50%; flex-shrink: 0; }
.continue-card b { display: block; font-size: 1.15rem; }
.continue-card small { font-weight: 700; opacity: 0.92; }
.continue-card.all-done { background: #ffc800; color: #4a3b00; box-shadow: 0 5px 0 #e0a800; }
.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 12px; }

/* Sterne pro Lektion, Grammatik-Lektionen */
.node .mstars { color: #ffb100; font-size: 0.9rem; letter-spacing: 1px; margin-top: -4px; }
.node.mastered button { background: #ffb100; box-shadow: 0 7px 0 #d18f00; outline: 4px solid #ffe08a; outline-offset: 2px; }
.node.grammar button { border-radius: 22px; }
.node.grammar.open button, .node.grammar.done:not(.mastered) button { background: #ce82ff; box-shadow: 0 7px 0 #a568cc; }
.node.grammar .label { color: #a568cc; }
.node.locked button { cursor: pointer; }
.jump { margin-left: auto; background: rgba(255,255,255,0.25); color: #fff; border: 2px solid rgba(255,255,255,0.6); border-radius: 99px; padding: 4px 12px; font-weight: 800; font-size: 0.85rem; }
.level-tag { font-size: 0.8rem; font-weight: 800; color: #ffb100; white-space: nowrap; }

/* Unterseite zum Springen */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 560px; background: var(--bg); border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  display: grid; gap: 10px; text-align: center;
}
.sheet h2 { margin: 0; }
.sheet p { margin: 0; line-height: 1.5; }
.sheet .logo { font-size: 2.6rem; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.btn.secondary { background: var(--card); color: var(--blue); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.secondary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }

/* Grammatik */
.badge.grammar { background: #f3e5ff; color: #a568cc; }
.grammar-text { display: grid; gap: 10px; }
.grammar-text p, .grammar-card p, .tip-box p { margin: 0; line-height: 1.55; }
.grammar-text p { font-size: 1.1rem; background: #f3e5ff; color: #4b2a63; padding: 12px 14px; border-radius: 14px; }
.tip-box { display: grid; gap: 8px; }
.grammar-card { border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 12px; display: grid; gap: 10px; }
.grammar-card[open] { display: block; }
.grammar-card[open] > * + * { margin-top: 10px; }
.grammar-card summary { cursor: pointer; font-size: 1.05rem; list-style-position: inside; }
.grammar-card summary small { color: var(--muted); font-weight: 700; margin-left: 6px; }
.back { margin: 0 0 4px; padding: 0; text-decoration: none; }

/* Ergebnis: Sterne und Tagesziel */
.big-stars { font-size: 2.2rem; color: #ffb100; letter-spacing: 4px; margin-top: 8px; }
.goal-line { width: 100%; max-width: 360px; margin-top: 18px; display: grid; gap: 6px; color: var(--muted); font-weight: 700; }

/* Einstellungen */
.set-block { margin-top: 20px; padding: 16px; border: 2px solid var(--line); border-radius: 16px; display: grid; gap: 10px; }
.set-block h2 { margin: 0; font-size: 1.15rem; }
.goal-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.chip.goal { display: flex; flex-direction: column; align-items: center; }
.chip.goal small { color: var(--muted); font-weight: 700; }
.chip.goal.selected { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
textarea.code { width: 100%; font: 0.85rem/1.4 ui-monospace, monospace; padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); word-break: break-all; resize: vertical; }
.notice { background: var(--green-soft); color: var(--green-dark); font-weight: 800; padding: 10px 14px; border-radius: 12px; }

@media (prefers-color-scheme: dark) {
  .grammar-text p, .badge.grammar { background: #3a2550; color: #e8ccff; }
  .node.grammar .label { color: #d6a8ff; }
}
[hidden] { display: none !important; }
.blank-gap { display: inline-block; min-width: 3.2em; border-bottom: 3px solid var(--blue); color: transparent; }

/* ---------- Version 5: Spielelemente ---------- */

/* Farbthemen (werden mit Level freigeschaltet) */
:root[data-theme="ozean"] { --accent: #1cb0f6; --accent-dark: #1690cc; }
:root[data-theme="lavendel"] { --accent: #a560e8; --accent-dark: #8447c2; }
:root[data-theme="sonne"] { --accent: #ff8a00; --accent-dark: #d26f00; }
:root[data-theme="kirsche"] { --accent: #ff5c93; --accent-dark: #d63f74; }
:root[data-theme="nacht"] { --accent: #4b5bd6; --accent-dark: #3443b0; }

/* Kopfzeile: Level-Ring */
.topbar { gap: 10px; }
.topbar .stats { flex: 1; justify-content: center; }
.lvl-ring {
  --p: 0; width: 42px; height: 42px; padding: 4px; border: none; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center;
}
.lvl-ring span { width: 100%; height: 100%; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-weight: 900; font-size: 0.95rem; }
.lvl-ring.small { width: 50px; height: 50px; }
.lvl-ring.small span { font-size: 1.1rem; }

/* Hinweis oben auf der Startseite */
.notice-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--blue-soft); margin-bottom: 10px; }
.notice-card > span { font-size: 1.8rem; line-height: 1; }
.notice-card p { margin: 0; line-height: 1.45; }
.notice-card b { display: block; }

/* Bereich "Heute": Woche, Serie, Missionen, Duell */
.today-card { margin-top: 16px; padding: 14px; border: 2px solid var(--line); border-radius: 18px; display: grid; gap: 10px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border-radius: 12px; background: var(--line); }
.wd small { font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.wd b { height: 1.35em; font-size: 1rem; }
.wd.on { background: #ffefcc; }
.wd.rest { background: var(--blue-soft); }
.wd.future { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.wd.today { box-shadow: inset 0 0 0 3px var(--accent); }
.streak-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 1.05rem; }
.streak-line small { color: var(--muted); font-weight: 700; }
.streak-hint { margin: -4px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.lost-box { padding: 12px; border-radius: 14px; background: var(--red-soft); display: grid; gap: 6px; }
.lost-box p { margin: 0; line-height: 1.45; }
.lost-box small { font-weight: 800; color: var(--muted); }
.lost-box .fill { background: var(--red); }
.missions-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.missions-head small { color: var(--muted); font-weight: 800; }
.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.missions li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; }
.missions .mi { font-size: 1.35rem; text-align: center; }
.missions .mt { display: grid; gap: 5px; font-weight: 700; font-size: 0.95rem; }
.missions .mp { font-weight: 800; color: var(--muted); font-size: 0.88rem; }
.missions li.done .mt span { color: var(--muted); }
.missions li.done .fill { background: var(--green); }
.bar.small { height: 10px; }
.mission-reward { margin: 0; font-size: 0.86rem; color: var(--muted); font-weight: 700; }
.duel { display: grid; gap: 6px; padding-top: 10px; border-top: 2px solid var(--line); }
.duel .missions-head { flex-wrap: wrap; }
.duel-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; font-size: 0.85rem; font-weight: 700; }
.duel-row .bar { grid-column: 1 / -1; }
.duel-row b { text-align: right; }
.duel-row.prev .fill { background: var(--muted); opacity: 0.55; }

/* Kacheln: Wiederholen, Blitzrunde, Pass, Grammatik */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px;
}
.tile .icon { font-size: 1.6rem; }
.tile b { font-size: 1.02rem; }
.tile small { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.tile:hover:not(:disabled) { background: var(--blue-soft); border-color: var(--blue); }
.tile:disabled { opacity: 0.55; }
.tile:last-child:nth-child(odd) { grid-column: span 2; }

/* Lektion: Kombo */
.combo-tag { font-weight: 900; color: #ff9600; white-space: nowrap; }
.combo-tag.pop { animation: pop 0.35s ease; }
@keyframes pop { 50% { transform: scale(1.4); } }
.check-area .feedback .combo-msg { font-weight: 900; color: #e08600; }

/* Ergebnis: Belohnungen */
.rewards { width: 100%; max-width: 420px; display: grid; gap: 10px; margin-top: 8px; text-align: left; }
.lvl-line { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--line); border-radius: 16px; }
.lvl-text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.lvl-text small { color: var(--muted); font-weight: 700; }
.fill.grow { transition: width 1s ease 0.3s; }
.reward-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); animation: slideup 0.45s both; }
.reward-row .ri { font-size: 1.6rem; }
.reward-row b { display: block; }
.reward-row small { color: var(--muted); }
.reward-row.hl { background: #fff4d6; border-color: #ffd36b; }
.rewards > :nth-child(2) { animation-delay: 0.15s; }
.rewards > :nth-child(3) { animation-delay: 0.3s; }
.rewards > :nth-child(4) { animation-delay: 0.45s; }
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } }
.new-stamps { text-align: center; padding: 12px 10px; border-radius: 16px; border: 2px dashed var(--line); }
.ns-title { margin: 0 0 10px; font-weight: 900; }
.ns-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.new-stamp { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; max-width: 110px; }
.new-stamp .stamp { animation: stampin 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) 0.4s both; }
.new-stamp small { color: var(--muted); font-weight: 700; }
@keyframes stampin { from { transform: scale(2.4) rotate(var(--rot)); opacity: 0; } to { transform: scale(1) rotate(var(--rot)); opacity: 1; } }
.pause-hint { max-width: 420px; background: var(--blue-soft); padding: 10px 14px; border-radius: 14px; margin: 6px 0 0; line-height: 1.45; }

/* Stempel (wie im Reisepass) */
.stamp {
  --ink: #b9c0c6; position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 5px var(--ink);
  background: var(--bg); background: color-mix(in srgb, var(--ink) 12%, var(--bg));
  transform: rotate(var(--rot, 0deg));
}
.stamp-icon { font-size: 1.75rem; line-height: 1; }
.stamp-tier {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 6px; font-size: 0.62rem; white-space: nowrap;
}
.stamp.t0 { border-style: dashed; box-shadow: none; }
.stamp.t0 .stamp-icon { filter: grayscale(1); opacity: 0.4; }
.stamp.t1 { --ink: #c07a3a; }
.stamp.t2 { --ink: #8d9aa5; }
.stamp.t3 { --ink: #e0a400; }
.stamp.t4 { --ink: #27a7b8; }
.stamp.t5 { --ink: #8b5cf6; }
.stamp.t-single { --ink: #e5484d; }
.stamp.big { width: 110px; height: 110px; border-width: 4px; }
.stamp.big .stamp-icon { font-size: 3rem; }
.sheet-stamp { display: grid; place-items: center; padding: 6px 0 12px; }

/* Mein Pass */
.pass-head { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, #23466b, #1b6d75); color: #fff; margin-top: 4px; }
.pass-photo { width: 64px; height: 64px; border-radius: 14px; background: rgba(255, 255, 255, 0.18); display: grid; place-items: center; font-size: 2.3rem; flex-shrink: 0; }
.pass-id { flex: 1; display: grid; gap: 6px; min-width: 0; }
.pass-id h1 { font-size: 1.3rem; margin: 0; }
.pass-id small { opacity: 0.88; font-weight: 700; }
.pass-id .bar { background: rgba(255, 255, 255, 0.25); height: 12px; }
.pass-id .fill { background: #ffd34d; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.stat-tile { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border: 2px solid var(--line); border-radius: 14px; text-align: center; }
.stat-tile span { font-size: 1.3rem; }
.stat-tile b { font-size: 1.2rem; }
.stat-tile small { color: var(--muted); font-size: 0.76rem; font-weight: 700; line-height: 1.25; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.tab { padding: 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 800; }
.tab small { color: var(--muted); }
.tab.on { border-color: var(--accent); box-shadow: inset 0 -4px 0 var(--accent); }
.group-title { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 8px; }
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stamp-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); text-align: center; }
.stamp-tile .stamp { margin-bottom: 4px; }
.stamp-tile b { font-size: 0.98rem; }
.stamp-tile small { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.stamp-tile .bar { width: 100%; display: block; }
.stamp-tile .fill { display: block; }
.stamp-tile .prog { font-weight: 800; }
.stamp-tile.locked b { color: var(--muted); }
.chip.selected { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.chip:disabled { opacity: 0.55; }

/* Postkarten */
.card-langs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 10px; }
.pc-mini {
  aspect-ratio: 3 / 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 8px; border-radius: 12px; border: 2px solid #eadfc8; background: #fffaf0; color: #3c3c3c; text-align: center; box-shadow: 0 3px 0 #eadfc8;
}
.pc-mini .pc-emoji { font-size: 2rem; }
.pc-mini b { font-size: 0.8rem; line-height: 1.2; }
.pc-mini small { font-size: 0.7rem; color: #777; }
.pc-mini.empty { background: transparent; border: 2px dashed var(--line); box-shadow: none; color: var(--muted); }
.postcard {
  width: 100%; max-width: 380px; border-radius: 18px; overflow: hidden; background: #fffaf0; color: #3c3c3c; text-align: left;
  border: 1px solid #eadfc8; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); animation: cardin 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.pc-front { position: relative; height: 150px; display: grid; place-items: center; background: linear-gradient(135deg, #ffe7b3, #ffc6a8 55%, #b8e1ff); }
.pc-big { font-size: 4.5rem; }
.pc-place { position: absolute; left: 12px; bottom: 10px; background: rgba(255, 255, 255, 0.88); padding: 3px 10px; border-radius: 99px; font-weight: 800; font-size: 0.85rem; }
.pc-mark { position: absolute; right: 12px; top: 12px; width: 46px; height: 54px; display: grid; place-items: center; font-size: 1.6rem; background: #fff; border: 2px dashed #d9b77a; border-radius: 4px; transform: rotate(6deg); }
.pc-back { padding: 14px 16px 16px; display: grid; gap: 10px; }
.pc-back h2 { margin: 0; font-size: 1.2rem; }
.pc-back p { margin: 0; line-height: 1.5; }
.pc-word { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: #fff; border-radius: 12px; border: 1px solid #eadfc8; }
.pc-target { font-weight: 900; font-size: 1.15rem; }
.pc-py { color: #777; font-weight: 700; }
.pc-word small { display: block; color: #777; }
.pc-sheet { justify-items: center; }
.pc-screen .badge { align-self: center; }
@keyframes cardin { from { transform: translateY(30px) rotate(-6deg) scale(0.9); opacity: 0; } }

/* Level-Aufstieg */
.lvl-big {
  width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle at 30% 30%, #ffe27a, #ffb100); color: #5a3d00;
  box-shadow: 0 10px 0 #d18f00, 0 0 0 12px rgba(255, 200, 0, 0.22); animation: lvlpop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.lvl-big small { font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.85rem; }
.lvl-big span { font-size: 4rem; font-weight: 900; line-height: 1; }
@keyframes lvlpop { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } }
.levelup h1 { margin-top: 18px; }
.new-title { font-size: 1.2rem; margin: 0; }
.next-goal { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.theme-unlock { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; width: 100%; max-width: 380px; text-align: left; }
.theme-unlock > span:nth-child(2) { flex: 1; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; flex-shrink: 0; border: 2px solid rgba(0, 0, 0, 0.12); }
.btn.small { width: auto; padding: 8px 12px; font-size: 0.85rem; margin: 0; }

/* Blitzrunde */
.blitz .timer .fill { transition: width 0.1s linear; background: #ff9600; }
.blitz .timer .fill.hurry { background: var(--red); }
.blitz-score { font-weight: 900; color: #ff9600; min-width: 48px; text-align: right; white-space: nowrap; }
.blitz-area .prompt { margin-bottom: 0; }
.blitz-card { font-size: 1.8rem; font-weight: 800; text-align: center; padding: 22px 12px; border: 2px solid var(--line); border-radius: 18px; }
.options.grid2 { grid-template-columns: 1fr 1fr; }
.options.grid2 .option { min-height: 64px; }
.result .btn.secondary { max-width: 360px; margin-top: 12px; }
.result .btn.secondary + .btn.primary { margin-top: 12px; }

/* Einstellungen: Schalter und Farben */
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; padding: 4px 0; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.theme-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.chip.theme { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chip.theme small { color: var(--muted); font-weight: 700; }
.chip.theme.selected { background: var(--card); color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

/* Tagesziel beim Start */
.lang-card.recommended { border-color: var(--accent); }
.lang-card em { font-style: normal; font-size: 0.72rem; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }

/* Konfetti */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

@media (prefers-color-scheme: dark) {
  .wd.on { background: #3d2f12; }
  .reward-row.hl { background: #3a3215; border-color: #6b5a1f; }
}

/* ---------- Version 6: viele Lektionen und Sprachen ---------- */

/* Sprachauswahl: zwei Spalten */
.lang-list.langs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-width: 460px; }
.lang-list.langs .lang-card { gap: 10px; padding: 12px 14px; font-size: 1.05rem; }
.lang-list.langs .lang-card .flag { font-size: 2rem; }
.lang-list.langs .lang-card small { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-top: 2px; }
.lang-card.current { border-color: var(--accent); }

/* Kopf: aktuelle Stufe und geschaffte Lektionen (ohne Gesamtzahl) */
.course-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -6px 0 10px; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.level-chip { background: var(--accent); color: #fff; border-radius: 99px; padding: 2px 10px; font-size: 0.8rem; font-weight: 800; }

/* Stufen (A1, A2, B1) zum Auf- und Zuklappen */
.level { margin-top: 18px; }
.level-head { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid var(--line); padding: 6px 2px; }
.level-toggle { flex: 1; display: flex; align-items: center; gap: 8px; background: none; border: none; color: var(--text); text-align: left; padding: 6px 0; }
.level-name { font-size: 1.2rem; font-weight: 900; }
.chev { display: inline-block; color: var(--muted); transition: transform 0.2s; }
.level.open > .level-head .chev, .unit.open .unit-toggle .unit-no::before { transform: rotate(90deg); }
.level-state { color: var(--muted); font-weight: 800; font-size: 0.9rem; white-space: nowrap; }
.jump.small { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }

/* Teile zum Auf- und Zuklappen */
.unit { margin-top: 12px; }
.unit-toggle { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: none; border: none; color: inherit; text-align: left; padding: 0; min-width: 0; }
.unit-toggle .unit-no::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform 0.2s; }
.unit-toggle .unit-no em { font-style: normal; background: rgba(255,255,255,0.3); border-radius: 99px; padding: 0 8px; text-transform: none; }
.unit-state { font-weight: 900; white-space: nowrap; opacity: 0.95; }
.unit.locked .unit-head { filter: saturate(0.35); }
.unit:not(.open) .unit-head { box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.new-tag { font-style: normal; font-size: 0.7rem; background: var(--blue); color: #fff; border-radius: 99px; padding: 1px 7px; vertical-align: middle; }

/* Umschrift unter Wörtern, die mit Leerzeichen geschrieben werden (z. B. Koreanisch) */
.zh-line.spaced { gap: 2px 12px; }
