/* Vokabeltrainer – freundlich, klar, für Handys gemacht. Hell und dunkel. */
:root {
  --grund: #f4f5fb; --flaeche: #ffffff; --text: #1b1f3b; --leise: #6b7090; --rand: #e6e8f2;
  --akzent: #5b4fe8; --akzent2: #9a5cf6; --akzent-hell: #eeecff; --akzent-text: #ffffff;
  --gut: #1f9d55; --gut-hell: #e2f6ea; --fast: #d97706; --fast-hell: #fff1dc;
  --falsch: #e03e3e; --falsch-hell: #fde8e8;
  --radius: 20px; --schatten: 0 1px 2px rgba(27, 31, 59, .05), 0 8px 24px rgba(27, 31, 59, .07);
  --verlauf: linear-gradient(135deg, #5b4fe8 0%, #9a5cf6 100%); /* in beiden Modi dunkel genug für weiße Schrift */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0e0f1d; --flaeche: #1a1b2f; --text: #ecedf7; --leise: #9a9cb8; --rand: #2b2d47;
    --akzent: #7f73ff; --akzent2: #b07cff; --akzent-hell: #26234d; --akzent-text: #ffffff;
    --gut: #4fd18b; --gut-hell: #143225; --fast: #ffb648; --fast-hell: #3a2b12;
    --falsch: #ff7b7b; --falsch-hell: #3d1a1d;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
/* Farben für Lernmethoden und Avatare */
.farbe-1 { --ton: #6d5ef0; --ton-hell: #efedff; }
.farbe-2 { --ton: #0ea5e9; --ton-hell: #e2f4fd; }
.farbe-3 { --ton: #f97316; --ton-hell: #ffefe3; }
.farbe-4 { --ton: #ec4899; --ton-hell: #fde8f3; }
.farbe-5 { --ton: #16a34a; --ton-hell: #e3f6e9; }
@media (prefers-color-scheme: dark) {
  .farbe-1 { --ton-hell: #262150; } .farbe-2 { --ton-hell: #0f2a3a; } .farbe-3 { --ton-hell: #3a2414; }
  .farbe-4 { --ton-hell: #3a1830; } .farbe-5 { --ton-hell: #12301e; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text); background: var(--grund); }
body {
  font: 17px/1.45 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(900px 360px at 0% -8%, var(--akzent-hell), transparent 70%),
    radial-gradient(700px 320px at 100% -6%, var(--akzent-hell), transparent 70%);
  background-repeat: no-repeat; min-height: 100vh;
}

/* Kopfzeile */
.kopf { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--grund) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--rand) 70%, transparent); }
.marke { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px;
  color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.marke img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 4px 12px rgba(91, 79, 232, .35); }
.wer { font-size: 14px; font-weight: 700; color: var(--akzent); background: var(--akzent-hell);
  padding: 5px 12px; border-radius: 99px; }
.wer:empty { display: none; }

/* Grundlayout */
.inhalt { max-width: 720px; margin: 0 auto; padding: 18px 16px 96px; }
.inhalt > * { animation: hinein .28s ease-out both; }
.fuss { text-align: center; font-size: 12px; color: var(--leise); margin-top: -64px;
  padding: 0 16px max(24px, env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.15; margin: 6px 0 16px; letter-spacing: -.02em; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 28px 4px 10px; }
a { color: var(--akzent); }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.zurueck { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none;
  margin: 0 0 10px; padding: 6px 12px 6px 8px; border-radius: 99px; background: var(--flaeche); box-shadow: var(--schatten); }
.karte { background: var(--flaeche); border-radius: var(--radius); padding: 18px; margin: 0 0 12px;
  box-shadow: var(--schatten); border: 1px solid color-mix(in srgb, var(--rand) 60%, transparent); }
.karte.klickbar { cursor: pointer; display: block; color: inherit; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease; }
.karte.klickbar:hover { transform: translateY(-2px); }
.karte.klickbar:active { transform: scale(.985); }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zeile.ende { justify-content: flex-end; }
.zeile.zwischen { justify-content: space-between; }
.zeile > .breit { flex: 1; }
.stapel > * + * { margin-top: 12px; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.zahl { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }

/* Großer Farbbereich oben (Begrüßung, Anmeldung) */
.held { position: relative; overflow: hidden; background: var(--verlauf); color: #fff; border-radius: 26px;
  padding: 24px 22px; margin: 0 0 14px; box-shadow: 0 14px 34px rgba(91, 79, 232, .32); }
.held::after { content: ""; position: absolute; width: 220px; height: 220px; right: -60px; top: -80px;
  border-radius: 50%; background: rgba(255, 255, 255, .13); }
.held h1 { margin: 0 0 6px; font-size: 30px; }
.held p { margin: 0; opacity: .92; }
.held .logo { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }

/* Kennzahlen */
.kachel { background: var(--flaeche); border-radius: var(--radius); padding: 16px; box-shadow: var(--schatten);
  border: 1px solid color-mix(in srgb, var(--rand) 60%, transparent); }
.kachel .symbol { font-size: 22px; display: block; margin-bottom: 4px; }

/* Lernmethoden als Kacheln */
.methoden { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.methode { flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; gap: 2px; min-height: 112px;
  padding: 14px; border: 0; border-radius: 18px; background: var(--ton-hell); color: var(--text); font-weight: 700; }
button.methode .symbol { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: var(--ton); color: #fff; font-size: 22px; margin-bottom: 8px; box-shadow: 0 6px 14px rgba(0, 0, 0, .14); }
button.methode .klein { color: var(--leise); font-weight: 500; line-height: 1.3; }
button.methode.gross { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 88px;
  background: var(--verlauf); color: #fff; box-shadow: 0 10px 24px rgba(91, 79, 232, .3); }
button.methode.gross .symbol { margin: 0; background: rgba(255, 255, 255, .22); box-shadow: none; }
button.methode.gross .klein { color: rgba(255, 255, 255, .85); }
button.methode .text { display: flex; flex-direction: column; }

/* Knöpfe und Eingaben */
button, .knopf { appearance: none; border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
  border-radius: 14px; padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer; min-height: 50px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease; }
button:active:not(:disabled), .knopf:active { transform: scale(.97); }
button.haupt, .knopf.haupt { background: var(--verlauf); color: var(--akzent-text); border-color: transparent;
  box-shadow: 0 8px 20px rgba(91, 79, 232, .3); }
button.haupt:hover, .knopf.haupt:hover { filter: brightness(1.06); }
button.breit, .knopf.breit { width: 100%; }
button.gefahr { color: var(--falsch); }
button.klein { min-height: 38px; padding: 6px 12px; font-size: 15px; border-radius: 11px; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, .knopf:focus-visible, a:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--grund);
  border: 2px solid transparent; border-radius: 14px; padding: 11px 14px; min-height: 50px;
  transition: border-color .15s ease, background .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); }
textarea { min-height: 150px; }
input[type="file"] { padding: 8px; color: var(--leise); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 700; border: 0; border-radius: 10px;
  padding: 8px 14px; margin-right: 10px; background: var(--akzent-hell); color: var(--akzent); cursor: pointer; }
label { display: block; font-size: 14px; font-weight: 700; color: var(--leise); margin: 0 0 6px 4px; }
label > input, label > select, label > textarea { margin-top: 6px; }
.antwort { font-size: 22px; text-align: center; font-weight: 700; min-height: 60px; }

/* Reiter als Segment-Schalter */
.reiter { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 16px; padding: 4px; border-radius: 16px;
  background: color-mix(in srgb, var(--rand) 70%, transparent); }
.reiter { scrollbar-width: none; }
.reiter button { flex: 1 1 0; min-width: max-content; min-height: 42px; padding: 8px 10px; border: 0;
  background: transparent; color: var(--leise); border-radius: 12px; font-size: 15px; white-space: nowrap; }
.reiter.senkrecht { flex-direction: column; }
.reiter.senkrecht button { flex: 0 0 auto; }
.reiter button.aktiv { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }

/* Kleine Markierungen */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: 99px; background: var(--akzent-hell); color: var(--akzent); }
.chip.gut { background: var(--gut-hell); color: var(--gut); }
.chip.fast { background: var(--fast-hell); color: var(--fast); }
.chip.falsch { background: var(--falsch-hell); color: var(--falsch); }
.chip.grau { background: color-mix(in srgb, var(--rand) 70%, transparent); color: var(--leise); }
.marke-gut { color: var(--gut); } .marke-fast { color: var(--fast); } .marke-falsch { color: var(--falsch); }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 15px;
  background: var(--ton); color: #fff; font-weight: 800; font-size: 20px; }
.avatar.gross { width: 56px; height: 56px; font-size: 24px; border-radius: 18px; }
.titelzeile { display: flex; align-items: center; gap: 14px; margin: 6px 0 16px; }
.titelzeile h1 { margin: 0; flex: 1; }

/* Fortschritt */
.balken { height: 12px; background: color-mix(in srgb, var(--rand) 80%, transparent); border-radius: 99px;
  overflow: hidden; margin-top: 10px; }
.balken > span { display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .6s ease; }
.punkte { display: flex; gap: 5px; flex-wrap: wrap; }
.punkte span { width: 10px; height: 10px; border-radius: 50%; background: var(--rand); }
.punkte span.richtig { background: var(--gut); } .punkte span.fast { background: var(--fast); }
.punkte span.falsch { background: var(--falsch); }

/* Tabellen */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle td, .tabelle th { padding: 10px 6px; border-bottom: 1px solid var(--rand); text-align: left; vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td.aktionen { white-space: nowrap; text-align: right; width: 1%; }
.tabelle td.aktionen button + button { margin-left: 6px; }
.tabelle input { min-height: 40px; padding: 6px 10px; border-radius: 10px; }
/* Vorschau beim Einlesen: eine Vokabel pro Block, Felder untereinander */
.vorschau-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rand); }
.vorschau-zeile:last-child { border-bottom: 0; }
.vorschau-zeile .felder { flex: 1; min-width: 0; display: grid; gap: 6px; }
.vorschau-zeile input { min-height: 40px; padding: 6px 12px; border-radius: 10px; }
.vorschau-zeile input.fremd { font-weight: 700; }
.vorschau-zeile input.zusatz { min-height: 34px; font-size: 14px; color: var(--leise); }

/* Abfrage */
.lernkarte { text-align: center; padding: 22px 18px; }
.lernkarte.wackeln { animation: wackeln .4s ease; }
.frage { font-size: 34px; font-weight: 800; text-align: center; margin: 14px 0; word-break: break-word;
  letter-spacing: -.01em; }
.satz { font-size: 22px; text-align: center; margin: 12px 0; line-height: 1.5; }
.aufgedeckt { animation: pop .35s ease both; }
.rueckmeldung { display: grid; place-items: center; gap: 8px; text-align: center; font-size: 20px; font-weight: 800; }
.rueckmeldung .kreis { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%;
  font-size: 34px; color: #fff; background: var(--verlauf); animation: pop .4s cubic-bezier(.2, 1.6, .4, 1) both; }
.rueckmeldung .kreis.grau { background: var(--leise); }
.rueckmeldung .kreis.note { width: 84px; height: 84px; font-size: 44px; font-weight: 800; }
.durch { text-decoration: line-through; color: var(--falsch); }
button.methode.quer { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 80px; }
button.methode.quer .symbol { margin: 0; }
.lernkarte > .zeile { justify-content: center; }
.ergebnis-richtig { background: linear-gradient(180deg, var(--gut-hell), var(--flaeche) 70%); }
.ergebnis-richtig .kreis { background: var(--gut); }
.ergebnis-fast { background: linear-gradient(180deg, var(--fast-hell), var(--flaeche) 70%); }
.ergebnis-fast .kreis { background: var(--fast); }
.ergebnis-falsch { background: linear-gradient(180deg, var(--falsch-hell), var(--flaeche) 70%); }
.ergebnis-falsch .kreis { background: var(--falsch); }
.optionen { display: grid; gap: 10px; }
.optionen button { min-height: 60px; font-size: 20px; border-width: 2px; }
.optionen button:hover { border-color: var(--akzent); }
.knopfreihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.ja { background: var(--gut); color: #fff; border-color: transparent; }
button.nein { background: var(--falsch-hell); color: var(--falsch); border-color: transparent; }
.anhoeren { font-size: 42px; width: 110px; height: 110px; border-radius: 50%; margin: 10px auto; display: flex;
  background: var(--verlauf); color: #fff; border: 0; box-shadow: 0 12px 28px rgba(91, 79, 232, .35); }

/* Konfetti nach geschaffter Runde (Position/Farbe per CSSOM) */
.konfetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.konfetti span { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px;
  animation: fallen 2.4s ease-in forwards; }

/* QR-Code und Kalender */
.qr { display: block; width: 240px; max-width: 100%; margin: 12px auto; background: #fff; border-radius: 16px; padding: 8px; }
.kalender { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.kalender span { aspect-ratio: 1; border-radius: 7px; background: color-mix(in srgb, var(--rand) 80%, transparent); }
.kalender span.an { background: var(--verlauf); box-shadow: 0 3px 8px rgba(91, 79, 232, .3); }
.kalender span.heute { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* Leerer Zustand */
.leer { text-align: center; padding: 26px 16px; color: var(--leise); }
.leer .symbol { font-size: 44px; display: block; margin-bottom: 6px; }

/* Meldung unten */
.meldung { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); background: var(--text); color: var(--grund); padding: 12px 18px;
  border-radius: 14px; font-weight: 600; opacity: 0; transition: opacity .2s, transform .25s ease;
  pointer-events: none; max-width: 90vw; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.meldung.an { opacity: 1; transform: translate(-50%, 0); }
.meldung.fehler { background: var(--falsch); color: #fff; }
details summary { cursor: pointer; color: var(--leise); font-weight: 700; margin: 14px 4px 10px; }
[hidden] { display: none !important; }

@keyframes hinein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes wackeln { 0%, 100% { transform: none; } 20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes fallen { to { transform: translateY(110vh) rotate(720deg); opacity: .8; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
