/* ===== Farben ============================================================ */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --text: #1c1f2e;
  --muted: #646a82;
  --border: #dde0ee;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-text: #ffffff;
  --primary-soft: #e8e7fd;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --bad: #dc2626;
  --on-bad: #ffffff;
  --bad-soft: #fee2e2;
  --near: #d97706;
  --near-soft: #fef3c7;
  --info-soft: #e0f2fe;
  --seg-new: #c9cddd;
  --seg-1: #ef4444;
  --seg-2: #f97316;
  --seg-3: #eab308;
  --seg-4: #84cc16;
  --seg-5: #16a34a;
  --bar-time: #6366f1;
  --shadow: 0 1px 2px rgba(20, 24, 50, .06), 0 4px 16px rgba(20, 24, 50, .06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11131c;
    --surface: #1b1e2b;
    --surface-2: #252938;
    --text: #e8eaf3;
    --muted: #9ba1bb;
    --border: #2f3446;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-text: #11131c;
    --primary-soft: #2a2d4a;
    --ok: #4ade80;
    --ok-soft: #14321f;
    --bad: #f87171;
    --on-bad: #11131c;
    --bad-soft: #3b1a1a;
    --near: #fbbf24;
    --near-soft: #3a2c0c;
    --info-soft: #11314a;
    --seg-new: #464b60;
    --bar-time: #818cf8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #11131c;
  --surface: #1b1e2b;
  --surface-2: #252938;
  --text: #e8eaf3;
  --muted: #9ba1bb;
  --border: #2f3446;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-text: #11131c;
  --primary-soft: #2a2d4a;
  --ok: #4ade80;
  --ok-soft: #14321f;
  --bad: #f87171;
  --on-bad: #11131c;
  --bad-soft: #3b1a1a;
  --near: #fbbf24;
  --near-soft: #3a2c0c;
  --info-soft: #11314a;
  --seg-new: #464b60;
  --bar-time: #818cf8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ===== Grundlagen ======================================================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: .4rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
pre.code { background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.warn { color: var(--near); }
.inline { display: inline; }
[hidden] { display: none !important; }

.container { max-width: 980px; margin: 0 auto; padding: 16px; }

/* ===== Kopfzeile & Navigation ========================================== */
/* Kopfzeile und Leiste bleiben beim Scrollen gemeinsam oben (auf dem Handy liegt die Leiste unten) */
.top-stick { position: sticky; top: 0; z-index: 10; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.who { color: var(--muted); font-size: .9rem; margin: 0 4px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  background: none; border: 0; cursor: pointer; font-size: 1.25rem; line-height: 1;
  padding: 8px; border-radius: 10px; color: var(--text); text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }

.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.mainnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; font-size: .75rem; color: var(--muted); text-decoration: none;
}
.mainnav a.active { color: var(--primary); font-weight: 600; }
.nav-icon { line-height: 0; }
.ui-icon { display: block; width: 22px; height: 22px; }

@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  .mainnav {
    position: static; justify-content: center; gap: 4px;
    border-top: 0; border-bottom: 1px solid var(--border); padding: 6px;
  }
  [id] { scroll-margin-top: 110px; }
  .mainnav a { flex: 0 0 auto; flex-direction: row; gap: 6px; font-size: .95rem; padding: 8px 14px; border-radius: 10px; }
  .mainnav a.active { background: var(--primary-soft); }
  .ui-icon { width: 20px; height: 20px; }
  .mainnav { flex-wrap: wrap; }
}

/* ===== Karten, Listen, Raster =========================================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card.narrow { max-width: 420px; margin: 24px auto; }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform .1s, border-color .1s; }
.card-link:hover { border-color: var(--primary); }
.card-link:active { transform: scale(.99); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 16px; }
.grid .card { margin: 0; }
.two-col { display: grid; gap: 0 16px; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.list .card { margin: 0; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .6rem; }
.steps li { margin-bottom: .4rem; }
.danger-zone { border-color: var(--bad-soft); }

/* ===== Buttons ========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-danger-outline { background: none; border-color: var(--bad); color: var(--bad); }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding-left: 0; }
.btn-block { width: 100%; }
.btn-big { font-size: 1.2rem; padding: 14px 28px; min-height: 56px; }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
/* Auf Touch-Geräten genug Platz für den Finger */
@media (pointer: coarse) { .btn-small { min-height: 44px; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.actions.center { justify-content: center; }

/* ===== Formulare ======================================================== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
/* Falle für Bots bei der Registrierung: für Menschen unsichtbar */
.form input.hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); flex: 0 0 auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
input:disabled { opacity: .7; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 600; padding: 0 6px; }
details summary { cursor: pointer; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
details[open] { display: flex; flex-direction: column; gap: 12px; }
.segmented { flex-direction: row; gap: 18px; }
.segmented label { flex-direction: row; align-items: center; gap: 8px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Meldungen ======================================================== */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.flash ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.flash-ok { background: var(--ok-soft); }
.flash-error { background: var(--bad-soft); }
.flash-info { background: var(--info-soft); }

/* ===== Tabellen ========================================================= */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.vocab-table td { min-width: 110px; }

/* ===== Login ============================================================ */
.login-card { text-align: center; }
.login-card .form { text-align: left; }
.login-logo { margin: 4px 0 8px; }

/* ===== Kennzahlen ======================================================= */
.kid-head { display: flex; justify-content: space-between; align-items: center; }
.kid-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; text-align: center; }
.kpis strong { display: block; font-size: .95rem; white-space: nowrap; }
.kpis span { font-size: .72rem; color: var(--muted); }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; align-items: flex-start;
}
.kpi-icon { font-size: 1.4rem; }
.kpi strong { font-size: 1.6rem; line-height: 1.2; }
.kpi span { font-weight: 600; }
.kpi small { color: var(--muted); }
.streak { font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.streak.on { background: #ffedd5; color: #c2410c; }
:root[data-theme="dark"] .streak.on { background: #3b2410; color: #fdba74; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .streak.on { background: #3b2410; color: #fdba74; } }
.streak.big { font-size: 1.2rem; padding: 6px 14px; }
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hero { text-align: center; padding: 26px 18px; }
.hero h2 { font-size: 1.4rem; }

/* ===== Karteikasten-Balken ============================================== */
.boxbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 10px 0 4px; }
.boxbar .seg { height: 100%; }
.seg-new { background: var(--seg-new); }
.seg-1 { background: var(--seg-1); }
.seg-2 { background: var(--seg-2); }
.seg-3 { background: var(--seg-3); }
.seg-4 { background: var(--seg-4); }
.seg-5 { background: var(--seg-5); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend i.bar-ok { background: var(--ok); }
.legend i.bar-bad { background: var(--bad); }
.legend i.bar-time { background: var(--bar-time); }
.progress-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.progress-row:last-of-type { border-bottom: 0; }
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { display: inline-block; min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff; }
.pill.seg-new { color: var(--text); }

.meter-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .9rem; }
.meter { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ok); }

/* ===== Diagramme ======================================================== */
.chart { width: 100%; height: auto; display: block; }
.chart .gridline {stroke: var(--border); stroke-width: 1; }
.chart { max-height: 320px; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar-ok { fill: var(--ok); }
.chart .bar-bad { fill: var(--bad); }
.chart .bar-time { fill: var(--bar-time); }
.chart .hit { fill: transparent; }
.chart g:hover .hit { fill: var(--surface-2); opacity: .5; }

/* ===== Abzeichen ======================================================== */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 12px 8px; border-radius: 14px; background: var(--surface-2);
}
.badge.locked { opacity: .55; }
.badge.earned { background: var(--primary-soft); }
.badge-icon { font-size: 2rem; line-height: 1.2; }
.badge strong { font-size: .9rem; }
.badge small { font-size: .74rem; color: var(--muted); }
.new-badges { margin: 16px auto; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.pop { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ===== Übungsauswahl ==================================================== */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 8px; }
.mode-card {
  position: relative; display: flex !important; flex-direction: column; gap: 2px !important;
  padding: 12px; border: 2px solid var(--border); border-radius: 14px; cursor: pointer; font-weight: 500 !important;
}
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-card:has(input:focus-visible) { outline: 2px solid var(--primary); }
.mode-icon { font-size: 1.3rem; }
.mode-card strong { overflow-wrap: anywhere; hyphens: auto; }
.mode-card small { color: var(--muted); font-size: .78rem; }

/* ===== Üben ============================================================= */
.page-practice .mainnav { display: none; }
.page-practice { padding-bottom: 24px; }
.practice { max-width: 560px; margin: 0 auto; }
.practice-top { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width .3s; }
.loading { text-align: center; padding: 48px 0; color: var(--muted); font-size: 1.1rem; }
.question { text-align: center; padding: 22px 18px; }
.question.is-repeat { border-color: var(--near); }
.q-text { color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.prompt-wrap { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 20px; min-height: 3rem; }
.prompt { font-size: 2rem; font-weight: 800; line-height: 1.2; word-break: break-word; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px;
  font: inherit; font-size: 1.2rem; font-weight: 600; text-align: left; color: var(--text);
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; cursor: pointer;
  transition: transform .08s, border-color .1s, background .1s;
}
.option:hover:not(:disabled) { border-color: var(--primary); }
.option:active:not(:disabled) { transform: scale(.98); }
.option:disabled { cursor: default; }
.opt-key {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--muted);
}
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.option.dim { opacity: .45; }
.answer-input { font-size: 1.3rem !important; text-align: center; padding: 14px !important; border-width: 2px !important; }
.answer-input.correct { border-color: var(--ok) !important; background: var(--ok-soft); }
.answer-input.wrong { border-color: var(--bad) !important; background: var(--bad-soft); animation: shake .35s; }
.typed { display: flex; flex-direction: column; gap: 10px; }
.special-chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.special-chars:empty { display: none; }
.char {
  min-width: 42px; height: 42px; font: inherit; font-size: 1.15rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.feedback { margin-top: 16px; padding: 14px; border-radius: 14px; text-align: center; }
.feedback p { margin: 4px 0; }
.st-correct .feedback { background: var(--ok-soft); }
.st-near .feedback { background: var(--near-soft); }
.st-wrong .feedback { background: var(--bad-soft); }
.fb-title { font-size: 1.3rem; font-weight: 800; }
.fb-answer { font-size: 1.15rem; }
.fb-note { font-size: .95rem; }
.feedback .btn { margin-top: 8px; }
.next { margin-top: 14px; }
.summary { padding: 28px 18px; }
.summary-emoji { font-size: 4rem; line-height: 1.1; margin: 0; }
.summary-score { font-size: 1.5rem; font-weight: 800; margin: 6px 0; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Import-Vorschau ================================================== */
.vocab-table td.auto { font-style: italic; }

/* ===== Familien ========================================================= */
.list-group { margin: 14px 0 2px; font-size: .9rem; color: var(--muted); }
.list-group:first-child { margin-top: 0; }
.family-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill.plan-free { background: var(--surface-2); color: var(--muted); }
.pill.plan-pay { background: var(--primary); color: var(--primary-text); }

/* ===== Handys verbinden ================================================= */
.pair-box { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-bottom: 8px; }
.pair-box .qr { width: 220px; max-width: 100%; aspect-ratio: 1; background: #fff; border-radius: 12px; overflow: hidden; }
.pair-box .qr svg { display: block; width: 100%; height: 100%; }
.pair-box > div:last-child { flex: 1; min-width: 220px; }
.pair-code { font: 700 1.8rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; margin: 4px 0; }
.device-fold > summary { margin: 0; }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }

/* ===== Rechtliches ====================================================== */
.prose h2 { margin-top: 1.4rem; }
.prose h3 { margin-top: 1rem; }
.prose li { margin-bottom: .35rem; }
.prose mark { background: var(--near-soft); color: var(--text); padding: 0 4px; border-radius: 4px; }
.site-footer { text-align: center; font-size: .85rem; color: var(--muted); margin: 24px 0 8px; }
.site-footer a { color: var(--muted); }

/* Admin-Bereich (?p=admin) */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.admin-tabs a { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: var(--surface); }
.admin-tabs a.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.admin-search { display: flex; gap: 8px; margin-bottom: 8px; }
.admin-search input { flex: 1; min-width: 0; }
.admin-family h2 { margin: 0; }
.admin-family details { margin: 4px 0 10px; }

/* ===== Lernziele ======================================================== */
.goal-items { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; margin: 4px 0 8px; }
.goal-item { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.ring { position: relative; width: 92px; height: 92px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg {
  stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--pct)); animation: ring-fill 1.1s cubic-bezier(.2, .8, .2, 1);
}
.ring-done .ring-fg { stroke: var(--ok); }
.ring-done { animation: pop .6s ease-out 1s backwards; }
@keyframes ring-fill { from { stroke-dashoffset: 100; } }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-text strong { font-size: 1.5rem; }
.ring-text small { font-size: .68rem; color: var(--muted); text-align: center; max-width: 70px; }
.week-dots { display: flex; gap: 6px; }
.week-dots i { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); }
.week-dots i.on { background: var(--ok); border-color: var(--ok); animation: pop .45s ease-out calc(.3s + var(--i) * .12s) backwards; }
.goal-bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.goal-bar span { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, var(--primary), var(--ok)); border-radius: 999px; animation: grow 1s cubic-bezier(.2, .8, .2, 1); }
@keyframes grow { from { width: 0; } }
.nags { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.nags li {
  padding: 10px 14px; border-radius: 12px; background: var(--near-soft); font-weight: 600;
  animation: slide-in .45s ease-out calc(.2s + var(--i) * .12s) backwards;
}
.nags li:first-child { animation-name: slide-in, nudge; animation-duration: .45s, .6s; animation-delay: .2s, 1.6s; }
@keyframes slide-in { from { transform: translateX(-16px); opacity: 0; } }
@keyframes nudge { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.2deg); } 75% { transform: rotate(1.2deg); } }
.goal-card.goal-green { border-color: var(--ok); }
.goal-card.goal-red { border-color: var(--bad); }
.light { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.light i { width: 10px; height: 10px; border-radius: 50%; }
.light-green i { background: var(--ok); }
.light-yellow i { background: #eab308; }
.light-red i { background: var(--bad); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.kid-light { margin-top: 8px; font-size: .85rem; }
.kid-light .light { margin-right: 6px; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.weekday-picker label { display: block !important; cursor: pointer; }
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker span { display: inline-block; min-width: 46px; text-align: center; padding: 8px 6px; border: 2px solid var(--border); border-radius: 12px; font-weight: 700; }
.weekday-picker input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.weekday-picker input:focus-visible + span { outline: 2px solid var(--primary); }
.lesson-goal-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lesson-goal-row:last-child { border-bottom: 0; }
.lesson-goal-row input[type="date"] { width: auto; }
.goal-reached {
  display: inline-flex; align-items: center; gap: 10px; margin: 10px auto; padding: 10px 18px;
  border-radius: 999px; background: var(--ok-soft); font-size: 1.1rem;
}
.goal-reached-icon { font-size: 1.6rem; }

/* ===== Bewegung ========================================================= */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }
.container > .card, .container > .grid > .card, .container > .kpi-grid > .kpi, .hello {
  animation: fade-up .45s ease-out backwards;
}
.container > :nth-child(2) { animation-delay: .05s; }
.container > :nth-child(3) { animation-delay: .1s; }
.container > :nth-child(4) { animation-delay: .15s; }
.container > :nth-child(n+5) { animation-delay: .2s; }
@keyframes fade-up { from { transform: translateY(12px); opacity: 0; } }
.hero { background: linear-gradient(135deg, var(--primary-soft), var(--surface) 70%); }
.hero .btn-big { animation: breathe 2.6s ease-in-out 1.2s infinite; }
@keyframes breathe { 50% { transform: scale(1.04); box-shadow: 0 6px 20px rgba(79, 70, 229, .3); } }
.streak.on { animation: flame 2.2s ease-in-out infinite; display: inline-block; }
@keyframes flame { 50% { transform: scale(1.08) rotate(-2deg); } }
.badge.earned { transition: transform .15s; }
.badge.earned:hover { transform: translateY(-3px) rotate(-1deg); }
.boxbar .seg { animation: grow-x .9s cubic-bezier(.2, .8, .2, 1); transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.question { animation: card-in .3s ease-out; }
@keyframes card-in { from { transform: translateX(24px) scale(.98); opacity: 0; } }
.option.correct { animation: bounce .45s ease-out; }
@keyframes bounce { 40% { transform: scale(1.05); } 70% { transform: scale(.98); } }
.st-correct .feedback, .st-near .feedback, .st-wrong .feedback { animation: fade-up .3s ease-out; }
.summary-emoji { animation: pop .6s ease-out, wiggle 1.2s ease-in-out .8s 2; display: inline-block; }
@keyframes wiggle { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.progress span { background: linear-gradient(90deg, var(--ok), #84cc16); transition: width .45s cubic-bezier(.2, .8, .2, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* "Mit Google anmelden" */
.google-box { display: flex; justify-content: center; min-height: 44px; margin: 8px 0 4px; }
.google-button { display: flex; justify-content: center; width: 100%; }
p.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; margin: 14px 0; }
p.or::before, p.or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Startseite für Besucher */
.page-home .container { max-width: 1100px; }
.landing { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; margin: 8px 0 28px; }
@media (min-width: 860px) { .landing { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.landing h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); line-height: 1.15; margin: 8px 0 12px; }
.landing .accent { color: var(--primary); }
.landing .lead { font-size: 1.1rem; color: var(--muted); }
.landing-points { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; font-size: 1.05rem; }
.store-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.store-link { display: inline-flex; flex-direction: column; justify-content: center; min-width: 150px; padding: 7px 18px;
  border-radius: 10px; background: #000; color: #fff; border: 1px solid #555; text-decoration: none; line-height: 1.2; }
.store-link small { font-size: .72rem; }
.store-link strong { font-size: 1.15rem; }
.store-link:hover { color: #fff; background: #222; }
.store-link.soon { opacity: .45; cursor: default; }
.landing-login { margin: 0; }
.landing-login h2 { margin-top: 0; }
.features h2, .faq h2 { margin: 28px 0 12px; }
.feature-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.feature-grid .card { margin: 0; }
.feature h3 { margin: 6px 0; }
.feature p { margin: 0; color: var(--muted); }
.feature-icon { font-size: 1.8rem; }
.privacy-teaser { margin-top: 28px; }
.privacy-teaser ul { padding-left: 1.2em; display: grid; gap: 6px; }
.faq-item { margin: 0 0 10px; padding: 0; }
.faq-item summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "＋ "; color: var(--primary); }
.faq-item[open] summary::before { content: "－ "; }
.faq-item p { margin: 0; padding: 0 16px 14px; color: var(--muted); }
.site-footer { line-height: 2; }

/* ===== Neue Übungsarten ================================================= */
.is-listen .prompt { display: none; }
.listen-btn { font-size: 1.3rem; padding: 18px 28px; border-radius: 999px; animation: breathe 2.6s ease-in-out infinite; }
.st-correct .listen-btn, .st-near .listen-btn, .st-wrong .listen-btn { display: none; }
.puzzle { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.puzzle-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.puzzle-slots.wrong { animation: shake .35s; }
.puzzle-word { display: flex; gap: 4px; }
.puzzle-slot {
  width: 38px; height: 46px; font: inherit; font-size: 1.35rem; font-weight: 800; color: var(--text);
  background: var(--surface-2); border: 0; border-bottom: 3px solid var(--border); border-radius: 8px; cursor: pointer;
}
.puzzle-slot.filled { background: var(--primary-soft); animation: pop .3s ease-out; }
.puzzle-slots.correct .puzzle-slot { border-bottom-color: var(--ok); }
.puzzle-slots.wrong .puzzle-slot { border-bottom-color: var(--bad); }
.puzzle-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.puzzle-tile {
  width: 50px; height: 50px; font: inherit; font-size: 1.35rem; font-weight: 700; cursor: pointer;
  background: var(--primary-soft); color: var(--text); border: 2px solid var(--border); border-radius: 12px;
  transition: opacity .15s, transform .08s;
}
.puzzle-tile:active { transform: scale(.94); }
.puzzle-tile.used { opacity: 0; pointer-events: none; }
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.pair-col { display: flex; flex-direction: column; gap: 10px; }
.pair-card {
  min-height: 64px; padding: 10px 8px; font: inherit; font-size: 1.1rem; font-weight: 700; color: var(--text); cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; transition: background .15s, border-color .15s;
}
.pair-card.sel { border-color: var(--primary); background: var(--primary-soft); }
.pair-card.ok { border-color: var(--ok); background: var(--ok-soft); animation: bounce .45s ease-out; }
.pair-card.revealed { border-color: var(--near); background: var(--near-soft); }
.pair-card.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.pair-card:disabled { cursor: default; }
.st-correct .puzzle-tiles, .st-near .puzzle-tiles, .st-wrong .puzzle-tiles { display: none; }

/* Vorlage zum Kopieren (?p=ki-import) */
.copy-box { position: relative; }
.copy-box pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; padding-top: 44px;
  white-space: pre-wrap; word-break: break-word; font-size: .85rem; max-height: 420px; overflow: auto; }
.copy-box .copy-btn { position: absolute; top: 8px; right: 8px; }
.import-ways > p { color: var(--muted); }
.import-ways code, .feature code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.admin-filter select { width: auto; }
.admin-filter { flex-wrap: wrap; }
.rate-bad { color: var(--bad); }
.rate-mid { color: var(--near); }
.family-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; margin-bottom: 8px; }

/* Lektionsliste mit Mehrfachauswahl */
.lesson-row { justify-content: flex-start; }
.lesson-check { width: 22px; height: 22px; flex: none; accent-color: var(--primary, #4f46e5); }
.lesson-row-link { display: flex; flex-direction: column; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.lesson-row-link:hover strong { text-decoration: underline; }
.lesson-row:has(.lesson-check:checked) { outline: 2px solid var(--primary, #4f46e5); }
.bulk-bar { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15); }
@media (min-width: 760px) { .bulk-bar { bottom: 12px; } }
.bulk-bar .actions { margin: 0; }
/* Solange nichts angehakt ist, nimmt die Leiste auf dem Handy keinen Platz weg */
#bulk-form:not(:has(.lesson-check:checked)) .bulk-bar { display: none; }
@media (max-width: 559px) {
  .lesson-row { flex-wrap: wrap; }
  .lesson-row-link { flex-basis: calc(100% - 44px); }
  .lesson-row > .small { flex-basis: 100%; text-align: left; padding-left: 40px; }
}
.bulk-kids { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.badges-open { margin-top: 12px; }
.badges-open summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }

/* Lektionen nach Sprache gruppiert */
.lang-group { margin: 8px 0; }
.lang-group > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }

/* Flaggen selbst gezeichnet: Windows zeigt Flaggen-Emojis nur als Buchstaben, für Katalonien gibt es gar kein allgemein verfügbares */
.flag { display: inline-block; width: 1.35em; height: .9em; vertical-align: -.05em; border-radius: 2px; background-size: 100% 100%; box-shadow: 0 0 0 1px rgba(127,127,127,.25); }
.flag-en { background-image: url(flag-gb.svg); }
.flag-es { background-image: linear-gradient(to bottom, #aa151b 25%, #f1bf00 25%, #f1bf00 75%, #aa151b 75%); }
.flag-fr { background-image: linear-gradient(to right, #002395 33.33%, #fff 33.33%, #fff 66.66%, #ed2939 66.66%); }
.flag-it { background-image: linear-gradient(to right, #009246 33.33%, #fff 33.33%, #fff 66.66%, #ce2b37 66.66%); }
.flag-de { background-image: linear-gradient(to bottom, #000 33.33%, #dd0000 33.33%, #dd0000 66.66%, #ffce00 66.66%); }
.flag-ca { background-image: repeating-linear-gradient(to bottom, #fcdd09 0, #fcdd09 calc(100% / 9), #da121a calc(100% / 9), #da121a calc(200% / 9)); }

/* Anleitung KI-Import: Vorlage je Sprache */
.ki-direction { margin: 8px 0; }
.ki-direction > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }

.badge-group { grid-column: 1 / -1; margin: 10px 0 0; font-size: .95rem; color: var(--muted); }

.bulk-families { flex-basis: 100%; }
.bulk-families > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

.group-bar { margin-top: 6px; font-weight: 400; }
.lang-group[open] > summary .group-bar { display: none; }

.changelog > summary { cursor: pointer; }
.changelog .nowrap { white-space: nowrap; }
.changelog table { margin-top: 10px; }

.flag-ja { background-image: radial-gradient(circle at center, #bc002d 28%, #fff 29%); }

/* iPad hochkant: alle Punkte der Leiste passen in eine Zeile */
@media (min-width: 760px) and (max-width: 900px) {
  .mainnav a { padding: 8px 8px; font-size: .88rem; gap: 4px; }
}

/* Avatare: vorgegebene Figuren */
.avatar { display: inline-block; vertical-align: middle; border-radius: 50%; background: var(--surface-2); object-fit: contain; padding: 2px; }
.who-line { display: flex; align-items: center; gap: 10px; }
.avatar-pick { margin-bottom: 12px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.avatar-choice { display: flex !important; flex-direction: column; align-items: center; gap: 2px !important; padding: 6px; border: 2px solid transparent; border-radius: 14px; cursor: pointer; text-align: center; font-weight: 500 !important; }
.avatar-choice input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.avatar-choice:has(input:focus-visible) { outline: 2px solid var(--primary); }
.avatar-choice small { font-size: .74rem; color: var(--muted); }
.avatar-lang { margin: 8px 0; }
.avatar-lang > summary { color: var(--text); padding: 4px 0; margin-bottom: 4px; }

.goal-why { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bad); font-size: .9rem; }
.goal-why ul { margin: 4px 0 0; padding-left: 18px; }
