/* Schriften liegen im Ordner fonts (keine Verbindung zu Google, gut für den Datenschutz) */
@font-face { font-family: Quicksand; font-weight: 600; font-display: swap; src: url(fonts/quicksand-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Quicksand; font-weight: 700; font-display: swap; src: url(fonts/quicksand-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Andika; font-weight: 400; font-display: swap; src: url(fonts/andika-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Andika; font-weight: 700; font-display: swap; src: url(fonts/andika-latin-700-normal.woff2) format("woff2"); }

/* LOPSTER-Farben: Petrol, Koralle, Sand */
:root {
  --ground: #F8F3E9;
  --surface: #FFFFFF;
  --ink: #2B2F31;
  --muted: #5D6466;
  --line: #E6DCC6;
  --teal: #1F5F63;
  --teal-soft: #E3EEEE;
  --navy: #2B2F31;
  --koralle: #E8553D; --koralle-soft: #FBE3DC;
  --gold: #D9A441;    --gold-soft: #F7ECD2;
  --petrol2: #3B8F93; --petrol2-soft: #DCECEC;
  --gelb: #D9A441; --gelb-soft: #F7ECD2;
  --ok: #2F7A3E; --ok-soft: #E2F1E3;
  --nein: #B9402F; --nein-soft: #FBE3DC;
  --kopf: #1F5F63;
  --farbe: var(--teal); --farbe-soft: var(--teal-soft);
  --display: Quicksand, "Nunito", system-ui, sans-serif;
  --body: Andika, "Trebuchet MS", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #172629; --surface: #203338; --ink: #F3EEE4; --muted: #AEB8B9; --line: #34494E;
    --teal: #7FC3C6; --teal-soft: #24414A; --kopf: #143F42;
    --koralle-soft: #45271F; --gold-soft: #3F3420; --petrol2-soft: #1F3D40; --gelb-soft: #3F3420;
    --ok: #9BD3A3; --ok-soft: #1F3A26; --nein: #F59A8C; --nein-soft: #45271F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #172629; --surface: #203338; --ink: #F3EEE4; --muted: #AEB8B9; --line: #34494E;
  --teal: #7FC3C6; --teal-soft: #24414A; --kopf: #143F42;
  --koralle-soft: #45271F; --gold-soft: #3F3420; --petrol2-soft: #1F3D40; --gelb-soft: #3F3420;
  --ok: #9BD3A3; --ok-soft: #1F3A26; --nein: #F59A8C; --nein-soft: #45271F;
  color-scheme: dark;
}

.deutsch    { --farbe: var(--koralle); --farbe-soft: var(--koralle-soft); }
.geschichte { --farbe: var(--gold);    --farbe-soft: var(--gold-soft); }
.wbs        { --farbe: var(--petrol2); --farbe-soft: var(--petrol2-soft); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  background: var(--ground);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; text-wrap: balance; }

/* Kopfzeile */
header {
  background: var(--kopf);
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 4px solid var(--koralle);
}
.header-inner {
  max-width: 900px; margin: 0 auto;
  padding: 10px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: .06em; color: #fff; text-decoration: none; }
.logo img { width: 40px; height: 40px; border-radius: 10px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
nav a {
  flex-shrink: 0;
  min-height: 44px; display: flex; align-items: center;
  padding: 0 14px; border-radius: 999px;
  text-decoration: none; color: #fff;
  font-family: var(--display); font-weight: 700; font-size: .95rem;
  background: rgba(255,255,255,.12);
}
nav a.aktiv { background: var(--koralle); color: #fff; }

.held { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.held img { width: 96px; height: 96px; border-radius: 24px; flex-shrink: 0; box-shadow: 0 4px 0 var(--line); }
.held h1 { margin: 0 0 4px; }
.held p { margin: 0; color: var(--muted); }
@media (min-width: 600px) { .held img { width: 128px; height: 128px; border-radius: 30px; } }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); margin: 0 0 8px; }
.intro { color: var(--muted); margin: 0 0 24px; }
.pill {
  display: inline-block; background: var(--farbe-soft); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: .85rem;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
}

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.kachel {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: 20px; padding: 18px;
  box-shadow: 0 3px 0 var(--line);
  text-decoration: none; color: var(--ink);
  transition: transform .15s;
}
.kachel:active { transform: scale(.98); }
.kachel .badge {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%;
  background: var(--farbe); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
}
.kachel h2 { margin: 0 0 2px; font-size: 1.25rem; }
.kachel p { margin: 0; color: var(--muted); font-size: .95rem; }
.kachel .pfeil { margin-left: auto; font-size: 1.4rem; color: var(--muted); }

.filter { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.filter-btn {
  flex-shrink: 0; font: inherit; font-family: var(--display); font-weight: 700; font-size: .95rem;
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.filter-btn.aktiv { background: var(--teal); border-color: var(--teal); color: #fff; }

/* Tipp-Knopf in Aufgaben */
.hilfe { margin: -6px 0 18px; }
.hilfe-btn {
  font: inherit; font-family: var(--display); font-weight: 700; font-size: 1rem;
  min-height: 48px; padding: 0 18px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--gelb); background: var(--gelb-soft); color: var(--ink);
}
.hilfe-btn:disabled { opacity: .4; cursor: default; }
.hilfe-tipp { margin-top: 10px; background: var(--gelb-soft); border-radius: 12px; padding: 12px 14px; }
.hilfe-tipp b { font-family: var(--display); }

.sterne { display: flex; justify-content: center; gap: 8px; margin: 4px 0 8px; }
.stern { fill: var(--gelb); }
.stern.aus { fill: var(--line); }

.leer {
  background: var(--surface); border: 2px dashed var(--line); border-radius: 20px;
  padding: 28px 20px; text-align: center; color: var(--muted);
}

/* Tipp-Box */
.tip { display: flex; gap: 12px; align-items: flex-start; background: var(--navy); color: #fff; border-radius: 14px; padding: 14px 16px; margin-top: 24px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tip { background: var(--teal-soft); } }
:root[data-theme="dark"] .tip { background: var(--teal-soft); }
.tip .birne { color: var(--gelb); font-size: 1.2rem; line-height: 1.3; }

footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }

/* ===== Aufgabenseiten ===== */
.gate { max-width: 420px; margin: 40px auto; background: var(--surface); border-radius: 20px; padding: 28px 20px; text-align: center; box-shadow: 0 3px 0 var(--line); }
.gate h1 { font-size: 1.45rem; }
input[type=password], input[type=text], textarea {
  width: 100%; font: inherit; font-size: 17px; /* 16px+ verhindert Zoomen auf dem iPhone */
  padding: 14px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--teal); }
.btn {
  font: inherit; font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  min-height: 52px; padding: 0 28px; border: none; border-radius: 14px;
  background: var(--teal); color: #fff; cursor: pointer; margin-top: 14px;
  box-shadow: 0 4px 0 #143F42;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #143F42; }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #16222C; box-shadow: 0 4px 0 #4F8C96; } }
:root[data-theme="dark"] .btn { color: #16222C; box-shadow: 0 4px 0 #4F8C96; }
.btn.breit { width: 100%; }
.fehler { color: var(--nein); font-weight: 700; min-height: 1.5em; margin-top: 8px; }

.schritt-info { color: var(--muted); font-family: var(--display); font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.fortschritt { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 0 0 20px; }
.fortschritt div { height: 100%; background: var(--farbe); width: 0; transition: width .3s; border-radius: 99px; }

.karte { background: var(--surface); border-radius: 20px; padding: 20px 16px; margin-bottom: 16px; box-shadow: 0 3px 0 var(--line); }
.karte-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.nr {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  background: var(--farbe); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 1.2rem;
}
.karte h2 { margin: 0; font-size: 1.25rem; }
.auftrag { color: var(--muted); margin: 0 0 16px; }
.merke { background: var(--farbe-soft); border-radius: 12px; padding: 14px; margin: 0 0 18px; }
.merke b { font-family: var(--display); }
.kette { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.kette span { display: block; }
.kette .frage { color: var(--muted); font-style: italic; padding-left: 14px; }

.item { border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.item > p { margin: 0 0 12px; font-weight: 700; }
.optionen { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  font: inherit; font-size: 1rem; min-height: 48px; padding: 10px 16px;
  border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-align: left;
}
.optionen.voll .opt { width: 100%; }
.opt:active:not(:disabled) { border-color: var(--teal); }
.opt.richtig { background: var(--ok-soft); border-color: var(--ok); color: var(--ink); font-weight: 700; }
.opt.falsch { background: var(--nein-soft); border-color: var(--nein); color: var(--ink); text-decoration: line-through; }
.opt:disabled { cursor: default; }
.feedback { margin-top: 10px; padding: 12px; border-radius: 12px; display: none; }
.feedback.ok { display: block; background: var(--ok-soft); }
.feedback.nein { display: block; background: var(--nein-soft); }
.feedback b { font-family: var(--display); }

.begruendungen { display: grid; gap: 8px; margin-bottom: 16px; }
.begr { display: flex; gap: 10px; align-items: flex-start; background: var(--teal-soft); border-radius: 12px; padding: 10px 12px; }
.begr b { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); }

.bau-ziel { min-height: 64px; border: 2px dashed var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.bau-ziel:empty::before { content: "Hier entsteht dein Argument …"; color: var(--muted); }
.bau-ziel span { background: var(--farbe-soft); border-radius: 8px; padding: 8px 10px; }
.bau-teile { display: flex; flex-direction: column; gap: 8px; }
.bau-teile .opt { width: 100%; }

.feld { margin-bottom: 16px; }
.feld label { display: block; font-family: var(--display); font-weight: 700; margin-bottom: 6px; }
.feld small { color: var(--muted); display: block; margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--teal); margin: 0; }
.vorschau { background: var(--ground); border-radius: 12px; padding: 14px; font-style: italic; }

.ergebnis { text-align: center; }
.code {
  font-family: var(--display); font-size: clamp(1.6rem, 8vw, 2.2rem); font-weight: 700; letter-spacing: 3px;
  background: var(--farbe-soft); border: 3px solid var(--farbe); border-radius: 16px;
  padding: 18px 10px; margin: 16px 0; word-break: break-all;
}
.punkte { font-family: var(--display); font-size: 1.2rem; font-weight: 700; }
.navi { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--ground) 30%); }
.versteckt { display: none !important; }

@media (min-width: 700px) {
  .karte { padding: 24px; }
  .navi { display: flex; justify-content: flex-end; }
  .navi .btn { width: auto; }
}

/* ===== Weitere Aufgabenformate ===== */
.infotext { background: var(--ground); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.infotext h3 { margin: 18px 0 6px; font-size: 1.1rem; color: var(--teal); }
.infotext h3:first-child { margin-top: 0; }
.infotext p { margin: 0 0 10px; }
.infotext .bsp { background: var(--surface); border-left: 5px solid var(--farbe); border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
.infotext ul { margin: 0 0 10px; padding-left: 20px; }
.infotext li { margin-bottom: 4px; }
.lese-check { background: var(--teal-soft); border-radius: 12px; padding: 14px; font-weight: 700; }

.zu-titel { font-family: var(--display); font-weight: 700; margin: 0 0 8px !important; color: var(--muted); font-size: .95rem; }
.zu-begriffe { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.zu-begriff { font-family: var(--display); font-weight: 700; }
.zu-begriff.gewaehlt { background: var(--teal); border-color: var(--teal); color: #fff; }
.zu-defs { display: flex; flex-direction: column; gap: 8px; }
.zu-def { width: 100%; }
.zu-label { display: block; font-family: var(--display); font-weight: 700; font-size: .85rem; }
.zu-label:empty { display: none; }
.wackeln { animation: wackeln .35s; border-color: var(--nein) !important; }
@keyframes wackeln { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.lt-text { font-weight: 400 !important; line-height: 2.4; }
.luecke {
  font: inherit; font-size: 16px; font-weight: 700;
  min-height: 40px; padding: 4px 8px; margin: 0 2px;
  border: 2px solid var(--teal); border-radius: 10px;
  background: var(--teal-soft); color: var(--ink); max-width: 100%;
}
.luecke.richtig { border-color: var(--ok); background: var(--ok-soft); opacity: 1; }
.luecke.falsch { border-color: var(--nein); background: var(--nein-soft); }

.wortzeile { display: flex; flex-wrap: wrap; gap: 6px; }
.wort {
  font: inherit; font-size: 1rem; min-height: 44px; padding: 6px 12px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.wort.richtig { background: var(--ok-soft); border-color: var(--ok); font-weight: 700; }
.wort.falsch { background: var(--nein-soft); border-color: var(--nein); }
.wort:disabled { cursor: default; }

.bau-ziel.woerter { flex-direction: row; flex-wrap: wrap; align-items: center; }
.bau-ziel[data-leer]:empty::before { content: attr(data-leer); }
.bau-teile.woerter { flex-direction: row; flex-wrap: wrap; }
.bau-teile.woerter .opt { width: auto; }

/* Startseite: vier gleich große Kacheln */
.kacheln.vier { grid-template-columns: 1fr; }
@media (min-width: 520px) { .kacheln.vier { grid-template-columns: 1fr 1fr; } }
.downloads { --farbe: var(--teal); --farbe-soft: var(--teal-soft); }
.downloads .badge { color: #fff; font-size: 1rem; }

/* ===== Der Hummer als Lernbegleiter ===== */
.hummer-svg { display: block; width: 100%; height: auto; }
.gate-hummer { width: 120px; margin: -8px auto 6px; }
.fach-held .fach-hummer { width: 96px; flex-shrink: 0; }
.fach-held .pill { margin-bottom: 4px; }
@media (min-width: 600px) { .fach-held .fach-hummer { width: 120px; } }
.leer-hummer { width: 110px; margin: 0 auto 6px; }
.leer p { margin: 0; }
.tipp-reihe { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; }
.tipp-hummer { width: 64px; flex-shrink: 0; }
.blase { position: relative; flex: 1; background: var(--gelb-soft); border-radius: 14px; padding: 12px 14px; }
.blase::before { content: ""; position: absolute; left: -9px; top: 24px; border: 9px solid transparent; border-left: 0; border-right-color: var(--gelb-soft); }
.blase p { margin: 0 0 8px; }
.blase p:last-child { margin-bottom: 0; }
.blase b { font-family: var(--display); }
.ergebnis-hummer { width: 140px; margin: 0 auto 4px; }
.ergebnis-hummer .hummer-svg { animation: huepfen 1.2s ease-in-out infinite; }
@keyframes huepfen { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.krabbel { position: relative; height: 34px; margin: 0 18px 2px 0; }
.krabbel-h { position: absolute; bottom: -4px; left: 0; width: 34px; transform: translateX(-30%); transition: left .5s ease; }
.krabbel-h .hummer-svg { animation: krabbeln .6s ease-in-out infinite alternate; }
@keyframes krabbeln { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .ergebnis-hummer .hummer-svg, .krabbel-h .hummer-svg { animation: none; } }
.fuss-lopster { font-size: .85rem; line-height: 1.6; }
.fuss-lopster b { font-family: var(--display); letter-spacing: .06em; color: var(--teal); }
.fuss-lopster i { font-style: normal; font-weight: 700; color: var(--koralle); }
.lehrer-link { display: flex; flex-direction: column; align-items: center; gap: 2px; width: max-content; margin: 8px auto 0; padding: 8px 14px 6px; border-radius: 16px; text-decoration: none; color: var(--muted); font-family: var(--display); font-weight: 700; font-size: .8rem; }
.lehrer-link:hover, .lehrer-link:focus-visible { background: var(--surface); box-shadow: 0 2px 0 var(--line); }
.lehrer-hummer { width: 56px; display: block; }
