/* ==========================================================================
   Französisch Prüfungstraining – Stylesheet
   Reihenfolge: Basis · Layout · Komponenten · Module · Übungs-Engine · Views
   ========================================================================== */

/* ------------------------------ 1. Basis -------------------------------- */
:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e3e8f0;
  --line-2: #eef2f8;
  --bg: #f5f7fb;
  --card: #ffffff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #e11d48;
  --green: #059669;
  --orange: #ea580c;
  --amber: #b45309;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, .22);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .35);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --nav-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -8%, #e8efff 0%, rgba(232, 239, 255, 0) 62%),
    radial-gradient(900px 460px at 6% -12%, #fdeef2 0%, rgba(253, 238, 242, 0) 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: clamp(1.55rem, 1.1rem + 1.5vw, 2.1rem); }
h2 { font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem); }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .9rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

strong, b { font-weight: 650; }
em { font-style: italic; }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .88em;
  background: #eef2f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

svg { width: 20px; height: 20px; flex: none; }

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(37, 99, 235, .18); }

/* ------------------------------ 2. Kopfzeile ---------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 22px;
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(90deg, #2563eb 0 33.3%, #ffffff 33.3% 66.6%, #e11d48 66.6%);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; letter-spacing: -.01em; }
.brand-text small { font-size: .7rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 10px;
  color: #475569;
  font-size: .895rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav-link svg { width: 17px; height: 17px; }
.nav-link:hover { background: #f1f5fb; color: var(--ink); text-decoration: none; }
.nav-link.active { background: #eaf1ff; color: var(--blue-dark); }

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

/* ------------------------------ 3. Layout ------------------------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; width: 100%; }

main.wrap { padding-top: 30px; padding-bottom: 64px; flex: 1 0 auto; }

.section { margin-bottom: 38px; }
.section:last-child { margin-bottom: 0; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sec-head h1, .sec-head h2 { margin: 0; }
.sec-head .link { font-size: .86rem; }

.two-col {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 22px;
  margin-bottom: 38px;
  align-items: start;
}
.two-col .section { margin-bottom: 0; }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 18px;
}
.backlink:hover { color: var(--ink); text-decoration: none; }
.backlink svg { width: 15px; height: 15px; transform: rotate(180deg); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.card.soft { box-shadow: var(--shadow-sm); }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ------------------------------ 4. Elemente ----------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #f1f5fb;
  color: var(--ink);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { text-decoration: none; background: #e8eefa; }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .85);
}
.btn.primary:hover { background: var(--blue-dark); }

.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: #c3cddd; background: #fbfcff; }

.btn.lg { padding: 13px 22px; font-size: 1rem; border-radius: 14px; }
.btn.tiny { padding: 5px 10px; font-size: .78rem; border-radius: 9px; gap: 5px; }
.btn.tiny svg { width: 14px; height: 14px; }
.btn.danger { color: #be123c; }
.btn.danger:hover { background: #fff1f4; border-color: #fbc9d4; }

.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn.pulse { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.link { font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef3fa;
  color: #475569;
  font-size: .8rem;
  font-weight: 650;
  white-space: nowrap;
}
.chip.ok { background: #e6f7ef; color: #047857; }
.chip.bad { background: #fdecef; color: #be123c; }
.chip.warn { background: #fef3c7; color: var(--amber); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: #eef3fa;
  color: #475569;
}
.badge.lv1 { background: #e6f7ef; color: #047857; }
.badge.lv2 { background: #fef3c7; color: #92400e; }
.badge.lv3 { background: #fdecef; color: #be123c; }
.badge.topic { background: #eef2ff; color: #3730a3; }

.bar {
  height: 9px;
  border-radius: 999px;
  background: #e9eef7;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width .45s cubic-bezier(.2, .8, .2, 1);
}
.bar.thin { height: 6px; }

.ok { color: var(--green); }
.bad { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ------------------------------ 5. Dashboard-Hero ----------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, .75fr);
  gap: 34px;
  padding: 38px 40px;
  border-radius: 26px;
  background:
    radial-gradient(700px 380px at 92% -30%, rgba(99, 102, 241, .55), transparent 70%),
    linear-gradient(135deg, #0e1e3d 0%, #1b3a7d 55%, #312e81 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  margin-bottom: 38px;
}

.hero-main h1 { margin: 10px 0 12px; color: #fff; }
.hero-sub { color: rgba(255, 255, 255, .82); font-size: 1.02rem; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 22px; }
.hero .btn.primary { background: #fff; color: #1e3a8a; box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .7); }
.hero .btn.primary:hover { background: #eff4ff; }
.hero .btn.ghost {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
}
.hero .btn.ghost:hover { background: rgba(255, 255, 255, .18); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #bcd0f7;
}
.eyebrow svg { width: 15px; height: 15px; }

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.ring {
  --p: 0;
  --track: #e6ebf5;
  --hole: #fff;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--c, var(--blue)) calc(var(--p) * 1%), var(--track) 0);
  flex: none;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--hole);
  z-index: 0;
}
.ring > span {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
}
.ring > span small {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.ring.big { width: 148px; height: 148px; }
.ring.big::before { inset: 11px; }
.ring.big > span { font-size: 2.1rem; }
.ring.big > span small { font-size: .6rem; }

.hero .ring { --track: rgba(255, 255, 255, .18); --hole: #17264b; }
.hero .ring > span { color: #fff; }
.hero .ring > span small { color: rgba(255, 255, 255, .65); }

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.hero-kpis > div {
  text-align: center;
  padding: 9px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hero-kpis b { display: block; font-size: 1.15rem; color: #fff; }
.hero-kpis span { font-size: .68rem; color: rgba(255, 255, 255, .65); text-transform: uppercase; letter-spacing: .06em; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi b { font-size: 1.5rem; letter-spacing: -.02em; }
.kpi span { font-size: .78rem; color: var(--muted); }

/* ------------------------------ 6. Modulkarten -------------------------- */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 16px;
}

.mod-card {
  --c: var(--blue);
  --cs: #eaf1ff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 15px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mod-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--c);
  box-shadow: var(--shadow-md);
}

.mod-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--cs);
  color: var(--c);
  display: grid;
  place-items: center;
}
.mod-icon svg { width: 23px; height: 23px; }

.mod-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mod-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mod-head strong { font-size: 1.05rem; }
.mod-count { font-size: .75rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.mod-card p { margin: 0; }
.mod-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mod-foot .small { font-size: .78rem; line-height: 1.35; }
.mod-go { color: var(--c); font-size: .82rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; align-self: flex-end; }
.mod-go svg { width: 15px; height: 15px; }

.c-bleu { --c: #2563eb; --cs: #eaf1ff; }
.c-rouge { --c: #e11d48; --cs: #fdeef2; }
.c-gruen { --c: #059669; --cs: #e6f7ef; }
.c-orange { --c: #ea580c; --cs: #fdf0e6; }

/* ------------------------------ 7. Modulseite --------------------------- */
.mod-hero {
  --c: var(--blue);
  --cs: #eaf1ff;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 28px 30px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--cs), #fff 70%);
  border: 1px solid var(--line);
  margin-bottom: 30px;
}
.mod-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: #fff;
  color: var(--c);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.mod-hero-icon svg { width: 27px; height: 27px; }
.mod-hero h1 { margin-bottom: 6px; }
.mod-hero .eyebrow { color: var(--c); }
.mod-hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 232px;
  flex: none;
  margin-left: auto;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
}
.mod-hero-side .bar,
.mod-hero-side .btn { width: 100%; }
.mod-hero-side .ring { --c: var(--c); }
.source { font-size: .8rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

.th-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #eaf1ff;
  color: var(--blue);
  font-size: .8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.th-body { padding: 0 4px 18px; }

.theory { margin-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.theory:last-of-type { border-bottom: 0; }
.theory > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  font-weight: 650;
  border-radius: 10px;
}
.theory > summary::-webkit-details-marker { display: none; }
.theory > summary:hover { color: var(--blue-dark); }
.theory > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
  transition: transform .2s ease;
}
.theory[open] > summary::after { content: "–"; }
.theory-help { font-size: .82rem; color: var(--muted); }

.theory-list { padding: 4px 4px 18px; }
.theory-block { margin-bottom: 18px; }
.theory-block:last-child { margin-bottom: 0; }

.table-card { margin: 14px 0 18px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; }

.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
.tbl th {
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
  white-space: nowrap;
}
.tbl td { padding: 9px 13px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #f9fbff; }
.tbl td:first-child { font-weight: 600; }

.vocab-tbl td:nth-child(2) { color: var(--muted); }

.ex-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.ex-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  padding: 11px 14px;
  background: #fafbfe;
  border: 1px solid var(--line-2);
  border-radius: 12px;
}
.ex-fr { font-family: var(--serif); font-size: .98rem; }
.ex-de { color: var(--muted); font-size: .87rem; }

.tips { margin: 14px 0 0; padding-left: 20px; }
.tips li { margin-bottom: 7px; }
.tips li::marker { color: var(--blue); }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.topic-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: .92rem;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.topic-card:hover {
  text-decoration: none;
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.topic-card small { display: block; color: var(--muted); font-weight: 600; font-size: .74rem; }
.tc-arrow { margin-left: auto; color: var(--blue); }
.tc-arrow svg { width: 16px; height: 16px; }

.note-card {
  border-left: 3px solid var(--amber);
  background: #fffbeb;
  border-radius: 0 14px 14px 0;
  padding: 14px 16px;
  font-size: .9rem;
  color: #78350f;
}

/* ------------------------------ 8. Lesen --------------------------------- */
.text-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.text-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.text-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
}
.text-card h3 { font-family: var(--serif); font-size: 1.15rem; }
.tc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; font-size: .82rem; }

.reader-head { margin-bottom: 20px; }
.reader-head h1 { font-family: var(--serif); }
.text-body {
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.78;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
}
.text-body .para { margin-bottom: 18px; }
.text-body .para p { margin: 0 0 6px; }
.text-body .para p.de {
  display: none;
  font-family: var(--font);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 12px;
}
.text-body.show-tr .para p.de { display: block; }

.vocab-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.vchip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f3f6fc;
  border: 1px solid var(--line-2);
  font-size: .85rem;
}
.vchip .fr { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.vchip .de { color: var(--muted); font-size: .82rem; }
.vchip .de::before { content: "·"; margin-right: 6px; color: #cbd5e1; }
.vocab-chips.hide-de .vchip .de { display: none; }

button.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}
button.link:hover { text-decoration: underline; }

/* ------------------------------ 9. Trainer-Setup ------------------------ */
.setup { max-width: 780px; }
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.setup-grid > label,
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.setup-grid > label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.field label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

select, input[type="text"], textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd9e8;
  border-radius: 11px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.inline-select { width: auto; min-width: 190px; }

.setup-modes { display: flex; gap: 10px; margin: 6px 0 4px; flex-wrap: wrap; }
.mode-btn {
  flex: 1 1 220px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  text-align: left;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.mode-btn > svg { margin-top: 2px; color: var(--blue); }
.mode-btn > span { display: flex; flex-direction: column; }
.mode-btn strong { display: block; font-size: .96rem; margin-bottom: 2px; }
.mode-btn span { font-size: .82rem; color: var(--muted); }
.mode-btn:hover { border-color: #b9c8de; }
.mode-btn.active { border-color: var(--blue); background: #f5f9ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }

.setup-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.setup-foot .btn { margin-left: auto; }

/* ------------------------------ 10. Übungs-Engine ----------------------- */
.sess { max-width: 820px; margin: 0 auto; }

.sess-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sess-title { display: flex; align-items: center; gap: 10px; }
.sess-title strong { font-size: 1.05rem; }
.sess-sub { font-size: .82rem; color: var(--muted); display: block; }
.sess-stats { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sess-bar { margin-bottom: 18px; }

.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
}
.iconbtn:hover { border-color: #c3cddd; background: #fbfcff; }
.iconbtn svg { width: 17px; height: 17px; transform: rotate(180deg); }

.qcard { padding: 26px 26px 20px; }
.qmeta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.qbody { font-size: 1.02rem; }
.qbody .qtext { margin-bottom: 14px; }
.qinstr { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }

.fill-sent {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 2.5;
}
.fill-sent .qtext { font-family: var(--font); font-size: .95rem; line-height: 1.6; }

input.blank {
  font: inherit;
  font-size: .98rem;
  font-weight: 650;
  color: var(--blue-dark);
  text-align: center;
  padding: 3px 8px;
  min-width: 92px;
  border: none;
  border-bottom: 2px solid #94a3b8;
  background: #f6f9ff;
  border-radius: 7px 7px 0 0;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
input.blank:focus {
  outline: none;
  border-bottom-color: var(--blue);
  background: #eef5ff;
  box-shadow: 0 3px 0 -1px rgba(37, 99, 235, .25);
}
input.blank.correct { border-bottom-color: var(--green); background: #edfbf4; color: #047857; }
input.blank.wrong { border-bottom-color: var(--red); background: #fff1f4; color: #be123c; }
input.blank[disabled] { opacity: 1; }

.opts { display: grid; gap: 10px; margin-top: 6px; }
.opts.tf { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: .96rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.opt:hover { border-color: #b9c8de; background: #fbfcff; }
.opt.sel { border-color: var(--blue); background: #f3f8ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.opt.correct { border-color: var(--green); background: #eefbf5; }
.opt.wrong { border-color: var(--red); background: #fff2f5; }
.opt.locked { cursor: default; }
.opt.locked:hover { border-color: inherit; }
.opt-k {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: #f1f5fb;
  color: #475569;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  flex: none;
}
.opt.sel .opt-k { background: var(--blue); color: #fff; }
.opt.correct .opt-k { background: var(--green); color: #fff; }
.opt.wrong .opt-k { background: var(--red); color: #fff; }

.order-answer {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1.5px dashed #c6d2e4;
  border-radius: 12px;
  background: #fbfcff;
  margin-bottom: 14px;
  font-family: var(--serif);
}
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.token {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid #cfd9e8;
  background: #fff;
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .12s ease, background .14s ease, border-color .14s ease;
}
.token:hover { background: #f3f8ff; border-color: #9dbdf5; }
.token.in-answer { background: #eaf1ff; border-color: #b6cdfb; color: var(--blue-dark); font-weight: 600; }
.token.locked { cursor: default; }

.match { display: grid; gap: 10px; }
.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  gap: 12px;
  align-items: center;
}
.match-fr { font-family: var(--serif); font-size: 1rem; }
.match-sel { font-size: .9rem; padding: 8px 10px; }
.match-row.correct .match-sel { border-color: var(--green); background: #f2fbf7; }
.match-row.wrong .match-sel { border-color: var(--red); background: #fff4f6; }

textarea.free-in { min-height: 92px; resize: vertical; font-size: 1rem; line-height: 1.55; }
.hintline { font-size: .82rem; color: var(--muted); margin-top: 8px; }

.qfoot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.qactions { display: flex; gap: 9px; flex-wrap: wrap; }
.qfoot .kb { font-size: .76rem; color: var(--muted); }

.hintbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  font-size: .9rem;
}
.hintbox svg { width: 18px; height: 18px; color: #d97706; margin-top: 2px; }

.fb { margin-top: 16px; border-radius: 14px; padding: 15px 16px; border: 1px solid var(--line); background: #f8fafc; }
.fb.good { background: #eefbf5; border-color: #bfeeda; }
.fb.bad { background: #fff2f5; border-color: #fbcdd7; }
.fb.neutral { background: #f5f8fd; border-color: #d8e3f4; }
.fb-head { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.fb-head svg { width: 18px; height: 18px; }
.fb.good .fb-head { color: #047857; }
.fb.bad .fb-head { color: #be123c; }
.fb.neutral .fb-head { color: #1d4ed8; }
.fb-sol { margin-top: 10px; font-family: var(--serif); font-size: 1.02rem; }
.fb-sol .lbl, .sol-text .lbl, .mr-sol .lbl {
  font-family: var(--font);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}
.fb-expl { margin-top: 10px; font-size: .9rem; color: var(--ink-2); }
.fb-extra { margin-top: 10px; font-size: .85rem; color: var(--muted); }

.sol-text { font-family: var(--serif); font-size: 1.05rem; }

.card.result { max-width: 720px; margin: 0 auto; padding: 30px; }
.res-top { display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.res-top h2 { margin-bottom: 4px; }
.res-list { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 22px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.res-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: #fbfcfe;
  font-size: .9rem;
}
.res-row .res-q { min-width: 0; }
.res-row .res-sol { font-family: var(--serif); color: var(--muted); font-size: .88rem; margin-top: 2px; }
.res-row .res-sol .lbl { font-family: var(--sans); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); margin-right: 6px; }
.res-row .res-q { color: var(--ink-2); }
.res-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------ 11. Statistik --------------------------- */
.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(80px, 1fr) 58px auto;
  align-items: center;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-2);
}
.stat-row:last-child { border-bottom: 0; }
.sr-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.sr-bar { min-width: 0; }
.sr-val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.sr-val.good { color: var(--green); }
.sr-val.mid { color: #b45309; }
.sr-val.bad { color: var(--red); }
.sr-mini { font-size: .78rem; color: var(--muted); text-align: right; white-space: nowrap; }
.sr-mini .ok { color: #059669; font-weight: 700; }
.sr-mini .bad { color: #e11d48; font-weight: 700; }

/* ------------------------------ 12. Fehler ------------------------------ */
.mist-group { margin-bottom: 26px; }
.mg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mg-head h3 { margin: 0; }
.mist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
}
.mr-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mr-q { font-size: .92rem; }
.mr-sol { font-family: var(--serif); font-size: .88rem; color: var(--muted); }
.mr-side { display: flex; align-items: center; gap: 10px; flex: none; }
.mr-count { font-size: .76rem; font-weight: 700; color: var(--red); white-space: nowrap; }

/* ------------------------------ 13. Karteikarten ------------------------ */
.deck-sub { margin: 4px 0 16px; }
.deck-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.flash-card {
  position: relative;
  margin: 18px 0;
  min-height: 230px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #ffffff, #f6f9ff 75%);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  user-select: none;
  transition: box-shadow .18s ease, transform .18s ease;
}
.flash-card:hover { box-shadow: var(--shadow-lg); }
.fc-side, .fc-back {
  min-height: 230px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}
.fc-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.fc-front {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  line-height: 1.3;
  color: var(--ink);
}
.fc-sub { max-width: 46ch; }
.fc-answer { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); font-weight: 650; color: var(--blue-dark); }
.fc-back { display: none; }
.flash-card.flipped .fc-side { display: none; }
.flash-card.flipped .fc-back { display: flex; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.fc-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 6px 0 14px; }
.fc-actions .btn { min-width: 132px; }
.bad-btn { background: #fff1f4; border-color: #fbcdd7; color: #be123c; }
.bad-btn:hover { background: #ffe6ec; }

/* ------------------------------ 14. Hilfe ------------------------------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.help-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.help-card h3 { margin: 10px 0 6px; }
.help-card p { font-size: .9rem; color: var(--ink-2); }
.hc-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #eaf1ff;
  color: var(--blue);
}
.hc-icon svg { width: 20px; height: 20px; }

.plan { margin: 0; padding-left: 20px; }
.plan li { margin-bottom: 10px; }
.plan li::marker { color: var(--blue); font-weight: 700; }

/* ------------------------------ 15. Prüfung ----------------------------- */
.exam-hero {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 28px 30px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fdeef2, #fff 65%);
  border: 1px solid var(--line);
  margin-bottom: 26px;
}
.exam-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: #fff;
  color: var(--rouge, var(--red));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.exam-hero-icon svg { width: 27px; height: 27px; }
.exam-hero .eyebrow { color: var(--red); }
.exam-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rules { margin: 14px 0 0; padding-left: 20px; }
.rules li { margin-bottom: 6px; }

.exam-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.exam-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fafbfe;
  font-size: .88rem;
}
.exam-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.exam-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.exam-pct.good { color: var(--green); }
.exam-pct.mid { color: #b45309; }
.exam-pct.bad { color: var(--red); }
.exam-last { margin: 10px 0 12px; display: flex; flex-direction: column; gap: 6px; }

/* ------------------------------ 16. Schwächen / Fehlerbox --------------- */
.weak-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-2);
}
.weak-row:last-child { border-bottom: 0; }
.weak-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.weak-rate { font-weight: 700; font-variant-numeric: tabular-nums; }
.weak-rate.low { color: var(--red); }
.weak-rate.mid { color: #b45309; }
.weak-rate.high { color: var(--green); }

.mistake-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff6f8;
  border: 1px solid #fbcdd7;
  margin-bottom: 12px;
}
.mb-num { font-size: 1.9rem; font-weight: 750; color: var(--red); line-height: 1; font-variant-numeric: tabular-nums; }
.mb-txt { display: flex; flex-direction: column; line-height: 1.3; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.quick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.quick:hover { text-decoration: none; border-color: var(--blue); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.quick > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.q-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eaf1ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
}
.q-icon svg { width: 18px; height: 18px; }

/* ------------------------------ 17. Leerzustand / Toast ----------------- */
.empty { text-align: center; padding: 34px 24px; }
.empty h3 { margin: 12px 0 6px; }
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e6f7ef;
  color: var(--green);
  display: grid;
  place-items: center;
  margin: 0 auto;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty .btn { margin-top: 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 24px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: .9rem;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: #92400e; }

/* ------------------------------ 18. Fusszeile --------------------------- */
.footer { border-top: 1px solid var(--line); background: rgba(255, 255, 255, .7); }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 20px;
  padding-bottom: 24px;
  font-size: .8rem;
  color: var(--muted);
}
.footer-inner nav { display: flex; gap: 14px; flex-wrap: wrap; }

/* ------------------------------ 19. Responsive -------------------------- */
@media (max-width: 1180px) {
  .nav-link { padding: 8px 10px; }
  .nav-link span { display: none; }
  .nav-link { gap: 0; }
}

@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; padding: 30px; gap: 26px; }
  .hero-side { flex-direction: row; justify-content: flex-start; gap: 22px; }
  .hero-kpis { grid-template-columns: repeat(3, 1fr); max-width: 320px; }
  .two-col { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: minmax(0, 1fr) 92px 52px auto; }
}

@media (max-width: 780px) {
  main.wrap { padding-top: 22px; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .brand-text small { display: none; }
  .nav { gap: 0;
    justify-content: flex-start;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  }
  .nav-link { padding: 8px 9px; font-size: .84rem; }
  .nav-link span { display: none; }
  .nav-link.active span { display: inline; }
  .nav-link svg { width: 19px; height: 19px; }
  .wrap { padding: 0 16px; }
  .card { padding: 20px; }
  .qcard { padding: 20px 18px 16px; }
  .mod-hero, .exam-hero { padding: 22px; flex-wrap: wrap; }
  .mod-hero-side {
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }
  .mod-hero-side .ring { width: 74px; height: 74px; }
  .mod-hero-side .ring > span { font-size: 1rem; }
  .mod-hero-side .bar { flex: 1 1 120px; width: auto; }
  .mod-hero-side .btn { width: auto; }
  .res-top { flex-direction: column; align-items: flex-start; gap: 14px; }
  .stat-row { grid-template-columns: minmax(0, 1fr) 56px auto; }
  .stat-row .sr-bar { display: none; }
  .deck-progress { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  h1 { font-size: 1.4rem; }
  .hero { padding: 22px; border-radius: 20px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .hero-side { flex-direction: column; align-items: flex-start; }
  .hero .ring.big { width: 118px; height: 118px; }
  .hero .ring.big > span { font-size: 1.6rem; }
  .mod-card { grid-template-columns: 1fr; }
  .mod-icon { width: 40px; height: 40px; }
  .opts.tf { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 1fr; gap: 6px; }
  .qfoot { flex-direction: column; align-items: stretch; }
  .qactions .btn { flex: 1 1 auto; }
  .sess-top { flex-direction: column; align-items: flex-start; }
  .sess-stats { width: 100%; }
  .fill-sent { font-size: 1rem; line-height: 2.8; }
  input.blank { min-width: 74px; font-size: .92rem; }
  .fc-side, .fc-back { padding: 24px 18px; min-height: 200px; }
  .fc-actions .btn { flex: 1 1 100%; }
  .mist-row { grid-template-columns: 1fr; gap: 8px; }
  .mr-side { justify-content: space-between; }
  .weak-row { grid-template-columns: minmax(0, 1fr) auto; }
  .weak-row .btn { grid-column: 1 / -1; justify-self: start; }
  .exam-row { grid-template-columns: 52px minmax(0, 1fr) auto; font-size: .84rem; }
  .inline-select { width: 100%; }
  .sec-head { align-items: flex-start; }
  .res-list { max-height: none; }
}

/* ------------------------------ 20. Motion / Druck ---------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .topbar, .footer, .btn, .fc-actions, .quick-grid, .toast { display: none !important; }
  body { background: #fff; }
  .card, .text-card { box-shadow: none; }
}
