/* Lern-App – baut auf brand.css auf */
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
main { max-width: 820px; margin: 0 auto; padding: 22px 18px 30px; outline: none; }

.app-nav .nav-links { display: none; }
@media (min-width: 760px) { .app-nav .nav-links { display: flex; } }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(9, 9, 10, .97); border-top: 1px solid #232326; padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(12px);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 11px; text-decoration: none;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--dim);
}
.bottomnav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bottomnav a.active { color: #fff; }
.bottomnav a.active svg { stroke: var(--red); }
body.in-quiz .bottomnav { display: none; }
body.in-quiz { padding-bottom: 20px; }
@media (min-width: 760px) { .bottomnav { display: none; } body { padding-bottom: 30px; } }

.page-head { margin: 6px 0 22px; }
.page-head h1 { font-size: clamp(2.1rem, 7vw, 3.4rem); margin-top: 12px; }
.page-head p { color: var(--muted); margin: 12px 0 0; max-width: 560px; }
.section-title { font-size: 1.6rem; margin: 30px 0 14px; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: .95rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 1.3rem; }
.card-head a { color: var(--muted); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; text-decoration: none; }
.card-head a:hover { color: #fff; }

.loading { display: grid; place-items: center; gap: 16px; padding: 80px 0; color: var(--muted); text-align: center; }
.loading img { width: 92px; height: 92px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

/* Start */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 5.4vw, 2.7rem); margin: 10px 0 10px; }
.hero p { color: var(--muted); margin: 0 0 16px; }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; text-align: center; } .hero .eyebrow, .legend { justify-content: center; } }
.ring { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--panel-3); }
.ring-fg { stroke: var(--red); stroke-linecap: round; transition: stroke-dashoffset .7s ease; filter: drop-shadow(0 0 8px rgba(213, 31, 38, .5)); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-size: 2.2rem; font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.ring-label span { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-weight: 800; margin-top: 6px; }

.statusbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--neu); gap: 2px; }
.seg { display: block; min-width: 4px; }
.seg.gruen { background: var(--ok); } .seg.gelb { background: var(--warn); }
.seg.rot { background: var(--bad); } .seg.neu { background: var(--neu); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--muted); }
.legend b { color: #fff; margin-left: 3px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--neu); }
.dot.gruen { background: var(--ok); } .dot.gelb { background: var(--warn); } .dot.rot { background: var(--bad); }

.grade-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grade-pick select { width: auto; min-width: 220px; flex: 1; }

.actions { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .actions { grid-template-columns: 1fr 1fr; } }
.action {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; text-align: left; padding: 20px;
  background: linear-gradient(160deg, var(--panel) 0, #0e0e10 100%); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .1s; color: #fff;
}
.action:hover:not(:disabled) { border-color: #4a4a52; }
.action:active:not(:disabled) { transform: scale(.99); }
.action:disabled { opacity: .45; cursor: default; }
.action b { display: block; font-size: 1.08rem; font-weight: 850; letter-spacing: -.02em; }
.action small { color: var(--muted); font-size: .85rem; }
.action .go { color: var(--red); font-weight: 800; }
.action.primary { background: radial-gradient(circle at 100% 0, #e2262d, var(--red) 40%, var(--red-2)); border-color: var(--red); }
.action.primary small { color: rgba(255, 255, 255, .85); }
.action.primary .go, .action.primary .num { color: #fff; }

.examlist { list-style: none; padding: 0; margin: 0; }
.examlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 13px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.examlist li:first-child { border-top: 0; padding-top: 0; }
.examlist time { margin-left: auto; color: var(--dim); font-size: .8rem; }
.pill.ok { border-color: rgba(63, 185, 107, .45); color: var(--ok); background: var(--ok-soft); }
.pill.bad { border-color: rgba(255, 89, 97, .45); color: var(--bad); background: var(--bad-soft); }

/* Lernen */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); padding: 8px 15px; border-radius: 999px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chip:hover { border-color: var(--red); color: #fff; }
.catlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .catlist { grid-template-columns: 1fr 1fr; } }
.catitem {
  width: 100%; height: 100%; display: grid; gap: 12px; text-align: left; padding: 20px; color: #fff;
  background: linear-gradient(160deg, var(--panel) 0, #0e0e10 100%); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s;
}
.catitem:hover { border-color: #4a4a52; }
.cat-top { display: flex; justify-content: space-between; align-items: center; }
.catitem b { font-size: 1.25rem; font-weight: 850; letter-spacing: -.03em; line-height: 1.1; }
.catitem small { color: var(--muted); font-size: .85rem; }
.cat-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.cat-foot span:last-child { color: var(--red); }
.txt-rot { color: var(--bad); font-style: normal; }

/* Prüfung */
.rules { list-style: none; margin: 0 0 22px; padding: 0; }
.rules li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); }
.rules li:first-child { border-top: 0; }
.rules b { color: #fff; }
.btn.big { width: 100%; padding: 17px; font-size: 1.05rem; }

/* Quiz */
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.quiz-title { flex: 1; min-width: 0; display: grid; }
.quiz-title b { font-weight: 850; letter-spacing: -.02em; }
.quiz-title small { color: var(--dim); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); font-size: 17px; color: var(--muted); }
.icon-btn:hover { color: #fff; border-color: #4a4a52; }
.icon-btn.star.on { color: var(--warn); border-color: var(--warn); }
.timer { font-variant-numeric: tabular-nums; font-weight: 850; padding: 9px 16px; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line); }
.timer.low { background: var(--red); border-color: var(--red); }
.progress { height: 3px; border-radius: 99px; background: var(--panel-3); overflow: hidden; margin-bottom: 18px; }
.progress span { display: block; height: 100%; background: var(--red); transition: width .3s ease; box-shadow: 0 0 10px var(--red); }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.q-text { font-size: clamp(1.4rem, 4.6vw, 1.9rem); margin-bottom: 8px; letter-spacing: -.03em; line-height: 1.15; }
.hint { color: var(--dim); font-size: .82rem; margin: 0 0 18px; }
.answers { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.answer {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 15px 16px; color: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: #0d0d0f; transition: border-color .12s, background .12s;
}
.answer:hover:not(:disabled) { border-color: #4a4a52; }
.answer:disabled { cursor: default; }
.answer .box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid #55555c; display: grid; place-items: center; }
.answer.sel { border-color: var(--red); background: var(--red-soft); }
.answer.sel .box { background: var(--red); border-color: var(--red); }
.answer.sel .box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.answer.right { border-color: var(--ok); background: var(--ok-soft); }
.answer.right.sel .box { background: var(--ok); border-color: var(--ok); }
.answer.wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer.wrong .box { background: var(--bad); border-color: var(--bad); }
.answer .mark { margin-left: auto; font-weight: 850; }
.answer.right .mark { color: var(--ok); } .answer.wrong .mark { color: var(--bad); }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius-s); border: 1px solid; }
.feedback p { margin: 6px 0 0; color: var(--muted); }
.feedback.ok { background: var(--ok-soft); border-color: rgba(63, 185, 107, .4); }
.feedback.ok b { color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: rgba(255, 89, 97, .4); }
.feedback.bad b { color: var(--bad); }
.quiz-nav { display: flex; gap: 10px; margin-bottom: 16px; }
.quiz-nav .btn { flex: 1; padding: 16px; }
.navgrid-wrap summary { cursor: pointer; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--muted); }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 16px 0; }
.navgrid button { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #0d0d0f; font-weight: 800; font-size: .9rem; }
.navgrid button.done { background: var(--red-soft); border-color: var(--red); }
.navgrid button.cur { outline: 2px solid #fff; outline-offset: 1px; }

/* Ergebnis */
.result { text-align: center; padding: 36px 20px; }
.result h1 { font-size: clamp(2.4rem, 9vw, 3.6rem); margin: 14px 0 6px; }
.result.pass h1 { color: var(--ok); }
.result.fail h1 .outline { -webkit-text-stroke-color: var(--bad); }
.big-num { font-size: 3rem; font-weight: 850; letter-spacing: -.04em; margin: 8px 0 0; }
.big-num small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.result p { margin: 4px 0; color: var(--muted); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.review { list-style: none; padding: 0; margin: 0; }
.review h3 { font-size: 1.2rem; margin-bottom: 14px; letter-spacing: -.02em; line-height: 1.2; }
.review-ans li { display: flex; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #0d0d0f; border: 1px solid var(--line); }
.review-ans li.right { background: var(--ok-soft); border-color: rgba(63, 185, 107, .4); }
.review-ans li.wrong { background: var(--bad-soft); border-color: rgba(255, 89, 97, .4); }
.review-ans li span { font-weight: 850; width: 14px; flex: none; }
.review-ans li.right span { color: var(--ok); } .review-ans li.wrong span { color: var(--bad); }
.expl { color: var(--muted); margin: 14px 0 0; font-size: .95rem; }

/* Statistik */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 4px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: grid; gap: 4px; padding: 20px; margin-bottom: 12px; }
.kpi b { font-size: 2rem; font-weight: 850; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.catstats { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.catstats li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: .92rem; }
.catstats .statusbar { grid-column: 1 / -1; }
.catstats .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.hardest { margin: 0 0 18px; padding-left: 22px; display: grid; gap: 10px; }
.hardest small { display: block; color: var(--dim); }
.chart { width: 100%; height: auto; margin-bottom: 12px; }
.bar-ok { fill: var(--ok); } .bar-bad { fill: var(--red); }
.limit { stroke: var(--dim); stroke-dasharray: 4 4; }
.limit-label { fill: var(--dim); font-size: 10px; font-family: Inter, Arial, sans-serif; }
