/* Lernpfad: Oberfläche im Sticker-Stil.
   Ein Grunddesign, die Farbpalette wechselt über data-theme am <html>. */

@font-face { font-family: "Lilita One"; src: url("fonts/lilita-one-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --ink: #1d1442;
  --paper: #ffffff;
  --mist: #f1efff;
  --good: #16b971;
  --bad: #ff4d5e;
  --bg: #2b59ff;
  --bg-dot: #4a72ff;
  --accent: #ffd23f;
  --accent2: #00e0c6;
  --line: 3px;
  --pop: 4px 4px 0 var(--ink);
  --pop-sm: 3px 3px 0 var(--ink);
  --r-lg: 22px;
  --r-md: 14px;
  --r-pill: 999px;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
html[data-theme="candy"] { --bg: #ff5fa2; --bg-dot: #ff7db4; --accent: #ffe66d; --accent2: #8b5cf6; }
html[data-theme="dschungel"] { --bg: #14a865; --bg-dot: #22bd76; --accent: #ffd23f; --accent2: #ff7a3d; }
html[data-theme="lava"] { --bg: #ff6a2b; --bg-dot: #ff8550; --accent: #ffe14d; --accent2: #7a2cff; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 2.5px, transparent 2.6px);
  background-size: 26px 26px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px 16px 40px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.1; margin: 0 0 12px; letter-spacing: 0.01em; }
h1 { font-size: clamp(34px, 7vw, 56px); }
h2 { font-size: clamp(26px, 4.5vw, 34px); }
h3 { font-size: 22px; }
p { margin: 0 0 12px; }
a { color: inherit; }
.onbg { color: var(--paper); text-shadow: 3px 3px 0 var(--ink); }
.muted { opacity: 0.75; font-size: 15px; }
.hidden { display: none !important; }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }

/* Grundbausteine: Sticker mit Kontur und hartem Schatten */
.sticker { background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--pop); padding: 20px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.btn {
  font-family: var(--display); font-size: 21px; line-height: 1; color: var(--ink);
  background: var(--accent); border: var(--line) solid var(--ink); border-radius: var(--r-md);
  box-shadow: var(--pop-sm); padding: 14px 22px; cursor: pointer; min-height: 52px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.alt { background: var(--accent2); }
.btn.plain { background: var(--paper); }
.btn.good { background: var(--good); color: var(--paper); }
.btn.danger { background: var(--bad); color: var(--paper); }
.btn.small { font-size: 16px; padding: 9px 14px; min-height: 42px; }
.btn.wide { width: 100%; }
.linkbtn { background: none; border: 0; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; color: inherit; padding: 6px 0; }

label { display: block; font-weight: 800; font-size: 16px; margin-bottom: 6px; }
input, textarea, select {
  font: inherit; font-size: 20px; width: 100%; color: var(--ink); background: var(--mist);
  border: var(--line) solid var(--ink); border-radius: var(--r-md); padding: 12px 14px;
}
input:focus, textarea:focus, select:focus { background: var(--paper); outline: none; box-shadow: 0 0 0 4px var(--accent); }
.field + .field { margin-top: 14px; }
.msg { border: var(--line) solid var(--ink); border-radius: var(--r-md); padding: 10px 14px; font-weight: 700; background: var(--mist); }
.msg.bad { background: #ffe0e3; }
.msg.good { background: #d8f8e9; }

/* Kopfzeile (HUD) */
.hud {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: var(--paper);
  border-bottom: var(--line) solid var(--ink);
}
.hud-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.hud .brand { font-family: var(--display); font-size: 24px; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.hud .grow { flex: 1; min-width: 0; }
.lvl { display: flex; align-items: center; gap: 10px; }
.lvl-badge {
  font-family: var(--display); font-size: 18px; background: var(--accent2); color: var(--ink);
  border: var(--line) solid var(--paper); border-radius: 50%; width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
}
.xpbar { flex: 1; height: 16px; border: 2px solid var(--paper); border-radius: var(--r-pill); overflow: hidden; background: #3a2f6e; max-width: 260px; }
.xpbar i { display: block; height: 100%; background: var(--accent); border-right: 2px solid var(--paper); }
.xptext { font-size: 13px; font-weight: 700; opacity: 0.85; white-space: nowrap; }
.coin {
  font-family: var(--display); font-size: 20px; background: var(--accent); color: var(--ink);
  border: var(--line) solid var(--paper); border-radius: var(--r-pill); padding: 6px 14px; white-space: nowrap; cursor: pointer;
}
.hud .menu { background: none; border: 2px solid var(--paper); color: var(--paper); border-radius: var(--r-md); font: inherit; font-weight: 800; padding: 6px 12px; cursor: pointer; }

/* Startseite */
.hello { margin: 18px 0 20px; }
.banner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--accent); }
.banner .grow { flex: 1; min-width: 200px; }
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 20px 0 28px; }
.world {
  position: relative; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--pop);
  padding: 14px 14px 16px; min-height: 150px; display: flex; flex-direction: column; gap: 8px;
  transition: transform 0.1s ease;
}
.world:hover { transform: rotate(-1deg) translateY(-2px); }
.world .icon { font-size: 36px; line-height: 1; width: 56px; height: 56px; display: grid; place-items: center; border: var(--line) solid var(--ink); border-radius: 18px; }
.world .name { font-family: var(--display); font-size: 22px; }
.world .bar { margin-top: auto; }
.world .tag { position: absolute; top: -12px; right: 12px; background: var(--accent2); border: 2px solid var(--ink); border-radius: var(--r-pill); font-size: 13px; font-weight: 800; padding: 2px 10px; }
.bar { height: 14px; border: 2px solid var(--ink); border-radius: var(--r-pill); background: var(--mist); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--good); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.badge { text-align: center; font-size: 13px; font-weight: 800; }
.badge .b { font-size: 34px; width: 66px; height: 66px; margin: 0 auto 6px; display: grid; place-items: center; border: var(--line) solid var(--ink); border-radius: 50%; background: var(--accent); box-shadow: var(--pop-sm); }
.badge.off .b { background: var(--mist); filter: grayscale(1); opacity: 0.45; box-shadow: none; }

/* Lernpfad als Level-Karte */
.trail { position: relative; padding: 8px 0 20px; }
.chapter { font-family: var(--display); font-size: 22px; color: var(--paper); text-shadow: 2px 2px 0 var(--ink); margin: 26px 0 6px; text-align: center; }
.stop { display: flex; justify-content: center; margin: 10px 0; }
.stop:nth-child(4n+1) { transform: translateX(-70px); }
.stop:nth-child(4n+3) { transform: translateX(70px); }
.node {
  width: 86px; height: 86px; border-radius: 50%; border: var(--line) solid var(--ink); box-shadow: var(--pop);
  background: var(--paper); font-family: var(--display); font-size: 28px; color: var(--ink); cursor: pointer;
  display: grid; place-items: center; position: relative;
}
.node.done { background: var(--good); color: var(--paper); }
.node.open { background: var(--accent); }
.node.locked { background: #c9c3e8; cursor: default; box-shadow: var(--pop-sm); }
.node.boss { width: 104px; height: 104px; border-radius: 30px 30px 52px 52px; background: var(--accent2); }
.node.boss.locked { background: #c9c3e8; }
.node.boss.done { background: var(--good); }
.node.rep { width: 70px; height: 70px; font-size: 22px; }
.node small { position: absolute; bottom: -30px; white-space: nowrap; font-family: var(--body); font-weight: 800; font-size: 13px; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 1px 9px; }
.node.current::after { content: ""; position: absolute; inset: -12px; border: 4px solid var(--paper); border-radius: inherit; animation: pulse 1.6s ease-out infinite; }
/* MINT-Kennzeichnung */
.mint { display: inline-block; font-family: var(--display); font-size: 13px; letter-spacing: 0.06em; color: var(--paper); background: #0d9488; border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 1px 9px; margin-left: 8px; vertical-align: middle; box-shadow: 2px 2px 0 var(--ink); }
.mintline { margin: 4px 0; }
.mintline .mint { margin-left: 0; }
.node .mintdot { position: absolute; top: -10px; right: -18px; font-style: normal; font-family: var(--display); font-size: 11px; letter-spacing: 0.05em; color: var(--paper); background: #0d9488; border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 0 6px; }
@keyframes pulse { from { opacity: 1; transform: scale(0.9); } to { opacity: 0; transform: scale(1.25); } }

/* Unteres Blatt (Sheet) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(29, 20, 66, 0.55); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.sheet { width: 100%; max-width: 620px; max-height: 88vh; overflow: auto; animation: rise 0.18s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .overlay { align-items: center; } }

/* Aufgabe */
.taskbar { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.taskbar .grow { flex: 1; }
.clock { font-family: var(--display); font-size: 20px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r-pill); padding: 6px 14px; }
.clock.full { background: var(--good); color: var(--paper); }
.segbar { display: flex; gap: 4px; height: 18px; }
.segbar i { flex: 1; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); }
.segbar i.on { background: var(--accent); }
.qhead { font-weight: 800; font-size: 15px; opacity: 0.8; margin-bottom: 4px; }
.question { font-size: clamp(22px, 3.6vw, 30px); font-weight: 800; line-height: 1.3; margin: 6px 0 18px; white-space: pre-wrap; }
.options { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .options { grid-template-columns: 1fr 1fr; } }
.opt {
  font: inherit; font-size: 21px; font-weight: 800; text-align: left; color: var(--ink); cursor: pointer;
  background: var(--mist); border: var(--line) solid var(--ink); border-radius: var(--r-md); box-shadow: var(--pop-sm);
  padding: 14px 16px; min-height: 62px;
}
.opt:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.opt.right { background: var(--good); color: var(--paper); }
.opt.wrong { background: var(--bad); color: var(--paper); }
.answer-row { display: flex; gap: 10px; }
.answer-row input { flex: 1; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.btn.speak.speaking { animation: talk 0.9s ease-in-out infinite; }
@keyframes talk { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .btn.speak.speaking { animation: none; outline: 4px solid var(--accent); } }
.hint, .explain, .readtext { border: var(--line) solid var(--ink); border-radius: var(--r-md); padding: 12px 14px; margin-top: 12px; }
.hint { background: #fff6c9; }
.explain { background: #e6fbf1; }
.readtext { background: var(--mist); font-size: 21px; line-height: 1.65; white-space: pre-wrap; }
.verdict { font-family: var(--display); font-size: 28px; margin-top: 16px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }

/* Abschluss */
.win { text-align: center; }
.bigpts { font-family: var(--display); font-size: clamp(64px, 16vw, 120px); color: var(--accent); text-shadow: 5px 5px 0 var(--ink); -webkit-text-stroke: 3px var(--ink); line-height: 1; margin: 10px 0; }
.board { text-align: left; margin-top: 16px; }
.board div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 2px dashed #cfc9ee; }
.board div:last-child { border-bottom: 0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border: 2px solid var(--ink); animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* Login */
.gate { max-width: 460px; margin: 6vh auto 0; }
.gate h1 { text-align: center; }
.tagline { text-align: center; font-weight: 800; color: var(--paper); text-shadow: 2px 2px 0 var(--ink); margin-bottom: 22px; }

/* Elternbereich */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.tab { font: inherit; font-weight: 800; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r-pill); padding: 8px 16px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); box-shadow: var(--pop-sm); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--mist); border: 2px solid var(--ink); border-radius: var(--r-md); padding: 10px 12px; }
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 30px; }
.grid2 { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 2px dashed #cfc9ee; }
.list li:last-child { border-bottom: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 74px; height: 74px; border: var(--line) solid var(--ink); border-radius: 18px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; color: var(--paper); text-shadow: 1px 1px 0 var(--ink); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--ink); }
.sw-arena { background: linear-gradient(135deg, #2b59ff 55%, #ffd23f 55%); }
.sw-candy { background: linear-gradient(135deg, #ff5fa2 55%, #ffe66d 55%); }
.sw-dschungel { background: linear-gradient(135deg, #14a865 55%, #ffd23f 55%); }
.sw-lava { background: linear-gradient(135deg, #ff6a2b 55%, #ffe14d 55%); }

/* Fusszeile */
.foot { background: var(--ink); color: var(--paper); border-top: var(--line) solid var(--ink); }
.foot-in { max-width: 980px; margin: 0 auto; padding: 16px; display: flex; gap: 14px 22px; flex-wrap: wrap; align-items: center; font-size: 15px; }
.foot a { color: var(--paper); font-weight: 800; }
.foot .grow { flex: 1; }
.twint { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--accent); border: var(--line) solid var(--ink); border-radius: var(--r-md); box-shadow: var(--pop-sm); padding: 14px; }
.twint strong { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 8vw, 40px); letter-spacing: 0.02em; }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin: 6px 0; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .xpbar, .xptext { display: none; }
  .stop:nth-child(4n+1) { transform: translateX(-40px); }
  .stop:nth-child(4n+3) { transform: translateX(40px); }
  .answer-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Bildschirmtastatur (Handy, Tablet): --kb ist die Höhe der Tastatur, --vvh die sichtbare
   Höhe. Beides setzt web/app.js über visualViewport. Inhalt bekommt unten Platz, damit
   das aktive Feld über der Tastatur stehen kann; Blätter (Sheets) rutschen mit. */
:root { --kb: 0px; --vvh: 100vh; }
body { padding-bottom: var(--kb); }
.overlay { bottom: var(--kb); height: auto; }
.sheet { max-height: calc(var(--vvh) - 24px); }
input, textarea, select { scroll-margin: 90px 0 24px; }

/* Lehrplan 21 (Phase 3) */
.lp21 { font-size: 13px; margin: -6px 0 10px; opacity: 0.9; }
.lp21box { border: 2px dashed var(--ink); border-radius: var(--r-md); padding: 10px 12px; font-size: 15px; }
.lp21box .list { margin: 6px 0; }

/* Bonusfragen (Phase 4) */
.bonustag { font-weight: 800; color: var(--ink); background: var(--accent); border-radius: var(--r-md); padding: 6px 10px; display: inline-block; }

/* Zertifikat (Phase 4): druckbare Seite */
.cert { background: #fff; color: #1d1442; border: 6px double #1d1442; border-radius: 18px; padding: 32px; max-width: 760px; margin: 0 auto; }
.cert h1 { font-size: 40px; color: #1d1442; }
.cert-brand { font-family: var(--display); font-size: 22px; margin: 0 0 8px; }
.cert-name { font-family: var(--display); font-size: 48px; margin: 6px 0; }
.cert-code { font-size: 18px; }
@media print {
  body { background: #fff !important; padding: 0 !important; }
  .hud, .foot, .noprint, .overlay { display: none !important; }
  main { max-width: none; padding: 0; }
  .cert { border-width: 4px; box-shadow: none; }
}

/* Lehrpersonen (Phase 5) */
.vertrag { white-space: pre-wrap; font-family: var(--body); font-size: 14px; max-height: 320px; overflow: auto; background: var(--mist); border-radius: var(--r-md); padding: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; }
.check input { width: auto; margin-top: 4px; }
.kidrow { border: 2px solid var(--ink); border-radius: var(--r-md); padding: 10px 12px; }
.kidrow summary { cursor: pointer; }

/* Lern-Coach (Phase 6) */
.coach-q { margin: 0; font-weight: 700; }
.coach-a { margin: 0; background: var(--mist); border-radius: var(--r-md); padding: 8px 10px; }

/* Bildschirmtastatur offen (24.11.2026): Kopfzeile ausblenden, damit Aufgabe, Feld und
   Knopf Platz haben; Antwortzeile bleibt nebeneinander (Knopf direkt neben dem Feld). */
.kb-open .hud { display: none; }
.kb-open .answer-row { flex-direction: row; }
.kb-open .answer-row .btn { flex: 0 0 auto; padding-left: 16px; padding-right: 16px; }
.kb-open .lp21 { display: none; }
