:root { --c: #2c7a8f; --ink: #1c2833; --muted: #6b7785; --bg: #f4f6f8; --card: #fff; --ok: #1f8a3c; --bad: #c0392b; --dark: #0b1f2c; }
* { box-sizing: border-box; }
html { font: 16px/1.6 Inter, "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.4rem; background: var(--dark); color: #fff; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-size: 1.15rem; }
.brand b { color: #ff8a65; }
.logo { width: 2rem; height: 2rem; border-radius: .6rem; background: #ff8a65; display: grid; place-items: center; font-weight: 900; font-size: 1.4rem; }
nav { display: flex; gap: .3rem; flex-wrap: wrap; }
nav a { text-decoration: none; padding: .4rem .8rem; border-radius: 2rem; font-size: .92rem; color: #cfe0ea; }
nav a.on, nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.foot { text-align: center; font-size: .78rem; color: var(--muted); padding: 1.5rem; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }

/* Startseite */
.hero { background: linear-gradient(135deg, #12384f, #1f6f8b); color: #fff; border-radius: 1.4rem; padding: 2rem 2rem 1.6rem; margin-bottom: 1.6rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { margin: 0 0 .4rem; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.1; }
.hero p { margin: 0; max-width: 40rem; color: #dbe9f0; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
.stat { background: rgba(255,255,255,.12); border-radius: .8rem; padding: .5rem .9rem; font-size: .9rem; }
.stat b { font-size: 1.2rem; display: block; }
.part { margin: 1.6rem 0 .6rem; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tile { background: var(--card); border-radius: 1rem; overflow: hidden; text-decoration: none; box-shadow: 0 2px 10px rgba(11,31,44,.06); display: flex; flex-direction: column; transition: transform .15s; }
.tile:hover { transform: translateY(-3px); }
.tile .band { background: var(--c); color: #fff; padding: .9rem 1rem; display: flex; align-items: center; gap: .8rem; }
.tile .num { font-weight: 900; font-size: 1.8rem; opacity: .55; }
.tile .tt { font-weight: 800; line-height: 1.2; }
.tile .bar { height: .35rem; background: #e6ebef; margin: .9rem 1rem .3rem; border-radius: 1rem; overflow: hidden; }
.tile .bar i { display: block; height: 100%; background: var(--c); }
.tile .meta { font-size: .8rem; color: var(--muted); padding: 0 1rem .9rem; }

/* Kapitel */
.opener { background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #0b1f2c)); color: #fff; border-radius: 1.2rem; padding: 1.6rem 1.8rem; display: flex; align-items: center; gap: 1.2rem; }
.opener .num { font-size: 4rem; font-weight: 900; opacity: .35; line-height: 1; }
.opener h1 { margin: .2rem 0 0; font-size: clamp(1.5rem, 3.5vw, 2.2rem); line-height: 1.1; }
.opener small { letter-spacing: .25em; text-transform: uppercase; font-weight: 700; opacity: .85; font-size: .72rem; }
.tabs { display: flex; gap: .4rem; margin: 1rem 0 1.2rem; flex-wrap: wrap; }
.tabs button, .btn { border: 0; font: inherit; cursor: pointer; padding: .55rem 1rem; border-radius: 2rem; background: #e3e9ee; color: var(--ink); font-weight: 600; }
.tabs button.on, .btn.pri { background: var(--c); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; } .btn.bad { background: var(--bad); color: #fff; } .btn.ghost { background: transparent; border: 1.5px solid #c9d3da; }
.btn:disabled { opacity: .5; cursor: default; }
.read { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.6rem; align-items: start; }
@media (max-width: 860px) { .read { grid-template-columns: 1fr; } .aside { position: static; } }
.content { background: var(--card); border-radius: 1rem; padding: 1.4rem 1.8rem; box-shadow: 0 2px 10px rgba(11,31,44,.05); }
.content h2 { font-size: 1.3rem; margin: 1.6rem 0 .5rem; }
.content h2::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: .2rem; background: var(--c); margin-right: .55rem; }
.content h3 { color: var(--c); margin: 1.2rem 0 .3rem; }
.content p { margin: 0 0 .8rem; }
.content b { color: var(--dark); }
.content i.la, .la { color: #7a5a24; }
.lead { font-size: 1.08rem; color: #34495a; margin: 1.2rem 0; }
.fig { margin: 1.2rem 0; background: #fff; border: 1px solid #e3e8ec; border-radius: .9rem; padding: .8rem; text-align: center; }
.fig img { max-width: 100%; max-height: 75vh; height: auto; cursor: zoom-in; }
.fig figcaption { text-align: left; font-size: .85rem; color: #4d5c69; margin-top: .5rem; }
.fig figcaption b { background: var(--c); color: #fff; padding: .05rem .45rem; border-radius: .3rem; margin-right: .35rem; }
.cred { display: block; font-size: .72rem; color: #8a98a5; margin-top: .2rem; }
.side { display: flex; gap: .7rem; } .side > .fig { flex: 1; min-width: 0; }
@media (max-width: 600px) { .content .side { flex-direction: column; } }
table { width: 100%; border-collapse: collapse; margin: .8rem 0 1.2rem; font-size: .92rem; }
th { background: var(--c); color: #fff; text-align: left; padding: .45rem .6rem; }
td { padding: .4rem .6rem; border-bottom: 1px solid #e8edf1; vertical-align: top; }
tr:nth-child(even) td { background: color-mix(in srgb, var(--c) 5%, #fff); }
.box { border-radius: .8rem; padding: .8rem 1rem; margin: 1rem 0; }
.box h4 { margin: 0 0 .3rem; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; }
.box p { margin: 0; }
.merke { background: color-mix(in srgb, var(--c) 10%, #fff); } .merke h4 { color: var(--c); }
.praxis { background: #fff3e6; } .praxis h4 { color: #c26a0a; }
.kurz { background: var(--dark); color: #e9f1f5; } .kurz h4 { color: #ffb08f; } .kurz b { color: #fff; }
.fact { background: #fffbe0; border: 1px dashed #e3c84a; } .fact h4 { color: #a27f00; }
.aside { position: sticky; top: 5rem; display: grid; gap: .8rem; }
.aside .box { margin: 0; font-size: .9rem; }
.aside ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* Lightbox */
.lb { position: fixed; inset: 0; background: rgba(5,15,22,.88); display: grid; place-items: center; z-index: 50; padding: 1rem; cursor: zoom-out; }
.lb img { max-width: 96vw; max-height: 92vh; background: #fff; border-radius: .6rem; }

/* Aufgaben */
.task { background: var(--card); border-radius: 1rem; padding: 1.1rem 1.3rem; margin-bottom: 1rem; box-shadow: 0 2px 10px rgba(11,31,44,.05); border-left: 5px solid var(--c); }
.task.done-ok { border-left-color: var(--ok); } .task.done-part { border-left-color: #e6a23c; } .task.done-bad { border-left-color: var(--bad); }
.th { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.th .no { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.th .kind { font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 800; color: var(--c); flex: 1; }
.th .pts { font-size: .85rem; color: var(--muted); font-weight: 700; }
.q { font-weight: 650; margin: 0 0 .7rem; }
.opts { display: grid; gap: .45rem; }
.opt { text-align: left; border: 1.5px solid #d5dde3; background: #fff; border-radius: .7rem; padding: .6rem .8rem; font: inherit; cursor: pointer; }
.opt:hover { border-color: var(--c); }
.opt.right { border-color: var(--ok); background: #eaf7ee; } .opt.wrong { border-color: var(--bad); background: #fdecea; }
.tfrow { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .55rem 0; border-bottom: 1px solid #eef2f5; flex-wrap: wrap; }
.tfrow .s { flex: 1; min-width: 14rem; }
.tfrow .b { display: flex; gap: .4rem; }
.feedback { margin-top: .6rem; font-size: .9rem; padding: .5rem .8rem; border-radius: .6rem; }
.feedback.ok { background: #eaf7ee; color: #1b5e2f; } .feedback.bad { background: #fdecea; color: #8a2419; } .feedback.info { background: #eef4f8; color: #24455a; }
.gaptext { line-height: 2.3; }
.gaptext input { font: inherit; border: 0; border-bottom: 2px solid #9fb0bd; background: #f6f9fb; padding: .05rem .4rem; width: 9rem; border-radius: .3rem .3rem 0 0; }
.gaptext input.right { border-color: var(--ok); background: #eaf7ee; } .gaptext input.wrong { border-color: var(--bad); background: #fdecea; }
.pair { display: grid; gap: .45rem; }
.pair .row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.6fr); gap: .6rem; align-items: center; }
select, textarea, .lab input { font: inherit; border: 1.5px solid #cfd8de; border-radius: .6rem; padding: .45rem .6rem; width: 100%; background: #fff; }
select.right, .lab input.right { border-color: var(--ok); background: #eaf7ee; } select.wrong, .lab input.wrong { border-color: var(--bad); background: #fdecea; }
textarea { min-height: 5rem; resize: vertical; }
.case { background: #fff3e6; border-radius: .7rem; padding: .6rem .9rem; margin-bottom: .7rem; }
.case small { font-weight: 800; letter-spacing: .15em; color: #c26a0a; font-size: .7rem; }
.lab { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 760px) { .lab { grid-template-columns: 1fr; } }
.lab .inputs { display: grid; gap: .35rem; align-content: start; max-height: 70vh; overflow: auto; }
.lab .inputs label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.lab .inputs label span { flex: 0 0 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--dark); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.lab img { width: 100%; border: 1px solid #e3e8ec; border-radius: .8rem; background: #fff; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.scorebar { position: sticky; top: 4.2rem; z-index: 5; background: var(--dark); color: #fff; border-radius: 1rem; padding: .7rem 1.1rem; display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scorebar .meter { flex: 1; min-width: 8rem; height: .5rem; background: rgba(255,255,255,.18); border-radius: 1rem; overflow: hidden; }
.scorebar .meter i { display: block; height: 100%; background: #ff8a65; transition: width .3s; }

/* Lernkarten */
.cardwrap { max-width: 560px; margin: 1rem auto; perspective: 1200px; }
.card { position: relative; height: 280px; transform-style: preserve-3d; transition: transform .5s; cursor: pointer; }
.card.flip { transform: rotateY(180deg); }
.card .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 1.3rem; display: grid; place-items: center; text-align: center; padding: 1.5rem; font-size: 1.6rem; font-weight: 800; box-shadow: 0 8px 30px rgba(11,31,44,.15); }
.card .front { background: #fff; color: var(--dark); }
.card .back { background: linear-gradient(135deg, var(--c), #0b1f2c); color: #fff; transform: rotateY(180deg); font-style: italic; }
.card small { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); font-style: normal; margin-top: .6rem; }
.card .back small { color: #cfe0ea; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin: .5rem 0 1rem; }
.center { text-align: center; }
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 1rem; background: #e3e9ee; font-size: .8rem; font-weight: 700; }
.progress-table td:nth-child(3) { width: 40%; }
.mini { height: .5rem; background: #e6ebef; border-radius: 1rem; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--c); }
.result { text-align: center; background: var(--card); border-radius: 1.2rem; padding: 2rem; }
.result .big { font-size: 3rem; font-weight: 900; color: var(--c); }
.lab .inputs { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); max-height: none; }
.lab > img { position: sticky; top: 9rem; }
.lab { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }

/* ---------- Anmeldung, Konto, Auswertung ---------- */
.user { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.user a { color: #cfe0ea; text-decoration: none; font-size: .9rem; padding: .35rem .7rem; border-radius: 2rem; }
.user a.on, .user a:hover { background: rgba(255,255,255,.12); color: #fff; }
.user .who::before { content: "👤 "; }
body.auth nav, body.auth .user { visibility: hidden; }
.login { max-width: 25rem; margin: 3rem auto; background: var(--card); border-radius: 1.2rem; padding: 2rem 2rem 1.6rem; box-shadow: 0 8px 30px rgba(11,31,44,.1); display: flex; flex-direction: column; gap: .8rem; }
.login h1 { margin: .2rem 0 0; } .login p { margin: 0; color: var(--muted); font-size: .92rem; }
.logo.big { width: 3rem; height: 3rem; font-size: 2rem; display: grid; place-items: center; border-radius: .8rem; background: var(--c); color: #fff; font-weight: 800; }
.login label, .form label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: .25rem; }
.login input, .form input, .form select, .filters select, form.inline input { font: inherit; padding: .55rem .7rem; border: 1.5px solid #c9d3da; border-radius: .6rem; background: #fff; }
.login input:focus, .form input:focus { outline: none; border-color: var(--c); }
.login .err { color: var(--bad); min-height: 1.2em; font-weight: 600; }
.form { display: flex; flex-direction: column; gap: .7rem; max-width: 26rem; margin-bottom: 1rem; }
.form.row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; max-width: none; }
.form.row label { flex: 1 1 10rem; }
.narrow { max-width: 40rem; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: .7rem 1.2rem; border-radius: .8rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 99; }
.toast.bad { background: var(--bad); }
.admin-tabs { margin-bottom: 1rem; flex-wrap: wrap; }
#adm .content { margin-bottom: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpis div { background: var(--card); border-radius: 1rem; padding: 1rem 1.2rem; box-shadow: 0 2px 10px rgba(11,31,44,.05); border-top: 4px solid var(--c); }
.kpis.small div { box-shadow: none; background: var(--bg); }
.kpis b { display: block; font-size: 1.8rem; color: var(--dark); line-height: 1.1; } .kpis span { font-size: .82rem; color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; }
.heatwrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 3px; font-size: .8rem; }
table.heat th { padding: .3rem .25rem; text-align: center; font-size: .75rem; }
table.heat td { text-align: center; min-width: 2.1rem; height: 2.1rem; border-radius: .35rem; padding: 0 .2rem; font-weight: 700; color: #20313d; position: relative; }
table.heat td:first-child { text-align: left; white-space: nowrap; background: none !important; padding-right: .6rem; }
table.heat td i { position: absolute; top: 1px; right: 3px; font-size: .5rem; font-style: normal; color: #20313d; }
table.heat tr:nth-child(even) td { background: inherit; }
table.pick tr[data-u] { cursor: pointer; } table.pick tr.sel td { background: color-mix(in srgb, var(--c) 18%, #fff) !important; }
.bars { display: flex; gap: 3px; align-items: flex-end; height: 7rem; margin: .6rem 0 1.2rem; padding-bottom: 1.1rem; }
.bars div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.bars i { display: block; background: var(--c); border-radius: .2rem .2rem 0 0; min-height: 1px; }
.bars span { position: absolute; bottom: -1.1rem; width: 100%; text-align: center; font-size: .6rem; color: var(--muted); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pill { padding: .1rem .55rem; border-radius: 1rem; font-weight: 700; white-space: nowrap; }
.btn.sm { padding: .3rem .7rem; font-size: .8rem; }
td.act { white-space: nowrap; } td.act .btn { margin-right: .3rem; }
form.inline { display: flex; gap: .3rem; } form.inline input { padding: .3rem .5rem; width: 10rem; }
.dl .btn { display: inline-block; text-decoration: none; margin: 0 .3rem .4rem 0; }
@media (max-width: 700px) { .user a:not(.who) { display: none; } }
.warn { background: #fdecea; border-left: 5px solid var(--bad); }
#adm td .mini { width: 7rem; min-width: 5rem; }
.filters select { width: auto; max-width: 100%; }
