/* Mila Math – Design-Tokens und Komponenten. Flat, Apple-inspiriert, ohne Verläufe und unnötige Schatten. */
:root {
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #20263D;
  --text-2: #62646C;
  --primary: #7860C1;
  --bar: #8874CD;
  --track: #EAE7F5;
  --line: #E4E5EC;
  --field: #F8F8FB;

  --lavender-bg: #E6E1FA; --lavender: #6952AC; --lavender-text: #5F489F;
  --sage-bg: #DDF0E7;     --sage: #347D60;     --sage-text: #2C6B52;
  --blue-bg: #DDEAFB;     --blue: #3B6DA9;     --blue-text: #335F95;
  --apricot-bg: #F9E7D5;  --apricot: #A66C36;  --apricot-text: #8A5626;
  --rose-bg: #F8E0E9;     --rose: #A94D73;     --rose-text: #94405F;
  --yellow-bg: #F9EFCB;   --yellow: #9D7B23;   --yellow-text: #7A5F14;

  --success: #2C6B52; --success-bg: #E3F3EA;
  --warn: #8A5626;    --warn-bg: #FBEEDF;
  --danger: #B03A3A;  --danger-bg: #FBE7E7;

  --accent: var(--lavender); --accent-bg: var(--lavender-bg); --accent-text: var(--lavender-text);

  --radius-card: 20px;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

.t-lavender { --tbg: var(--lavender-bg); --tc: var(--lavender); --tt: var(--lavender-text); --accent: var(--lavender); --accent-bg: var(--lavender-bg); --accent-text: var(--lavender-text); }
.t-sage     { --tbg: var(--sage-bg);     --tc: var(--sage);     --tt: var(--sage-text);     --accent: var(--sage);     --accent-bg: var(--sage-bg);     --accent-text: var(--sage-text); }
.t-blue     { --tbg: var(--blue-bg);     --tc: var(--blue);     --tt: var(--blue-text);     --accent: var(--blue);     --accent-bg: var(--blue-bg);     --accent-text: var(--blue-text); }
.t-apricot  { --tbg: var(--apricot-bg);  --tc: var(--apricot);  --tt: var(--apricot-text);  --accent: var(--apricot);  --accent-bg: var(--apricot-bg);  --accent-text: var(--apricot-text); }
.t-rose     { --tbg: var(--rose-bg);     --tc: var(--rose);     --tt: var(--rose-text);     --accent: var(--rose);     --accent-bg: var(--rose-bg);     --accent-text: var(--rose-text); }
.t-yellow   { --tbg: var(--yellow-bg);   --tc: var(--yellow);   --tt: var(--yellow-text);   --accent: var(--yellow);   --accent-bg: var(--yellow-bg);   --accent-text: var(--yellow-text); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(120, 96, 193, .45); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--card); padding: 10px 14px; border-radius: 12px; z-index: 50; }
.skip-link:focus { top: calc(env(safe-area-inset-top) + 8px); }
.muted { color: var(--text-2); }
.center { text-align: center; }

.app {
  max-width: 1000px; margin: 0 auto; outline: none; min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 14px) max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + var(--safe-b) + 28px) max(16px, env(safe-area-inset-left));
}

/* ---------- Icons ---------- */
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon .dot { stroke-width: 2.6; }
.icon .thick { stroke-width: 2.6; }
.icon .fill { fill: currentColor; stroke: none; }

/* ---------- Startseite ---------- */
.app-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-top: 6px; }
.app-title { font-size: clamp(28px, 7.5vw, 32px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.claim { margin-top: 2px; color: var(--text-2); font-size: 15px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--lavender-bg); color: var(--primary);
  display: grid; place-items: center; font-weight: 600; font-size: 18px; text-decoration: none; flex: none;
}
.greeting { margin-top: 22px; }
.greeting h2 { font-size: clamp(22px, 6vw, 26px); font-weight: 700; letter-spacing: -.01em; }
.greeting p { color: var(--text-2); margin-top: 4px; font-size: 15px; }

.topic-select {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: var(--radius); min-height: 56px; padding: 0 16px; margin: 16px 0;
  font-size: 17px; font-weight: 600; cursor: pointer;
}
.topic-select__label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-select .icon { color: var(--text-2); }
.topic-select select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; appearance: none; }
.topic-select:focus-within { outline: 3px solid rgba(120, 96, 193, .35); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic-card {
  display: flex; flex-direction: column; gap: 2px; min-height: 118px; padding: 16px 14px; border-radius: var(--radius-card);
  background: var(--tbg); color: var(--text); text-decoration: none; transition: transform .15s ease;
}
.topic-card:active { transform: scale(.97); }
.topic-card__symbol { color: var(--tc); font-size: 28px; font-weight: 600; line-height: 1; height: 34px; display: flex; align-items: center; margin-bottom: 14px; letter-spacing: -.01em; }
.topic-card__symbol .sym-icon { width: 30px; height: 30px; stroke-width: 2; }
.topic-card__title { font-size: clamp(16px, 4.6vw, 19px); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.topic-card__sub { font-size: 14px; color: var(--tt); }

.week-card { display: block; margin-top: 14px; background: var(--card); border-radius: var(--radius-card); padding: 16px 18px 14px; color: var(--text); text-decoration: none; }
.week-card__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.week-card h3 { font-size: 17px; font-weight: 600; }
.week-card__pct { color: var(--primary); font-weight: 600; font-size: 17px; }
.week-card p { color: var(--text-2); font-size: 14px; margin-top: 10px; }

.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--bar); transition: width .4s ease; }

/* ---------- Navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + var(--safe-b)) max(8px, env(safe-area-inset-left));
}
.tabbar a {
  flex: 1; max-width: 140px; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-2); text-decoration: none; font-size: 12px; font-weight: 500;
}
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--primary); }
.tabbar a[aria-current="page"] .icon { stroke-width: 2.1; }

/* ---------- Seiten ---------- */
.page-head { margin: 6px 0 18px; }
.page-title { font-size: clamp(24px, 6.5vw, 28px); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.page-sub { color: var(--text-2); margin-top: 4px; }
.section-title { font-size: 19px; font-weight: 600; margin: 24px 0 10px; }
.card { background: var(--card); border-radius: var(--radius-card); padding: 18px; margin-bottom: 14px; }
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.empty { text-align: center; padding: 28px 18px; display: grid; gap: 12px; }
.footnote { color: var(--text-2); font-size: 13px; text-align: center; margin: 20px 8px 0; }
.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; color: var(--primary); text-decoration: none; font-weight: 500; margin: -6px 0 6px -6px; }

/* Lernübersicht */
.cat { margin-bottom: 26px; }
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.cat-head h2 { font-size: 20px; font-weight: 600; }
.cat-area { color: var(--text-2); font-size: 13px; }
.module-grid { display: grid; gap: 12px; }
.module-card { background: var(--card); border-radius: var(--radius-card); overflow: hidden; }
.module-card__main { display: flex; gap: 14px; align-items: flex-start; padding: 16px; color: var(--text); text-decoration: none; }
.module-card__sym { flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--tbg); color: var(--tc); display: grid; place-items: center; font-weight: 700; font-size: 19px; }
.module-card__sym .sym-icon, .module-hero__sym .sym-icon, .quick-row__sym .sym-icon, .tp-sym .sym-icon, .challenge-card__sym .sym-icon { width: 26px; height: 26px; stroke-width: 2; }
.module-card__body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.module-card__title { font-size: 17px; font-weight: 600; }
.module-card__desc { color: var(--text-2); font-size: 14px; }
.module-card__meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.module-card .bar > span { background: var(--tc); }
.chev { color: #B4B6C0; margin-top: 14px; }
.subtopics { border-top: 1px solid var(--line); }
.subtopics summary { list-style: none; cursor: pointer; padding: 12px 16px; min-height: 44px; color: var(--accent-text); font-weight: 500; font-size: 15px; display: flex; justify-content: space-between; }
.subtopics summary::-webkit-details-marker { display: none; }
.subtopics summary::after { content: '+'; font-size: 20px; line-height: 1; }
.subtopics[open] summary::after { content: '−'; }
.subtopics ul { list-style: none; margin: 0; padding: 0 16px 12px; display: grid; gap: 2px; }
.subtopics li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); }
.subtopics li:last-child { border-bottom: 0; }
.subtopics a { color: var(--text); text-decoration: none; font-size: 15px; }
.module-card.is-planned { padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: transparent; border: 1.5px dashed #D5D6DE; color: var(--text-2); }
.module-card.is-planned .module-card__title { font-weight: 500; font-size: 15px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: #EEEFF3; color: #555862; }
.chip-planned { background: #EEEFF3; }
.st-wiederholen.chip { background: var(--apricot-bg); color: var(--apricot-text); }
.st-inArbeit.chip { background: var(--lavender-bg); color: var(--lavender-text); }
.st-zunehmend.chip { background: #E5F4EC; color: var(--sage-text); }
.st-sicher.chip { background: #CDEBDC; color: #215A43; }

/* Modulseite */
.module-hero { display: flex; gap: 16px; align-items: flex-start; background: var(--tbg); border-radius: var(--radius-card); padding: 18px; margin-bottom: 14px; }
.module-hero__sym { flex: none; width: 56px; height: 56px; border-radius: 18px; background: var(--card); color: var(--tc); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.module-hero h1 { font-size: clamp(22px, 6vw, 26px); font-weight: 600; line-height: 1.2; }
.module-hero p { margin-top: 4px; font-size: 15px; }
.module-hero .ref { color: var(--tt); font-size: 13px; margin-top: 8px; }
.tabs { display: flex; background: #E9EAF0; padding: 3px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--text-2); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--text); }
.explain { background: var(--card); border-radius: var(--radius-card); padding: 18px; margin-bottom: 12px; }
.explain h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.explain-body p + p { margin-top: 8px; }
.explain-body ul, .explain-body ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.explain-visual { margin-top: 12px; overflow-x: auto; }
.merksatz { margin-top: 12px; background: var(--accent-bg); color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.mistake { margin-top: 10px; background: var(--warn-bg); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
table.mini { border-collapse: collapse; margin-top: 6px; }
table.mini td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line); }

/* Formulare */
.setup { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { font-weight: 600; font-size: 15px; padding: 0; }
.field-hint { color: var(--text-2); font-size: 14px; }
.select, .text-input {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); padding: 0 14px; font-size: 16px;
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2362646C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.select:focus, .text-input:focus { outline: none; border-color: var(--primary); }
.seg { display: flex; background: #EEEFF3; border-radius: 12px; padding: 3px; gap: 2px; }
.seg-opt { flex: 1; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg-opt span { display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--text-2); text-align: center; padding: 0 4px; }
.seg-opt input:checked + span { background: var(--card); color: var(--text); }
.seg-opt input:focus-visible + span { outline: 3px solid rgba(120, 96, 193, .45); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; cursor: pointer; position: relative; }
.toggle-text { display: grid; }
.toggle-text span { font-weight: 600; font-size: 15px; }
.toggle-text small { color: var(--text-2); font-size: 13px; }
.toggle input { position: absolute; opacity: 0; right: 0; width: 52px; height: 32px; margin: 0; }
.toggle-ui { flex: none; width: 52px; height: 32px; border-radius: 99px; background: #DADBE2; position: relative; transition: background .2s; }
.toggle-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .toggle-ui { background: var(--primary); }
.toggle input:checked + .toggle-ui::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-ui { outline: 3px solid rgba(120, 96, 193, .45); outline-offset: 2px; }
.check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.check-chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 99px; background: #EEEFF3; color: var(--text-2); font-weight: 500; font-size: 15px; }
.check-chip input:checked + span { background: var(--lavender-bg); color: var(--lavender-text); }
.check-chip input:checked + span::before { content: '✓ '; white-space: pre; }
.check-chip input:focus-visible + span { outline: 3px solid rgba(120, 96, 193, .45); }

/* Buttons */
.btn {
  appearance: none; border: 0; border-radius: 14px; min-height: 52px; padding: 0 20px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 17px; text-decoration: none; text-align: center;
  transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--lavender-bg); color: var(--lavender-text); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: var(--danger-bg); color: var(--danger); }
.btn-sm { min-height: 40px; font-size: 15px; width: auto; padding: 0 14px; border-radius: 12px; flex: none; }
.btn[disabled] { opacity: .5; }
.file-btn { cursor: pointer; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; }
.link-btn { border: 0; background: none; padding: 6px 2px; color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; min-height: 36px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--text); background: var(--card); flex: none; }

/* Übungsliste */
.type-list { list-style: none; padding: 6px 16px; display: grid; }
.type-row { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; min-height: 56px; }
.type-list li:last-child .type-row { border-bottom: 0; }
.type-row__title { font-weight: 500; }
.type-row small { grid-column: 1 / -1; color: var(--text-2); font-size: 13px; margin-top: -4px; }
.type-row .bar { grid-column: 1; height: 6px; }
.type-row .chip { grid-column: 2; grid-row: 1; }
.review-card { display: grid; gap: 12px; }
.review-card p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.resume-card, .challenge-card { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.resume-card > div, .challenge-card > div { flex: 1; }
.resume-card p, .challenge-card p { color: var(--text-2); font-size: 14px; }
.challenge-card { background: var(--tbg); }
.challenge-card__sym { width: 48px; height: 48px; border-radius: 14px; background: var(--card); color: var(--tc); display: grid; place-items: center; flex: none; }
.quick-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.quick-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 10px 14px; min-height: 60px; color: var(--text); text-decoration: none; font-weight: 500; }
.quick-row > span:nth-child(2) { flex: 1; }
.quick-row .icon:last-child { color: #B4B6C0; }
.quick-row__sym { width: 40px; height: 40px; border-radius: 12px; background: var(--tbg); color: var(--tc); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }

/* ---------- Übungsansicht ---------- */
.practice { max-width: 640px; margin: 0 auto; }
.practice-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.practice-top__title { flex: 1; text-align: center; font-size: 16px; }
.practice-top__title strong { font-weight: 600; }
.timer, .timer-spacer { min-width: 44px; }
.timer { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 15px; }
.timer .icon { width: 18px; height: 18px; }
.practice-count { color: var(--text-2); font-size: 14px; margin-bottom: 8px; text-align: center; }
.practice .bar > span { background: var(--bar); }
.q-card { background: var(--card); border-radius: 22px; padding: 22px 18px 18px; margin-top: 16px; animation: rise .28s ease-out; }
.q-topic { color: var(--accent-text); font-size: 14px; font-weight: 600; text-align: center; min-height: 1em; }
.q-prompt { text-align: center; margin-top: 8px; font-size: 17px; line-height: 1.5; }
.q-math {
  font-size: clamp(38px, 11vw, 54px); font-weight: 600; text-align: center; letter-spacing: -.01em; line-height: 1.25;
  margin: 14px 0 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.q-math.md { font-size: clamp(26px, 7.4vw, 38px); }
.q-math.sm { font-size: clamp(21px, 6vw, 30px); }
.q-math .gap { display: inline-block; min-width: 1.1em; color: var(--accent); }
.q-visual { margin: 14px auto 4px; display: flex; justify-content: center; overflow-x: auto; }
.answer { margin-top: 18px; display: grid; gap: 12px; }
.ans-label { display: block; color: var(--text-2); font-size: 14px; font-weight: 500; text-align: center; padding: 0; }
.ans-row { display: flex; align-items: center; gap: 10px; justify-content: center; }
.ans-input {
  width: 100%; max-width: 360px; height: 66px; border: 2px solid var(--line); border-radius: 16px; background: var(--field);
  font-size: 32px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none;
}
.ans-input.sm { height: 58px; font-size: 26px; max-width: 120px; }
.ans-input::placeholder { color: #B4B6C0; font-size: 15px; font-weight: 500; }
.ans-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.ans-unit { font-size: 22px; font-weight: 600; color: var(--text-2); flex: none; }
.ans-help { text-align: center; color: var(--text-2); font-size: 13px; }
.frac-input, .rem-input, .time-input { border: 0; padding: 0; margin: 0; min-width: 0; }
.frac-row, .rem-row, .time-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.fi-stack { display: grid; gap: 6px; justify-items: center; }
.fi-line { display: block; width: 110px; height: 3px; border-radius: 3px; background: var(--text); }
.fi-whole .ans-input { max-width: 90px; }
.rem-row label { display: grid; gap: 4px; justify-items: center; }
.small-label { font-size: 12px; color: var(--text-2); }
.rem-word { font-weight: 600; color: var(--text-2); }
.time-colon { font-size: 30px; font-weight: 700; }
.time-row .ans-input { max-width: 86px; }
.choice-row { display: flex; justify-content: center; gap: 12px; }
.choice {
  width: 84px; height: 72px; border-radius: 18px; border: 2px solid var(--line); background: var(--field); font-size: 34px; font-weight: 600;
  transition: transform .12s ease;
}
.choice:active { transform: scale(.96); }
.choice.is-right { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.choice.is-wrong { background: var(--warn-bg); border-color: #E7C6A6; color: var(--warn); }
.feedback:empty { display: none; }
.feedback { border-radius: 14px; padding: 12px 14px; font-size: 16px; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; }
.feedback.success { background: var(--success-bg); color: var(--success); }
.feedback.warn { background: var(--warn-bg); color: var(--warn); }
.feedback.info { background: #EEF0F6; color: var(--text); }
.feedback .icon { width: 20px; height: 20px; stroke-width: 2.4; margin-top: 1px; }
.actions { display: grid; gap: 10px; }
.is-correct .ans-input { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.hint, .solution { margin-top: 16px; border-radius: 16px; padding: 14px 16px; }
.hint { background: var(--accent-bg); }
.solution { background: #F3F4F8; }
.hint-title { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 6px; color: var(--accent-text); }
.solution .hint-title { color: var(--text); }
.hint-title .icon { width: 20px; height: 20px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.steps li { padding-left: 2px; }
.answer-line { margin-top: 10px; font-size: 17px; }
.levelup { margin-top: 14px; display: grid; gap: 12px; background: var(--yellow-bg); }
.levelup .row .btn { flex: 1; }
.shake { animation: shake .35s ease; }

/* Brüche */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 .08em; font-size: .78em; font-variant-numeric: tabular-nums; }
.frac .num { border-bottom: .07em solid currentColor; padding: 0 .14em .05em; }
.frac .den { padding: .05em .14em 0; }
.frac.sm { font-size: .82em; }
.steps .frac, .hint .frac, .answer-line .frac { font-size: .92em; }

/* Zusammenfassung */
.summary { max-width: 640px; margin: 0 auto; text-align: center; display: grid; gap: 14px; }
.summary-badge { width: 72px; height: 72px; margin: 10px auto 0; border-radius: 50%; background: var(--yellow-bg); color: var(--yellow); display: grid; place-items: center; }
.summary-badge .icon { width: 36px; height: 36px; }
.summary-msg { color: var(--text-2); font-size: 17px; }
.summary .card { text-align: left; margin: 0; }
.weak-list li { display: grid; gap: 2px; }
.weak-q { font-weight: 600; }
.weak-a { color: var(--text-2); font-size: 14px; }

/* Fortschritt */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: var(--radius-card); padding: 14px 16px; display: grid; gap: 2px; text-align: left; }
.kpi-v { font-size: 28px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: 16px; color: var(--text-2); font-weight: 500; }
.kpi-l { color: var(--text-2); font-size: 13.5px; }
.chart { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto; }
.chart-track { fill: #F1F1F6; }
.chart-bar { fill: var(--bar); }
.chart-val { font: 600 12px var(--font); fill: var(--text); }
.chart-lbl { font: 500 12px var(--font); fill: var(--text-2); }
.recs, .plain { list-style: none; margin: 0; padding: 0; display: grid; }
.recs li, .plain li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 48px; }
.recs li:last-child, .plain li:last-child { border-bottom: 0; }
.topic-progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.topic-progress a { display: flex; gap: 12px; align-items: center; padding: 8px 0; color: var(--text); text-decoration: none; }
.tp-sym { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--tbg); color: var(--tc); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.tp-body { flex: 1; display: grid; gap: 5px; min-width: 0; }
.tp-title { display: flex; justify-content: space-between; font-weight: 500; font-size: 15px; gap: 8px; }
.tp-title span { color: var(--text-2); }
.tp-body .chip { justify-self: start; }
.topic-progress .bar > span { background: var(--tc); }
.matrix-wrap { overflow-x: auto; margin: 6px -8px 0; }
.matrix { --cell: min(44px, calc((100vw - 104px) / 11)); border-collapse: separate; border-spacing: 2px; margin: 0 auto; }
.matrix th { font-size: 12px; font-weight: 600; color: var(--text-2); width: var(--cell); height: var(--cell); padding: 0; }
.matrix td { padding: 0; }
.mx { width: var(--cell); height: var(--cell); border: 0; border-radius: 8px; font-size: 13px; font-weight: 700; display: grid; place-items: center; padding: 0; }
.mx.st-neu, .mx-dot.st-neu { background: #ECEDF1; color: #9A9CA6; }
.mx.st-wiederholen, .mx-dot.st-wiederholen { background: #F6D9BD; color: #7C4A1E; }
.mx.st-inArbeit, .mx-dot.st-inArbeit { background: var(--lavender-bg); color: var(--lavender-text); }
.mx.st-zunehmend, .mx-dot.st-zunehmend { background: #D3EEDF; color: #2C6B52; }
.mx.st-sicher, .mx-dot.st-sicher { background: #3F8F6C; color: #fff; }
.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.mx-dot { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.stats div { background: #F4F5F8; border-radius: 12px; padding: 10px 12px; }
.stats dt { color: var(--text-2); font-size: 13px; }
.stats dd { margin: 2px 0 0; font-weight: 600; font-size: 17px; }

/* Sheet & Toast */
.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 24px 24px 0 0; background: var(--card); color: var(--text);
  max-height: 88vh; overflow-y: auto;
}
.sheet::backdrop { background: rgba(32, 38, 61, .35); }
.sheet[open] { animation: up .25s ease-out; }
.sheet-inner { padding: 22px 20px calc(22px + var(--safe-b)); position: relative; display: grid; gap: 10px; }
.sheet-close { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #EEEFF3; display: grid; place-items: center; color: var(--text-2); }
.sheet-inner > .chip { justify-self: start; }
.sheet-title { font-size: 22px; font-weight: 600; padding-right: 40px; }
.sheet-math { font-size: 30px; }
.confirm-text { font-size: 17px; padding-right: 40px; margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 60;
  background: var(--text); color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; gap: 14px; align-items: center;
  max-width: calc(100vw - 32px); width: max-content; font-size: 15px; animation: rise .2s ease-out;
}
.toast button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; border-radius: 10px; min-height: 36px; padding: 0 12px; font-weight: 600; }

/* ---------- Visualisierungen ---------- */
.vz { width: 100%; height: auto; display: block; margin: 4px auto; }
.vz-stack { display: grid; gap: 8px; width: 100%; max-width: 300px; margin: 0 auto; }
.vz-dot { fill: var(--accent); }
.vz-dot2 { fill: var(--accent); opacity: .45; }
.vz-part { stroke: var(--accent); stroke-width: 1.5; }
.vz-on { fill: var(--accent); fill-opacity: .75; }
.vz-off { fill: #fff; }
.vz-soft { fill: var(--accent-bg); }
.vz-cell { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1; }
.vz-outline { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.vz-shape { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.vz-hole { fill: #fff; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; }
.vz-dash { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.vz-line { fill: none; stroke: var(--text-2); stroke-width: 1.5; }
.vz-axis { stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; }
.vz-mark { fill: var(--accent); }
.vz-text { fill: var(--text); font: 600 14px var(--font); }
.vz-label { fill: var(--text-2); font: 500 13px var(--font); }
.pv { border-collapse: collapse; margin: 6px auto; font-variant-numeric: tabular-nums; }
.pv th, .pv td { width: 40px; height: 38px; text-align: center; border: 1.5px solid var(--line); }
.pv th { background: var(--accent-bg); color: var(--accent-text); font-size: 14px; }
.pv td { font-size: 20px; font-weight: 600; background: #fff; }
.pv .pv-point { border-right: 3px solid var(--text); }
.ladder { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.ladder-unit { min-width: 44px; padding: 8px 10px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); text-align: center; font-weight: 600; }
.ladder-unit.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ladder-step { font-size: 12px; color: var(--text-2); font-weight: 600; }
.colcalc { border-collapse: collapse; margin: 4px auto; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.colcalc td { width: 26px; height: 32px; text-align: center; }
.colcalc .cc-op { color: var(--text-2); }
.colcalc .cc-carry td { font-size: 13px; height: 18px; color: var(--accent-text); }
.colcalc .cc-res td { border-top: 2px solid var(--text); }
.colcalc .cc-res td.cc-op { border-top: 0; }

/* ---------- Bewegung ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.no-anim *, .no-anim *::before, .no-anim *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- iPad und grösser ---------- */
@media (min-width: 700px) {
  .app { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .topic-card { min-height: 140px; padding: 20px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sheet { margin: auto; border-radius: 24px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .btn-ghost, .actions #next { grid-column: 1 / -1; }
  .review-card { grid-template-columns: 1fr auto; align-items: center; }
  .review-card .btn { width: auto; }
  .stack.inline { grid-auto-flow: column; }
  #panel-verstehen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  #panel-verstehen[hidden] { display: none; }
  #panel-verstehen .explain { margin: 0; }
  #panel-verstehen > .btn { grid-column: 1 / -1; max-width: 360px; justify-self: center; }
  .quick-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (hover: hover) {
  .topic-card:hover, .quick-row:hover, .module-card__main:hover { filter: brightness(.985); }
  .btn-primary:hover { background: #6D55B5; }
}
