/* ==========================================================================
   Web Learning – Design System
   Ruhig, hell, viel Weissraum. Systemschrift (SF Pro auf Apple-Geräten).
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
    Inter, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-3: #f0f0f3;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.16);

  --accent: #0071e3;
  --accent-text: #0066cc;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-soft-2: rgba(0, 113, 227, 0.18);
  --green: #12813f;
  --green-soft: rgba(18, 129, 63, 0.1);
  --red: #c8291f;
  --red-soft: rgba(200, 41, 31, 0.09);
  --amber: #9a6100;
  --amber-soft: rgba(154, 97, 0, 0.1);
  --violet: #6b40c9;

  --radius-xs: 10px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.055);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.05), 0 24px 60px rgba(0, 0, 0, 0.12);
  --sidebar-w: 264px;
  --content-w: 1060px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #141416;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #242428;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #86868b;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  --accent: #2997ff;
  --accent-text: #6cb4ff;
  --accent-soft: rgba(41, 151, 255, 0.15);
  --accent-soft-2: rgba(41, 151, 255, 0.24);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.14);
  --red: #ff6961;
  --red-soft: rgba(255, 105, 97, 0.14);
  --amber: #ffd60a;
  --amber-soft: rgba(255, 214, 10, 0.13);
  --violet: #bf9aff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 40px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { letter-spacing: -0.022em; line-height: 1.14; margin: 0; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft-2); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--surface); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Boot & Toast ---------- */
.boot {
  min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px;
}
.boot__mark {
  width: 52px; height: 52px; border-radius: 14px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 24px;
  animation: breathe 1.6s var(--ease) infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.94); opacity: 0.75; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg); z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease), transform 0.3s var(--ease-out);
  max-width: min(92vw, 460px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; gap: 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-right: 1px solid var(--line);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 2px;
  color: var(--text); text-decoration: none;
}
.sidebar__brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.sidebar__brand b { font-size: 15.5px; letter-spacing: -0.02em; }
.sidebar__brand small { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 450; letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-3); font-weight: 600; padding: 10px 10px 4px;
}
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px; color: var(--text);
  font-size: 14.5px; font-weight: 500; text-decoration: none;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav__item:hover { background: var(--surface-3); text-decoration: none; }
.nav__item:active { transform: scale(0.985); }
.nav__item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav__icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; opacity: 0.9; }
.nav__icon svg { width: 19px; height: 19px; }
.nav__item.is-active .nav__icon { opacity: 1; }
.nav__spacer { flex: 1; }

.sidebar__foot { display: flex; flex-direction: column; gap: 10px; }
.sidebar__progress {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.sidebar__progress b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.sidebar__progress small { display: block; color: var(--text-2); font-size: 11.5px; margin-top: 1px; }

.main { padding-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar__burger { display: none; }
.topbar__crumb { font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.topbar__crumb b { color: var(--text); font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page {
  max-width: var(--content-w); margin: 0 auto; padding: 30px 22px 90px;
  animation: pageIn 0.45s var(--ease-out) both;
}
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.mobilebar { display: none; }
.backdrop { display: none; }

/* ---------- Typography helpers ---------- */
.kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent-text);
}
.display { font-size: clamp(30px, 4.4vw, 44px); font-weight: 680; letter-spacing: -0.032em; line-height: 1.06; }
.h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 660; letter-spacing: -0.028em; }
.h2 { font-size: 22px; font-weight: 640; }
.h3 { font-size: 17px; font-weight: 620; letter-spacing: -0.015em; }
.lead { font-size: 17.5px; color: var(--text-2); line-height: 1.55; max-width: 68ch; }
.muted { color: var(--text-2); }
.tiny { font-size: 12.5px; color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 0.92em; }
strong, b { font-weight: 620; }

.page__head { margin-bottom: 26px; display: flex; flex-direction: column; gap: 10px; }
.page__head .row { margin-top: 6px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack--lg { gap: 22px; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 17px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.16s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.975); }
.btn svg { width: 17px; height: 17px; }
.btn--primary {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--accent-text); padding-inline: 10px; }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn--danger:hover { background: var(--red-soft); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.card--pad-lg { padding: 26px; }
.card--flush { padding: 0; overflow: hidden; }
.card--tint { background: var(--surface-2); }
.card__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card__head .spacer { flex: 1; }
.card__title { font-size: 15.5px; font-weight: 620; letter-spacing: -0.014em; }
.card__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.card--link { cursor: pointer; transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease); }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); text-decoration: none; }

.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: var(--surface);
  padding: 30px; box-shadow: var(--shadow-sm);
}
.hero__glow {
  position: absolute; width: 460px; height: 460px; right: -160px; top: -220px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft-2), transparent 68%);
  pointer-events: none; filter: blur(10px);
}
.hero > * { position: relative; }
.hero__greet { font-size: 13px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* ---------- Progress & stats ---------- */
.bar {
  height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; width: 100%;
}
.bar__fill {
  height: 100%; border-radius: inherit; background: var(--accent);
  transition: width 0.7s var(--ease-out);
}
.bar--green .bar__fill { background: var(--green); }
.bar--amber .bar__fill { background: var(--amber); }
.bar--red .bar__fill { background: var(--red); }
.bar--lg { height: 10px; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat__value { font-size: 28px; font-weight: 660; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat__label { font-size: 12.5px; color: var(--text-2); }
.stat__note { font-size: 12px; color: var(--text-3); }

.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring__bg { stroke: var(--surface-3); }
.ring__fg { stroke: var(--accent); transition: stroke-dashoffset 0.9s var(--ease-out); stroke-linecap: round; }
.ring__label {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.ring__label b { font-size: 26px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

.topic-line { display: grid; grid-template-columns: 1fr 46px; align-items: center; gap: 12px; }
.topic-line__name { font-size: 13.5px; font-weight: 550; margin-bottom: 6px; }

/* ---------- Pills / badges / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent; white-space: nowrap;
}
.pill--accent { background: var(--accent-soft); color: var(--accent-text); }
.pill--green { background: var(--green-soft); color: var(--green); }
.pill--amber { background: var(--amber-soft); color: var(--amber); }
.pill--red { background: var(--red-soft); color: var(--red); }
.pill--violet { background: color-mix(in srgb, var(--violet) 12%, transparent); color: var(--violet); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13px; cursor: pointer; color: var(--text-2);
  transition: all 0.16s var(--ease); font-weight: 500;
}
.chip:hover { background: var(--surface-3); }
.chip.is-on { background: var(--accent); border-color: transparent; color: #fff; }

/* ---------- Module cards ---------- */
.modcard { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.modcard__top { display: flex; align-items: center; gap: 10px; }
.modcard__icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); flex: none;
}
.modcard__icon svg { width: 19px; height: 19px; }
.modcard__goal { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }

/* ---------- Prose content ---------- */
.prose { display: flex; flex-direction: column; gap: 14px; max-width: 74ch; }
.prose p { color: var(--text); }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 7px; }
.prose li::marker { color: var(--text-3); }
.prose code, .inline-code {
  font-family: var(--mono); font-size: 0.87em; background: var(--surface-3);
  padding: 1.5px 5px; border-radius: 6px; border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.prose h3 { margin-top: 10px; }
.prose a { font-weight: 500; }
.prose--wide { max-width: none; }

.code {
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
  overflow: hidden; font-family: var(--mono); font-size: 13px; line-height: 1.65;
}
.code__bar {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface-3);
  font-family: var(--font); font-size: 11.5px; color: var(--text-2); font-weight: 600;
}
.code__bar .spacer { flex: 1; }
.code pre {
  margin: 0; padding: 13px 15px; overflow-x: auto; white-space: pre; tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
.code pre code { font-family: inherit; background: none; border: 0; padding: 0; }
.code--bad { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.code--good { border-color: color-mix(in srgb, var(--green) 30%, var(--line)); }
.code__copy {
  background: none; border: 0; color: var(--text-2); cursor: pointer; font-size: 11.5px;
  padding: 2px 6px; border-radius: 6px; font-weight: 600;
}
.code__copy:hover { background: var(--surface-2); color: var(--text); }

/* Syntax-Farben (dezent, beide Modi) */
.tok-tag { color: #c2410c; }
.tok-attr { color: #7c3aed; }
.tok-str { color: #0f766e; }
.tok-com { color: var(--text-3); font-style: italic; }
.tok-kw { color: #b91c6a; }
.tok-num { color: #1d4ed8; }
.tok-prop { color: #0369a1; }
[data-theme="dark"] .tok-tag { color: #ff9d6b; }
[data-theme="dark"] .tok-attr { color: #c4a7ff; }
[data-theme="dark"] .tok-str { color: #6ee7b7; }
[data-theme="dark"] .tok-kw { color: #ff8fc3; }
[data-theme="dark"] .tok-num { color: #93c5fd; }
[data-theme="dark"] .tok-prop { color: #7dd3fc; }

.note {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  font-size: 14px; line-height: 1.5;
}
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent-text); }
.note--warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.note--warn svg { color: var(--amber); }
.note--ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.note--ok svg { color: var(--green); }
.note--bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 22%, transparent); }
.note--bad svg { color: var(--red); }
.note__body { display: flex; flex-direction: column; gap: 5px; }
.note__body b { font-weight: 620; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 420px; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td code { font-family: var(--mono); font-size: 0.9em; }
.table--fixed { table-layout: fixed; }

.steps { display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 13px; padding-bottom: 16px; position: relative; }
.step:last-child { padding-bottom: 0; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 650;
  position: relative; z-index: 1;
}
.step:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 27px; bottom: 0; width: 1px; background: var(--line-strong);
}
.step__body { padding-top: 2px; display: flex; flex-direction: column; gap: 5px; }
.step__body b { font-size: 14.5px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare__col { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px; background: var(--surface-2); }
.compare__col h4 { font-size: 13.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }

details.disclosure {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  padding: 0; overflow: hidden;
}
details.disclosure > summary {
  cursor: pointer; padding: 12px 15px; font-weight: 570; font-size: 14px; list-style: none;
  display: flex; align-items: center; gap: 9px;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after {
  content: "+"; margin-left: auto; color: var(--text-3); font-weight: 400; font-size: 17px;
}
details.disclosure[open] > summary::after { content: "−"; }
details.disclosure > .disclosure__body { padding: 0 15px 15px; display: flex; flex-direction: column; gap: 12px; }

.term { border-bottom: 1px dotted var(--line-strong); cursor: help; }

/* ---------- Interactives ---------- */
.demo-stage {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--surface-3) 8px, var(--surface-3) 9px);
  padding: 14px; min-height: 120px;
}
.demo-box {
  background: var(--accent-soft); border: 1.5px solid var(--accent); color: var(--accent-text);
  border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  padding: 12px; min-width: 44px; min-height: 44px; text-align: center;
}
.demo-box--alt { background: var(--surface); border-color: var(--line-strong); color: var(--text-2); border-style: dashed; }
.demo-item--x { border-radius: 8px; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; padding: 14px 8px; }

.playground { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.playground__controls { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.field select, .field input[type="text"], .field input[type="number"], .field textarea, .input {
  font: inherit; font-size: 13.5px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  width: 100%; transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field select:focus, .field input:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.55; font-family: var(--mono); font-size: 13px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* URL analyzer */
.urlz { display: flex; flex-wrap: wrap; gap: 2px; font-family: var(--mono); font-size: 14px; line-height: 1.9; word-break: break-all; }
.urlz__part {
  padding: 2px 3px; border-radius: 5px; cursor: pointer; border-bottom: 2px solid transparent;
  transition: background 0.15s var(--ease);
}
.urlz__part:hover, .urlz__part.is-on { background: var(--accent-soft); border-bottom-color: var(--accent); }
.urlz__desc { margin-top: 10px; font-size: 13.5px; color: var(--text-2); min-height: 40px; }
.urlz__desc b { color: var(--text); }

/* Flex/Grid preview */
.layout-preview { min-height: 230px; display: flex; }

/* ---------- Quiz ---------- */
.quiz { display: flex; flex-direction: column; gap: 14px; }
.quiz__q { font-size: 15.5px; font-weight: 570; line-height: 1.45; }
.quiz__prompt-code { margin-top: 2px; }
.quiz__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.quiz__points { font-variant-numeric: tabular-nums; }
.quiz__body { display: flex; flex-direction: column; gap: 12px; }

.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface);
  cursor: pointer; font-size: 14.5px; line-height: 1.45; width: 100%;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.option:hover:not([disabled]) { background: var(--surface-2); border-color: var(--text-3); }
.option:active:not([disabled]) { transform: scale(0.994); }
.option__key {
  width: 21px; height: 21px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; font-size: 11px; font-weight: 650; color: var(--text-2);
  margin-top: 1px;
}
.option.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.option.is-selected .option__key { background: var(--accent); border-color: var(--accent); color: #fff; }
.option.is-correct { border-color: var(--green); background: var(--green-soft); }
.option.is-correct .option__key { background: var(--green); border-color: var(--green); color: #fff; }
.option.is-wrong { border-color: var(--red); background: var(--red-soft); }
.option.is-wrong .option__key { background: var(--red); border-color: var(--red); color: #fff; }
.option[disabled] { cursor: default; opacity: 0.95; }
.option code { font-family: var(--mono); font-size: 0.9em; }

.quiz--exam .option { cursor: pointer; }

.answer-input {
  font: inherit; font-size: 14.5px; padding: 10px 13px; border-radius: 10px; width: 100%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-family: var(--mono);
}
.answer-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.answer-input.is-correct { border-color: var(--green); background: var(--green-soft); }
.answer-input.is-wrong { border-color: var(--red); background: var(--red-soft); }

.blank {
  display: inline-block; min-width: 74px; padding: 1px 6px; border-bottom: 2px solid var(--accent);
  font-family: var(--mono); font-size: 0.94em; background: var(--accent-soft); border-radius: 4px 4px 0 0;
}
.blank-input {
  font-family: var(--mono); font-size: 13px; padding: 4px 8px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  min-width: 96px; width: 130px; margin: 2px 2px;
}
.blank-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.blank-input.is-correct { border-color: var(--green); background: var(--green-soft); }
.blank-input.is-wrong { border-color: var(--red); background: var(--red-soft); }

.matchgrid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 10px; }
.matchgrid__term { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 13.5px; display: flex; align-items: center; }
.matchgrid__def { display: flex; flex-direction: column; gap: 4px; }
.matchgrid__def select { font-size: 12.5px; padding: 6px 8px; }
.matchcol { display: flex; flex-direction: column; gap: 8px; }

.orderlist { display: flex; flex-direction: column; gap: 6px; }
.orderitem {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13.5px;
  cursor: pointer; text-align: left;
}
.orderitem:hover { background: var(--surface-2); }
.orderitem.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.orderitem__n { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 650; flex: none; }
.orderitem.is-picked .orderitem__n { background: var(--accent); color: #fff; }
.orderitem.is-correct { border-color: var(--green); background: var(--green-soft); }
.orderitem.is-wrong { border-color: var(--red); background: var(--red-soft); }

.codearea {
  width: 100%; min-height: 130px; font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); resize: vertical; tab-size: 2;
}
.codearea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.linepick { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); font-family: var(--mono); font-size: 12.8px; }
.linepick__row { display: flex; gap: 10px; padding: 2px 10px; cursor: pointer; white-space: pre; }
.linepick__row:hover { background: var(--surface-3); }
.linepick__row.is-on { background: var(--accent-soft); }
.linepick__row.is-answer { background: var(--green-soft); }
.linepick__row.is-picked-wrong { background: var(--red-soft); }
.linepick__n { color: var(--text-3); width: 20px; text-align: right; flex: none; user-select: none; }
.linepick__code { overflow-x: auto; }

.feedback {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: 11px; font-size: 13.8px; line-height: 1.5;
  border: 1px solid var(--line); background: var(--surface-2);
  animation: fbIn 0.3s var(--ease-out) both;
}
@keyframes fbIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.feedback__icon { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--text-3); }
.feedback--ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.feedback--ok .feedback__icon { background: var(--green); }
.feedback--bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.feedback--bad .feedback__icon { background: var(--red); }
.feedback--info .feedback__icon { background: var(--accent); }
.feedback__body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.feedback__title { font-weight: 620; font-size: 14px; }
.feedback__body p { color: var(--text); }
.feedback__goal { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: baseline; }

.exercise {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.exercise__head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.exercise__num {
  width: 25px; height: 25px; border-radius: 8px; background: var(--surface-3); font-size: 12px;
  display: grid; place-items: center; font-weight: 650; flex: none; color: var(--text-2);
}
.exercise__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.exercise.is-done { border-color: color-mix(in srgb, var(--green) 30%, var(--line)); }

.runner { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.runner__head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-3); font-size: 12px; font-weight: 600; color: var(--text-2); }
.runner__out {
  margin: 0; padding: 11px 14px; font-family: var(--mono); font-size: 12.8px; white-space: pre-wrap;
  background: var(--surface-2); min-height: 46px; max-height: 260px; overflow: auto;
}
.runner__out.is-ok { color: var(--green); }
.runner__out.is-bad { color: var(--red); }

/* ---------- Exercise list / filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtercount { margin-left: auto; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.listrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; color: var(--text); text-decoration: none;
}
.listrow:last-child { border-bottom: 0; }
.listrow:hover { text-decoration: none; }
.listrow:hover .listrow__title { color: var(--accent-text); }
.listrow__title { font-weight: 550; transition: color 0.15s var(--ease); }
.listrow__meta { font-size: 12px; color: var(--text-2); }

/* ---------- Exam ---------- */
.exam-top {
  position: sticky; top: var(--header-h); z-index: 30; margin: -4px -22px 18px; padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.timer {
  display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
  font-size: 16px; font-weight: 640; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); letter-spacing: -0.01em;
}
.timer.is-warn { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-soft); }
.timer.is-warn .timer__dot { animation: blink 1s steps(2) infinite; }
.timer__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
@keyframes blink { 50% { opacity: 0.2; } }
.exam-progress { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px; }
.exam-progress .bar { max-width: 260px; }

.qlist { display: flex; flex-wrap: wrap; gap: 5px; }
.qlist__item {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 11.5px; font-weight: 600; cursor: pointer;
  display: grid; place-items: center; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.qlist__item.is-answered { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.qlist__item.is-current { outline: 2px solid var(--accent); outline-offset: 1px; }
.qlist__item.is-flagged { box-shadow: inset 0 -3px 0 var(--amber); }

.result-hero { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.grade-badge {
  display: inline-flex; align-items: baseline; gap: 4px; font-size: 46px; font-weight: 680;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}

/* ---------- Cheatsheet ---------- */
.cheat-layout { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.cheat-panel { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 140px); overflow: auto; padding-right: 4px; }
.cheat-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cheat-group__head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); font-size: 12.5px; font-weight: 620; }
.cheat-group__body { padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.cheat-check { display: flex; gap: 8px; align-items: flex-start; padding: 5px 7px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.cheat-check:hover { background: var(--surface-3); }
.cheat-check input { accent-color: var(--accent); margin: 3px 0 0; }
.cheat-preview-wrap { overflow: auto; padding: 16px; background: var(--surface-3); border-radius: var(--radius); border: 1px solid var(--line); }
.sheet-a4 {
  width: 210mm; min-height: 297mm; background: #fff; color: #111; padding: 7mm 7mm 6mm;
  box-shadow: var(--shadow); margin: 0 auto; font-family: var(--font); position: relative;
}
.sheet-a4__head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1.5px solid #111; padding-bottom: 2mm; margin-bottom: 2.5mm; }
.sheet-a4__title { font-size: calc(var(--cheat-fs, 8px) * 2.3); font-weight: 700; letter-spacing: -0.02em; }
.sheet-a4__meta { font-size: calc(var(--cheat-fs, 8px) * 1.25); color: #555; }
.cheat-body { column-count: 2; column-gap: 5mm; font-size: var(--cheat-fs, 8px); line-height: 1.28; color: #111; }
.cheat-sec { break-inside: avoid; margin-bottom: 2mm; }
.cheat-sec h4 {
  font-size: calc(var(--cheat-fs, 8px) * 1.22); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 0.4pt solid #999; margin-bottom: 0.8mm; padding-bottom: 0.3mm; font-weight: 700;
}
.cheat-sec ul { margin: 0; padding-left: 3.2mm; }
.cheat-sec li { margin: 0 0 0.55mm; }
.cheat-sec p { margin: 0 0 0.6mm; }
.cheat-sec code, .cheat-sec pre { font-family: var(--mono); font-size: 0.96em; }
.cheat-sec pre { margin: 0.4mm 0 0.8mm; white-space: pre-wrap; line-height: 1.2; }
.cheat-sec b { font-weight: 700; }
.cheat-empty { display: grid; place-items: center; min-height: 260px; color: var(--text-2); text-align: center; padding: 20px; }

/* ---------- Presentation topics ---------- */
.pres-card { display: flex; flex-direction: column; gap: 12px; }
.pres-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flashcard {
  perspective: 1400px; min-height: 190px; cursor: pointer;
}
.flashcard__inner {
  position: relative; width: 100%; height: 100%; min-height: 190px;
  transition: transform 0.6s var(--ease-out); transform-style: preserve-3d;
}
.flashcard.is-flipped .flashcard__inner { transform: rotateY(180deg); }
.flashcard__face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.flashcard__face--back { transform: rotateY(180deg); background: var(--surface-2); }
.flashcard__face .hint { font-size: 11.5px; color: var(--text-3); }

/* ---------- Misc utility ---------- */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 22px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; } .mb-4 { margin-bottom: 22px; }
.w-100 { width: 100%; }
.min0 { min-width: 0; }
.nowrap { white-space: nowrap; }
.scorebar { display: flex; height: 9px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.scorebar > span { height: 100%; }
.scorebar .ok { background: var(--green); }
.scorebar .part { background: var(--amber); }
.scorebar .miss { background: var(--red); }

.sr-list { display: flex; flex-direction: column; gap: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .cheat-layout { grid-template-columns: 1fr; }
  .cheat-panel { max-height: none; }
}

@media (max-width: 1000px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: 286px; transform: translateX(-104%); transition: transform 0.34s var(--ease-out);
    box-shadow: var(--shadow-lg); background: var(--surface);
  }
  .sidebar.is-open { transform: none; }
  .backdrop {
    display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.32);
    opacity: 0; pointer-events: none; transition: opacity 0.28s var(--ease);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  }
  .backdrop.is-on { opacity: 1; pointer-events: auto; }
  .main { padding-left: 0; }
  .topbar__burger { display: inline-grid; }
  .page { padding: 22px 18px 96px; }
  .exam-top { margin-inline: -18px; padding-inline: 18px; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobilebar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 44; padding: 7px; border-radius: 18px; gap: 2px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .mobilebar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: 12px; color: var(--text-2); font-size: 10.5px; font-weight: 550;
    text-decoration: none;
  }
  .mobilebar a.is-active { color: var(--accent-text); background: var(--accent-soft); }
  .mobilebar svg { width: 20px; height: 20px; }
  .hero { padding: 24px; }
  .ring { width: 96px; height: 96px; }
  .ring__label b { font-size: 22px; }
}

@media (max-width: 780px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .playground { grid-template-columns: 1fr; }
  .matchgrid { grid-template-columns: 1fr; }
  .display { font-size: 28px; }
  .lead { font-size: 16px; }
  .card { padding: 16px; }
  .hero { border-radius: 20px; }
  .sheet-a4 { width: 100%; min-height: 0; padding: 14px; }
  .cheat-body { column-count: 1; }
  .page__head { margin-bottom: 20px; }
  .result-hero { gap: 16px; }
  .grade-badge { font-size: 38px; }
  .table th, .table td { padding: 8px 9px; }
  .exercise { padding: 15px; }
  .exam-top { position: static; }
}

@media (max-width: 420px) {
  .options .option { font-size: 14px; padding: 10px 12px; }
  .mobilebar a span { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Druck
   ========================================================================== */
@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff !important; }
  .sidebar, .topbar, .mobilebar, .backdrop, .toast, .skip-link, .no-print { display: none !important; }
  .main { padding: 0 !important; }
  .page { padding: 0 !important; max-width: none; }
  .print-root { display: block !important; }
  .print-root .sheet-a4 {
    width: 210mm; min-height: 0; box-shadow: none; margin: 0; page-break-after: avoid;
    padding: 7mm 7mm 5mm;
  }
  .print-root .cheat-body { column-count: 2; }
  body.is-printing .app { display: none !important; }
}
