/* =====================================================================
   KI-Adventskalender · Stylesheet
   Konzept "Winterlicht": ruhige Papierflächen, eine klare Markenfarbe,
   ein warmes Licht als einziger Advents-Akzent. Details in docs/DESIGN.md.

   Aufbau
   1. Tokens: Grundwerte (themeunabhängig)
   2. Theme "standard" hell + dunkel (weitere Themes in css/themes/*.css)
   3. Basis, Typografie, Hilfsklassen
   4. Komponenten (Buttons, Formulare, Topbar, Login, Dashboard,
      Türchen, Tagesinhalte, Abschlusstest, Zertifikat, Rückmeldungen)
   5. Bewegung, Druck
   ===================================================================== */

/* ---------- 1. Tokens: Grundwerte ---------- */
:root {
  /* Schrift. Bewusst Systemschriften: keine Verbindung zu Google beim Laden
     (DSGVO, wichtig für Banken und Behörden). Eigene Schriften lassen sich
     selbst gehostet über @font-face in einem Theme ergänzen. */
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --display-weight: 600;
  --display-tracking: -0.01em;
  --eyebrow-tracking: 0.12em;

  /* Typo-Skala (mobil zuerst, wächst fließend) */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-md: 1rem;        /* 16 */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-2xl: clamp(1.5rem, 1.25rem + 1.2vw, 2.125rem);
  --fs-3xl: clamp(1.875rem, 1.4rem + 2vw, 2.75rem);

  /* Abstände (4er-Raster) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  --container: 1080px;
  --measure: 720px;
  --gutter: 16px;
  --topbar-h: 56px;

  /* Radien (Themes können sie kantiger machen) */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 420ms;

  /* Konfettifarben lesen app.js aus diesen Tokens */
  --confetti-1: var(--c-primary);
  --confetti-2: var(--c-light);
  --confetti-3: var(--c-success);
  --confetti-4: var(--c-text-muted);
}

@media (min-width: 768px) {
  :root { --gutter: 24px; --topbar-h: 64px; }
}
@media (min-width: 1100px) {
  :root { --gutter: 32px; }
}

/* ---------- 2. Theme "standard": Tannengrün, Papier, Kerzenlicht ---------- */
:root,
[data-theme~="standard"] {
  color-scheme: light;
  --c-bg: #f6f4ef;
  --c-surface: #ffffff;
  --c-surface-2: #efece5;
  --c-surface-3: #e7e3da;
  --c-line: #e2ddd3;
  --c-control: #857e70;
  --c-text: #18212b;
  --c-text-muted: #525b66;
  --c-primary: #1f5446;
  --c-primary-hover: #173f35;
  --c-on-primary: #ffffff;
  --c-primary-soft: #e3eee8;
  --c-primary-text: #1f5446;
  --c-light: #d9a441;
  --c-light-soft: #fbf0d9;
  --c-on-light: #2a1c02;
  --c-success: #1c7449;
  --c-success-soft: #e2f2e8;
  --c-danger: #b3261e;
  --c-danger-soft: #fbe9e7;
  --c-focus: #1f5446;
  --c-mark: #fbf0d9;

  --c-hero-bg: #14232f;
  --c-hero-bg-2: #1d3445;
  --c-hero-text: #f4f2ed;
  --c-hero-muted: #b4c0ca;
  --c-hero-line: rgba(255, 255, 255, 0.16);
  --c-hero-accent: #e4b55c;
  --c-hero-on-accent: #241802;
  --snow-opacity: 0.55;

  --shadow-1: 0 1px 2px rgba(24, 33, 43, 0.06), 0 1px 1px rgba(24, 33, 43, 0.04);
  --shadow-2: 0 2px 6px rgba(24, 33, 43, 0.06), 0 12px 32px rgba(24, 33, 43, 0.08);
  --shadow-glow: 0 0 0 4px rgba(217, 164, 65, 0.22), 0 10px 28px rgba(217, 164, 65, 0.22);

  /* Zertifikat: bleibt in beiden Modi ein helles Dokument */
  --cert-paper: #fffdf8;
  --cert-ink: #1b2430;
  --cert-muted: #5b6470;
  --cert-accent: #1f5446;
  --cert-accent-2: #b0822a;
  --cert-line: #d8cfbd;
}

@media (prefers-color-scheme: dark) {
  :root,
  [data-theme~="standard"] {
    color-scheme: dark;
    --c-bg: #0e151c;
    --c-surface: #152029;
    --c-surface-2: #111a22;
    --c-surface-3: #1b2833;
    --c-line: #263441;
    --c-control: #6d7c8a;
    --c-text: #e9edf1;
    --c-text-muted: #a3afbb;
    --c-primary: #86c9ae;
    --c-primary-hover: #a3d8c2;
    --c-on-primary: #0b1f18;
    --c-primary-soft: #1a3129;
    --c-primary-text: #93d3b9;
    --c-light: #e2b25a;
    --c-light-soft: #2c2415;
    --c-on-light: #241803;
    --c-success: #74d3a3;
    --c-success-soft: #16302a;
    --c-danger: #f28b81;
    --c-danger-soft: #3a1e1c;
    --c-focus: #9ddbc2;
    --c-mark: #3a3018;

    --c-hero-bg: #16242f;
    --c-hero-bg-2: #1f3443;
    --c-hero-line: rgba(255, 255, 255, 0.12);
    --snow-opacity: 0.4;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 0 4px rgba(226, 178, 90, 0.2), 0 10px 28px rgba(226, 178, 90, 0.18);
  }
}

/* ---------- 3. Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-text);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Start: App erst zeigen, wenn Edition und Theme geladen sind.
   Sicherheitsnetz: nach 3 s sichtbar, selbst wenn JavaScript hängt. */
.booting #app { visibility: hidden; animation: boot-reveal 0s linear 3s forwards; }
@keyframes boot-reveal { to { visibility: visible; } }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.2;
  color: var(--c-text);
  text-wrap: balance;
}
p { margin: 0; }
p + p { margin-top: var(--sp-3); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
strong { font-weight: 650; }
a { color: var(--c-primary-text); text-underline-offset: 3px; }

/* hidden-Attribut hat immer Vorrang, auch vor Regeln mit display (README, Runde 5) */
[hidden] { display: none !important; }

.view { min-height: 100vh; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow { max-width: calc(var(--measure) + 2 * var(--gutter)); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
@media (max-width: 419px) {
  .collapse-xs {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@media (max-width: 599px) { .hide-sm { display: none; } }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--c-surface); color: var(--c-text);
  padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow-2);
}
.skip-link:focus { top: 12px; }

.noscript {
  max-width: 480px; margin: 20vh auto; padding: var(--sp-6);
  background: var(--c-surface); border-radius: var(--r-md); text-align: center;
}

/* Sichtbarer Tastaturfokus */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* Icons (Inline-SVG aus app.js) */
.icon { width: 1.25em; height: 1.25em; flex: none; }
.icon-slot { display: inline-flex; }
.icon-slot:empty { display: none; }

/* Markenzeichen: neutraler Stern, kein Fremdlogo */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: none;
  color: var(--c-light);
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark-lg { width: 40px; height: 40px; }

/* Kundenlogo: Platz ist reserviert, erscheint nur mit META.logo */
.kunden-logo {
  height: var(--logo-h, 32px);
  width: auto;
  max-width: 180px;
  object-fit: contain;
}
/* Höhen je Einsatzort, per Theme überschreibbar */
.kunden-logo-topbar { --logo-h: var(--kunden-logo-topbar-h, 28px); }
.kunden-logo-login { --logo-h: var(--kunden-logo-login-h, 44px); }
.kunden-logo-cert { --logo-h: var(--kunden-logo-cert-h, clamp(24px, 4.5cqw, 40px)); max-width: 40%; }
/* Wenn ein Kundenlogo gesetzt ist, tritt der Stern zurück */
.has-kunden-logo .brand-mark { display: none; }

/* ---------- 4. Komponenten ---------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.btn .icon { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-primary { background: var(--c-primary); color: var(--c-on-primary); box-shadow: var(--shadow-1); }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-hover); }

.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-control); }
.btn-secondary:hover:not(:disabled) { background: var(--c-surface-2); }

.btn-quiet { background: transparent; color: var(--c-text); padding-inline: 10px; }
.btn-quiet:hover:not(:disabled) { background: var(--c-surface-2); }

.btn-light { background: var(--c-hero-accent); color: var(--c-hero-on-accent); }
.btn-light:hover:not(:disabled) { filter: brightness(1.06); }

.btn-sm { min-height: 40px; padding: 8px 12px; }
.btn-xs { min-height: 34px; padding: 6px 10px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn-block { width: 100%; }

.btn-link {
  background: none; border: 0; padding: 4px 0;
  color: var(--c-primary-text); font-size: var(--fs-sm); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { text-decoration-thickness: 2px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text);
}
.icon-btn:hover:not(:disabled) { background: var(--c-surface-2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--c-text); }
.field input,
.num-input {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--c-control);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-md);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.field input:hover, .num-input:hover { border-color: var(--c-text-muted); }
.field input:focus-visible, .num-input:focus-visible {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 30%, transparent);
}
.field input[aria-invalid="true"] { border-color: var(--c-danger); }
.form-error {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--c-danger-soft);
  color: var(--c-danger);
  font-size: var(--fs-sm);
  font-weight: 550;
}

/* ---------- Ladebalken ---------- */
#loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 90; pointer-events: none;
  opacity: 0; transition: opacity var(--dur) ease;
  background: linear-gradient(90deg, transparent, var(--c-primary), transparent) no-repeat;
  background-size: 40% 100%;
}
body.api-loading #loadbar { opacity: 1; animation: loadslide 1.1s linear infinite; }
@keyframes loadslide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 80;
  display: flex; align-items: center; gap: var(--sp-2);
  max-width: min(calc(100vw - 32px), 440px);
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--c-text);
  color: var(--c-bg);
  font-size: var(--fs-sm);
  font-weight: 550;
  box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast .icon { width: 18px; height: 18px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--c-bg); /* Rückfall ohne color-mix() */
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: var(--topbar-h);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-lg);
  letter-spacing: var(--display-tracking);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-title {
  flex: 1; min-width: 0; text-align: center;
  font-size: var(--fs-sm); font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { width: 88px; }
.day-nav { display: flex; gap: var(--sp-2); }
@media (max-width: 419px) {
  .topbar-spacer { width: 0; }
}

/* ---------- Demo-Leiste ---------- */
.demo-bar {
  border-bottom: 1px dashed var(--c-control);
  background: var(--c-surface-2); /* Rückfall ohne color-mix() */
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--c-light) 7%, transparent) 10px 20px),
    var(--c-surface-2);
  font-size: var(--fs-sm);
}
.demo-bar-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  padding-block: var(--sp-2);
}
.demo-bar-label { color: var(--c-text-muted); }
.demo-bar-label strong { color: var(--c-text); }
.demo-bar-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.demo-day {
  min-width: 72px; text-align: center;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.demo-bar .btn-xs .icon { width: 16px; height: 16px; }

/* ---------- Login ---------- */
.view-login { display: flex; align-items: stretch; }
.login-shell {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  min-height: 100vh;
}
.login-art {
  position: relative;
  overflow: hidden;
  min-height: 136px;
  background:
    radial-gradient(120% 90% at 80% 0%, var(--c-hero-bg-2), transparent 60%),
    var(--c-hero-bg);
  color: var(--c-hero-text);
}
.login-art-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--sp-4);
  padding: var(--sp-6);
}
/* 24 Fenster, einige schon erleuchtet */
.login-lights {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  width: min(100%, 280px);
}
.login-lights span {
  aspect-ratio: 3 / 4;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--c-hero-line);
}
.login-lights span.on {
  border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c-hero-accent) 85%, #fff), var(--c-hero-accent));
  box-shadow: 0 0 14px color-mix(in srgb, var(--c-hero-accent) 45%, transparent);
}
.login-art-caption {
  display: none;
  max-width: 30ch;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-hero-muted);
}

.login-panel {
  display: flex; flex-direction: column; justify-content: center;
  width: 100%; max-width: 460px;
  margin-inline: auto;
  padding: var(--sp-6) var(--gutter) var(--sp-10);
}
.login-head { margin-bottom: var(--sp-6); }
@media (min-width: 900px) { .login-head { margin-bottom: var(--sp-8); } }
.login-head .brand-mark { margin-bottom: var(--sp-4); }
.login-head .kunden-logo { margin-bottom: var(--sp-5); }
.login-dates { color: var(--c-primary-text); margin-bottom: var(--sp-2); }
.login-title { font-size: var(--fs-3xl); }
.login-sub { margin-top: var(--sp-3); color: var(--c-text-muted); font-size: var(--fs-lg); line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.login-form .btn { margin-top: var(--sp-2); min-height: 48px; font-size: var(--fs-md); }

.demo-hint {
  margin-top: var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  border: 1px dashed var(--c-control);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.demo-hint strong { color: var(--c-text); }
.demo-hint[hidden] { display: none; }
.login-provider { margin-top: var(--sp-8); font-size: var(--fs-xs); color: var(--c-text-muted); }

@media (min-width: 900px) {
  .login-shell { grid-template-columns: minmax(0, 1.05fr) minmax(420px, 1fr); }
  .login-art { min-height: 100vh; }
  .login-art-inner { justify-content: center; padding: var(--sp-16); }
  .login-art-inner { gap: var(--sp-8); }
  .login-lights { grid-template-columns: repeat(6, 1fr); gap: 14px; width: min(70%, 300px); }
  .login-art-caption { display: block; }
  .login-title { font-size: clamp(1.875rem, 0.9rem + 2vw, 2.75rem); }
  .login-panel { padding: var(--sp-12) var(--sp-10); }
}

/* Schnee: wenige, ruhige Punkte, nur in den dunklen Flächen */
.snow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: var(--snow-opacity); container-type: size; }
.snow i {
  position: absolute; top: -8px;
  width: var(--s, 3px); height: var(--s, 3px);
  border-radius: 50%;
  background: #fff;
  opacity: var(--o, 0.6);
  animation: snowfall var(--d, 18s) linear var(--delay, 0s) infinite;
}
@keyframes snowfall {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(10px, 50cqh, 0); }
  100% { transform: translate3d(-6px, 105cqh, 0); }
}

/* ---------- Dashboard ---------- */
.dash { padding-top: var(--sp-5); padding-bottom: var(--sp-16); }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 120% at 100% 0%, var(--c-hero-bg-2), transparent 65%),
    var(--c-hero-bg);
  color: var(--c-hero-text);
  box-shadow: var(--shadow-2);
}
.hero-snow { position: absolute; inset: 0; }
.hero-body {
  position: relative;
  display: grid; gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-5);
}
.hero-text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
.hero-text .eyebrow { color: var(--c-hero-accent); }
.hero-title { font-size: var(--fs-2xl); color: var(--c-hero-text); }
.hero-lead { color: var(--c-hero-muted); max-width: 52ch; }
.hero-teaser {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  margin-top: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-hero-line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  max-width: 560px;
}
.hero-teaser .icon { width: 22px; height: 22px; color: var(--c-hero-accent); margin-top: 2px; }
.hero-teaser-type { display: block; font-size: var(--fs-xs); color: var(--c-hero-muted); letter-spacing: 0.04em; }
.hero-teaser-title { display: block; font-weight: 650; color: var(--c-hero-text); }
.hero-teaser-text { display: block; font-size: var(--fs-sm); color: var(--c-hero-muted); }
.hero-text .btn { margin-top: var(--sp-2); }
.hero .btn-light { min-height: 48px; padding-inline: 22px; font-size: var(--fs-md); }
.hero .btn-ghost-light {
  background: transparent; color: var(--c-hero-text);
  border-color: var(--c-hero-line);
}
.hero .btn-ghost-light:hover { background: rgba(255,255,255,0.08); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.hero-actions .btn { margin-top: 0; }

.hero-progress { display: flex; flex-direction: column; gap: var(--sp-3); }
.hero-progress-label { font-size: var(--fs-sm); color: var(--c-hero-muted); }
.hero-progress-label strong { color: var(--c-hero-text); }
.hero :focus-visible { outline-color: var(--c-hero-accent); }

/* Lichterkette: 24 Lichter = 24 Türchen */
.lights { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; width: 100%; max-width: 420px; }
.lights span {
  aspect-ratio: 1; border-radius: 50%;
  border: 1.5px solid var(--c-hero-line);
}
.lights span.open { border-color: color-mix(in srgb, var(--c-hero-text) 55%, transparent); }
.lights span.on {
  border-color: var(--c-hero-accent);
  background: var(--c-hero-accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--c-hero-accent) 65%, transparent);
}
.lights span.today { border-color: var(--c-hero-accent); border-width: 2px; }

@media (min-width: 768px) {
  .hero-body { padding: var(--sp-10) var(--sp-10); gap: var(--sp-8); }
}
@media (min-width: 960px) {
  .hero-body { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); align-items: end; }
  .lights { grid-template-columns: repeat(6, 1fr); gap: 10px; max-width: 216px; margin-left: auto; }
  .hero-progress { align-items: flex-end; text-align: right; }
}

.doors { margin-top: var(--sp-10); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.section-title { font-size: var(--fs-xl); }
.legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  margin: 0; padding: 0; list-style: none;
  font-size: var(--fs-xs); color: var(--c-text-muted);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--c-control); }
.legend-dot.is-today { border: 2px solid var(--c-primary); background: var(--c-surface); }
.legend-dot.is-viewed { background: var(--c-light); border-color: var(--c-light); }
.legend-dot.is-locked { background: var(--c-surface-3); border-color: var(--c-surface-3); }

/* ---------- Türchen ---------- */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 600px) { .tiles-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 900px) { .tiles-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } }

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  aspect-ratio: 5 / 6;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  text-align: left;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) ease;
}
@media (min-width: 600px) { .tile { aspect-ratio: 1; padding: 14px; } }

.tile:hover:not(.locked) { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--c-control); }

.tile-num {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.02em;
}
.tile-foot { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.tile-type { display: flex; align-items: center; gap: 6px; color: var(--c-primary-text); }
.tile-type .icon { width: 18px; height: 18px; }
.tile-type-label {
  font-size: 11px; font-weight: 600; line-height: 1.25;
  color: var(--c-text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 600px) { .tile-type-label { font-size: var(--fs-xs); } }
.tile-status {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
}
.tile-status .icon { width: 14px; height: 14px; }

/* Gesehen: Licht ist an */
.tile.viewed { background: linear-gradient(160deg, var(--c-light-soft), var(--c-surface) 70%); }
.tile.viewed .tile-status { background: var(--c-light); color: var(--c-on-light); }

/* Verschlossen */
.tile.locked {
  cursor: default;
  background: var(--c-surface-2);
  border-color: transparent;
  box-shadow: none;
}
.tile.locked .tile-num { color: var(--c-text-muted); opacity: 0.75; }
.tile.locked .tile-type, .tile.locked .tile-type-label { color: var(--c-text-muted); opacity: 0.7; }
.tile.locked .tile-status { color: var(--c-text-muted); }

/* Heute: klarer Anker für den wichtigsten Klick des Tages */
.tile.today {
  border: 2px solid var(--c-primary);
  box-shadow: var(--shadow-glow);
  animation: today-glow 3.2s ease-in-out infinite;
}
@keyframes today-glow {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-light) 18%, transparent), 0 8px 22px color-mix(in srgb, var(--c-light) 14%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c-light) 30%, transparent), 0 10px 30px color-mix(in srgb, var(--c-light) 30%, transparent); }
}
.tile-today-badge {
  position: absolute; top: 9px; right: 9px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--c-light);
  color: var(--c-on-light);
  font-size: 10px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase;
  line-height: 1.4;
  z-index: 2;
}
.tile.today .tile-status { display: none; }
@media (max-width: 599px) {
  /* Schmal: Etikett über der Zahl, damit nichts kollidiert */
  .tile.today { padding-top: 30px; }
  .tile-today-badge { top: 8px; left: 10px; right: auto; }
}

/* Öffnen: 2D-Lichtschein statt 3D-Tür (3D ist auf Android unzuverlässig) */
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 30% 20%, var(--c-light) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--dur-slow) ease;
}
.tile.opening { transform: scale(0.97); }
.tile.opening::after { opacity: 0.55; }
.tile.opening .tile-num { transform: translateY(-3px); transition: transform var(--dur-slow) var(--ease); }

.tile.shake { animation: shake 320ms ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Leer- und Fehlerzustand */
.state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-6);
  border: 1px dashed var(--c-control);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-text-muted);
  grid-column: 1 / -1;
}
.state > .icon { width: 32px; height: 32px; color: var(--c-text-muted); }
.state h3 { font-size: var(--fs-lg); }
.state .btn { margin-top: var(--sp-2); }

/* ---------- Tagesinhalt ---------- */
.narrow { padding-top: var(--sp-5); padding-bottom: var(--sp-16); }
.content-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--sp-6) var(--sp-5);
}
@media (min-width: 600px) { .content-card { padding: var(--sp-10); } }
.content-card.enter { animation: fade-up var(--dur-slow) var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.day-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.type-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill);
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em;
}
.type-chip .icon { width: 16px; height: 16px; }
.day-date { font-size: var(--fs-sm); color: var(--c-text-muted); }
.day-title { font-size: var(--fs-2xl); }
.day-title:focus { outline: none; }
.day-lead { margin-top: var(--sp-3); font-size: var(--fs-lg); color: var(--c-text-muted); line-height: 1.5; }
.day-body { margin-top: var(--sp-8); }
.day-body > * + * { margin-top: var(--sp-5); }
.prose { max-width: 62ch; }

.callout {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  font-size: var(--fs-sm);
}
.callout .icon { width: 20px; height: 20px; color: var(--c-primary-text); margin-top: 1px; }
.callout-title { display: block; font-weight: 700; margin-bottom: 2px; color: var(--c-text); }
.callout-light { background: var(--c-light-soft); }

/* Video */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    radial-gradient(80% 100% at 70% 0%, var(--c-hero-bg-2), transparent 70%),
    var(--c-hero-bg);
  color: var(--c-hero-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3);
  text-align: center; padding: var(--sp-4);
}
.video-play {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  border: 1.5px solid var(--c-hero-line);
  background: rgba(255,255,255,0.06);
  color: var(--c-hero-accent);
}
.video-play .icon { width: 26px; height: 26px; margin-left: 3px; }
.video-label { font-size: var(--fs-sm); color: var(--c-hero-muted); max-width: 36ch; }
.video-duration {
  position: absolute; right: 12px; bottom: 12px;
  padding: 2px 8px; border-radius: var(--r-xs);
  background: rgba(0,0,0,0.45); color: #fff;
  font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
}

/* Echtes Video */
.video-player {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-hero-bg);
}
.video-player video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--c-hero-bg); }
.video-player video::cue { font-size: 1.05em; line-height: 1.35; background: rgba(0, 0, 0, 0.72); color: #fff; }

/* Praxisbeispiel: drei Schritte */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  position: relative;
  padding: 0 0 var(--sp-6) 48px;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface-2); color: var(--c-text);
  font-weight: 700; font-size: var(--fs-sm);
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 15.5px; top: 38px; bottom: 6px;
  width: 1px; background: var(--c-line);
}
.steps li:last-child { padding-bottom: 0; }
.steps li.is-result::before { background: var(--c-primary); color: var(--c-on-primary); }
.step-label { display: block; margin-bottom: 2px; }
.steps li.is-result .step-text {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-primary-soft);
  font-weight: 550;
}

/* Prompt */
.prompt {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface-2);
}
.prompt-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
}
.prompt-head .eyebrow { margin: 0; }
.prompt-text {
  margin: 0;
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--c-text);
}
.prompt-text mark {
  background: var(--c-mark);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: inset 0 -1px 0 var(--c-light);
}
.copy-btn.is-done { border-color: var(--c-success); color: var(--c-success); }

/* Tool-Steckbrief */
.facts { margin: 0; border-top: 1px solid var(--c-line); }
.facts > div {
  display: grid; gap: 4px;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--c-line);
}
.facts dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-muted); }
.facts dd { margin: 0; }
.facts .facts-lead dd { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--fs-lg); }
@media (min-width: 600px) {
  .facts > div { grid-template-columns: 160px 1fr; gap: var(--sp-6); align-items: baseline; }
}

/* Mythos: aufdecken statt umdrehen (kein 3D) */
.myth {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.myth-part { padding: var(--sp-5); }
.myth-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.myth-front { background: var(--c-surface-2); }
.myth-front .myth-tag { color: var(--c-text-muted); }
.myth-statement {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.35;
  font-weight: var(--display-weight);
}
.myth.is-revealed .myth-statement {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: color-mix(in srgb, var(--c-danger) 70%, transparent);
  color: var(--c-text-muted);
}
.myth-verdict {
  display: inline-block; margin-top: var(--sp-3);
  padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--c-danger-soft); color: var(--c-danger);
  font-size: var(--fs-xs); font-weight: 700;
}
.myth-back {
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
}
.myth-back .myth-tag { color: var(--c-success); }
.myth-back.enter { animation: fade-up var(--dur-slow) var(--ease) both; }
.myth-toggle { margin-top: var(--sp-4); }
.myth-reality { font-size: var(--fs-lg); line-height: 1.55; }

/* Auswahloptionen (Quiz, Umfrage) */
.options { display: flex; flex-direction: column; gap: var(--sp-3); }
.option {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--c-control);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  text-align: left;
  font-size: var(--fs-md);
  line-height: 1.4;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.option:hover:not(:disabled) { border-color: var(--c-primary); background: var(--c-primary-soft); }
.option:disabled { cursor: default; }
.option-key {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--c-surface-2); color: var(--c-text-muted);
  font-size: var(--fs-sm); font-weight: 700;
}
.option-text { flex: 1; }
.option-mark { flex: none; display: inline-flex; }
.option-mark .icon { width: 20px; height: 20px; }
.option.correct { border-color: var(--c-success); background: var(--c-success-soft); border-width: 2px; padding: 11px 13px; }
.option.correct .option-key { background: var(--c-success); color: var(--c-surface); }
.option.correct .option-mark { color: var(--c-success); }
.option.incorrect { border-color: var(--c-danger); background: var(--c-danger-soft); border-width: 2px; padding: 11px 13px; }
.option.incorrect .option-key { background: var(--c-danger); color: var(--c-surface); }
.option.incorrect .option-mark { color: var(--c-danger); }
.option.is-dim { opacity: 0.7; }

.feedback {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border-left: 4px solid var(--c-control);
  background: var(--c-surface-2);
}
.feedback .icon { width: 22px; height: 22px; margin-top: 1px; }
.feedback-title { display: block; font-weight: 700; }
.feedback.is-correct { border-left-color: var(--c-success); background: var(--c-success-soft); }
.feedback.is-correct .icon { color: var(--c-success); }
.feedback.is-incorrect { border-left-color: var(--c-danger); background: var(--c-danger-soft); }
.feedback.is-incorrect .icon { color: var(--c-danger); }
.feedback small { display: block; margin-top: var(--sp-2); color: var(--c-text-muted); }
.question { font-size: var(--fs-lg); font-weight: 650; line-height: 1.45; }

/* Checkliste */
.checklist-progress { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-muted); }
.meter { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; max-width: 220px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--c-primary); border-radius: inherit; transition: width var(--dur) var(--ease); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.check {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: 14px var(--sp-4);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.check:hover { border-color: var(--c-control); }
.check input {
  appearance: none; -webkit-appearance: none;
  flex: none; margin: 1px 0 0;
  width: 22px; height: 22px;
  border: 1.5px solid var(--c-control);
  border-radius: 6px;
  background: var(--c-surface);
  display: grid; place-content: center;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
/* Haken als Maske, damit er in jedem Theme die Kontrastfarbe annimmt */
.check input::before {
  content: ""; width: 14px; height: 14px;
  background: var(--c-on-primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease);
}
.check input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.check input:checked::before { transform: scale(1); }
.check:has(input:checked) { background: var(--c-surface-2); border-color: transparent; }
.check:has(input:checked) .check-text { color: var(--c-text-muted); }
.check:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.check input:focus-visible { outline: none; }

/* Rechner */
.calc { display: grid; gap: var(--sp-5); }
.calc-inputs { display: grid; gap: var(--sp-4); }
@media (min-width: 600px) { .calc-inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } .calc-range { grid-column: 1 / -1; } }
.field-hint { font-size: var(--fs-xs); color: var(--c-text-muted); }
@media (min-width: 600px) {
  /* Eingabefelder auf einer Linie, auch wenn Beschriftungen umbrechen */
  .calc-inputs > .field:not(.calc-range) label { min-height: 2.9em; display: flex; align-items: flex-end; line-height: 1.35; }
}
.calc .field input { max-width: 100%; font-variant-numeric: tabular-nums; }
.calc-range label { display: flex; justify-content: space-between; gap: var(--sp-3); }
.calc-range output { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c-primary-text); }
input[type="range"] {
  width: 100%;
  accent-color: var(--c-primary);
  height: 28px;
  margin: 0;
}
.calc-result {
  display: grid; gap: var(--sp-1);
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  background: var(--c-hero-bg);
  color: var(--c-hero-text);
  text-align: center;
}
.calc-big {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-3xl);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.calc-big small { font-size: 0.5em; font-weight: 500; color: var(--c-hero-muted); }
.calc-sub { color: var(--c-hero-muted); font-size: var(--fs-sm); }
.calc-note { font-size: var(--fs-xs); color: var(--c-text-muted); }

/* Impuls */
.quote {
  margin: 0;
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
  border-left: 3px solid var(--c-light);
}
.quote p {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-2xl);
  line-height: 1.35;
  letter-spacing: var(--display-tracking);
  text-wrap: pretty;
}
.quote footer { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-muted); }

/* Umfrage */
.poll-results { display: flex; flex-direction: column; gap: var(--sp-4); }
.poll-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); margin-bottom: 6px; }
.poll-row-head .pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-bar { height: 12px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.poll-bar-fill {
  height: 100%; border-radius: inherit;
  background: color-mix(in srgb, var(--c-primary) 45%, var(--c-surface-3));
  width: 0; transition: width 700ms var(--ease);
}
.poll-row.mine .poll-bar-fill { background: var(--c-primary); }
.poll-row.mine .poll-opt { font-weight: 700; }
.mine-chip {
  display: inline-block; margin-left: 6px;
  padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--c-light-soft); color: var(--c-text);
  border: 1px solid var(--c-light);
  font-size: 11px; font-weight: 700; vertical-align: 1px;
}
.poll-total { font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ---------- Abschlusstest ---------- */
.final-intro { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); font-size: var(--fs-sm); color: var(--c-text-muted); }
.final-intro strong { color: var(--c-text); }
.passed-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  background: var(--c-success-soft);
  border: 1px solid color-mix(in srgb, var(--c-success) 40%, transparent);
}
.passed-note .icon { color: var(--c-success); width: 24px; height: 24px; }
.passed-note-text { flex: 1 1 220px; }
.passed-note small { display: block; color: var(--c-text-muted); }

.final-form { display: flex; flex-direction: column; gap: var(--sp-6); }
.final-q {
  margin: 0; padding: 0; border: 0; min-width: 0;
}
.final-q legend {
  padding: 0; margin-bottom: var(--sp-3);
  font-weight: 650; font-size: var(--fs-lg); line-height: 1.45;
  display: flex; gap: var(--sp-3);
}
.final-q-num {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-top: 1px;
  border-radius: 50%;
  background: var(--c-surface-2);
  font-size: var(--fs-sm); font-weight: 700;
}
.final-q.is-answered .final-q-num { background: var(--c-primary); color: var(--c-on-primary); }
.final-q.is-missing .final-q-num { background: var(--c-danger); color: var(--c-surface); }
.radio-opt {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 12px 14px;
  border: 1px solid var(--c-control);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.radio-opt + .radio-opt { margin-top: var(--sp-2); }
.radio-opt:hover { border-color: var(--c-primary); }
.radio-opt input {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 20px; height: 20px; margin: 2px 0 0;
  border: 1.5px solid var(--c-control); border-radius: 50%;
  background: var(--c-surface);
  display: grid; place-content: center;
}
.radio-opt input::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-primary); transform: scale(0);
  transition: transform var(--dur-fast) ease;
}
.radio-opt input:checked { border-color: var(--c-primary); }
.radio-opt input:checked::before { transform: scale(1); }
.radio-opt:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); box-shadow: inset 0 0 0 1px var(--c-primary); }
.radio-opt:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.radio-opt input:focus-visible { outline: none; }

.final-submit-row {
  position: sticky; bottom: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-inline: calc(-1 * var(--sp-5));
  padding: var(--sp-3) var(--sp-5) max(var(--sp-3), env(safe-area-inset-bottom));
  background: var(--c-surface); /* Rückfall ohne color-mix() */
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--c-line);
}
@media (min-width: 600px) { .final-submit-row { margin-inline: calc(-1 * var(--sp-10)); padding-inline: var(--sp-10); } }
.final-count { font-size: var(--fs-sm); color: var(--c-text-muted); font-variant-numeric: tabular-nums; }

.result {
  margin-top: var(--sp-8);
  padding: var(--sp-8) var(--sp-5);
  border-radius: var(--r-lg);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
}
.result.is-pass { background: var(--c-hero-bg); color: var(--c-hero-text); }
.result.is-fail { background: var(--c-surface-2); }
.result-score {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-3xl);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-score small { font-size: 0.45em; font-weight: 500; opacity: 0.8; }
.result.is-pass .result-score { color: var(--c-hero-accent); }
.result-title { font-size: var(--fs-xl); color: inherit; }
.result.is-pass .result-title { color: var(--c-hero-text); }
.result-text { max-width: 44ch; }
.result.is-pass .result-text { color: var(--c-hero-muted); }
.result.is-fail .result-text { color: var(--c-text-muted); }
.result .btn { margin-top: var(--sp-2); }

/* Abschluss-Navigation */
.day-bottom-nav {
  display: flex; flex-direction: column-reverse; gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.day-bottom-nav .btn { width: 100%; min-height: 48px; }
@media (min-width: 600px) {
  .day-bottom-nav { flex-direction: row; justify-content: space-between; }
  .day-bottom-nav .btn { width: auto; }
}

/* ---------- Zertifikat ---------- */
.cert-page { padding-top: var(--sp-5); padding-bottom: var(--sp-16); }
.cert-editor {
  display: grid; gap: var(--sp-3);
  max-width: 880px; margin: 0 auto var(--sp-6);
  padding: var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
}
.cert-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.cert-actions .btn { flex: 1 1 auto; }
.cert-editor-hint { font-size: var(--fs-xs); color: var(--c-text-muted); }
@media (min-width: 768px) {
  .cert-editor { grid-template-columns: 1fr auto; align-items: end; }
  .cert-actions .btn { flex: none; }
  .cert-editor-hint { grid-column: 1 / -1; }
}

.cert-stage { overflow-x: auto; }
.certificate {
  --cert-pad: clamp(20px, 5vw, 56px);
  position: relative;
  max-width: 880px;
  aspect-ratio: 297 / 210;
  margin: 0 auto;
  padding: var(--cert-pad);
  background: var(--cert-paper);
  color: var(--cert-ink);
  border-radius: 4px;
  box-shadow: var(--shadow-2);
  font-family: var(--font-text);
  container-type: inline-size;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
@media (max-width: 599px) {
  /* Auf dem Telefon als Hochformat-Vorschau, gedruckt wird immer quer */
  .certificate { aspect-ratio: auto; }
}
.cert-frame {
  position: relative;
  height: 100%;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(18px, 4cqw, 40px) clamp(16px, 5cqw, 48px);
  border: 1px solid var(--cert-line);
  outline: 3px solid var(--cert-accent);
  outline-offset: clamp(5px, 1.2cqw, 10px);
}
.cert-top { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 28px; }
.cert-top .brand-mark { color: var(--cert-accent-2); width: 24px; height: 24px; }
.cert-edition { font-size: clamp(10px, 1.5cqw, 13px); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cert-muted); font-weight: 650; }
.cert-kicker {
  margin-top: clamp(14px, 3.5cqw, 32px);
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(22px, 5.2cqw, 46px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cert-accent);
  line-height: 1.1;
}
.cert-rule { width: 64px; height: 2px; margin: clamp(10px, 2cqw, 18px) auto; background: var(--cert-accent-2); border: 0; }
.cert-lead { font-size: clamp(12px, 1.8cqw, 15px); color: var(--cert-muted); }
.cert-name {
  margin-top: clamp(6px, 1.2cqw, 12px);
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(24px, 5cqw, 44px);
  line-height: 1.15;
  color: var(--cert-ink);
  overflow-wrap: anywhere;
}
.cert-text { margin-top: clamp(8px, 1.6cqw, 14px); font-size: clamp(12px, 1.9cqw, 16px); line-height: 1.55; max-width: 62ch; }
.cert-course { display: block; margin-top: 4px; text-wrap: balance; font-family: var(--font-display); font-weight: var(--display-weight); font-size: clamp(14px, 2.3cqw, 20px); color: var(--cert-ink); }
.cert-foot {
  margin-top: auto;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: clamp(12px, 3cqw, 32px);
  padding-top: clamp(16px, 3cqw, 28px);
}
.cert-foot .cert-seal { grid-column: 1; grid-row: 1; }
.cert-sigs { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; gap: clamp(16px, 4cqw, 40px); justify-content: center; text-align: left; }
.cert-meta { grid-column: 3; grid-row: 1; }
.cert-sig { width: clamp(120px, 22cqw, 190px); font-size: clamp(11px, 1.6cqw, 14px); }
.cert-sig-line { display: block; height: 1px; background: var(--cert-ink); opacity: 0.55; margin: clamp(18px, 4cqw, 36px) 0 6px; }
.cert-sig small { display: block; color: var(--cert-muted); font-size: 0.9em; }
.cert-seal { width: clamp(64px, 12cqw, 104px); color: var(--cert-accent); }
.cert-seal .seal-star { color: var(--cert-accent-2); }
.cert-meta { text-align: right; font-size: clamp(11px, 1.6cqw, 14px); color: var(--cert-muted); }
.cert-meta strong { display: block; color: var(--cert-ink); font-weight: 650; }

@media (max-width: 599px) {
  .cert-foot { grid-template-columns: 1fr; justify-items: center; }
  .cert-foot .cert-seal, .cert-sigs, .cert-meta { grid-column: 1; grid-row: auto; }
  .cert-sigs { justify-content: center; text-align: center; }
  .cert-meta { text-align: center; }
}

/* ---------- Konfetti ---------- */
.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti span {
  position: absolute; top: -4vh;
  border-radius: 2px;
  animation: confetti-fall var(--d, 3s) cubic-bezier(0.3, 0.6, 0.4, 1) var(--delay, 0s) both;
}
@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(var(--r, 0deg)); opacity: 1; }
  100% { transform: translate3d(var(--x, 0px), 110vh, 0) rotate(calc(var(--r, 0deg) + 480deg)); opacity: 0.8; }
}

/* ---------- KI-Chat zum Ausprobieren (docs/CHAT.md) ---------- */
/* Mobil Vollbild, ab 768 px Seitenleiste rechts. Nur Tokens, damit alle Themes hell und dunkel passen. */
.chat-offen, .chat-offen body { overflow: hidden; }
@media (min-width: 768px) {
  .chat-offen, .chat-offen body { overflow: auto; }
}

.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.chat-open-btn .icon, .chat-open-icon .icon { color: var(--c-primary-text); }
@media (max-width: 419px) {
  .chat-open-btn { padding-inline: 10px; }
}

.chat-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 16, 22, 0.42);
}

.chat-panel {
  position: fixed; inset: 0; z-index: 61;
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  padding-top: env(safe-area-inset-top);
  animation: chat-in var(--dur) var(--ease) both;
}
@media (min-width: 768px) {
  .chat-panel {
    left: auto;
    width: min(460px, 100vw);
    border-left: 1px solid var(--c-line);
    box-shadow: var(--shadow-2);
  }
}
@keyframes chat-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.chat-head {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--topbar-h);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--gutter);
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
}
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-size: var(--fs-lg); }
.chat-rest { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 2px; }
.chat-head .btn .icon { width: 16px; height: 16px; }
@media (max-width: 419px) {
  #chat-new { padding-inline: 8px; }
}

.chat-log {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-5) var(--gutter);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.chat-log:focus { outline: none; }

.chat-empty { display: flex; flex-direction: column; gap: var(--sp-3); }
.chat-empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--c-light-soft); color: var(--c-text);
}
.chat-empty-icon .icon { width: 22px; height: 22px; }
.chat-empty-text { color: var(--c-text); max-width: 46ch; }
.chat-empty-label { margin-top: var(--sp-2); }
.chat-suggestions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.chat-suggestion {
  width: 100%; min-height: 44px;
  padding: 10px 14px;
  text-align: left;
  font-size: var(--fs-sm); line-height: 1.45;
  border: 1px solid var(--c-control);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.chat-suggestion:hover:not(:disabled) { background: var(--c-primary-soft); border-color: var(--c-primary); }
.chat-suggestion:disabled { opacity: 0.55; cursor: default; }

.chat-msg { display: flex; }
.chat-msg-nutzer { justify-content: flex-end; }
.chat-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.chat-msg-nutzer .chat-bubble {
  max-width: 88%;
  background: var(--c-primary-soft);
  color: var(--c-text);
  border-bottom-right-radius: var(--r-xs);
}
.chat-msg-assistent .chat-bubble {
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-bottom-left-radius: var(--r-xs);
}
.chat-msg.is-error .chat-bubble { background: var(--c-danger-soft); border-color: transparent; color: var(--c-text); }
.chat-bubble p + p, .chat-bubble p + ul, .chat-bubble p + ol, .chat-bubble ul + p, .chat-bubble ol + p,
.chat-bubble pre + p, .chat-bubble p + pre { margin-top: var(--sp-2); }
.chat-bubble ul, .chat-bubble ol { margin: 0; padding-left: 1.3em; }
.chat-bubble li + li { margin-top: 4px; }
.chat-bubble code {
  font-family: var(--font-mono); font-size: 0.92em;
  padding: 1px 4px; border-radius: var(--r-xs);
  background: var(--c-surface-2);
}
.chat-bubble pre {
  margin: 0; padding: var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-bubble pre code { padding: 0; background: none; }
.chat-bubble hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--sp-3) 0; }
.chat-bubble mark {
  background: var(--c-mark); color: inherit;
  border-radius: 3px; padding: 0 2px;
  box-shadow: inset 0 -1px 0 var(--c-light);
}
.chat-note { font-size: var(--fs-xs); color: var(--c-text-muted); font-style: italic; }
.chat-retry { margin-top: var(--sp-2); }
.chat-retry .icon { width: 14px; height: 14px; }
.chat-limit {
  align-self: center; text-align: center;
  font-size: var(--fs-sm); color: var(--c-text-muted);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
}

/* Ladeanzeige und Schreibmarke */
.chat-typing { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-text-muted); }
.chat-dots { display: inline-flex; gap: 4px; }
.chat-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-text-muted);
  animation: chat-dot 1.2s ease-in-out infinite;
}
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-cursor {
  display: inline-block; width: 7px; height: 1em; margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--c-primary);
  animation: chat-blink 1s steps(2, start) infinite;
}
@keyframes chat-blink { to { visibility: hidden; } }

/* Fuß: Warnung, Hinweis, Eingabe */
.chat-foot {
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
  padding: var(--sp-3) var(--gutter) max(var(--sp-3), env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.chat-warnung {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-light-soft);
  border: 1px solid var(--c-light);
  font-size: var(--fs-sm);
  color: var(--c-text);
}
.chat-warnung-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.chat-hinweis {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  font-size: var(--fs-xs); line-height: 1.5;
  color: var(--c-text-muted);
}
.chat-hinweis .icon { width: 16px; height: 16px; margin-top: 1px; }
.chat-beispiel-hinweis {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--c-primary-soft);
  font-size: var(--fs-sm); line-height: 1.5;
  color: var(--c-text);
}
.chat-beispiel-hinweis[hidden] { display: none; }
.chat-beispiel-hinweis .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.chat-form { display: flex; flex-direction: column; gap: var(--sp-2); }
.chat-input {
  width: 100%;
  min-height: 48px;
  max-height: 40vh;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--c-control);
  border-radius: var(--r-sm);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--fs-md); /* 16 px: kein Zoom auf iOS */
  line-height: 1.5;
}
.chat-input:hover:not(:disabled) { border-color: var(--c-text-muted); }
.chat-input:focus-visible {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 30%, transparent);
}
.chat-input:disabled { opacity: 0.6; cursor: not-allowed; }
.chat-form-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.chat-zaehler { flex: 1; font-size: var(--fs-xs); color: var(--c-text-muted); font-variant-numeric: tabular-nums; }
.chat-form-row .btn { min-height: 44px; }
.chat-form-row .btn .icon { width: 16px; height: 16px; }

.chat-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3);
  margin: auto 0;
  padding: var(--sp-8) var(--sp-4);
  color: var(--c-text-muted);
}
.chat-state > .icon { width: 32px; height: 32px; }
.chat-state h3 { font-size: var(--fs-lg); }

/* Türchen vom Typ prompt: "Im Chat ausprobieren" */
.prompt-try { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.prompt-try-note { font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ---------- 5. Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .snow, .confetti { display: none; }
  .tile.today { animation: none; box-shadow: var(--shadow-glow); }
  body.api-loading #loadbar { animation: none; background: var(--c-primary); background-size: 100% 100%; }
  .booting #app { animation: boot-reveal 0s linear 3s forwards !important; }
  .chat-dots i, .chat-cursor { animation: none; opacity: 1; }
}

/* ---------- Druck: nur das Zertifikat, A4 quer ---------- */
@page { size: A4 landscape; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  body * { visibility: hidden; }
  .no-print, .snow, .confetti, #loadbar, #toast, .skip-link, .chat-panel, .chat-backdrop { display: none !important; }
  #view-certificate, #view-certificate * { visibility: visible; }
  #view-certificate { min-height: 0; }
  .cert-page { padding: 0; max-width: none; }
  .cert-stage { overflow: visible; }
  .certificate {
    position: fixed; inset: 0;
    width: 297mm; height: 210mm; max-width: none;
    aspect-ratio: auto;
    margin: 0; padding: 12mm;
    border-radius: 0; box-shadow: none;
  }
  .cert-foot { grid-template-columns: auto 1fr auto; justify-items: stretch; }
  .cert-foot .cert-seal { grid-column: 1; grid-row: 1; }
  .cert-sigs { grid-column: 2; grid-row: 1; justify-content: center; text-align: left; }
  .cert-meta { grid-column: 3; grid-row: 1; text-align: right; }
}
