/* ==========================================================================
   Lerntrainer: dunkles Design
   Farben, Formen und Schatten stehen als Variablen in :root.
   --ac ist die Farbe des Schulfachs und wird von js/theme.js gesetzt.
   ========================================================================== */

/* ---------- Schriften: liegen im Projekt, damit die App auch offline gleich aussieht ---------- */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/inter-greek.woff2) format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/spacegrotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Farben und Formen ---------- */
/* Alle Text-Paare haben mindestens 4,5:1 Kontrast. */
:root {
  color-scheme: dark;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --head: "Space Grotesk", var(--font);
  --ac: #7AA7FF;

  --bg: #0E1014;
  --surface: #161A21;
  --surface2: #1E232C;
  --field: #0F1217;
  --tx: #EEF0F4;
  --tx2: #C5CBD6;
  --mut: #98A1B0;
  --line: rgb(255 255 255 / .08);
  --line2: rgb(255 255 255 / .14);
  --glass: rgb(255 255 255 / .04);
  --glass2: rgb(255 255 255 / .075);
  --on-ac: #0E1014;
  --ok: #5BD38A; --on-ok: #0E1014; --ok-tx: #7EE2A6; --okbg: #122A1E;
  --bad: #F26D6D; --on-bad: #0E1014; --bad-tx: #FF9C9C; --badbg: #2E171A;

  --acbg: color-mix(in srgb, var(--ac) 14%, var(--surface));
  --acsoft: color-mix(in srgb, var(--ac) 18%, transparent);
  --acglow: color-mix(in srgb, var(--ac) 45%, transparent);
  --acgrad: linear-gradient(180deg, color-mix(in srgb, var(--ac), white 16%), var(--ac));

  --rc: 22px;   /* Ecken von Karten */
  --rb: 14px;   /* Ecken von Knöpfen */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 18px 40px -24px rgb(0 0 0 / .7);
  /* Farbschein der Schulfachfarbe oben im Bild. Kopf und Seite teilen ihn, damit kein Streifen entsteht. */
  --glow: radial-gradient(1100px 560px at 50% -240px, color-mix(in srgb, var(--ac) 17%, transparent), transparent 70%);
}

/* ---------- Grundgerüst ---------- */
* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-color: #2C323D transparent; }
body {
  margin: 0; overflow-x: clip;
  background: var(--glow) fixed, var(--bg);
  color: var(--tx);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--acglow); color: var(--tx); }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 18px 64px; }

/* ---------- Kopf und Navigation ---------- */
/* Glasleiste über die ganze Breite. Bleibt beim Scrollen oben, damit „Zurück“ immer erreichbar ist. */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 66px; margin: 0 calc(50% - 50vw) 6px; padding: 10px calc(50vw - 50%);
  background: var(--glow) fixed, color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.logo {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px;
  background: var(--acgrad); box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 6px 18px -6px var(--acglow);
}
.logo svg { width: 20px; height: 20px; }
.logo rect { stroke: var(--on-ac); stroke-width: 2; stroke-linejoin: round; }
.logo rect:first-child { fill: none; opacity: .55; }
.logo rect:last-child { fill: var(--on-ac); }
.back:not([hidden]) + .brand { font-size: 17px; }
.back:not([hidden]) + .brand .logo { display: none; }

.back {
  display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px 0 11px;
  background: var(--glass); color: var(--tx); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--font); font-size: 15px; font-weight: 600;
}
.back[hidden] { display: none; }
.back .arrow { width: 18px; height: 18px; stroke-width: 2.2; transition: transform .2s var(--ease); }
.back:hover:not(:disabled) { background: var(--glass2); filter: none; }
.back:hover .arrow { transform: translateX(-2px); }

/* Runde und Stand im Kopf während des Lernens (siehe setTopInfo in nav.js) */
.topinfo { display: none; }
.top.info { display: grid; grid-template-columns: 1fr auto 1fr; }
.top.info .brand { display: none; }
.top.info .back { justify-self: start; }
.top.info .topinfo { display: contents; }
.topinfo b { justify-self: center; font-family: var(--head); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.topinfo .tcount { justify-self: end; padding: 3px 10px; border-radius: 999px; background: var(--glass); color: var(--tx2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.topinfo .tline { position: fixed; left: 0; right: 0; top: 0; height: 3px; background: var(--line); }
.topinfo .tline i {
  display: block; height: 100%; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ac) 55%, transparent), var(--ac));
  box-shadow: 0 0 12px var(--acglow); transition: width .5s var(--ease);
}

/* Tabs als Schalterleiste */
.seg {
  display: flex; gap: 4px; padding: 5px; margin-bottom: 22px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
}
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 8px;
  border-radius: 13px; color: var(--mut); font-family: var(--font); font-size: 15px; font-weight: 600;
}
.seg svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.seg button:hover:not(.on) { color: var(--tx); background: var(--glass); filter: none; }
.seg button.on { color: var(--tx); background: var(--surface2); box-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 6px 16px -8px rgb(0 0 0 / .8); }
.seg button.on svg { color: var(--ac); }

/* ---------- Knöpfe ---------- */
button {
  font: inherit; font-weight: 600; min-height: 48px; padding: 10px 20px;
  border: 0; border-radius: var(--rb); background: none; color: inherit; cursor: pointer;
  transition: filter .15s, transform .15s var(--ease), box-shadow .2s, background-color .15s, border-color .15s, color .15s;
}
/* Hauptknopf: jeder Knopf ohne eigene Rolle */
button:where(:not(.sec, .alt, .link, .chip, .choice, .subject, .back, .symbar button, .seg button, .me)) {
  background: var(--acgrad); color: var(--on-ac);
  box-shadow: 0 1px 0 rgb(255 255 255 / .3) inset, 0 10px 24px -12px var(--acglow);
  font-family: var(--head); font-weight: 700; letter-spacing: -.005em;
}
button:where(:not(.sec, .alt, .link, .chip, .choice, .subject, .back, .symbar button, .seg button, .me)):hover:not(:disabled) {
  filter: brightness(1.06); transform: translateY(-1px);
  box-shadow: 0 1px 0 rgb(255 255 255 / .3) inset, 0 14px 30px -12px var(--acglow);
}
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .4; cursor: default; box-shadow: none; }
button:focus-visible { outline: 2px solid var(--ac); outline-offset: 3px; }
button.sec { background: var(--glass); color: var(--tx); border: 1px solid var(--line2); font-family: var(--font); font-weight: 600; }
button.sec:hover:not(:disabled) { background: var(--glass2); filter: none; }
button.ok { background: linear-gradient(180deg, color-mix(in srgb, var(--ok), white 14%), var(--ok)); color: var(--on-ok); box-shadow: 0 1px 0 rgb(255 255 255 / .3) inset, 0 10px 24px -12px color-mix(in srgb, var(--ok) 50%, transparent); }
button.block { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; font-size: 18px; border-radius: 16px; }
button.small { min-height: 36px; padding: 6px 13px; border-radius: 11px; font-family: var(--font); font-size: 14px; font-weight: 600; }
button.link { min-height: 44px; padding: 0; color: var(--ac); font-size: 15px; white-space: nowrap; }
button.link:hover:not(:disabled) { filter: none; text-decoration: underline; text-underline-offset: 4px; }
/* Nebenweg unter dem Hauptknopf */
button.alt { min-height: 48px; color: var(--tx2); border: 1px solid var(--line); font-family: var(--font); font-size: 15px; }
button.alt:hover:not(:disabled) { color: var(--tx); background: var(--glass); filter: none; }
.arrow { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
button:hover:not(:disabled) > .arrow { transform: translateX(3px); }
.back:hover > .arrow { transform: translateX(-2px); }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions button { flex: 1; }
/* Pause und Rundenende: passen beide Knöpfe nicht nebeneinander, steht der Hauptknopf oben */
.center .actions { flex-wrap: wrap-reverse; }
.center .actions button { flex: 1 1 auto; }

/* ---------- Karten, Gruppen, Überschriften ---------- */
.card {
  background: linear-gradient(180deg, rgb(255 255 255 / .035), rgb(255 255 255 / .01)), var(--surface);
  border: 1px solid var(--line); border-radius: var(--rc); padding: 22px 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card.rows { padding: 4px 18px; }
.group { margin-top: 30px; }
.group > .section-title { margin-bottom: 12px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); margin: 0 0 6px; }
.center .eyebrow { justify-content: center; }
h2 { font-family: var(--head); font-size: 28px; line-height: 1.15; margin: 0 0 8px; font-weight: 700; letter-spacing: -.025em; }
.section-title { font-family: var(--head); font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; color: var(--tx); margin: 0 0 14px; }
.headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.headrow .section-title { margin: 0; }
.sub { color: var(--mut); margin: 0 0 18px; }
.hint { color: var(--mut); font-size: 13.5px; margin: 12px 0 0; }
.count { color: var(--mut); font-weight: 400; font-size: 14px; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.badge {
  display: inline-grid; place-items: center; flex: none; min-width: 30px; height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--glass2); color: var(--tx2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- Schulfächer als Chips ---------- */
.subjects { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.subject {
  display: flex; align-items: center; gap: 8px; min-height: 42px; min-width: 0; padding: 0 14px 0 12px;
  background: var(--glass); color: var(--tx2); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--font); font-size: 15px; font-weight: 600; text-align: left;
}
.subject b { font-weight: inherit; overflow-wrap: anywhere; line-height: 1.25; }
.subject small { font-size: 13px; font-weight: 600; color: var(--mut); font-variant-numeric: tabular-nums; }
.subject .sicon { width: 18px; height: 18px; stroke-width: 2; color: var(--mut); }
.subject:hover:not(.on) { color: var(--tx); background: var(--glass2); filter: none; }
.subject.on {
  color: var(--tx); background: color-mix(in srgb, var(--ac) 15%, var(--surface));
  border-color: color-mix(in srgb, var(--ac) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 12%, transparent), 0 8px 22px -12px var(--acglow);
}
.subject.on .sicon { color: var(--ac); }
.subject.on small { color: var(--tx2); }
.subject.add { justify-content: center; min-width: 42px; padding: 0; background: transparent; color: var(--mut); border: 1px dashed var(--line2); font-size: 20px; font-weight: 500; }
.subject.add:hover { color: var(--ac); border-color: var(--ac); }

/* ---------- Übersicht: Runde und Karteikasten ---------- */
.hero {
  position: relative; display: flex; flex-direction: column; gap: 16px; padding: 22px 20px 20px;
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--ac) 22%, transparent), transparent 55%),
    linear-gradient(180deg, rgb(255 255 255 / .04), rgb(255 255 255 / .01)), var(--surface);
  border-color: color-mix(in srgb, var(--ac) 24%, rgb(255 255 255 / .06));
}
.hero > * { margin: 0; }
.hero .eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 10px var(--ac); }
.herotop { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero > .eyebrow { margin-bottom: -6px; }
.herostat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: var(--mut); font-size: 16px; }
.herostat b { font-family: var(--head); font-size: 64px; line-height: .95; font-weight: 600; letter-spacing: -.045em; color: var(--tx); font-variant-numeric: tabular-nums; }
.why { color: var(--tx2); font-size: 17px; }

/* Fortschritt der offenen Runde */
.ring { position: relative; flex: none; width: 84px; height: 84px; }
.ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: rgb(255 255 255 / .08); }
.ring .val { stroke: var(--ac); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--acglow)); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Verteilung auf die fünf Fächer. Eine Farbe, von dunkel (Neu) nach hell (Gemeistert). */
.f1 { background: color-mix(in oklab, var(--ac) 34%, var(--bg)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); }
.f2 { background: color-mix(in oklab, var(--ac) 54%, var(--bg)); }
.f3 { background: color-mix(in oklab, var(--ac) 78%, var(--bg)); }
.f4 { background: var(--ac); }
.f5 { background: color-mix(in oklab, var(--ac) 45%, white); }

.dist { display: flex; gap: 2px; height: 12px; }
.dist.empty { background: var(--glass2); border-radius: 6px; }
.dist span { flex-basis: 0; min-width: 6px; border-radius: 4px; }
.dist span:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.dist span:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
/* Je Fach die Zahl, darüber die Farbe aus dem Balken */
.boxes { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 10px; list-style: none; margin: 18px 0 0; padding: 0; }
.boxes li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.boxes i { width: 20px; height: 5px; border-radius: 3px; margin-bottom: 6px; }
.boxes b { font-family: var(--head); font-size: 24px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.boxes span { color: var(--mut); font-size: 12.5px; }

/* ---------- Einstellungen und Auswahl mit Schaltern ---------- */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; cursor: pointer; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative;
  width: 46px; height: 28px; margin: 0; border-radius: 999px; cursor: pointer;
  background: rgb(255 255 255 / .13); box-shadow: inset 0 1px 2px rgb(0 0 0 / .35); transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #C9CFD9; box-shadow: 0 2px 6px rgb(0 0 0 / .4); transition: transform .25s var(--ease), background .2s;
}
.switch:checked { background: var(--ac); box-shadow: 0 0 14px -2px var(--acglow); }
.switch:checked::after { background: #FFFFFF; transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--ac); outline-offset: 3px; }

/* ---------- Formulare ---------- */
input[type=text], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line2); border-radius: 12px; background: var(--field); color: var(--tx);
  transition: border-color .15s, box-shadow .15s;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398A1B0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px;
}
textarea { resize: vertical; min-height: 120px; }
input[type=text]:hover, input[type=password]:hover, select:hover, textarea:hover { border-color: rgb(255 255 255 / .22); }
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus { outline: none; border-color: var(--ac); box-shadow: 0 0 0 4px var(--acsoft); }
::placeholder { color: var(--mut); opacity: 1; }
.addform { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 15px; }
.field small { color: var(--mut); font-size: 14px; line-height: 1.4; }
.field textarea { min-height: 76px; }
.actions.tight { margin-top: 0; }
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  min-height: 38px; padding: 6px 14px; border-radius: 999px; background: var(--glass); color: var(--tx2);
  border: 1px solid var(--line); font-family: var(--font); font-size: 14px; font-weight: 600;
}
.chip:hover:not(:disabled) { filter: none; color: var(--tx); border-color: var(--line2); }
.chip.on { color: var(--tx); background: color-mix(in srgb, var(--ac) 16%, var(--surface)); border-color: color-mix(in srgb, var(--ac) 65%, transparent); }
.swatches { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.swatches legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line2); background: var(--glass); color: var(--tx2); transition: border-color .15s, background .15s; }
.swatch:hover span { border-color: rgb(255 255 255 / .25); }
.swatch input:checked + span { border-color: var(--ac); background: var(--acbg); color: var(--ac); box-shadow: 0 0 0 3px var(--acsoft); }
.swatch input:focus-visible + span { outline: 2px solid var(--ac); outline-offset: 3px; }
.colors .swatch span { width: 40px; height: 40px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line2); }
.colors .swatch input:checked + span { background: var(--c); border-color: var(--surface); box-shadow: 0 0 0 2px var(--c), 0 0 16px -2px var(--c); }
.preview { background: var(--acbg); border: 1px solid color-mix(in srgb, var(--ac) 22%, transparent); border-radius: 16px; padding: 14px 16px; overflow-wrap: anywhere; }
.preview .section-title { margin-bottom: 6px; font-size: 15px; color: var(--tx2); }
.preview .answer { font-weight: 700; color: var(--ac); margin-top: 6px; }
.preview p { margin: 0; }
.preview .symbol { margin: 0; }
.sicon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Bereiche und Kartenliste ---------- */
.poolrow { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.poolrow:first-of-type { border-top: 0; padding-top: 0; }
.poolrow .pname { flex: 1; font-weight: 600; min-width: 0; word-break: break-word; }
details { margin-top: 10px; }
details > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 3px 0 2px;
  border: solid var(--ac); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .2s var(--ease);
}
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--ac); }
details > summary:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 8px; }
.list { list-style: none; margin: 4px 0 8px; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.list .pair { flex: 1; min-width: 0; word-break: break-word; font-weight: 600; }
.list .pair small { display: block; color: var(--mut); font-weight: 400; font-size: 14px; }
.list .pair small.meta { font-size: 12.5px; margin-top: 3px; }
.list .symbol { width: 96px; margin: 4px 0; }
.rowbtns { display: grid; gap: 6px; flex: none; }
.moverow { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; }
.moverow > * { min-width: 0; }
#search { margin-bottom: 4px; }
#pools { margin: 8px 0 4px; }
#pools > details { border-top: 1px solid var(--line); margin: 0; padding: 4px 0; }
#pools > details:first-child { border-top: 0; }
.poolopts { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 2px 14px 14px; margin: 6px 0 10px; }
.poolopts > summary { color: var(--tx2); font-size: 15px; }
.poolopts .moverow { margin: 0 0 10px; }

/* ---------- Lernansicht ---------- */
.study { margin-top: 4px; }
.flashcard {
  position: relative; overflow: hidden;
  background:
    radial-gradient(90% 70% at 0% 0%, color-mix(in srgb, var(--ac) 9%, transparent), transparent 70%),
    linear-gradient(180deg, rgb(255 255 255 / .045), rgb(255 255 255 / .012)), var(--surface);
  border: 1px solid var(--line2); border-radius: 26px; padding: 18px 20px 22px;
  box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 30px 60px -30px rgb(0 0 0 / .8);
  transition: border-color .3s, box-shadow .3s;
}
/* Ergebnis: die Karte leuchtet in der passenden Farbe */
.flashcard.is-ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 0 0 3px color-mix(in srgb, var(--ok) 12%, transparent), 0 24px 60px -28px color-mix(in srgb, var(--ok) 55%, transparent); }
.flashcard.is-near { border-color: color-mix(in srgb, var(--ac) 55%, transparent); box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 0 0 3px var(--acsoft), 0 24px 60px -28px var(--acglow); }
.flashcard.is-bad { border-color: color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 0 0 3px color-mix(in srgb, var(--bad) 12%, transparent), 0 24px 60px -28px color-mix(in srgb, var(--bad) 50%, transparent); }
.flashcard.enter { animation: cardin .42s var(--ease) both; }
@keyframes cardin { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.cardhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.kind { padding: 4px 10px; border-radius: 999px; background: var(--glass2); color: var(--tx2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.boxinfo { display: flex; align-items: center; gap: 8px; color: var(--tx2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pips { display: flex; gap: 3px; }
.pips i { width: 12px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / .12); }
.pips i.on { background: var(--ac); box-shadow: 0 0 6px var(--acglow); }
.cardbody { overflow-wrap: anywhere; }

.task { color: var(--mut); font-size: 15px; margin: 22px 0 0; }
.word {
  font-family: var(--head); font-size: 32px; line-height: 1.18; font-weight: 600; letter-spacing: -.02em;
  margin: 6px 0 0; padding: 2px 0 6px; overflow-x: auto; overflow-y: hidden; word-break: break-word;
}
.cardbody > .word:first-child, .cardbody > .cardimg:first-child { margin-top: 24px; }
.word.mid { font-size: 25px; }
.word.long { font-family: var(--font); font-size: 19px; font-weight: 500; letter-spacing: 0; line-height: 1.6; }
.word.long:has(.gap) { line-height: 2.4; }
.ctx { display: inline-flex; margin: 10px 0 0; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--mut); font-size: 13px; }

.reveal {
  font-family: var(--head); font-size: 26px; font-weight: 600; letter-spacing: -.015em; color: var(--ac); word-break: break-word;
  margin: 20px 0 2px; padding-top: 18px; border-top: 1px dashed var(--line2); animation: fade .3s var(--ease);
}
.reveal.mid { font-size: 22px; }
.reveal.long { font-family: var(--font); font-size: 17px; font-weight: 600; letter-spacing: 0; line-height: 1.55; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Antwortfeld auf der Karte */
input[type=text].reply {
  height: 60px; margin-top: 22px; padding: 0 18px; border-radius: 16px; border: 1px solid var(--line2);
  background: var(--field); font-size: 20px; font-weight: 500;
}
input[type=text].reply:focus { border-color: var(--ac); box-shadow: 0 0 0 4px var(--acsoft), 0 0 24px -6px var(--acglow); }

.below { margin-top: 16px; }
.retry { color: var(--ac); font-weight: 600; margin: 0 0 12px; }
.retry:empty { display: none; }
.symbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.symbar button {
  min-height: 44px; padding: 0; border-radius: 12px; background: var(--glass); color: var(--tx);
  border: 1px solid var(--line); font-family: var(--font); font-size: 17px; font-weight: 500;
}
.symbar button:hover { background: var(--glass2); filter: none; }
.symbar button:active { transform: scale(.94); background: var(--acsoft); }
.below > .actions { margin-top: 18px; }
.keyhint { display: flex; justify-content: center; align-items: center; gap: 6px; }
kbd { padding: 1px 7px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; background: var(--glass); color: var(--tx2); font: 600 12.5px var(--font); }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 10px 16px 10px 12px; text-align: left;
  background: var(--glass); color: var(--tx); border: 1px solid var(--line2); border-radius: 16px;
  font-family: var(--font); font-size: 16px; font-weight: 500;
}
.choice .key {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px;
  background: var(--glass2); color: var(--mut); font-size: 13px; font-weight: 700; transition: background .15s, color .15s;
}
.choice .opt { flex: 1; min-width: 0; }
.choice:not(:disabled):hover { filter: none; background: var(--glass2); border-color: color-mix(in srgb, var(--ac) 60%, transparent); }
.choice:not(:disabled):hover .key { background: var(--ac); color: var(--on-ac); }
.choice:disabled { cursor: default; opacity: 1; }
.choice.right { background: var(--okbg); border-color: var(--ok); font-weight: 600; }
.choice.right .key { background: var(--ok); color: var(--on-ok); }
.choice.wrong { background: var(--badbg); border-color: var(--bad); color: var(--bad-tx); }
.choice.wrong .key { background: var(--bad); color: var(--on-bad); }
.choice.dim { opacity: .4; }

/* Rückmeldung nach der Antwort, immer mit Zeichen und Text */
.ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.note { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 12px 14px; border-radius: 16px; font-weight: 600; animation: fade .3s var(--ease); }
.note > .ic { width: 28px; height: 28px; padding: 5px; border-radius: 50%; }
.note > div { flex: 1; min-width: 0; padding-top: 2px; }
.note b { display: block; margin-top: 4px; font-family: var(--head); font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: var(--tx); }
.note.ok { background: var(--okbg); color: var(--ok-tx); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.note.ok > .ic { background: var(--ok); color: var(--on-ok); }
.note.near { background: var(--acbg); color: var(--ac); border: 1px solid color-mix(in srgb, var(--ac) 25%, transparent); }
.note.near > .ic { background: var(--ac); color: var(--on-ac); }
.note.gentle { background: var(--badbg); color: var(--bad-tx); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); }
.note.gentle > .ic { background: var(--bad); color: var(--on-bad); }
.explain { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; overflow-x: auto; }
.explain .calc { margin-top: 6px; }
.explain .calc:first-child { margin-top: 0; }

/* Pause und Rundenende */
.bigicon {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 4px auto 18px; border-radius: 24px;
  background: var(--acgrad); color: var(--on-ac);
  box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 16px 40px -12px var(--acglow);
  animation: pop .5s var(--ease) both;
}
.bigicon.ok { background: linear-gradient(180deg, color-mix(in srgb, var(--ok), white 16%), var(--ok)); color: var(--on-ok); box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 16px 40px -12px color-mix(in srgb, var(--ok) 55%, transparent); }
.bigicon .ic { width: 36px; height: 36px; stroke-width: 2.8; }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.stat { display: grid; gap: 2px; padding: 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); }
.stat b { font-family: var(--head); font-size: 36px; line-height: 1.05; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--mut); font-size: 14px; font-weight: 600; }
.stat.ok b { color: var(--ok-tx); }
.stat.bad b { color: var(--bad-tx); }

/* ---------- Formeln, Schaltzeichen, Bilder, Lücken ---------- */
.math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math, serif; font-size: 1.08em; font-weight: 400; }
.word .math, .reveal .math { font-size: 1.05em; }
.choice math, .note b math { vertical-align: middle; }
.symbol {
  display: block; width: 200px; max-width: 100%; margin: 0 auto;
  fill: none; stroke: var(--tx); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.symbol .fill { fill: var(--tx); }
.symbol .thick { stroke-width: 6; stroke-linecap: butt; }
.symbol text { fill: var(--tx); stroke: none; font: 600 26px system-ui, sans-serif; }
.word .symbol, .reveal .symbol { margin: 8px 0; }
.choice .symbol, .note .symbol { width: 130px; margin: 0; }
.cardimg { display: block; max-width: 100%; max-height: 340px; margin: 14px 0 6px; border-radius: 14px; border: 1px solid var(--line2); background: #FFFFFF; }
.cardimg[hidden] { display: none; }
.preview .cardimg { margin: 0 0 10px; }
input[type=text].gap { display: inline-block; width: 8.5em; max-width: 100%; padding: 5px 8px; border-radius: 10px; font-size: 16px; line-height: 1.4; text-align: center; vertical-align: middle; }
.blank { display: inline-block; width: 5em; border-bottom: 2px solid var(--ac); }
mark { background: var(--acbg); color: var(--ac); border-radius: 7px; padding: 1px 7px; }
mark.ok { background: var(--okbg); color: var(--ok-tx); }
mark.bad { background: var(--badbg); color: var(--bad-tx); }

/* ---------- Konto: Knopf im Kopf, Anmeldung, Benutzerverwaltung ---------- */
.avatar {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--ac) 30%, var(--surface2)), var(--surface2));
  border: 1px solid color-mix(in srgb, var(--ac) 35%, var(--line2)); color: var(--tx);
  font-family: var(--head); font-size: 16px; font-weight: 700;
}
.avatar.big { width: 56px; height: 56px; font-size: 24px; box-shadow: 0 10px 26px -14px var(--acglow); }
/* Der Punkt zeigt den Speicherstand: grün gespeichert, gelb unterwegs oder offline, rot Fehler */
.me {
  position: relative; display: grid; place-items: center; flex: none; width: 42px; min-height: 42px; height: 42px; padding: 0;
  border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ac) 35%, var(--line2));
  background: linear-gradient(160deg, color-mix(in srgb, var(--ac) 30%, var(--surface2)), var(--surface2));
  color: var(--tx); font-family: var(--head); font-size: 17px; font-weight: 700;
}
.me[hidden] { display: none; }
.me:hover:not(:disabled) { filter: brightness(1.12); }
.me i { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg); background: var(--ok); }
.me[data-sync=busy] i, .me[data-sync=off] i { background: #F0C24A; }
.me[data-sync=bad] i { background: var(--bad); }
.top.info .me { display: none; }

.auth { max-width: 420px; margin: 4vh auto 0; text-align: center; }
.auth .card { text-align: left; margin-top: 22px; }
.authmark {
  display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 22px;
  background: var(--acgrad); box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 18px 44px -14px var(--acglow);
  animation: pop .5s var(--ease) both;
}
.authmark svg { width: 40px; height: 40px; }
.authmark rect { stroke: var(--on-ac); stroke-width: 1.8; stroke-linejoin: round; }
.authmark rect:first-child { fill: none; opacity: .55; }
.authmark rect:last-child { fill: var(--on-ac); }
h1 { font-family: var(--head); font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; margin: 0 0 8px; }
.auth .sub { margin-bottom: 0; }
.auth .hint { margin-top: 18px; }
.hint.tight { margin-top: -4px; }
code { padding: 1px 6px; border-radius: 6px; background: var(--glass2); font: 500 13px ui-monospace, "Cascadia Mono", Consolas, monospace; }
.banner {
  margin: 0 0 18px; padding: 12px 16px; border-radius: 16px; text-align: left;
  background: var(--acbg); color: var(--tx); border: 1px solid color-mix(in srgb, var(--ac) 30%, transparent); font-weight: 600;
}
.auth .banner { margin: 20px 0 0; }

.profile { display: flex; align-items: center; gap: 16px; }
.pinfo { flex: 1; min-width: 0; }
.pinfo .section-title { margin: 0; overflow-wrap: anywhere; }
.syncline { display: flex; align-items: center; gap: 7px; margin: 4px 0 0; color: var(--mut); font-size: 14px; }
.syncline::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.syncline.busy::before, .syncline.off::before { background: #F0C24A; }
.syncline.bad { color: var(--bad-tx); }
.syncline.bad::before { background: var(--bad); }
.badge.acc { background: color-mix(in srgb, var(--ac) 18%, transparent); color: var(--ac); }
.pad { padding: 14px 0; margin: 0; }

.user { margin: 0; border-top: 1px solid var(--line); }
.user:first-child { border-top: 0; }
.user > summary, .user.self { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 0; font-weight: 400; }
.user > summary::before { order: 2; margin-left: auto; }
.uinfo { display: grid; gap: 2px; min-width: 0; }
.uname { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.uname b { overflow-wrap: anywhere; color: var(--tx); }
.uinfo small { color: var(--mut); font-size: 13px; }
.uname .badge { height: 20px; min-width: 0; font-size: 11.5px; }
.uopts { display: grid; gap: 10px; padding: 2px 0 16px 50px; }
.uopts .moverow { margin: 0; }
.uopts .msg { text-align: left; margin: 0; }

.loading { display: grid; place-items: center; min-height: 40vh; }
.loading span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--ac); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Meldungen und Sonstiges ---------- */
.warn { background: var(--badbg); color: var(--bad-tx); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); border-radius: 16px; padding: 12px 14px; margin: 0 0 16px; font-weight: 600; }
.msg { color: var(--ok-tx); text-align: center; font-weight: 600; min-height: 1.5em; margin: 12px 0 0; }
.msg:empty { display: none; }
.msg.bad { color: var(--bad-tx); }
/* Dateiauswahl unsichtbar, aber nicht display:none (das blockiert auf manchen Geräten die Auswahl) */
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }

.conf { position: fixed; top: -20px; width: 9px; height: 14px; border-radius: 2px; z-index: 50; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Neue Ansicht gleitet herein (Klasse setzt nav.js beim Wechsel). Die Lernkarte hat ihr eigenes Einblenden. */
#app.swap > :not(.study) { animation: rise .38s var(--ease) both; }
#app.swap > :nth-child(2) { animation-delay: .04s; }
#app.swap > :nth-child(3) { animation-delay: .08s; }
#app.swap > :nth-child(n+4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Am Handy liegen die Knöpfe beim Lernen unten im Daumenbereich */
@media (hover: none) and (max-width: 600px) {
  .study { display: flex; flex-direction: column; min-height: calc(100dvh - 86px); }
  .below { flex: 1; display: flex; flex-direction: column; }
  .below > .actions { margin-top: auto; padding-top: 20px; }
}
/* Enter-Hinweis nur mit Tastatur */
@media (hover: none) { .keyhint { display: none; } }
/* Schmale Handys: etwas kleinere Zahlen */
@media (max-width: 370px) {
  .herostat b { font-size: 54px; }
  .ring { width: 72px; height: 72px; }
  .boxes b { font-size: 21px; }
  .seg svg { display: none; }
}

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