/* ============================================================
   FamilyApp – Design-System (mobile-first, iPhone-optimiert)
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e3e6ef;
  --text: #1b1f2a;
  --muted: #667085;
  --primary: #5b5bd6;
  --primary-ink: #ffffff;
  --primary-soft: #ecebfd;
  --success: #12a150;
  --success-soft: #e3f6eb;
  --warning: #c27803;
  --warning-soft: #fdf3dc;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --info-soft: #e8f1fd;
  --kid: #f59e0b;
  --kid-soft: #fff4dc;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #232732;
    --border: #2e3340;
    --text: #eef0f5;
    --muted: #9aa3b5;
    --primary: #8b8bf5;
    --primary-ink: #0f1020;
    --primary-soft: #26264a;
    --success: #3ccf7a;
    --success-soft: #14301f;
    --warning: #f0b43c;
    --warning-soft: #34290f;
    --danger: #ff6b5e;
    --danger-soft: #3a1a17;
    --info-soft: #182438;
    --kid-soft: #33270e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 2rem; text-align: center; }

/* ── Layout ───────────────────────────────────────────────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar .title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
.main {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}
.main.no-tabs { padding-bottom: calc(var(--safe-bottom) + 24px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.page-head p { margin-top: 4px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 10px; }
.section-title h2 { font-size: 1.05rem; }

/* Tableiste unten (iOS-Stil) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .7rem; font-weight: 600;
}
.tabbar a .ico { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .75; }
.tabbar a.active { color: var(--primary); }
.tabbar a.active .ico { filter: none; opacity: 1; }
.tabbar a.plus .ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); filter: none; opacity: 1; font-size: 1.6rem; font-weight: 400;
}

@media (min-width: 900px) {
  .tabbar { top: 0; bottom: 0; right: auto; width: 96px; height: auto; flex-direction: column; justify-content: flex-start; padding: calc(var(--safe-top) + 80px) 0 0; gap: 8px; border-top: 0; border-right: 1px solid var(--border); }
  .tabbar a { flex: 0 0 auto; height: 68px; max-width: none; }
  .shell { padding-left: 96px; }
  .main { padding-bottom: 40px; }
}

/* ── Karten & Listen ──────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; border: 1px solid var(--border);
}
.card.flat { box-shadow: none; }
.card.tight { padding: 12px 14px; }
.card h2 + *, .card h3 + * { margin-top: 8px; }
.list { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px; color: inherit; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.list > .item + .item { border-top: 1px solid var(--border); }
.list > .item:active { background: var(--surface-2); }
.item .chev { color: var(--muted); font-size: 1.2rem; }
.item .item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .item-sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 6px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary);
}
.avatar.sm { width: 28px; height: 28px; font-size: .8rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge.open { background: var(--info-soft); color: var(--primary); }
.badge.progress { background: var(--warning-soft); color: var(--warning); }
.badge.correction { background: var(--warning-soft); color: var(--warning); }
.badge.done { background: var(--success-soft); color: var(--success); }
.badge.help { background: var(--kid-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.self { background: var(--primary-soft); color: var(--primary); }
.badge.test { background: #fde7f3; color: #be185d; }
@media (prefers-color-scheme: dark) { .badge.test { background: #3d1530; color: #f472b6; } }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .3s ease; }
.progress.success > span { background: var(--success); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.kpi .value { word-break: keep-all; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px; box-shadow: var(--shadow); }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.45rem; font-weight: 750; letter-spacing: -.01em; margin-top: 2px; }
.kpi .sub { font-size: .82rem; color: var(--muted); }
.kpi.good .value { color: var(--success); }
.kpi.warn .value { color: var(--warning); }

/* ── Buttons & Formulare ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; cursor: pointer; background: var(--surface-2); color: var(--text); text-align: center;
  transition: transform .06s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.link { background: none; color: var(--primary); padding: 0 6px; min-height: 40px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.05rem; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .875rem; border-radius: 10px; }
.btn.icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: transparent; font-size: 1.25rem; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-color: var(--primary-ink) transparent var(--primary-ink) transparent; animation: spin .8s linear infinite; }
.btn:not(.primary).busy::after { border-color: var(--text) transparent var(--text) transparent; }

.field { display: block; }
.field + .field { margin-top: 14px; }
.field > .label { display: block; font-size: .85rem; font-weight: 650; color: var(--muted); margin: 0 2px 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: 84px; resize: vertical; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: .8rem; color: var(--muted); margin: 6px 2px 0; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 550; }
.info-box { background: var(--info-soft); border-radius: 12px; padding: 12px 14px; }
.warn-box { background: var(--warning-soft); border-radius: 12px; padding: 12px 14px; }

/* Segmentierte Auswahl / Chips */
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip .avatar { width: 24px; height: 24px; font-size: .7rem; margin-left: -6px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 51px; height: 31px; border-radius: 99px; background: var(--border); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-soft); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--surface-2); font-size: 1.3rem; cursor: pointer; }
.stepper span { min-width: 48px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Themenkacheln */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.topic-tile {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; min-height: 60px;
  border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600;
}
.topic-tile .ico { font-size: 1.5rem; }
.topic-tile.active { border-color: var(--primary); background: var(--primary-soft); }
.topic-group { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 2px 8px; }

.pkg { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.pkg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pkg-body { padding: 14px 16px; }
.param-block { background: var(--surface-2); border-radius: 12px; padding: 12px; margin-top: 10px; }
.param-block .field + .field { margin-top: 10px; }
.param-block .field > .label { margin-bottom: 4px; }

/* ── Kinderansicht ───────────────────────────────────────── */
.kid { font-family: var(--font-round); }
.kid .hello { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
.kid-card {
  border-radius: 22px; padding: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; color: inherit;
}
.kid-card + .kid-card { margin-top: 12px; }
.kid-card:active { transform: scale(.99); }
.kid-card .emoji { font-size: 2.1rem; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--kid-soft); flex: 0 0 auto; }
.kid-card .t { font-weight: 750; font-size: 1.1rem; }
.kid-card .s { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.kid-card.new { border: 2px solid var(--kid); }
.kid-card.practice { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: 0; }
.kid-card.practice .emoji { background: rgba(255,255,255,.18); }
.kid-card.practice .s { color: rgba(255,255,255,.85); }

/* Haushaltsaufgaben (Kinder) */
.chore-card { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.chore-card .chore-icon { font-size: 2rem; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--kid-soft); flex: 0 0 auto; }
.chore-card .t { font-weight: 750; font-size: 1.08rem; }
.chore-card .s { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.chore-card.late:not(.done) { border-color: var(--warning); }
.chore-card.late:not(.done) .s { color: var(--warning); font-weight: 600; }
.chore-card.done { opacity: .6; }
.chore-card.done .t { text-decoration: line-through; }
.chore-check { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--border); background: var(--surface); font-size: 1.6rem; font-weight: 800; color: #fff; cursor: pointer; flex: 0 0 auto; transition: background .15s, border-color .15s; }
.chore-check:active { transform: scale(.94); }
.chore-check.done { background: var(--success); border-color: var(--success); }
.chore-check.busy { color: transparent; }

/* Aufgabenansicht (Lernen) */
.play { min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font-round); }
.play-top { padding: calc(var(--safe-top) + 8px) 12px 8px; display: flex; align-items: center; gap: 10px; }
.play-top .progress { flex: 1; height: 10px; }
.play-top .count { font-weight: 700; font-size: .9rem; color: var(--muted); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.play-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 16px; max-width: 560px; width: 100%; margin: 0 auto; }
.play-meta { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-weight: 650; font-size: .9rem; margin-bottom: 10px; }
.problem-card { background: var(--surface); border-radius: 26px; padding: 22px 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); text-align: center; }
.problem-text { font-size: clamp(1.7rem, 8.5vw, 2.4rem); font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
.problem-word { font-size: 1.25rem; font-weight: 650; line-height: 1.4; }
.problem-question { font-size: 1.25rem; font-weight: 750; margin-top: 8px; }
.answer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-size: 1.5rem; font-weight: 700; }
.ans {
  min-width: 96px; height: 60px; padding: 0 12px; border-radius: 14px; border: 2.5px solid var(--border); background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; cursor: text;
}
.ans.active { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.ans.active::after { content: ""; width: 2px; height: 32px; background: var(--primary); margin-left: 2px; animation: blink 1s step-end infinite; }
.ans.err { border-color: var(--danger); }
.ans .ph { color: var(--muted); opacity: .45; font-weight: 600; }
.unit { color: var(--muted); font-weight: 700; }
.clock-wrap { display: flex; justify-content: center; margin: 4px 0 8px; }
.clock-wrap svg { width: min(62vw, 240px); height: auto; }
.prev-answer { margin-top: 12px; color: var(--muted); font-size: .95rem; }
.prev-answer b { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 2px; }
.feedback { margin-top: 14px; border-radius: 16px; padding: 12px 14px; font-weight: 700; font-size: 1.05rem; animation: pop .25s ease; }
.feedback.ok { background: var(--success-soft); color: var(--success); }
.feedback.no { background: var(--warning-soft); color: var(--warning); }
.feedback.info { background: var(--info-soft); color: var(--text); font-weight: 600; }
.hint-box { margin-top: 14px; text-align: left; background: var(--kid-soft); border-radius: 16px; padding: 14px; }
.hint-box h3 { font-size: 1rem; margin-bottom: 6px; }
.hint-box ol { margin: 0; padding-left: 20px; }
.hint-box li + li { margin-top: 4px; }
.hint-box .sol { margin-top: 10px; font-weight: 800; font-size: 1.15rem; }
.field-error { color: var(--danger); font-weight: 600; margin-top: 10px; font-size: .95rem; }

.keypad { padding: 10px 12px calc(var(--safe-bottom) + 12px); background: var(--surface); border-top: 1px solid var(--border); }
.keypad-inner { max-width: 460px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  height: 54px; border-radius: 14px; border: 0; background: var(--surface-2); font-size: 1.55rem; font-weight: 700; cursor: pointer;
  font-family: var(--font-round); user-select: none; -webkit-user-select: none;
}
.key:active { background: var(--border); transform: scale(.97); }
.key.fn { font-size: 1.2rem; color: var(--muted); }
.key.go { grid-column: 1 / -1; background: var(--primary); color: var(--primary-ink); font-size: 1.15rem; height: 56px; }
.key.go:disabled { opacity: .5; }
.key-extras { grid-column: 1 / -1; display: flex; gap: 8px; }
.key-extras .key { flex: 1; height: 44px; font-size: 1.2rem; }
@media (max-height: 700px) { .key { height: 46px; } .key.go { height: 50px; } .ans { height: 54px; } }

.celebrate { text-align: center; padding: 24px 8px; }
.celebrate .big-emoji { font-size: 4.5rem; display: block; animation: pop .4s ease; }
.celebrate h1 { font-size: 1.9rem; margin-top: 10px; font-family: var(--font-round); }
.celebrate p { margin-top: 10px; font-size: 1.1rem; color: var(--muted); }
.celebrate .actions { margin-top: 26px; display: grid; gap: 10px; }

/* Bericht (Eltern) */
.prob-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 12px 14px; }
.prob-row + .prob-row { border-top: 1px solid var(--border); }
.prob-no { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.prob-no.ok { background: var(--success-soft); color: var(--success); }
.prob-no.bad { background: var(--danger-soft); color: var(--danger); }
.prob-text { font-weight: 650; font-variant-numeric: tabular-nums; }
.prob-detail { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.prob-detail .wrong { color: var(--danger); font-weight: 650; }
.attempts { margin-top: 8px; font-size: .82rem; display: grid; gap: 4px; }
.attempts div { display: flex; gap: 8px; align-items: baseline; }
.attempts .a-ok { color: var(--success); font-weight: 650; }
.attempts .a-bad { color: var(--danger); font-weight: 650; }

.bar-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 52px; gap: 10px; align-items: center; padding: 10px 0; }
.bar-row + .bar-row { border-top: 1px solid var(--border); }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.lvl-sicher { background: var(--success); }
.lvl-gefestigt { background: #3b82f6; }
.lvl-ueben { background: var(--warning); }
.lvl-wenig_daten { background: var(--muted); opacity: .5; }
.trend-up { color: var(--success); font-weight: 700; }
.trend-down { color: var(--danger); font-weight: 700; }
.chart { width: 100%; height: 160px; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart rect.b { fill: var(--primary); }

/* Toasts, Banner, Modal */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #1f2330; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 520px; animation: slideup .25s ease; pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.success { background: #0f7a3c; }
.banner { background: var(--primary); color: var(--primary-ink); padding: 10px 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; font-weight: 600; }
.banner.offline { background: var(--warning); color: #111; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); z-index: 200; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(var(--safe-bottom) + 16px); animation: slideup .25s ease; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } .modal { border-radius: 22px; } }
.modal .modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); max-width: 420px; margin: 0 auto; }
.login .logo { width: 76px; height: 76px; border-radius: 20px; display: block; margin: 0 auto 14px; box-shadow: var(--shadow-lg); }
.login h1 { text-align: center; }
.login .sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; padding: 48px 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; height: 64px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideup { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
