/* Pastel English Academy – Design-Tokens und Komponenten.
   Pastelltöne für Flächen; Text immer in dunklen Tönen (Kontrast ≥ 4,5:1). */
:root {
  --cream: #fffaf5;
  --paper: #ffffff;
  --rose: #fde4ec;   --rose-d: #a33a62;
  --lavender: #ece6fb; --lavender-d: #5b45a8;
  --lilac: #f3e6f7;  --lilac-d: #7a3b8f;
  --mint: #ddf5ea;   --mint-d: #23704f;
  --sky: #dfeffc;    --sky-d: #24609b;
  --peach: #ffe8da;  --peach-d: #9c4a1a;
  --butter: #fff4cc; --butter-d: #7a5a00;
  --ink: #3a3350;
  --ink-soft: #625a78;
  --line: #e8e0f0;
  --focus: #7c5cd6;
  --ok: #23704f; --ok-bg: #ddf5ea;
  --no: #a3324a; --no-bg: #fde4ea;
  --warn: #7a5a00; --warn-bg: #fff4cc;
  --radius: 20px;
  --radius-s: 12px;
  --shadow: 0 6px 24px rgba(90, 70, 140, .08);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 17px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--lavender-d); }
h1 { font-size: 1.7rem; margin: .2em 0 .6em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1.05rem; margin: .4em 0 .5em; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--ink-soft); } .small { font-size: .88rem; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }

/* Kopfzeile & Navigation */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 250, 245, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--rose), var(--lavender)); color: var(--rose-d); font-size: 22px; }
.logo.big { font-size: 1.1rem; margin-bottom: 8px; } .logo.big .icon { color: var(--rose-d); }
.nav { display: flex; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); border: 0; background: none; font: inherit; cursor: pointer; }
.nav-item:hover { background: var(--lavender); }
.nav-item.active { background: var(--lavender); color: var(--lavender-d); font-weight: 700; }
.icon { display: inline-flex; vertical-align: middle; } .icon svg { width: 22px; height: 22px; }
@media (max-width: 700px) {
  .logo-text { display: none; }
  .topbar { backdrop-filter: none; background: var(--cream); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; justify-content: space-around; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
  .nav-item { flex-direction: column; gap: 2px; font-size: .72rem; padding: 6px 8px; border-radius: 14px; }
  main { padding-bottom: 96px !important; }
  .footer { padding-bottom: 100px; }
}
main { flex: 1; padding: 20px; width: 100%; max-width: 1180px; margin: 0 auto; }
main:focus { outline: none; }
.page.narrow { max-width: 820px; margin: 0 auto; }
.footer { text-align: center; padding: 20px; font-size: .85rem; }
.offline-banner { display: none; background: var(--warn-bg); color: var(--warn); text-align: center; padding: 8px; font-weight: 600; }
body.is-offline .offline-banner { display: block; }

/* Karten, Kacheln, Raster */
.card { background: var(--paper); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin: 12px 0; border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { display: block; text-decoration: none; color: var(--ink); border-radius: 24px; padding: 20px; min-height: 170px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(90,70,140,.14); }
.tile-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.7); margin-bottom: 10px; }
.tile-icon svg { width: 28px; height: 28px; }
.tile-title { font-weight: 800; font-size: 1.2rem; } .tile-sub { color: var(--ink-soft); } .tile-count { font-size: .85rem; margin-top: 6px; }
.tint-rose { background: var(--rose); } .tint-rose .icon, .tint-rose .tile-icon { color: var(--rose-d); }
.tint-lavender { background: var(--lavender); } .tint-lavender .icon, .tint-lavender .tile-icon { color: var(--lavender-d); }
.tint-lilac { background: var(--lilac); } .tint-lilac .icon, .tint-lilac .tile-icon { color: var(--lilac-d); }
.tint-mint { background: var(--mint); } .tint-mint .icon, .tint-mint .tile-icon { color: var(--mint-d); }
.tint-sky { background: var(--sky); } .tint-sky .icon, .tint-sky .tile-icon { color: var(--sky-d); }
.tint-peach { background: var(--peach); } .tint-peach .icon, .tint-peach .tile-icon { color: var(--peach-d); }
.tint-butter { background: var(--butter); } .tint-butter .icon, .tint-butter .tile-icon { color: var(--butter-d); }
.bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.75); overflow: hidden; margin-top: 10px; flex: 1; min-width: 80px; }
.card .bar { background: var(--lavender); }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #b9a6f0, #8fd3b5); border-radius: 999px; transition: width .4s ease; }
.bar.weak span { background: linear-gradient(90deg, #f6b5c8, #f3c9a8); }
.task-card { display: block; text-decoration: none; color: var(--ink); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: transform .15s ease; }
.task-card:hover { transform: translateY(-2px); }
.task-title { font-weight: 700; margin: 8px 0; }
.area-chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .85rem; }
.status { font-weight: 600; }
.status.s-done, .status.s-reviewed { color: var(--ok); } .status.s-submitted { color: var(--warn); }
.placement-banner { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); background: linear-gradient(120deg, var(--mint), var(--sky)); }
.placement-banner .icon svg { width: 34px; height: 34px; }
.hello { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.stats-mini { display: flex; gap: 10px; flex-wrap: wrap; } .stats-mini span { background: var(--paper); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow); display: inline-flex; gap: 4px; align-items: center; }
.rec .why { margin: 0 0 6px; color: var(--ink-soft); font-size: .92rem; }
.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.stat .num { font-size: 2rem; font-weight: 800; }

/* Buttons & Formulare */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .1s ease, background .15s ease; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--lavender-d); color: #fff; }
.btn.primary:hover { background: #4b3792; }
.btn.soft { background: var(--lavender); color: var(--lavender-d); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn.wide { width: 100%; margin-top: 14px; }
.icon-btn { border: 0; background: var(--lavender); color: var(--lavender-d); border-radius: 50%; width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer; margin-left: 8px; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.actions { flex-wrap: wrap; margin: 16px 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; min-height: 46px; width: 100%; }
select { width: auto; min-width: 140px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(124,92,214,.18); }
label { display: block; margin: 10px 0 4px; font-weight: 600; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 8px 0; }
label.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--lavender-d); }
label.check.strong { font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-weight: 600; flex: 1; min-width: 200px; }
.field span { font-size: .9rem; }
.filters { margin: 10px 0 16px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }

/* Hinweise, Abzeichen */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-s); background: var(--sky); color: #1d4f80; margin: 10px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); } .notice.error { background: var(--no-bg); color: var(--no); } .notice.warn { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 700; background: var(--lavender); color: var(--lavender-d); white-space: nowrap; text-decoration: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.wait { background: var(--warn-bg); color: var(--warn); } .badge.new { background: var(--rose); color: var(--rose-d); }
.badge.lvl-b2 { background: var(--lavender); color: var(--lavender-d); } .badge.lvl-found { background: var(--peach); color: var(--peach-d); } .badge.star { background: var(--butter); color: var(--butter-d); }
.badge.st-draft { background: #eee; color: #555; } .badge.st-review { background: var(--warn-bg); color: var(--warn); } .badge.st-approved { background: var(--ok-bg); color: var(--ok); } .badge.st-locked { background: var(--no-bg); color: var(--no); }
.loading { display: flex; gap: 10px; align-items: center; padding: 40px; justify-content: center; color: var(--ink-soft); }
.dots { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--lavender); border-top-color: var(--lavender-d); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { max-width: 90vw; text-align: center; position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; transition: all .25s ease; z-index: 20; font-weight: 700; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); } .toast.success { background: var(--mint-d); } .toast.error { background: var(--no); }
.dialog { border: 0; border-radius: var(--radius); padding: 22px; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.2); color: var(--ink); }
.dialog::backdrop { background: rgba(58, 51, 80, .35); }

/* Übungen */
.task-head { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.task-head h1 { margin: 8px 0 4px; font-size: 1.45rem; }
.task-instr { font-weight: 700; margin: 8px 0 14px; }
.items { display: flex; flex-direction: column; gap: 14px; }
.item { background: var(--paper); border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); }
.item-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--lavender); color: var(--lavender-d); font-weight: 800; margin-right: 8px; font-size: .9rem; }
.prompt { margin-bottom: 10px; line-height: 2; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.option { min-height: 50px; border-radius: var(--radius-s); border: 2px solid var(--line); background: #fff; font: inherit; color: var(--ink); cursor: pointer; padding: 8px 12px; text-align: left; }
.option[aria-checked=true] { border-color: var(--lavender-d); background: var(--lavender); font-weight: 700; }
.gap { display: inline-block; width: auto; min-width: 140px; min-height: 40px; padding: 4px 10px; margin: 0 4px; border-radius: 10px; }
.match { display: flex; flex-direction: column; gap: 8px; }
.match-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-weight: 400; }
.match-left { flex: 1; min-width: 160px; font-weight: 600; }
.match-row select { flex: 1; min-width: 200px; }
.order-answer, .order-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border-radius: var(--radius-s); }
.order-answer { background: var(--lavender); margin-bottom: 8px; }
.chip { min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--lavender-d); color: #fff; border-color: transparent; } .chip.used { opacity: .35; }
.wrong-sentence { background: var(--no-bg); padding: 8px 12px; border-radius: 10px; }
.answer-text { min-height: 60px; }
.feedback:empty { display: none; }
.feedback { margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-s); }
.feedback.ok { background: var(--ok-bg); color: var(--ok); } .feedback.no { background: var(--no-bg); color: var(--no); }
.fb-head { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.expl { display: flex; gap: 6px; margin-top: 6px; color: var(--ink); } .rule { font-size: .85rem; color: var(--ink-soft); margin-top: 4px; }
.result-card { text-align: center; } .result-card.ok { background: var(--mint); } .result-card.try { background: var(--peach); }
.big { font-size: 1.3rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.reward { margin-top: 6px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.stimulus p { margin: 0 0 .8em; } .stimulus h3 { margin-top: 0; }
.audio-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; } .audio-card audio { flex: 1; min-width: 240px; }
audio { width: 100%; max-width: 520px; }
.transcript summary, details summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.writing { min-height: 260px; line-height: 1.6; }
.editor { margin: 12px 0; }
.wordcount { font-size: .9rem; color: var(--ink-soft); } .wordcount.ok { color: var(--ok); font-weight: 700; }
.save-status { font-size: .9rem; display: flex; gap: 6px; align-items: center; } .save-status.ok { color: var(--ok); } .save-status.warn { color: var(--warn); font-weight: 700; }
.textbox { white-space: pre-wrap; background: var(--cream); border-radius: var(--radius-s); padding: 12px; border: 1px solid var(--line); }
.prompt-card { background: var(--lilac); }
.rubric { width: 100%; border-collapse: collapse; } .rubric td, .rubric th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dialogue .line { display: flex; gap: 10px; padding: 10px 14px; border-radius: 16px; margin: 6px 0; }
.dialogue .line.mine { background: var(--rose); margin-left: 24px; } .dialogue .line.other { background: var(--sky); margin-right: 24px; }
.dialogue .role { font-weight: 800; min-width: 90px; }
.read-text { font-size: 1.15rem; line-height: 1.8; background: var(--butter); }
.phrases li { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.timer-row { margin: 8px 0; } .timer { font-weight: 800; font-variant-numeric: tabular-nums; }
.selfcheck { background: var(--mint); }
.flashcard { display: grid; place-items: center; width: 100%; min-height: 220px; border-radius: 28px; border: 0; background: linear-gradient(135deg, var(--lavender), var(--rose)); font: inherit; color: var(--ink); cursor: pointer; padding: 24px; margin: 10px 0; box-shadow: var(--shadow); transition: transform .3s ease; }
.flashcard.flipped { background: linear-gradient(135deg, var(--mint), var(--sky)); }
.fc-en { font-size: 1.8rem; font-weight: 800; } .fc-de { font-size: 1.4rem; font-weight: 700; } .fc-ex { margin-top: 10px; font-style: italic; }

/* Fortschritt & Listen */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 16px; background: var(--paper); border-radius: var(--radius-s); text-decoration: none; color: var(--ink); border: 1px solid var(--line); }
.list-row.card { margin: 0; }
.topic-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) 2fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.topic-row .bar { margin: 0; }
@media (max-width: 600px) { .topic-row { grid-template-columns: 1fr; gap: 4px; } }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; } .table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
.ledger { list-style: none; padding: 0; margin: 0; } .ledger li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ok-text { color: var(--ok); } .no-text { color: var(--no); }
.join .row input { flex: 1; text-transform: uppercase; letter-spacing: .1em; }

/* Anmeldung */
.auth { display: grid; place-items: center; min-height: 70vh; }
.auth-card { width: 100%; max-width: 440px; background: linear-gradient(180deg, #fff, var(--lilac)); }

/* Verwaltung */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.subnav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; background: var(--paper); border: 1px solid var(--line); color: var(--ink); min-height: 40px; display: inline-flex; align-items: center; }
.subnav a.active { background: var(--lavender-d); color: #fff; border-color: transparent; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.two-col .card { margin: 0; }
.comment-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin: 6px 0; align-items: center; }
.code strong { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; background: var(--butter); padding: 2px 8px; border-radius: 8px; }
.item-editor { background: var(--cream); }
.bulk { margin: 10px 0; }
.ai { background: var(--lilac); }
.prose li { margin: 6px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.rule-card { background: var(--butter); } .rule-card summary { display: flex; align-items: center; gap: 6px; }
