/* Flatcourse – Gestaltung
   Leitidee: Ein Kurs ist eine Route. Signalgelb (wie in der Werkstatt) markiert Fortschritt,
   jede Inhaltsart hat Farbe und Symbol: PDF ziegelrot, Video blau, Simulation grün, Übung violett. */

@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --ink: #16212b;
  --muted: #56636e;
  --line: #d3dbe0;
  --line-strong: #b9c4cb;
  --blue: #1e4e8c;
  --blue-soft: #e3ecf7;
  --signal: #f2b300;
  --signal-soft: #fff4d1;
  --ok: #2c7a4b;
  --ok-soft: #e2f1e7;
  --danger: #b3261e;
  --danger-soft: #fbe7e5;

  --c-pdf: #b4442e;
  --c-video: #1e4e8c;
  --c-sim: #2c7a4b;
  --c-h5p: #6d45a8;

  --font-body: "Atkinson Hyperlegible", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-head: "Barlow Condensed", "Arial Narrow", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --radius: 12px;
  --radius-s: 8px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow: 0 1px 2px rgba(22, 33, 43, 0.06), 0 6px 20px rgba(22, 33, 43, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171d;
    --surface: #19222a;
    --surface-2: #1e2830;
    --ink: #e6ecf0;
    --muted: #9aa7b1;
    --line: #2e3a44;
    --line-strong: #3d4b57;
    --blue: #8db8f2;
    --blue-soft: #1d2b3b;
    --signal-soft: #3a3014;
    --ok: #6cc28f;
    --ok-soft: #173126;
    --danger: #f0857d;
    --danger-soft: #3b1d1b;
    --c-pdf: #ec8a74;
    --c-video: #8db8f2;
    --c-sim: #6cc28f;
    --c-h5p: #b99be6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}

/* Chinesische Schriftzeichen kommen automatisch aus der Systemschrift (siehe Schriftlisten oben) */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.6 var(--font-body); }
a { color: var(--blue); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
img, video, iframe { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--surface); padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.1; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3rem); margin: 0 0 1rem; }
h2 { font-size: 1.5rem; margin: 0 0 0.75rem; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 62ch; margin: 0 0 1.5rem; }
.muted { color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); font-size: 0.9em; }
.ok { color: var(--ok); }
code { font-size: 0.95em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.icon-xs { width: 1em; height: 1em; }

/* ------------------------------------------------------------ Kopfzeile */
.site {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font: 600 1.5rem/1 var(--font-head); color: var(--ink); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; border: 5px solid var(--signal); }
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.site-nav a { padding: 0.35rem 0.7rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.97rem; }
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--blue-soft); font-weight: 700; }
.select-short { max-width: 20rem; }
.who { display: flex; align-items: center; gap: 0.9rem; font-size: 0.95rem; color: var(--muted); margin-left: auto; }
.who form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }

/* ------------------------------------------------------------ Schaltflächen und Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.15rem; border: 2px solid var(--blue); border-radius: var(--radius-s);
  background: var(--blue); color: var(--surface);
  font: 700 0.98rem/1.25 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-quiet { background: transparent; color: var(--blue); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.92rem; }
.btn-wide { width: 100%; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-s); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

label { display: block; font-weight: 700; margin: 0.9rem 0 0.35rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: 0.6rem 0.8rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-s);
  transition: border-color 0.15s;
}
textarea { resize: vertical; min-height: 3.2rem; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; }
.form > button, .form-actions { margin-top: 1.25rem; }
.form.compact label { margin-top: 0.6rem; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.form-actions form { margin: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 1rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; cursor: pointer; margin: 0.6rem 0; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--blue); flex: none; }
.error { color: var(--danger); font-weight: 700; margin: 0.75rem 0 0; }
.input-code { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }

/* ------------------------------------------------------------ Seitenrahmen */
.page { max-width: 64rem; margin: 0 auto; padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem) 4rem; }
.page-wide { max-width: 80rem; }
.page.narrow { max-width: 32rem; }
.crumbs { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin: 0 0 1.5rem; }
.panel-accent { border-color: var(--signal); background: var(--signal-soft); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.5rem; }
.two-col .panel { margin: 0; }
.empty-state { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty-state p { margin: 0.5rem 0; }

/* ------------------------------------------------------------ Meldungen */
.toast {
  position: fixed; left: 50%; top: 4.6rem; z-index: 50; transform: translateX(-50%);
  max-width: min(36rem, calc(100vw - 2rem)); padding: 0.75rem 1.1rem; border-radius: var(--radius-s);
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-weight: 700;
  animation: toast-in 0.35s var(--ease) both;
}
.toast-error { background: var(--danger); }
.toast.is-leaving { animation: toast-out 0.3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -12px); } }

/* ------------------------------------------------------------ Anmelden */
.auth { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(28rem, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem 2rem 1.5rem; box-shadow: var(--shadow); animation: rise 0.45s var(--ease) both; }
.auth-card h1 { font-size: 2.25rem; }
.auth-foot { margin: 1.25rem 0 0; font-size: 0.95rem; color: var(--muted); line-height: 1.8; }
.checks { list-style: none; padding: 0; margin: 1rem 0; font-size: 0.95rem; }
.checks li { display: flex; gap: 0.5rem; align-items: center; }
.checks .is-ok { color: var(--ok); }
.checks .is-bad { color: var(--danger); font-weight: 700; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------ Startseite: Kurskarten */
.course-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 1.5rem; }
.course-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); animation: rise 0.4s var(--ease) both; }
.course-card:nth-child(2) { animation-delay: 0.05s; }
.course-card:nth-child(3) { animation-delay: 0.1s; }
.course-card:nth-child(n+4) { animation-delay: 0.15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(22, 33, 43, 0.08), 0 14px 32px rgba(22, 33, 43, 0.12); }
.card-link { flex: 1; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.card-link:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; border-radius: var(--radius); }
.card-media { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s var(--ease); }
.course-card:hover .card-media img { transform: scale(1.03); }
.card-media.is-empty { display: grid; place-items: center; background: var(--signal-soft); background-image: repeating-linear-gradient(135deg, transparent 0 22px, rgba(242, 179, 0, 0.14) 22px 44px); }
.card-initial { font: 600 4.5rem/1 var(--font-head); color: var(--signal); }
.card-badge { position: absolute; top: 0.75rem; right: 0.75rem; background: #2c7a4b; color: #fff; font-size: 0.85rem; font-weight: 700; padding: 0.25rem 0.65rem; border-radius: 999px; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 0.45rem; padding: 1.1rem 1.25rem 1.2rem; }
.course-title { font: 600 1.6rem/1.1 var(--font-head); transition: color 0.15s; }
.card-link:hover .course-title { color: var(--blue); }
.course-desc { color: var(--muted); font-size: 0.97rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 0.6rem; display: flex; flex-direction: column; gap: 0.55rem; }
.course-count { color: var(--muted); font-size: 0.92rem; }
.is-complete .course-count { color: var(--ok); font-weight: 600; }
.course-resume { display: block; padding: 0.75rem 1.25rem; border-top: 1px solid var(--line); font-size: 0.95rem; font-weight: 600; background: var(--signal-soft); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-resume:hover { text-decoration: underline; }

.track { display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; }
.track .seg { flex: none; width: 18px; height: 3px; background: var(--line-strong); }
.track .seg.is-done { background: var(--signal); }
.track-gap { flex: none; width: 14px; }
.node { display: inline-block; flex: none; width: 14px; height: 14px; background: var(--surface); border: 2.5px solid var(--line-strong); border-radius: 50%; }
.node-video { border-radius: 3px; }
.node-pdf { border-radius: 2px; width: 12px; height: 15px; }
.node-h5p { border-radius: 2px; transform: rotate(45deg) scale(0.88); }
.node.is-done { background: var(--signal); border-color: var(--signal); }

/* ------------------------------------------------------------ Kursübersicht */
.course-hero { margin-bottom: 2rem; }
.progress-line { display: flex; align-items: center; gap: 1rem 1.25rem; flex-wrap: wrap; }
.meter { flex: 1 1 14rem; max-width: 22rem; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: var(--p); background: var(--signal); border-radius: inherit; animation: fill 0.9s var(--ease) 0.15s both; }
@keyframes fill { from { width: 0; } }
.meter-text { color: var(--muted); }
.progress-line .btn { margin-left: auto; }

/* Gliederung: Lektionen zum Auf- und Zuklappen */
.outline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.lesson { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color 0.2s, box-shadow 0.25s; }
.lesson.is-open { border-color: var(--line-strong); box-shadow: var(--shadow); }
.lesson-head { margin: 0; font-size: inherit; }
.lesson-toggle {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; background: none; border: 0; border-radius: var(--radius); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.lesson-toggle:hover .lesson-title { color: var(--blue); }
.lesson-no {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 2.5px solid var(--line-strong); font: 600 1.15rem/1 var(--font-head); color: var(--muted);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.lesson.is-open .lesson-no { border-color: var(--blue); color: var(--blue); }
.lesson.is-complete .lesson-no { background: var(--signal); border-color: var(--signal); color: #16212b; }
.lesson-no .icon { width: 1.1rem; height: 1.1rem; stroke-width: 2.6; }
.lesson-title { font: 600 1.45rem/1.15 var(--font-head); transition: color 0.15s; }
.lesson-count { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.chevron {
  width: 2.4rem; height: 2.4rem; padding: 0.4rem; border-radius: 50%;
  color: var(--blue); background: var(--blue-soft); stroke-width: 2.4;
  transition: transform 0.35s var(--ease), background 0.15s;
}
.lesson-toggle:hover .chevron { background: color-mix(in srgb, var(--blue) 20%, transparent); }
.lesson.is-open .chevron { transform: rotate(180deg); }
.outline-compact .chevron { width: 2rem; height: 2rem; padding: 0.3rem; }

.lesson-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.38s var(--ease); }
.lesson.is-open > .lesson-panel { grid-template-rows: 1fr; }
.lesson-panel-inner { overflow: hidden; min-height: 0; }
.lesson-empty { margin: 0; padding: 0 1.2rem 1.2rem 4.3rem; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0 0.6rem 0.7rem; }
.items > li { opacity: 0; transform: translateY(-6px); transition: opacity 0.25s ease, transform 0.3s var(--ease); }
.lesson.is-open .items > li { opacity: 1; transform: none; }
.lesson.is-open .items > li:nth-child(1) { transition-delay: 0.06s; }
.lesson.is-open .items > li:nth-child(2) { transition-delay: 0.1s; }
.lesson.is-open .items > li:nth-child(3) { transition-delay: 0.14s; }
.lesson.is-open .items > li:nth-child(4) { transition-delay: 0.18s; }
.lesson.is-open .items > li:nth-child(n+5) { transition-delay: 0.22s; }

.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: start;
  padding: 0.75rem 0.7rem; border-radius: var(--radius-s); color: inherit; text-decoration: none;
  transition: background 0.15s;
}
.item:hover { background: var(--surface-2); }
.item.is-current { background: var(--blue-soft); }
.item-icon {
  display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 10px; flex: none;
  color: var(--tc, var(--muted)); background: color-mix(in srgb, var(--tc, var(--muted)) 13%, transparent);
  transition: transform 0.2s var(--ease);
}
.item:hover .item-icon { transform: scale(1.06); }
.type-pdf { --tc: var(--c-pdf); }
.type-video { --tc: var(--c-video); }
.type-sim { --tc: var(--c-sim); }
.type-h5p { --tc: var(--c-h5p); }
.item-text { display: grid; gap: 0.1rem; min-width: 0; }
.item-title { font-weight: 700; line-height: 1.3; }
.item-desc { color: var(--muted); font-size: 0.97rem; line-height: 1.45; }
.item-meta { color: var(--tc, var(--muted)); font-size: 0.85rem; font-weight: 700; }
.item-state { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; align-self: center; border-radius: 50%; }
.item.is-done .item-state { background: var(--signal); color: #16212b; }
.item.is-done .item-state .icon { width: 1rem; height: 1rem; stroke-width: 2.8; }

/* Kompakte Gliederung in der Seitenleiste */
.outline-compact { gap: 0.4rem; }
.outline-compact .lesson { box-shadow: none; border-color: transparent; background: transparent; }
.outline-compact .lesson.is-open { border-color: transparent; }
.outline-compact .lesson-toggle { padding: 0.6rem 0.5rem; gap: 0.7rem; }
.outline-compact .lesson-no { width: 1.7rem; height: 1.7rem; font-size: 1rem; }
.outline-compact .lesson-title { font-size: 1.15rem; }
.outline-compact .items { padding: 0 0 0.4rem; }
.outline-compact .item { padding: 0.5rem; gap: 0.65rem; }
.outline-compact .item-icon { width: 2rem; height: 2rem; border-radius: 8px; }
.outline-compact .item-icon .icon { width: 1.1rem; height: 1.1rem; }
.outline-compact .item-title { font-weight: 400; font-size: 0.95rem; }
.outline-compact .item.is-current .item-title { font-weight: 700; }
.outline-compact .item-meta { display: none; }
.outline-compact .item-state { width: 1.3rem; height: 1.3rem; }

/* ------------------------------------------------------------ Inhaltsseite */
.study { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.study-side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem 0.8rem 2rem; position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; }
.side-back { display: block; margin: 0 0.5rem 0.9rem; font: 600 1.35rem/1.15 var(--font-head); color: var(--ink); text-decoration: none; }
.side-back::before { content: "‹ "; color: var(--muted); }
.side-back:hover { color: var(--blue); }
.side-toggle summary { list-style: none; margin: 0 0.5rem 0.5rem; color: var(--muted); font-size: 0.9rem; cursor: default; }
.side-toggle summary::-webkit-details-marker { display: none; }

.study-main { padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 3.5rem) 4rem; max-width: 72rem; animation: rise 0.4s var(--ease) both; }
.study-meta { display: flex; align-items: center; gap: 0.7rem; color: var(--muted); margin: 0 0 0.7rem; }
.study-meta .item-icon { width: 2.2rem; height: 2.2rem; }
.study-main h1 { margin-bottom: 0.5rem; }
.viewer { margin-top: 1.25rem; animation: rise 0.5s var(--ease) 0.1s both; }
.frame { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.open-card {
  --tc: var(--c-pdf);
  display: grid; grid-template-columns: auto 1fr auto; gap: 1.1rem; align-items: center;
  max-width: 48rem; padding: 1.25rem 1.4rem; background: var(--surface);
  border: 1px solid var(--line); border-left: 5px solid var(--tc); border-radius: var(--radius);
}
.open-card-icon { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 12px; color: var(--tc); background: color-mix(in srgb, var(--tc) 13%, transparent); }
.open-card-icon .icon { width: 1.9rem; height: 1.9rem; }
.open-card-text p { margin: 0; }
.open-card-name { font-weight: 700; word-break: break-all; }
.open-card.type-video { --tc: var(--c-video); }
.open-card.type-sim { --tc: var(--c-sim); }
.open-card.type-h5p { --tc: var(--c-h5p); }
.frame-pdf { height: min(82vh, 1100px); }
.open-card-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
.frame-video { aspect-ratio: 16 / 9; background: #000; border: 0; }
.frame-sim { height: min(78vh, 900px); background: #fff; }
.frame-sim:fullscreen { height: 100vh; border-radius: 0; }
.video { display: block; width: 100%; border-radius: var(--radius); background: #000; }
.viewer-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0.9rem 0 0; }
.h5p-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; max-width: 56rem; }
.result { max-width: 56rem; margin: 0.8rem 0 0; padding: 0.8rem 1rem; border-radius: var(--radius-s); background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.result.has-result { color: var(--ink); background: var(--surface); }
.result.is-full { background: var(--ok-soft); border-color: var(--ok); }
.result.is-error { background: var(--danger-soft); border-color: var(--danger); }
.result.pulse { animation: pulse 0.6s var(--ease); }
@keyframes pulse { 40% { transform: scale(1.015); } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.pager-link { display: grid; gap: 0.15rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.2s var(--ease); }
.pager-link:hover { border-color: var(--blue); transform: translateY(-2px); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-dir { color: var(--muted); font-size: 0.88rem; }
.pager-title { font-weight: 700; color: var(--blue); }
.pager-link.is-end .pager-title { color: var(--ok); }

/* ------------------------------------------------------------ Verwaltung */
.inline-create { display: flex; gap: 0.75rem; margin: 0 0 1.75rem; flex-wrap: wrap; }
.inline-create input { flex: 1 1 18rem; }
.admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.admin-row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-row-main { flex: 1 1 20rem; min-width: 0; }
.admin-row-title { margin: 0; font: 600 1.45rem/1.15 var(--font-head); color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
a.admin-row-title:hover { color: var(--blue); }
.admin-row-meta { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.admin-row-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.admin-row-actions form { margin: 0; }
.muted-warn { color: var(--c-pdf); }
.type-chip { display: inline-flex; align-items: center; gap: 0.2rem; margin-left: 0.35rem; color: var(--tc); font-weight: 700; }
.role { font: 700 0.75rem/1 var(--font-body); padding: 0.3rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.role-admin { background: var(--signal-soft); color: var(--ink); }
.role-lehrend { background: var(--blue-soft); color: var(--blue); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 0.75rem; }
.panel .list-head { margin-top: 0; }
.filter { max-width: 18rem; }

.course-head-form { margin-bottom: 1.5rem; }
.title-input { font: 600 clamp(1.9rem, 4vw, 2.6rem)/1.1 var(--font-head) !important; padding: 0.3rem 0.5rem !important; border-color: transparent !important; background: transparent !important; margin-left: -0.5rem; }
.title-input:hover { border-color: var(--line) !important; }
.title-input:focus { border-color: var(--blue) !important; background: var(--surface) !important; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.chip { margin: 0; font-weight: 400; cursor: pointer; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 0.4rem 0.85rem; border: 2px solid var(--line); border-radius: 999px; transition: background 0.15s, border-color 0.15s; }
.chip input:checked + span { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 700; }
.chip input:focus-visible + span { outline: 3px solid var(--signal); outline-offset: 2px; }
.check-list { display: grid; gap: 0.1rem; }
.check-list.scroll { max-height: 22rem; overflow-y: auto; padding-right: 0.5rem; }
.check-list .check { margin: 0; padding: 0.45rem 0.4rem; border-radius: 6px; }
.check-list .check:hover { background: var(--surface-2); }
.check-list small { display: block; }
.code-big { font: 600 2.4rem/1 var(--font-head); letter-spacing: 0.08em; margin: 0.75rem 0; }
.danger-zone { margin-top: 2rem; }

.lessons-head { margin-top: 2.5rem; }
.lesson-edit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem 1.2rem; margin: 0 0 1rem; scroll-margin-top: 80px; }
.lesson-edit-head { display: flex; align-items: center; gap: 0.75rem; }
.lesson-edit-head .lesson-no { border-color: var(--blue); color: var(--blue); }
.rename-form { flex: 1; margin: 0; }
.rename-form input { font: 600 1.4rem/1.2 var(--font-head) !important; border-color: transparent !important; padding: 0.25rem 0.5rem !important; }
.rename-form input:hover { border-color: var(--line) !important; }
.rename-form input:focus { border-color: var(--blue) !important; }
.row-tools { display: flex; align-items: center; gap: 0.15rem; }
.row-tools form { margin: 0; }
.item-list { list-style: none; padding: 0; margin: 0.75rem 0; display: grid; gap: 0.4rem; }
.item-edit { display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: start; padding: 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); scroll-margin-top: 90px; }
.item-edit.is-new { animation: arrive 1.6s var(--ease); }
@keyframes arrive { 0% { background: var(--signal-soft); border-color: var(--signal); transform: scale(0.98); } 20% { transform: none; } 100% { background: var(--surface-2); } }
.item-edit .item-title { margin: 0; }
.item-edit .item-desc, .item-edit .item-meta { margin: 0.1rem 0 0; }
.item-editor summary { cursor: pointer; color: var(--blue); font-size: 0.9rem; margin-top: 0.3rem; width: fit-content; }
.item-editor[open] summary { margin-bottom: 0.25rem; }
.item-editor .form { max-width: 36rem; animation: rise 0.25s var(--ease); }

.dropzone {
  display: grid; justify-items: center; gap: 0.35rem; padding: 1.4rem 1rem; margin-top: 0.75rem;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); text-align: center; color: var(--muted);
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.dropzone-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--surface-2); color: var(--blue); transition: transform 0.25s var(--ease); }
.dropzone p { margin: 0; }
.dropzone-text { color: var(--ink); }
.dropzone-hint { font-size: 0.9rem; }
.dropzone .btn { margin-top: 0.4rem; }
.dropzone.is-over { border-color: var(--blue); border-style: solid; background: var(--blue-soft); transform: scale(1.01); }
.dropzone.is-over .dropzone-icon { transform: translateY(-4px) scale(1.1); }
.dropzone.is-error { border-color: var(--danger); }
.dropzone.is-error .dropzone-hint { color: var(--danger); font-weight: 700; }
.lesson-new { margin-top: 1.5rem; }

.modal { border: 0; border-radius: 16px; padding: 1.75rem; width: min(34rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(10, 20, 30, 0.35); }
.modal[open] { animation: pop 0.3s var(--ease); }
.modal::backdrop { background: rgba(17, 23, 29, 0.55); animation: fade 0.3s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes fade { from { opacity: 0; } }
.modal-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.5rem; }
.modal-head h2 { margin: 0; }
.modal-head p { margin: 0.15rem 0 0; font-size: 0.92rem; word-break: break-all; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 1rem; }
.progress span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width 0.2s linear; }
.progress.is-busy span { width: 100% !important; background: linear-gradient(90deg, var(--blue) 0 40%, var(--signal) 50%, var(--blue) 60% 100%); background-size: 250% 100%; animation: busy 1.1s linear infinite; }
@keyframes busy { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Inhalt im neuen Fenster */
.page-solo .site-nav, .page-solo .who { display: none; }
.solo { max-width: 72rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem; animation: rise 0.4s var(--ease) both; }
.solo-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.solo-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.solo-course { margin: 0; color: var(--muted); font-size: 0.95rem; }
.frame-solo { height: calc(100vh - 11rem); min-height: 420px; background: #fff; }
.solo .h5p-box, .solo .result { max-width: none; }
.solo-hint { margin-top: 0.75rem; font-size: 0.92rem; }

/* Lernakte */
.akten { max-width: 52rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 4rem; }
.akte-tools { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.akte-tools p { margin: 0; }
.akte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem 2.2rem; margin-bottom: 2rem; }
.akte-label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.akte-head h1 { margin: 0.2rem 0 1rem; }
.akte-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.6rem 1.5rem; margin: 0 0 1.5rem; padding-bottom: 1.5rem; border-bottom: 2px solid var(--ink); }
.akte-facts dt { color: var(--muted); font-size: 0.85rem; }
.akte-facts dd { margin: 0; font-weight: 700; }
.akte-lesson h2 { font-size: 1.35rem; margin: 1.5rem 0 0.75rem; }
.akte-item { border-top: 1px solid var(--line); padding: 0.85rem 0; break-inside: avoid; }
.akte-item-head { display: grid; grid-template-columns: auto 1fr auto; gap: 0.8rem; align-items: center; }
.akte-item-head .item-icon { width: 2rem; height: 2rem; border-radius: 8px; }
.akte-item-head .item-icon .icon { width: 1.1rem; height: 1.1rem; }
.akte-item-title { margin: 0; font-weight: 700; }
.akte-item-status { margin: 0; font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
.akte-item-status.is-done { color: var(--ok); font-weight: 700; }
.akte-score { margin: 0.5rem 0 0 2.8rem; }
.akte-inputs { margin: 0.6rem 0 0 2.8rem; display: grid; gap: 0.7rem; }
.akte-inputs dt { font-weight: 700; font-size: 0.95rem; }
.akte-art { font-weight: 400; color: var(--muted); font-size: 0.82rem; margin-left: 0.4rem; }
.akte-inputs dd { margin: 0.2rem 0 0; padding: 0.55rem 0.8rem; background: var(--surface-2); border-left: 3px solid var(--signal); border-radius: 0 6px 6px 0; white-space: normal; overflow-wrap: anywhere; }
.results-actions .results-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.results th a { color: var(--ink); text-decoration-color: var(--line-strong); }
.th-ex.type-sim { color: var(--c-sim); }

@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site, .skip, .toast, .no-print { display: none !important; }
  .akten { padding: 0; max-width: none; }
  .akte { border: 0; padding: 0; margin: 0; border-radius: 0; }
  .akte + .akte { break-before: page; }
  .akte-inputs dd { background: #f3f3f3; border-left-color: #999; }
  .item-icon { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  * { animation: none !important; transition: none !important; }
}

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
.data-table th, .data-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table thead th { border-bottom: 2px solid var(--ink); white-space: nowrap; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th { font-weight: 700; }
.data-table tbody th small { display: block; font-weight: 400; color: var(--muted); }
.data-table .num { text-align: center; font-variant-numeric: tabular-nums; }
.data-table td small { display: block; color: var(--muted); font-size: 0.8rem; }
.th-ex { display: inline-flex; gap: 0.3rem; align-items: center; color: var(--c-h5p); }
.score { font-weight: 700; }
.score.is-full { color: var(--ok); }
.mini-meter { display: inline-block; width: 4rem; height: 6px; border-radius: 999px; background: var(--line); vertical-align: middle; margin-right: 0.4rem; overflow: hidden; }
.mini-meter span { display: block; height: 100%; width: var(--p); background: var(--signal); }
.filters { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filters > div { flex: 0 1 18rem; }
.filters label { margin-top: 0; }
.results-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ------------------------------------------------------------ Schmale Bildschirme */
@media (max-width: 900px) {
  .study { grid-template-columns: 1fr; }
  .study-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem 0.75rem 0.5rem; }
  .side-toggle summary { cursor: pointer; color: var(--blue); font-weight: 700; }
  .side-toggle summary::after { content: " ▾"; }
  .side-toggle[open] summary::after { content: " ▴"; }
  .open-card { grid-template-columns: auto 1fr; }
  .open-card-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .site { gap: 0.6rem 1rem; }
  .site-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .who-name { display: none; }
  .lesson-toggle { gap: 0.7rem; padding: 0.9rem; }
  .lesson-count { display: none; }
  .item-desc { font-size: 0.93rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
  .progress-line .btn { margin-left: 0; width: 100%; }
  .item-edit { grid-template-columns: auto 1fr; }
  .item-edit .row-tools { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

/* ------------------------------------------------------------ Kurseditor: Kursbild */
.course-image-panel { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 1.25rem; align-items: start; }
.course-image-panel h2 { margin-top: 0; }
.course-image-panel .form-actions { margin-top: 0.75rem; }
.course-image-preview { aspect-ratio: 16 / 9; border-radius: var(--radius-s); overflow: hidden; background: var(--line); }
.course-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-image-preview.is-empty { display: grid; place-items: center; color: var(--muted); font-size: 0.9rem; border: 1px dashed var(--line-strong); background: transparent; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 640px) { .course-image-panel { grid-template-columns: 1fr; } }
.course-image-panel { scroll-margin-top: 5rem; }
.course-image-panel .form-actions form { display: flex; } .file-btn { display: inline-flex; align-items: center; }
.done-hint { margin: 0.75rem 0 0; font-size: 0.93rem; }
.reset-form { margin: 0.2rem 0 0; } .reset-link { font-size: 0.82rem; font-weight: 400; color: var(--danger); }

/* ------------------------------------------------------------ Feedback am Kursende */
.feedback-cta { display: flex; justify-content: space-between; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; margin-top: 2rem; padding: 1.25rem 1.4rem; background: var(--signal-soft); border: 1px solid var(--signal); border-radius: var(--radius); }
.feedback-cta h2 { margin: 0 0 0.2rem; }
.feedback-cta p { margin: 0; }
.feedback .lead { margin-bottom: 1.25rem; }
.feedback-form { display: grid; gap: 0.25rem; }
.fb-q { border: 0; margin: 0; padding: 1.1rem 0 0.9rem; border-top: 1px solid var(--line); min-width: 0; }
.fb-q legend, .fb-legend { display: flex; gap: 0.6rem; align-items: baseline; padding: 0; margin: 0 0 0.7rem; font-weight: 700; line-height: 1.35; }
.fb-no { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font: 600 1rem/1 var(--font-head); transform: translateY(0.15rem); }
.fb-no-opt { background: var(--surface-2); color: var(--muted); }
.fb-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fb-choice { margin: 0; font-weight: 400; cursor: pointer; }
.fb-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-choice span { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.45rem 0.95rem; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; transition: background 0.15s, border-color 0.15s; }
.fb-choice:hover span { border-color: var(--line-strong); }
.fb-choice input:checked + span { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 700; }
.fb-choice input:focus-visible + span { outline: 3px solid var(--signal); outline-offset: 2px; }
.fb-scale { display: grid; grid-template-columns: repeat(5, minmax(2.75rem, 1fr)); gap: 0.5rem; max-width: 22rem; }
.fb-num span { width: 100%; padding: 0.45rem 0; font: 600 1.2rem/1 var(--font-head); }
.fb-scale-legend { display: flex; justify-content: space-between; max-width: 22rem; margin: 0.4rem 0 0; color: var(--muted); font-size: 0.88rem; }
.fb-q textarea, .fb-q input[type=email] { margin-top: 0; }
.fb-consent { margin-top: 0.8rem; font-size: 0.95rem; }
.fb-actions { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.fb-privacy { font-size: 0.88rem; margin: 0.75rem 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.feedback-notice, .feedback-errors { padding: 0.8rem 1rem; border-radius: var(--radius-s); margin: 0 0 1rem; }
.feedback-notice { background: var(--signal-soft); border: 1px solid var(--signal); }
.feedback-errors { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); font-weight: 700; }
.feedback-errors p { margin: 0.2rem 0; }
.feedback-thanks { text-align: center; padding: 2rem 0; animation: rise 0.4s var(--ease) both; }
.feedback-thanks-mark { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--signal); color: #16212b; margin-bottom: 1rem; }
.feedback-thanks-mark .icon { width: 1.8rem; height: 1.8rem; stroke-width: 2.8; }
.feedback-thanks .lead { margin-left: auto; margin-right: auto; }
.fb-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0 0 1.5rem; }
.fb-summary div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.75rem 1rem; }
.fb-summary dt { color: var(--muted); font-size: 0.85rem; }
.fb-summary dd { margin: 0.15rem 0 0; font: 600 1.6rem/1.1 var(--font-head); }
.fb-table .fb-text { min-width: 14rem; max-width: 26rem; white-space: normal; }
.nowrap { white-space: nowrap; }
.results-actions + .table-wrap { margin-top: 0.75rem; }
.page.feedback { max-width: 40rem; }
.fb-q legend { float: left; width: 100%; } .fb-q legend + * { clear: both; }
