:root {
  --bg: #f7f5ff;
  --card: #ffffff;
  --ink: #1f1b3a;
  --muted: #6f6a8f;
  --line: #e6e1fb;
  --primary: #6c4df6;
  --primary-dark: #4e32d1;
  --ok: #22b573;
  --ok-dark: #17895a;
  --ok-bg: #dcf8ea;
  --bad: #f04d5a;
  --bad-dark: #c12f3c;
  --bad-bg: #ffe3e5;
  --gold: #ffb020;
  --gold-dark: #d98a00;
  --locked: #d9d6e8;
  --locked-dark: #b7b2cf;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; font-weight: 900; font-size: 22px; color: var(--primary); }
.logo { font-size: 28px; }
.stats { display: flex; gap: 18px; }
.stat { display: flex; gap: 6px; align-items: center; font-weight: 800; font-size: 18px; }

main { max-width: 860px; margin: 0 auto; padding: 28px 20px 80px; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 12px 22px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; font-size: 15px;
  transition: transform .06s, filter .15s;
}
.btn:active { transform: translateY(3px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn.primary:active { box-shadow: 0 1px 0 var(--primary-dark); }
.btn.ok { background: var(--ok); color: #fff; box-shadow: 0 4px 0 var(--ok-dark); }
.btn.bad { background: var(--bad); color: #fff; box-shadow: 0 4px 0 var(--bad-dark); }
.btn.ghost { background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); color: var(--primary); }
.btn.big { padding: 15px 30px; font-size: 16px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.full { width: 100%; }

/* ---------- Startseite ---------- */
.hero h1 { font-size: 34px; line-height: 1.15; margin: 0 0 10px; font-weight: 900; }
.hero p { color: var(--muted); margin: 0 0 24px; max-width: 640px; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; }
.upload { display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 34px 20px; border: 3px dashed var(--line); border-radius: var(--radius); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: #f1edff; border-color: var(--primary); }
.drop-icon { font-size: 42px; }
.drop small { color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: #f1edff; border-radius: 999px; padding: 6px 8px 6px 14px; font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.chips button { border: 0; background: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 1; }
textarea { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; resize: vertical; }
textarea:focus { outline: none; border-color: var(--primary); }
.row { display: flex; justify-content: flex-end; }
.error { color: var(--bad-dark); background: var(--bad-bg); padding: 10px 14px; border-radius: 12px; margin: 0; font-weight: 700; }

.section-head { display: flex; justify-content: space-between; align-items: center; }
.section-head h2 { margin: 0 0 12px; }
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.course {
  text-align: left; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 4px 0 var(--line); position: relative;
}
.course:hover { border-color: var(--primary); }
.course .em { font-size: 34px; }
.course h3 { margin: 6px 0 4px; font-size: 19px; }
.course .meta { color: var(--muted); font-size: 14px; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .4s; }
.course .del { position: absolute; top: 10px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 18px; }
.empty { color: var(--muted); }

/* ---------- Laden ---------- */
.loading { text-align: center; padding: 80px 0; }
.loading p { color: var(--muted); }
.bouncer span { display: inline-block; font-size: 70px; animation: bounce 1s infinite ease-in-out; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-24px) } }

/* ---------- Kursansicht ---------- */
.course-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.course-head .em { font-size: 48px; }
.course-head h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.tabs { display: flex; gap: 8px; margin-bottom: 26px; overflow-x: auto; }
.tab { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 16px; font-weight: 800; white-space: nowrap; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Lernpfad ---------- */
.unit-banner {
  background: var(--primary); color: #fff; border-radius: var(--radius); padding: 16px 20px; margin: 26px 0 18px;
  box-shadow: 0 4px 0 var(--primary-dark);
}
.unit-banner small { opacity: .8; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.unit-banner h3 { margin: 2px 0 0; font-size: 21px; }
.unit-banner.u1 { background: #22b573; box-shadow: 0 4px 0 #17895a; }
.unit-banner.u2 { background: #ff8a3d; box-shadow: 0 4px 0 #d9661c; }
.unit-banner.u3 { background: #1fa3e0; box-shadow: 0 4px 0 #157db0; }
.unit-banner.u4 { background: #e2479b; box-shadow: 0 4px 0 #b52d76; }
.path { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 6px 0; }
.node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.node {
  width: 78px; height: 78px; border-radius: 50%; border: 0; font-size: 32px;
  background: var(--locked); box-shadow: 0 7px 0 var(--locked-dark);
  transition: transform .08s;
}
.node:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--locked-dark); }
.node.done { background: var(--gold); box-shadow: 0 7px 0 var(--gold-dark); }
.node.current { background: var(--primary); box-shadow: 0 7px 0 var(--primary-dark); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { outline: 6px solid rgba(108,77,246,.0) } 50% { outline: 8px solid rgba(108,77,246,.22) } }
.node-label { margin-top: 12px; font-weight: 800; font-size: 14px; color: var(--muted); max-width: 170px; text-align: center; line-height: 1.25; }
.start-bubble {
  position: absolute; top: -48px; background: #fff; border: 2px solid var(--line); color: var(--primary);
  font-weight: 900; padding: 6px 12px; border-radius: 12px; text-transform: uppercase; font-size: 13px; letter-spacing: .05em;
  animation: float 1.6s infinite ease-in-out; white-space: nowrap;
}
.start-bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
.trophy { text-align: center; font-size: 60px; margin-top: 20px; }

/* ---------- Lektion ---------- */
.lesson { position: fixed; inset: 0; background: #fff; z-index: 50; display: flex; flex-direction: column; }
.lesson-top { display: flex; align-items: center; gap: 16px; padding: 22px 24px; max-width: 900px; width: 100%; margin: 0 auto; }
.lesson-top .close { border: 0; background: none; font-size: 26px; color: var(--muted); }
.lesson-top .bar { flex: 1; height: 16px; margin: 0; }
.hearts { font-weight: 900; color: var(--bad); font-size: 19px; white-space: nowrap; }
.lesson-body { flex: 1; overflow-y: auto; padding: 10px 24px 30px; max-width: 680px; width: 100%; margin: 0 auto; }
.q-kind { color: var(--primary); font-weight: 900; text-transform: uppercase; font-size: 13px; letter-spacing: .06em; }
.q-text { font-size: 25px; font-weight: 800; margin: 6px 0 24px; line-height: 1.3; }
.q-text .blank { display: inline-block; min-width: 90px; border-bottom: 3px solid var(--ink); text-align: center; color: var(--primary); }
.options { display: grid; gap: 12px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 18px;
  box-shadow: 0 4px 0 var(--line); font-weight: 700; display: flex; gap: 12px; align-items: center;
}
.opt .key { border: 2px solid var(--line); border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; font-size: 13px; color: var(--muted); flex: none; }
.opt:hover { background: #faf8ff; }
.opt.sel { border-color: var(--primary); background: #f1edff; box-shadow: 0 4px 0 #c9bdfc; color: var(--primary-dark); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 4px 0 #9fe2c2; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 #f6b2b7; }
.opt:disabled { cursor: default; }
.lesson-foot { border-top: 2px solid var(--line); padding: 20px 24px; }
.lesson-foot.ok { background: var(--ok-bg); border-color: transparent; }
.lesson-foot.bad { background: var(--bad-bg); border-color: transparent; }
.foot-inner { max-width: 900px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.feedback h3 { margin: 0; font-size: 22px; }
.lesson-foot.ok .feedback { color: var(--ok-dark); }
.lesson-foot.bad .feedback { color: var(--bad-dark); }
.feedback p { margin: 2px 0 0; }

.result { text-align: center; padding-top: 40px; }
.result .big-emoji { font-size: 90px; }
.result h2 { font-size: 30px; margin: 8px 0; }
.result-stats { display: flex; justify-content: center; gap: 14px; margin: 26px 0; }
.rs { border: 2px solid var(--gold); border-radius: 16px; overflow: hidden; min-width: 130px; }
.rs small { display: block; background: var(--gold); color: #fff; font-weight: 900; padding: 4px; text-transform: uppercase; font-size: 12px; }
.rs b { display: block; padding: 10px; font-size: 22px; }
.rs.green { border-color: var(--ok); } .rs.green small { background: var(--ok); }

/* ---------- Lernkarten ---------- */
.fc-info { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; margin-bottom: 14px; }
.flip { perspective: 1200px; cursor: pointer; margin-bottom: 18px; }
.flip-inner { position: relative; min-height: 290px; transition: transform .5s; transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 24px; padding: 30px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  font-size: 23px; font-weight: 800; border: 2px solid var(--line); background: #fff; box-shadow: 0 6px 0 var(--line);
}
.face small { position: absolute; top: 16px; left: 20px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.face.back { transform: rotateY(180deg); background: #f1edff; border-color: #d6cdfd; box-shadow: 0 6px 0 #d6cdfd; font-weight: 700; font-size: 20px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rate .btn { text-transform: none; letter-spacing: 0; padding: 12px 6px; }
.rate small { display: block; font-weight: 700; opacity: .85; font-size: 12px; }
.btn.hard { background: #ff8a3d; color: #fff; box-shadow: 0 4px 0 #d9661c; }
.btn.easy { background: #1fa3e0; color: #fff; box-shadow: 0 4px 0 #157db0; }
.hint { text-align: center; color: var(--muted); font-weight: 700; }
.done-box { text-align: center; padding: 40px 0; }
.done-box .big-emoji { font-size: 70px; }
.all-cards { margin-top: 36px; }
.all-cards details { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 8px; }
.all-cards summary { font-weight: 800; cursor: pointer; }

/* ---------- Podcast ---------- */
.player { display: flex; gap: 18px; align-items: center; background: linear-gradient(135deg, #6c4df6, #a64df6); color: #fff; border-radius: 24px; padding: 22px; margin-bottom: 18px; box-shadow: 0 6px 0 var(--primary-dark); }
.cover { font-size: 52px; background: rgba(255,255,255,.18); border-radius: 18px; width: 92px; height: 92px; display: grid; place-items: center; flex: none; }
.player h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.player p { margin: 2px 0 12px; opacity: .85; font-size: 14px; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.play { width: 54px; height: 54px; border-radius: 50%; border: 0; background: #fff; color: var(--primary); font-size: 22px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.controls select { border: 0; border-radius: 10px; padding: 7px 10px; font: inherit; font-weight: 700; }
.ctrl { border: 0; background: rgba(255,255,255,.2); color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 800; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; text-align: left; }
.line .who { font-weight: 900; flex: none; width: 54px; }
.line.Lena .who { color: var(--primary); }
.line.Max .who { color: #ff8a3d; }
.line.now { border-color: var(--primary); background: #f1edff; }
.warn { background: #fff4dc; border: 2px solid #ffe0a3; border-radius: 14px; padding: 10px 14px; font-weight: 700; margin-bottom: 14px; }

/* ---------- Zusammenfassung ---------- */
.summary { font-size: 18px; }

@media (max-width: 600px) {
  .hero h1 { font-size: 27px; }
  .rate { grid-template-columns: 1fr 1fr; }
  .options.two { grid-template-columns: 1fr; }
  .player { flex-direction: column; text-align: center; }
  .controls { justify-content: center; }
}
