/* Layout: eine Spalte auf dem Schreibtisch, die Karteikarte ist der Star. Linierte Karte, roter Rand, farbige Fach-Reiter. */
:root {
  --desk: #e4eaf3;
  --ink: #1c2846;
  --muted: #5a6785;
  --paper: #ffffff;
  --rule: #d3e2f6;
  --margin: #f0a0a0;
  --line: #c9d3e3;
  --accent: #2c50cf;
  --accent-ink: #ffffff;
  --accent-soft: #dfe6fb;
  --good: #17844c;
  --good-bg: #dcf4e6;
  --bad: #c43d31;
  --bad-bg: #fde4e1;
  --almost: #8f5f00;
  --almost-bg: #fff0c7;
  --mark: #ffd2cc;
  --f0: #97a2b8;
  --f1: #ec6b5a;
  --f2: #f19536;
  --f3: #e8b923;
  --f4: #47b06c;
  --f5: #3b78db;
  --shadow: 0 1px 0 rgba(28, 40, 70, .06), 0 10px 28px -12px rgba(28, 40, 70, .28);

  --font-display: "Grandstander", "Chalkboard SE", "Comic Sans MS", system-ui, sans-serif;
  --font-body: "Andika", "Avenir Next", "Segoe UI", system-ui, sans-serif;

  --r: 14px;
  --ruled: 2.6rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0f1628;
    --ink: #e6ebf7;
    --muted: #9aa6c3;
    --paper: #1a2340;
    --rule: #26325a;
    --margin: #7d3e4a;
    --line: #2f3b62;
    --accent: #8aa4ff;
    --accent-ink: #0c1430;
    --accent-soft: #24305a;
    --good: #55d38f;
    --good-bg: #133525;
    --bad: #ff8576;
    --bad-bg: #3d1c1e;
    --almost: #f3c54f;
    --almost-bg: #392d0f;
    --mark: #6b2b2b;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0f1628;
  --ink: #e6ebf7;
  --muted: #9aa6c3;
  --paper: #1a2340;
  --rule: #26325a;
  --margin: #7d3e4a;
  --line: #2f3b62;
  --accent: #8aa4ff;
  --accent-ink: #0c1430;
  --accent-soft: #24305a;
  --good: #55d38f;
  --good-bg: #133525;
  --bad: #ff8576;
  --bad-bg: #3d1c1e;
  --almost: #f3c54f;
  --almost-bg: #392d0f;
  --mark: #6b2b2b;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { min-height: 100%; }
.screen {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Typo ---------- */
h1, h2, h3, .title, .hero-title, .block-title { font-family: var(--font-display); text-wrap: balance; margin: 0; }
.title { font-size: 1.7rem; font-weight: 800; }
.title.inline { font-size: 1.4rem; }
.eyebrow {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-title { font-size: 1.8rem; font-weight: 800; line-height: 1.15; }
.hero-text { margin: 0; color: var(--muted); }
.block-title { font-size: 1.15rem; font-weight: 600; }
.label { display: block; font-weight: 700; margin: 0; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }
.small { font-size: .9rem; }
.muted { color: var(--muted); }
.warn { color: var(--bad); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.brand-sub { margin: 4px 0 0; color: var(--muted); }
.logo { position: relative; width: 64px; height: 56px; flex: none; }
.logo-tab {
  position: absolute; left: 6px; top: 0;
  width: 26px; height: 12px;
  background: var(--f3);
  border-radius: 6px 6px 0 0;
}
.logo-card {
  position: absolute; inset: 9px 0 0 0;
  display: grid; place-items: center;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent);
  font-size: 1.3rem;
}

/* ---------- Paper (Karteikarte) ---------- */
.paper {
  position: relative;
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px 22px 24px 40px;
}
.paper::before {
  content: "";
  position: absolute;
  left: 24px; top: 0; bottom: 0;
  width: 2px;
  background: var(--margin);
  opacity: .7;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 10px 22px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.big { min-height: 64px; font-size: 1.3rem; padding-inline: 30px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn.primary:active { box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); transform: translateY(3px); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--bad); color: var(--paper); }
.link {
  background: none; border: 0; padding: 8px 4px;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.icon-btn {
  width: 48px; height: 48px; flex: none;
  border-radius: 50%; border: 2px solid var(--line); background: var(--paper);
  font-size: 1.2rem;
}
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.center { justify-content: center; }

/* ---------- Start / Profile ---------- */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.kid {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 12px 18px;
  background: var(--paper);
  border: 0;
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.kid:active { transform: scale(.98); }
.kid-name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; }
.kid-meta { color: var(--muted); font-size: .9rem; }
.avatar { font-size: 3.4rem; line-height: 1; }
.avatar.sm { font-size: 2rem; }

.form { display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.field {
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  font-size: 1.3rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 12px;
}
.field:focus { border-color: var(--accent); outline: none; }
.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.av { position: relative; }
.av input { position: absolute; opacity: 0; inset: 0; }
.av span {
  display: grid; place-items: center;
  height: 64px;
  font-size: 2.2rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.av input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.av input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Home ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.who-name { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.chips { display: flex; gap: 8px; }
.chip {
  padding: 6px 12px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hero .btn { margin-top: 8px; }
.block { display: flex; flex-direction: column; gap: 12px; }

.kasten {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--ink) 8%, var(--desk));
  border-radius: var(--r);
}
.slot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-bottom: 10px;
  background: var(--paper);
  border-radius: 10px;
  overflow: hidden;
}
.slot-tab {
  width: 100%;
  padding: 4px 2px;
  text-align: center;
  font-size: .8rem;
  font-weight: 700;
  color: #1c2846;
}
.slot-count { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.f0 { background: var(--f0); }
.f1 { background: var(--f1); }
.f2 { background: var(--f2); }
.f3 { background: var(--f3); }
.f4 { background: var(--f4); }
.f5 { background: var(--f5); }

.units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.unit { background: var(--paper); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.unit.off { opacity: .55; }
.unit-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.unit-title { font-weight: 700; }
.unit-meta { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--rule); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--f3), var(--f4)); border-radius: 99px; }

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toggle[aria-pressed="false"] { color: var(--muted); }

/* ---------- Session ---------- */
.sess-top { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; height: 14px; background: var(--paper); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 2px var(--line); }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }

.flash {
  min-height: 300px;
  padding-top: 18px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--ruled) - 1px),
    var(--rule) calc(var(--ruled) - 1px),
    var(--rule) var(--ruled)
  );
  background-position: 0 3.4rem;
}
.flash.enter { animation: card-in .3s ease both; }
@keyframes card-in { from { transform: translateX(24px) rotate(1deg); } to { transform: none; } }
.flash-head { display: flex; justify-content: flex-end; }
.tag { padding: 3px 12px; border-radius: 6px; font-size: .8rem; font-weight: 700; color: #1c2846; }
.flash-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-block: 8px 4px; }
.ask { margin: 0; color: var(--muted); font-weight: 700; }
.emoji { font-size: 5rem; line-height: 1.1; }
.word {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.word-sub { font-size: 1.5rem; color: var(--muted); }
.speak {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--paper);
  font-weight: 700;
}

.answer { display: flex; flex-direction: column; gap: 14px; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt {
  min-height: 76px;
  padding: 12px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--r);
  font-size: 1.45rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.opt:active { transform: scale(.98); }
.opt.right { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.opt:disabled { cursor: default; }

.write { display: flex; flex-direction: column; gap: 12px; }
.big-field { min-height: 84px; font-size: 2rem; font-weight: 700; text-align: center; letter-spacing: .02em; }
.pen { margin: 0; color: var(--muted); font-size: .9rem; text-align: center; }

.fb { margin: 0; padding: 14px 18px; border-radius: 12px; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.fb p { margin: 0; }
.fb.good { background: var(--good-bg); color: var(--good); }
.fb.bad { background: var(--bad-bg); color: var(--bad); }
.fb.almost { background: var(--almost-bg); color: var(--almost); }
.fb .small { font-weight: 400; color: var(--ink); }
.correction { font-size: 2.2rem; color: var(--ink); letter-spacing: .03em; }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 2px; text-decoration: underline wavy var(--bad); text-underline-offset: 6px; }

/* ---------- Done ---------- */
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.stars { display: flex; gap: 6px; }
.star { font-size: 4rem; color: var(--line); line-height: 1; }
.star.on { color: var(--f3); animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d); }
@keyframes pop { from { transform: scale(.3) rotate(-30deg); } to { transform: none; } }
.missed { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.missed li { padding: 6px 14px; border: 2px solid var(--line); border-radius: 999px; }

/* ---------- Wörterliste ---------- */
.wlist { list-style: none; margin: 0; padding: 6px 16px 6px 40px; }
.wrow {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas: "e en de d";
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.wrow:last-child { border-bottom: 0; }
.wemoji { grid-area: e; font-size: 1.6rem; }
.wen { grid-area: en; text-align: left; background: none; border: 0; padding: 0; font-weight: 700; overflow-wrap: anywhere; }
.wde { grid-area: de; color: var(--muted); overflow-wrap: anywhere; }
.dots { grid-area: d; display: inline-flex; gap: 3px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }

/* ---------- Eltern ---------- */
.parent { display: flex; flex-direction: column; gap: 12px; }
.parent-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code {
  margin: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; user-select: all; overflow-wrap: anywhere;
}
.code-field { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.minis { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { padding: 2px 10px; border-radius: 6px; font-size: .85rem; font-weight: 700; color: #1c2846; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

@media (max-width: 520px) {
  body { font-size: 17px; }
  .kasten { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opts { grid-template-columns: 1fr; }
  .wrow { grid-template-columns: 2rem minmax(0, 1fr) auto; grid-template-areas: "e en d" "e de d"; row-gap: 0; }
  .paper { padding-left: 34px; }
  .paper::before { left: 18px; }
}

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