﻿/* =====================================================================
   components.css – Bedienelemente: Gliederung, Bewertung, Kommentare,
   Aufgaben (Fragen, Lücken, Markieren, Zuordnen, Kreuzworträtsel),
   Selbstkontrollaufgaben (lehrquiz.js), KI-Elemente, Startseite.
   Ersetzt die entsprechenden Teile von NewSite.css und lehrquiz.css.
   ===================================================================== */

/* ---------- Gliederung (jsTree) ---------- */
#tree { padding: .5rem .25rem 2rem; font-size: .975rem; }
#tree i[class*=-unread]::before, #tree i[class*=-read]::before { font-family: 'Font Awesome 7 Pro'; font-weight: 400; color: var(--up-orange-icon); }
#tree i[class*=-read] { position: relative; }
#tree i[class*=-read]::before { color: var(--bs-secondary-color); }
#tree i[class*=-read]::after { content: '\f00c'; font-family: 'Font Awesome 7 Pro'; font-weight: 900; position: absolute; right: -5px; bottom: -3px; line-height: 1; font-size: .75rem; color: #2f7d32; text-shadow: 0 0 2px var(--bs-body-bg), 0 0 2px var(--bs-body-bg); }
[data-bs-theme=dark] #tree i[class*=-read]::after { color: #6fcf73; }
#tree i.home-read::before, #tree i.home-unread::before { content: '\f015'; }
#tree i.summary-read::before, #tree i.summary-unread::before { content: '\f0e8'; }
#tree i.finish-read::before, #tree i.finish-unread::before { content: '\f11e'; }
#tree i.check-read::before, #tree i.check-unread::before { content: '\f14a'; }
#tree i.case-read::before, #tree i.case-unread::before { content: '\f044'; }
#tree i.video-read::before, #tree i.video-unread::before { content: '\f1c8'; }
#tree i.interact-read::before, #tree i.interact-unread::before { content: '\f0e7'; }
#tree i.cards-read::before, #tree i.cards-unread::before { content: '\f0ae'; }
#tree i.chapter-read::before, #tree i.chapter-unread::before { content: '\f12e'; }
#tree i.text-read::before, #tree i.text-unread::before, #tree i.folder-read::before, #tree i.folder-unread::before { content: '\f15c'; }
#tree i.crossword-read::before, #tree i.crossword-unread::before { content: '\f05b'; }
#SearchView .list-group-item, #Archiv .list-group-item { cursor: pointer; }

/* ---------- Bewertung (Sterne) ---------- */
#Ranking .scale { display: inline-flex; }
.GradeButton { position: relative; width: 2rem; height: 2rem; padding: 0; border: 0; background: none; color: var(--up-grey); font: 400 1.25rem/1 'Font Awesome 7 Pro'; cursor: pointer; border-radius: 50%; }
.GradeButton::after { content: '\f005'; }
.GradeButton.active::before, .GradeButton.half::before, .GradeButton.hover::before { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: var(--up-orange-icon); content: '\f005'; }
.GradeButton.half::before { content: '\f089'; }
.GradeButton.hover::before { color: var(--up-orange); }
.rankers { margin-left: .5rem; }
#CommentView .card { border-radius: .75rem; }
.license a { color: inherit; }

/* Seite merken (Büroklammer im Lehrtext) */
button.markPage { float: right; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: none; color: var(--up-grey); font: 300 1.6rem/1 'Font Awesome 7 Pro'; transition: transform .25s ease, color .25s; }
button.markPage::before { content: '\f0c6'; }
button.markPage:hover, button.markPage.checked { color: var(--up-orange-icon); transform: rotate(-45deg); }

/* ---------- Aufgaben im Lehrtext ---------- */
#scroll .frage3, #scroll td.frage { cursor: pointer; text-align: center; }
#scroll .frage-inaktiv { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); text-align: center; }
#scroll .antwort { background: transparent; }
#Blaettern:hover { background: var(--bs-emphasis-color); color: var(--bs-body-bg); }

/* Text markieren */
#scroll .highlightarea { position: relative; border: 2px dashed var(--up-orange); border-radius: .75rem; padding: 2rem 1rem 1rem; margin: 1.25rem 0; min-height: 3rem; }
#scroll .highlightarea::before { content: 'Markieren Sie die zutreffenden Stellen'; position: absolute; top: .5rem; left: 1rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--up-accent); }
#scroll .highlightarea.finished { border-style: solid; border-color: #2f7d32; }
span.selectedText, span.selectedText.yellow { background: #fff2a8; color: #1f2937; }
span.selectedText.red { background: #ffd1cf; color: #1f2937; }
span.selectedText.blue { background: #cfe8ff; color: #1f2937; }
span.selectedText.green { background: #c9efcd; color: #1f2937; }
span.selectedText.highlight { background: #8f1c13; color: #fff; }
div#colorpopup { position: absolute; z-index: 1060; display: flex; align-items: center; gap: .4rem; padding: .4rem .5rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 999px; box-shadow: var(--up-shadow); user-select: none; }
div#colorpopup > button { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 2px solid var(--bs-border-color); cursor: pointer; }
div#colorpopup > button:hover { border-color: var(--bs-emphasis-color); }
div#colorpopup > button.green { background: #2f7d32; } div#colorpopup > button.red { background: #d92d20; }
div#colorpopup > button.blue { background: #1d6fd8; } div#colorpopup > button.yellow { background: #f5d000; } div#colorpopup > button.white { background: #fff; }
div#colorpopup > button.cancel { border: 0; background: none; font-size: 1.25rem; line-height: 1; color: var(--bs-body-color); }

/* Lückentext (Eingabefeld/Auswahlliste im Text) */
#scroll select.gapList, #scroll input.gapText { display: inline-block; width: auto; min-width: 9rem; max-width: 100%; min-height: 2.5rem; margin: .1rem .2rem; padding: .25rem .6rem; font-size: 1rem; border: 1px solid var(--up-grey); border-radius: .4rem; background-color: var(--bs-body-bg); color: var(--bs-body-color); }
#scroll .is-valid { border-color: #2f7d32; background-color: #edf7ee; }
#scroll .is-invalid { border-color: #b42318; }
#scroll div.explanation { margin: .75rem 0; padding: .75rem 1rem; border-radius: .75rem; background: var(--up-soft); border: 1px solid var(--bs-border-color); font-size: 1rem; }
#scroll div.explanation.finished { background: #edf7ee; text-align: center; }
[data-bs-theme=dark] #scroll .is-valid, [data-bs-theme=dark] #scroll div.explanation.finished { background-color: #162819; }

/* Zuordnen (Ziehen oder Antippen) */
.dragGame { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.25rem 0; }
@media (min-width: 576px) { .dragGame { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.dragGame .source, .dragGame .target { height: auto; min-height: 4rem; }
.dragGame .source::before, .dragGame .target::before { display: block; margin-bottom: .4rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }
.dragGame .source::before { content: 'Begriffe'; } .dragGame .target::before { content: 'Zuordnen zu'; }
.dragGame .subelement { margin: 0 0 .5rem; padding: .6rem .8rem; min-height: 2.75rem; border: 1px solid var(--up-grey); border-radius: .6rem; background: var(--bs-body-bg); color: var(--bs-body-color); cursor: grab; text-align: left; touch-action: none; }
.dragGame .subelement:hover, .dragGame .subelement.ui-draggable-dragging { border-color: var(--up-orange); box-shadow: var(--up-shadow); z-index: 900; }
.dragGame .subelement[aria-pressed=true] { border: 2px solid var(--up-orange); background: var(--up-soft); }
.dragGame .children .subelement, .dragGame .itarget .subelement { cursor: default; border-color: #2f7d32; margin: .4rem 0 0; }
.toplevel { margin-bottom: .75rem; padding: .6rem .75rem; min-height: 4.5rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; background: var(--bs-tertiary-bg); }
.toplevel .head { font-weight: 700; }
.toplevel.active, div.itarget.active { border-color: var(--up-orange); }
.toplevel.hover, div.itarget.hover, .dragGame.has-choice .toplevel:not(.noDrag):hover, .dragGame.has-choice div.itarget:not(.finished):hover { border-color: var(--up-orange); background: var(--up-soft); }
.finished .toplevel, div.itarget.finished { border-color: #2f7d32; }
div.itarget { margin: .4rem 0; padding: .5rem; min-height: 3.5rem; border: 1px dashed var(--up-grey); border-radius: .5rem; color: var(--bs-secondary-color); }
.dragGame .success { padding: 1rem; border-radius: .75rem; background: #edf7ee; color: #22602a; font-weight: 700; text-align: center; }
[data-bs-theme=dark] .dragGame .success { background: #162819; color: #9be29e; }

/* Kreuzworträtsel */
#scroll .crossword { cursor: default; overflow-x: auto; }
#scroll div.crossword table { border-collapse: collapse; border-spacing: 0; background: var(--bs-body-bg); }
#scroll div.crossword td { position: relative; width: 1.9rem; height: 1.9rem; padding: 0; text-align: center; vertical-align: middle; border: 1px solid transparent; background: var(--bs-body-bg); color: var(--bs-body-color); overflow: hidden; font-size: .9rem; }
#scroll div.crossword td.text { border-color: var(--up-grey); cursor: pointer; }
#scroll div.crossword td input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; text-align: center; font-weight: 700; text-transform: uppercase; background: var(--up-soft); color: var(--bs-emphasis-color); outline: 2px solid var(--up-orange); }
#scroll div.crossword td.right { border-right-color: var(--bs-emphasis-color); } #scroll div.crossword td.left { border-left-color: var(--bs-emphasis-color); }
#scroll div.crossword td.top { border-top-color: var(--bs-emphasis-color); } #scroll div.crossword td.bottom { border-bottom-color: var(--bs-emphasis-color); }
#scroll div.crossword td.sepHoriz { border-top-color: var(--bs-emphasis-color); border-bottom-color: var(--bs-emphasis-color); }
#scroll div.crossword td.sepVert { border-left-color: var(--bs-emphasis-color); border-right-color: var(--bs-emphasis-color); }
#scroll div.crossword td.vertDesc, #scroll div.crossword td.horDesc, #scroll div.crossword td.bothDesc { background: var(--bs-tertiary-bg); color: var(--up-accent); cursor: pointer; font-weight: 700; }
#scroll div.crossword td.vertDesc::after { content: '\2193'; } #scroll div.crossword td.horDesc::after { content: '\2192'; } #scroll div.crossword td.bothDesc::after { content: '\21b3'; }
#scroll div.crossword td.highlight.horDesc, #scroll div.crossword td.highlight.vertDesc { background: var(--up-orange); color: var(--up-on-orange); }
#scroll div.crossword td.text.finished { background: #edf7ee; }
[data-bs-theme=dark] #scroll div.crossword td.text.finished { background: #162819; }
#scroll div#termlist { float: none; width: auto; margin-top: 1rem; border-top: 1px solid var(--bs-border-color); font-size: .95rem; }
#scroll div#termlist h2 { font-size: .8rem; margin: .75rem 0 .25rem; }
#scroll div#termlist div { padding: .4rem .5rem; border-radius: .4rem; cursor: pointer; }
#scroll div#termlist div.active { background: var(--up-soft); }
#scroll div#termlist div.finished { text-decoration: line-through; color: var(--bs-secondary-color); }
@media (min-width: 992px) { #scroll div#termlist { float: right; width: 13rem; margin: 0 0 1rem 1rem; border-top: 0; border-left: 1px solid var(--bs-border-color); padding-left: .75rem; } }

/* Schaltflächen-Fokus für per Skript bedienbar gemachte Elemente */
#scroll [role=button]:focus-visible, .dragGame [tabindex]:focus-visible { outline: 3px solid var(--up-orange); outline-offset: 2px; }

/* ---------- Selbstkontrollaufgaben (lehrquiz.js) ---------- */
div.lehr-quiz { margin: 1.5rem 0; padding: 1rem 1.1rem; border: 1px solid var(--bs-border-color); border-left: 4px solid var(--up-orange); border-radius: .75rem; background: var(--bs-tertiary-bg); }
div.lehr-quiz .lq-titel { margin-bottom: .5rem; }
div.lehr-quiz .lq-liste { padding-left: 1.4rem; margin-bottom: .75rem; }
div.lehr-quiz .lq-item { margin-bottom: .6rem; padding: .25rem .4rem; border-radius: .4rem; }
div.lehr-quiz .lq-item.form-check { padding-left: 2rem; }
div.lehr-quiz .lq-ok { background: var(--bs-success-bg-subtle); }
div.lehr-quiz .lq-falsch { background: var(--bs-danger-bg-subtle); }
div.lehr-quiz .lq-feedback:empty { display: none; }
div.lehr-quiz .lq-saetze { line-height: 2.1; }
div.lehr-quiz .lq-satz { display: inline; padding: .1rem .2rem; border: 1px dashed transparent; border-radius: .25rem; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
div.lehr-quiz .lq-satz:hover, div.lehr-quiz .lq-satz:focus-visible { border-color: var(--bs-secondary-color); }
div.lehr-quiz .lq-satz.lq-markiert { background: var(--up-soft); border-color: var(--up-orange); }
div.lehr-quiz .lq-satz.lq-ok { background: var(--bs-success-bg-subtle); border-color: var(--bs-success); }
div.lehr-quiz .lq-satz.lq-falsch { background: var(--bs-danger-bg-subtle); border-color: var(--bs-danger); }
div.lehr-quiz .lq-satz.lq-uebersehen { border: 2px solid var(--bs-danger); }
div.lehr-quiz .lq-karte { min-height: 8rem; display: flex; flex-direction: column; justify-content: center; gap: .75rem; padding: 1.25rem; text-align: center; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .875rem; box-shadow: var(--up-shadow); }
div.lehr-quiz .lq-vorne { font-weight: 600; font-size: 1.05rem; }
div.lehr-quiz .lq-hinten { border-top: 1px solid var(--bs-border-color); padding-top: .75rem; }

/* ---------- KI-Elemente ---------- */
figure.ki-grafik { margin: 1.5rem auto; max-width: 50rem; text-align: center; }
figure.ki-grafik img { max-width: 100%; height: auto; background: #fff; border-radius: .5rem; border: 1px solid var(--bs-border-color); }
figure.ki-grafik figcaption { margin-top: .4rem; font-size: .875rem; color: var(--bs-secondary-color); }
.lehrtext img[src$=".svg"], .lehrtext img[src$=".png"] { background: #fff; }
.ki-grafik-vorschau img { background: #fff; max-height: 26rem; }
.ki-vorschau { max-height: 28rem; overflow: auto; background: var(--bs-body-bg); }
.ki-vorschau del, .ki-diff del { background: var(--bs-danger-bg-subtle); text-decoration: line-through; }
.ki-vorschau ins, .ki-diff ins { background: var(--bs-success-bg-subtle); text-decoration: none; }
.ki-textarea { font-family: var(--bs-font-monospace); font-size: .8rem; min-height: 16rem; }
.ki-prompt { font-family: var(--bs-font-monospace); font-size: .85rem; min-height: 32rem; }

/* ---------- Startseite: Kurskacheln ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.course-tile { position: relative; display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border: 1px solid var(--bs-border-color); border-radius: .875rem; background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; box-shadow: var(--up-shadow); transition: transform .15s ease, border-color .15s; }
.course-tile:hover { transform: translateY(-2px); border-color: var(--up-orange); color: var(--bs-body-color); }
.course-tile .tile-title { font-weight: 700; line-height: 1.3; }
.course-tile .tile-meta { font-size: .875rem; color: var(--bs-secondary-color); }
.course-tile .tile-cta { font-size: .875rem; font-weight: 700; color: var(--up-accent); }
.course-tile.is-locked { box-shadow: none; background: var(--bs-tertiary-bg); }
.course-tile.is-locked .tile-cta { color: var(--bs-secondary-color); }
.ring { --p: 0; flex: 0 0 3.5rem; width: 3.5rem; height: 3.5rem; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--up-orange) calc(var(--p) * 1%), var(--up-track) 0); }
.ring span { width: 2.7rem; height: 2.7rem; border-radius: 50%; background: var(--bs-body-bg); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.ring.done { background: #2f7d32; } .ring.done span { color: #22602a; }
[data-bs-theme=dark] .ring.done span { color: #9be29e; }

/* ---------- Seitenwechsel: optionale 3D-Blätteranimation ---------- */
html[data-anim=on] #scroll.turn-next { animation: turn-next .55s cubic-bezier(.2, .7, .2, 1); transform-origin: left center; }
html[data-anim=on] #scroll.turn-prev { animation: turn-prev .55s cubic-bezier(.2, .7, .2, 1); transform-origin: right center; }
html[data-anim=on] #scroll.turn-jump { animation: turn-jump .35s ease-out; }
@keyframes turn-next { from { transform: perspective(1600px) rotateY(-28deg) translateX(3rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes turn-prev { from { transform: perspective(1600px) rotateY(28deg) translateX(-3rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes turn-jump { from { opacity: 0; transform: translateY(.75rem); } to { opacity: 1; transform: none; } }

#popup { display: none; }
.popover-danger { --bs-popover-bg: #b42318; --bs-popover-body-color: #fff; --bs-popover-border-color: #b42318; }
#facts div { margin-bottom: .9rem; }

/* ---------- Lesezeichen, eigene Anmerkungen, Gastzugang ---------- */
#tree a.is-marked::after { content: '\f02e'; flex: 0 0 auto; margin-left: auto; padding-top: .2em; font: 900 .75rem/1 'Font Awesome 7 Pro'; color: var(--up-orange-icon); }
.mine-list .list-group-item { font-size: .95rem; }
.js-bookmark[aria-pressed=true] { color: var(--up-accent); background: var(--up-soft); }
.reader-pager { align-items: center; }
.reader-pager a.is-disabled { pointer-events: none; opacity: .45; }
.guest-hint { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .85rem 1rem; border-radius: .75rem; background: var(--up-soft); border: 1px solid var(--bs-primary-border-subtle); font-size: 1rem; }
.guest-hint > .fa-fw { font-size: 1.4rem; flex: 0 0 auto; }
.guest-hint > div { flex: 1 1 16rem; min-width: 0; }
.guest-hint .btn-close { margin-left: auto; }
@media (min-width: 576px) { .guest-hint .btn-close { margin-left: 0; } }
.guest button.markPage, .guest #colorpopup { display: none; }

/* Runde Symbol-Schaltflächen (Bearbeiten, Löschen): quadratisch statt Pille, damit sie als Kreis erscheinen */
.btn.rounded-circle, .btn.AdminButton { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%; line-height: 1; }
.btn.rounded-circle.btn-sm, .btn.AdminButton { width: 2rem; height: 2rem; font-size: .875rem; }
.btn.rounded-circle.big { width: 2.75rem; height: 2.75rem; font-size: 1.1rem; }
.btn.rounded-circle .fa-fw, .btn.AdminButton .fa-fw { width: auto; margin: 0; }
/* Blättern: Text und Symbol in den (höheren) Schaltflächen vertikal zentrieren */
.reader-pager .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0; line-height: 1.2; }
/* Badges in Flex-Zeilen (Rangliste, Listen) nicht strecken; Text mittig */
.badge { display: inline-flex; align-items: center; justify-content: center; align-self: center; }

/* ================= Kurskacheln mit Bild/Motiv ================= */
.course-tile.has-art { flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.course-tile .tile-art { --hue: 28; height: 6.5rem; display: grid; place-items: center; background: linear-gradient(135deg, hsl(var(--hue) 90% 92%), hsl(calc(var(--hue) + 25) 70% 80%)); color: hsl(var(--hue) 70% 28%); font-size: 2.6rem; }
.course-tile .tile-art img { width: 100%; height: 100%; object-fit: cover; }
[data-bs-theme=dark] .course-tile .tile-art { background: linear-gradient(135deg, hsl(var(--hue) 35% 22%), hsl(calc(var(--hue) + 25) 30% 16%)); color: hsl(var(--hue) 85% 72%); }
.course-tile .tile-body { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; }
.course-tile .tile-title { font-size: 1.05rem; margin: 0 0 .15rem; }
.course-tile .tile-title a { color: inherit; text-decoration: none; }
.course-tile .tile-title a:focus-visible { outline: none; }
.course-tile:focus-within { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 2px; }
.course-tile .tile-cta-link { position: relative; z-index: 2; text-decoration: none; align-self: flex-start; padding: .15rem 0; }
.course-tile .tile-cta-link:hover { text-decoration: underline; }
.course-tile.is-locked .tile-art { filter: grayscale(1); opacity: .6; }

/* ================= Kursübersicht ================= */
.course-hero { --hue: 28; background: linear-gradient(120deg, hsl(var(--hue) 100% 96%), var(--bs-body-bg) 75%); border-bottom: 1px solid var(--bs-border-color); }
[data-bs-theme=dark] .course-hero { background: linear-gradient(120deg, hsl(var(--hue) 30% 14%), var(--bs-body-bg) 75%); }
.course-hero h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem); }
.course-hero-art { flex: 0 0 auto; width: 8.5rem; height: 8.5rem; border-radius: 1.25rem; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, hsl(var(--hue) 90% 90%), hsl(calc(var(--hue) + 25) 70% 78%)); color: hsl(var(--hue) 70% 28%); font-size: 3.6rem; box-shadow: var(--up-shadow); }
[data-bs-theme=dark] .course-hero-art { background: linear-gradient(135deg, hsl(var(--hue) 35% 24%), hsl(calc(var(--hue) + 25) 30% 18%)); color: hsl(var(--hue) 85% 72%); }
.course-hero-art img { width: 100%; height: 100%; object-fit: cover; }
.chapter-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; counter-reset: kap; }
.chapter-card { counter-increment: kap; border: 1px solid var(--bs-border-color); border-radius: .875rem; background: var(--bs-body-bg); padding: 1rem 1.25rem; box-shadow: var(--up-shadow); }
.chapter-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .5rem; }
.chapter-head h3 a { color: inherit; text-decoration: none; }
.chapter-head h3 a::before { content: counter(kap) ". "; color: var(--up-accent); }
.chapter-head h3 a:hover { text-decoration: underline; }
.chapter-goals { background: var(--up-soft); border-left: 4px solid var(--up-orange); border-radius: .5rem; padding: .6rem .9rem; margin: .5rem 0; }
.chapter-goals ul { padding-left: 1.1rem; margin-top: .25rem; }
.chapter-card details summary { cursor: pointer; color: var(--up-accent); }
.chapter-card details ol { columns: 2 18rem; column-gap: 2rem; }
.chapter-card details li { break-inside: avoid; }

/* Fortschritt je Kapitel in der Gliederung */
.kap-ring { --p: 0; display: inline-block; width: .95rem; height: .95rem; margin-left: .4rem; vertical-align: -.12em; border-radius: 50%; flex: 0 0 auto;
    background: radial-gradient(closest-side, var(--bs-body-bg) 58%, transparent 60%), conic-gradient(var(--up-orange) calc(var(--p) * 1%), var(--up-track) 0); }

/* ================= Leseansicht: Lesehilfen ================= */
.lesezeit { color: var(--bs-secondary-color); }
.lh-norm { all: unset; cursor: pointer; color: var(--bs-link-color); text-decoration: underline dotted; text-underline-offset: .2em; border-radius: .2rem; }
.lh-norm:hover { text-decoration-style: solid; }
.lh-norm:focus-visible, #scroll span.glossar[role=button]:focus-visible { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 1px; }
#scroll span.glossar[role=button] { cursor: help; text-decoration: underline dotted var(--up-orange-icon); text-underline-offset: .2em; }
.lh-pop { position: absolute; z-index: 1080; background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-top: 3px solid var(--up-orange); border-radius: .75rem; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); max-height: 60vh; overflow: auto; font-size: .95rem; }
.lh-pop-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; padding: .6rem .9rem .3rem; position: sticky; top: 0; background: inherit; }
.lh-pop-body { padding: .2rem .9rem .8rem; white-space: normal; }
.tts-aktiv { background: var(--bs-highlight-bg); border-radius: .25rem; box-shadow: 0 0 0 .25rem var(--bs-highlight-bg); }
[data-bs-theme=dark] .tts-aktiv { background: #4a3514; box-shadow: 0 0 0 .25rem #4a3514; }
.feedback-card, .ask-card { border: 1px solid var(--bs-border-color); border-radius: .875rem; padding: 1rem 1.25rem; background: var(--bs-tertiary-bg); }
.js-daumen.active, .js-daumen[aria-pressed=true] { background: var(--up-orange); border-color: var(--up-orange); color: var(--up-on-orange); }
.was-fehlt fieldset { border: 0; padding: 0; margin: 0; }
.ask-answer { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-left: 4px solid var(--up-orange); border-radius: .5rem; padding: .75rem 1rem; }
.keys-table td:first-child { width: 7rem; white-space: nowrap; }
.keys-table kbd { background: var(--bs-tertiary-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-bottom-width: 2px; font-weight: 600; }
body.is-offline::after { content: "Offline – gespeicherte Fassung"; position: fixed; z-index: 1070; left: 1rem; bottom: 1rem; font-size: .85rem; background: var(--up-soft); color: var(--bs-body-color); border: 1px solid var(--up-orange); border-radius: 999px; padding: .2rem .8rem; }

/* ================= Startseite: Lernwoche und Abzeichen ================= */
.goal-progress { height: .65rem; background: var(--up-track); }
.goal-progress .progress-bar { background: var(--up-orange); transition: width .4s ease; }
.goal-progress.is-done .progress-bar { background: #2f7d32; }
.goal-input { width: 5.5rem; }
.badge-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .5rem; }
.badge-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; font-size: .75rem; line-height: 1.2; color: var(--bs-secondary-color); }
.badge-item .badge-icon { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--up-track); color: var(--bs-secondary-color); font-size: 1.1rem; }
.badge-item.is-earned { color: var(--bs-body-color); font-weight: 600; }
.badge-item.is-earned .badge-icon { background: var(--up-orange); color: var(--up-on-orange); box-shadow: 0 0 0 3px var(--up-soft); }
@media (prefers-reduced-motion: reduce) { .goal-progress .progress-bar { transition: none; } }

@media (max-width: 575.98px) { .course-tile .tile-art { height: 4.5rem; font-size: 2rem; } .course-hero-art { width: 5.5rem; height: 5.5rem; font-size: 2.4rem; } }

/* ================= Erklärvideo-Spieler ================= */
.erklaervideo { margin: 1rem 0 1.5rem; }
.ev { margin: 0; border-radius: .875rem; overflow: hidden; background: #111318; box-shadow: var(--up-shadow); }
.ev-buehne { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #111318; outline: none; }
.ev-buehne:focus-visible { box-shadow: inset 0 0 0 3px var(--up-orange); }
.ev-szenen, .ev-szene { position: absolute; inset: 0; }
.ev-szene { overflow: hidden; }
.ev-bild { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; animation-duration: var(--d, 10s); animation-timing-function: ease-in-out; animation-fill-mode: both; will-change: transform; }
.ev-kb-zoom-in { animation-name: ev-zoom-in; } .ev-kb-zoom-out { animation-name: ev-zoom-out; }
.ev-kb-links { animation-name: ev-links; } .ev-kb-rechts { animation-name: ev-rechts; }
.ev-kb-hoch { animation-name: ev-hoch; } .ev-kb-runter { animation-name: ev-runter; }
@keyframes ev-zoom-in { from { transform: scale(1.02); } to { transform: scale(1.16) translate(-1.5%, -1%); } }
@keyframes ev-zoom-out { from { transform: scale(1.18) translate(1%, 1%); } to { transform: scale(1.03); } }
@keyframes ev-links { from { transform: scale(1.14) translateX(4%); } to { transform: scale(1.14) translateX(-4%); } }
@keyframes ev-rechts { from { transform: scale(1.14) translateX(-4%); } to { transform: scale(1.14) translateX(4%); } }
@keyframes ev-hoch { from { transform: scale(1.14) translateY(4%); } to { transform: scale(1.14) translateY(-4%); } }
@keyframes ev-runter { from { transform: scale(1.14) translateY(-4%); } to { transform: scale(1.14) translateY(4%); } }

/* Einblendungen */
.ev-ebenen { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: .6em; padding: 5% 5% 15%; font-size: clamp(.75rem, 2.4cqi, 1.7rem); }
.ev-buehne { container-type: inline-size; }
.ev-chip { opacity: 0; max-width: 70%; padding: .45em .9em; border-radius: .6em; font-weight: 700; line-height: 1.25; color: #1f2937; background: rgba(255, 255, 255, .94); box-shadow: 0 .4em 1.4em rgba(0, 0, 0, .25); border-left: .3em solid #f8971c; animation: ev-chip-ein .7s cubic-bezier(.2, .9, .3, 1.3) both; }
.ev-chip-1 { align-self: center; } .ev-chip-2 { align-self: flex-end; }
.ev-chip-titel { position: absolute; top: 6%; left: 5%; max-width: 80%; background: #f8971c; color: #1f2937; border-left: 0; font-size: 1.15em; animation-name: ev-titel-ein; }
@keyframes ev-chip-ein { from { opacity: 0; transform: translateY(1.2em) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes ev-titel-ein { from { opacity: 0; transform: translateX(-1.5em); } to { opacity: 1; transform: none; } }

/* Übergänge */
.ev-szene.ev-raus { z-index: 1; animation: ev-aus .8s ease both; }
.ev-szene:not(.ev-raus) { z-index: 2; }
.ev-in-blende { animation: ev-blende .8s ease both; }
.ev-in-schieben { animation: ev-schieben .8s cubic-bezier(.65, 0, .35, 1) both; }
.ev-in-zoom { animation: ev-zoom .8s cubic-bezier(.2, .8, .2, 1) both; }
.ev-in-wischen { animation: ev-wischen .9s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes ev-aus { to { opacity: 0; } }
@keyframes ev-blende { from { opacity: 0; } to { opacity: 1; } }
@keyframes ev-schieben { from { transform: translateX(100%); } to { transform: none; } }
@keyframes ev-zoom { from { opacity: 0; transform: scale(1.25); } to { opacity: 1; transform: none; } }
@keyframes ev-wischen { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Pause: alle Animationen anhalten */
.ev-pausiert .ev-bild, .ev-pausiert .ev-chip, .ev-pausiert .ev-szene { animation-play-state: paused; }

/* Untertitel */
.ev-untertitel { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); z-index: 5; max-width: 86%; text-align: center; color: #fff; background: rgba(17, 19, 24, .78); padding: .3em .8em; border-radius: .4em; font-size: clamp(.8rem, 2.2cqi, 1.5rem); line-height: 1.35; }
.ev-untertitel:empty, .ev-bereit .ev-untertitel { display: none; }

/* Startschaltfläche */
.ev-start { position: absolute; inset: 0; z-index: 6; display: none; flex-direction: column; align-items: center; justify-content: center; gap: .5em; border: 0; color: #fff; background: linear-gradient(0deg, rgba(17, 19, 24, .75), rgba(17, 19, 24, .15)); cursor: pointer; font-size: clamp(.9rem, 2.6cqi, 1.8rem); }
.ev-bereit .ev-start, .ev-ende .ev-start { display: flex; }
.ev-start-icon { width: 3.6em; height: 3.6em; border-radius: 50%; display: grid; place-items: center; background: #f8971c; color: #1f2937; font-size: 1.1em; box-shadow: 0 .4em 1.4em rgba(0, 0, 0, .35); transition: transform .15s; }
.ev-start:hover .ev-start-icon, .ev-start:focus-visible .ev-start-icon { transform: scale(1.08); }
.ev-start:focus-visible { outline: 3px solid #f8971c; outline-offset: -6px; }
.ev-start-titel { font-weight: 700; max-width: 80%; text-align: center; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.ev-start-dauer { font-size: .8em; opacity: .9; }
.ev-ende .ev-start-icon i::before { content: "\f2ea"; }

/* Bedienleiste */
.ev-leiste { display: flex; align-items: center; gap: .35rem; padding: .4rem .6rem; background: #1c1f24; color: #e6e6e7; }
.ev-knopf { border: 0; background: transparent; color: inherit; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.ev-knopf:hover { background: rgba(255, 255, 255, .1); }
.ev-knopf:focus-visible { outline: 3px solid #f8971c; outline-offset: 1px; }
.ev-knopf.aktiv { color: #f8971c; }
.ev-play { background: #f8971c; color: #1f2937; } .ev-play:hover { background: #fbb15c; }
.ev-zeit { font-variant-numeric: tabular-nums; font-size: .85rem; white-space: nowrap; padding: 0 .3rem; }
.ev-regler { flex: 1 1 auto; min-width: 4rem; accent-color: #f8971c; }
.ev-transkript { background: var(--bs-body-bg); color: var(--bs-body-color); padding: .6rem 1rem; border-top: 1px solid var(--bs-border-color); }
.ev-transkript summary { cursor: pointer; color: var(--up-accent); font-weight: 600; font-size: .9rem; }
.ev-transkript ol { margin: .6rem 0 0; padding-left: 1.2rem; font-size: .95rem; }
.ev:fullscreen { display: flex; flex-direction: column; background: #000; }
.ev:fullscreen .ev-buehne { flex: 1 1 auto; aspect-ratio: auto; }
.ev:fullscreen .ev-transkript { display: none; }
@media (max-width: 575.98px) { .ev-zeit { display: none; } .ev-knopf { width: 2.2rem; height: 2.2rem; } }

/* Bewegung reduzieren: keine Kamerafahrten, nur Einblenden */
.ev-ruhig .ev-bild { animation: none !important; transform: none; }
.ev-ruhig .ev-chip { animation-name: ev-blende; }
.ev-ruhig .ev-szene { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .ev-bild { animation: none !important; } }

/* ================= Erklärvideo: Drehbuch-Editor ================= */
.video-seitenwahl { max-height: 22rem; overflow: auto; }
.drehbuch { min-width: 960px; }
.drehbuch .db-c1 { width: 17%; } .drehbuch .db-c2 { width: 38%; } .drehbuch .db-c3 { width: 38%; } .drehbuch .db-c4 { width: 7%; }
.drehbuch thead th { position: sticky; top: 0; background: var(--bs-tertiary-bg); z-index: 1; font-size: .9rem; }
.drehbuch textarea { min-height: 8rem; }
.drehbuch .db-nr { font-size: .8rem; font-weight: 700; color: var(--up-accent); margin-bottom: .25rem; }
.drehbuch .db-bild { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin-top: .5rem; border-radius: .4rem; border: 1px solid var(--bs-border-color); }
.drehbuch .db-bild.veraltet { opacity: .45; filter: grayscale(.6); }
.drehbuch .db-ton { width: 100%; height: 2rem; }
.drehbuch .db-c4 { display: flex; flex-direction: column; gap: .15rem; align-items: center; }
.drehbuch .js-erneuern.active { color: var(--up-on-orange); background: var(--up-orange); }
.db-leiste { position: sticky; bottom: 0; background: var(--bs-body-bg); padding: .6rem 0; border-top: 1px solid var(--bs-border-color); z-index: 2; }
.video-fortschritt { height: .5rem; }
.video-fortschritt .progress-bar { background-color: var(--up-orange); }
/* Inhaltsregeln für Bilder im Lehrtext nicht auf das Video anwenden */
#scroll .ev img.ev-bild, .lehrtext .ev img.ev-bild, .ev img.ev-bild { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: none; filter: none; padding: 0; }
.lehrtext .erklaervideo p { margin: 0; }

/* ================= Bearbeiten-Leiste (Kursverantwortliche) ================= */
.edit-leiste { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .4rem .5rem; margin-bottom: .75rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; background: var(--bs-tertiary-bg); }
.edit-leiste .btn { white-space: nowrap; }
.edit-leiste .btn-outline-secondary { --bs-btn-color: var(--bs-body-color); --bs-btn-border-color: var(--bs-border-color); --bs-btn-hover-color: var(--bs-emphasis-color); --bs-btn-hover-bg: var(--bs-body-bg); --bs-btn-hover-border-color: var(--up-orange); --bs-btn-active-color: var(--bs-emphasis-color); --bs-btn-active-bg: var(--bs-body-bg); background: var(--bs-body-bg); }
.edit-leiste .btn-outline-danger { background: var(--bs-body-bg); --bs-btn-color: var(--bs-danger-text-emphasis); }
.edit-leiste .btn-group .btn i, .edit-leiste .dropdown-toggle i { color: var(--up-orange-icon); }
.edit-leiste .btn-group .btn-outline-danger i { color: inherit; }
.edit-leiste .dropdown-menu .dropdown-item i { color: var(--up-orange-icon); margin-right: .35rem; }
@media (max-width: 575.98px) { .edit-leiste .btn-group .btn { font-size: 0; padding: .3rem .55rem; } .edit-leiste .btn-group .btn i { font-size: .875rem; } }
.edit-kontext { min-width: 15rem; padding: .3rem 0; border: 1px solid var(--bs-border-color); border-radius: .6rem; background: var(--bs-body-bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
.edit-kontext .list-group-item { border: 0; padding: .4rem 1rem; font-size: .9375rem; }
.edit-kontext .list-group-item i { width: 1.25rem; margin-right: .35rem; color: var(--up-orange-icon); }
.edit-kontext .list-group-item.text-danger, .edit-kontext .list-group-item.text-danger i { color: var(--bs-danger-text-emphasis) !important; }
.edit-kontext .list-group-item:focus-visible { outline: 3px solid var(--bs-focus-ring-color); outline-offset: -3px; }
.edit-kontext-trenner { border-top: 1px solid var(--bs-border-color); margin: .3rem 0; }

/* Randspalten: Löschknopf klein oben rechts */
.footnotes > div > .fn-del { position: absolute; top: .6rem; right: 0; width: 1.6rem !important; height: 1.6rem !important; font-size: .75rem; border: 1px solid var(--bs-border-color); color: var(--bs-danger-text-emphasis); background: var(--bs-body-bg); }
.footnotes > div:first-child > .fn-del { top: 0; }
.footnotes > div > .fn-del:hover, .footnotes > div > .fn-del:focus-visible { background: var(--bs-danger); border-color: var(--bs-danger); color: #fff; }
.footnotes > div:has(> .fn-del) .fn-title { padding-right: 2rem; }
.footnotes .indent.mce-content-body { outline: 2px solid var(--up-orange); outline-offset: 4px; border-radius: .25rem; min-height: 6rem; }

/* VisiLex-Auswahl im Editor */
.vl-auswahl .vl-baum { max-height: 60vh; overflow: auto; padding: .4rem; background: var(--bs-body-bg); }
.vl-auswahl .vl-baum .jstree-anchor { white-space: normal; height: auto; }
.vl-auswahl .vl-baum .jstree-hidden { display: none; }
.vl-auswahl .vl-liste { max-height: 60vh; overflow: auto; }
.vl-auswahl .vl-liste .list-group-item { cursor: pointer; }
.vl-auswahl .vl-liste .list-group-item:has(input:checked) { background: var(--up-soft); border-color: var(--bs-primary-border-subtle); }
.vl-auswahl .vl-zusatz { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.min-w-0 { min-width: 0; }

/* Kreuzworträtsel-Editor */
.kw-editor .kw-liste { max-height: 22rem; overflow: auto; border-top: 1px solid var(--bs-border-color); }
.kw-editor .kw-liste .list-group-item { padding: .6rem 1rem; }
.kw-editor .output:empty { display: none; }

/* Aufgabenformular im Editor */
.lq-zeile { background: var(--bs-tertiary-bg); }
.lq-zeile .form-floating > textarea.form-control { min-height: 4.5rem; }
.footnotes .fn-leiste { margin: .25rem 0 .5rem; } .footnotes .fn-leiste:empty { display: none; }
.footnotes .fn-leiste .tox-tinymce-inline { position: static !important; width: 100% !important; }
/* Kontrast: graue Umrissknöpfe auch auf getönten Flächen (Kartenfuß) ausreichend dunkel */
.btn-outline-secondary { --bs-btn-color: var(--bs-secondary-color); --bs-btn-border-color: var(--up-grey); }
/* Administration */
.admin-seite .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.admin-seite .nav-tabs .nav-link { white-space: nowrap; }
.admin-seite .admin-kacheln .btn { border-radius: .6rem; }
#userlist tr.table-warning a, #userlist tr.table-success a { color: var(--bs-table-color); }
#userlist td select { min-width: 11rem; }

/* Skriptimport: Gliederungsplan, Gegenüberstellung */
.import-plan .plan-seite { background: var(--bs-body-bg); }
.import-plan .plan-unterseite { border-style: dashed !important; }
.import-plan .plan-griff { cursor: grab; }
.import-plan .plan-titel { min-width: 12rem; }
.import-plan .plan-ziel-vor { box-shadow: inset 0 3px 0 var(--bs-primary); }
.import-plan .plan-ziel-nach { box-shadow: inset 0 -3px 0 var(--bs-primary); }
.import-plan .plan-ziel-kind { box-shadow: inset 4px 0 0 var(--bs-success); margin-left: 1.5rem; }
.import-plan .plan-ziel { outline: 2px dashed var(--bs-primary); }
.import-plan .plan-absaetze { max-height: 18rem; overflow: auto; }
.import-plan .plan-mini { max-height: 3rem; max-width: 6rem; background: #fff; border: 1px solid var(--bs-border-color); }
.import-plan .plan-zahlen > span + span::before { content: "· "; color: var(--bs-secondary-color); }
#lehrGegen .gegen-raster { min-height: calc(100vh - 9rem); }
#lehrGegen .gegen-vorlage { max-height: calc(100vh - 12rem); }
#lehrGegen .gegen-vorlage img { max-width: 100%; height: auto; }

/* KI-Protokoll */
.ki-zeilen { font-family: var(--bs-font-monospace); white-space: pre-wrap; word-break: break-word; max-height: 70vh; overflow: auto; padding: .5rem .5rem .5rem 3.5rem; background: var(--bs-tertiary-bg); }
.ki-zeilen li { padding-left: .4rem; }
.ki-zeilen li::marker { color: var(--bs-secondary-color); font-size: .8em; }
.ki-zeilen .ki-fehlerzeile { background: var(--bs-danger-bg-subtle); outline: 1px solid var(--bs-danger); }
.ki-json { max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
