/* NotizQuest – mobile-first, helles/dunkles Farbschema nach Systemeinstellung */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eceef5;
  --text: #1b1d26;
  --muted: #555b6b;
  --border: #d9dce6;
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --on-primary: #ffffff;
  --primary-soft: #e7e7fb;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --on-ok: #ffffff;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --on-bad: #ffffff;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --neu: #9aa0b0;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 4px 16px rgb(16 24 40 / .06);
  --shadow-lg: 0 8px 30px rgb(16 24 40 / .12);
  --radius: 14px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #181b24;
    --surface-2: #232734;
    --text: #e9ebf1;
    --muted: #a6acbb;
    --border: #2f3443;
    --primary: #a5b4fc;
    --primary-hover: #c7d2fe;
    --on-primary: #1e1b4b;
    --primary-soft: #262a48;
    --ok: #4ade80;
    --ok-soft: #13301f;
    --on-ok: #052e16;
    --bad: #f87171;
    --bad-soft: #3b1718;
    --on-bad: #450a0a;
    --warn: #fbbf24;
    --warn-soft: #382c0f;
    --neu: #5d6375;
    --focus: #93c5fd;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    --shadow-lg: 0 8px 30px rgb(0 0 0 / .5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin-top: 1.75rem; }
.h3, h3 { font-size: 1.05rem; margin-top: 0; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
[tabindex="-1"]:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem calc(2.5rem + env(safe-area-inset-bottom));
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: .5rem; top: -3rem;
  background: var(--primary); color: var(--on-primary);
  padding: .6rem 1rem; border-radius: var(--radius-sm); z-index: 100;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: .5rem; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.lead { color: var(--muted); font-size: 1.02rem; }
.pre { white-space: pre-wrap; }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .4rem 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 750; font-size: 1.1rem; color: var(--text); text-decoration: none;
  min-height: 44px;
}
.brand img { border-radius: 7px; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 .85rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

/* Im Spiel auf kleinen Bildschirmen Platz sparen */
@media (max-width: 599px) {
  body.in-game .topbar { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 48px; padding: .6rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 88%, black); }
.btn-bad { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-bad:hover { background: color-mix(in srgb, var(--bad) 88%, black); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-danger-outline { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
.btn-danger-outline:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { min-height: 44px; padding: .4rem .8rem; font-size: .925rem; }
.btn-big { min-height: 56px; font-size: 1.05rem; }
.btn[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }

.row { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }

/* ---------- Panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.panel-quiet { background: transparent; box-shadow: none; border-style: dashed; }
details.panel > summary { cursor: pointer; font-weight: 650; min-height: 32px; display: list-item; }
details.panel[open] > summary { margin-bottom: .75rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .5rem 0 .5rem; }
.page-head h1 { margin: 0; }

.chip {
  display: inline-block; margin: .25rem 0 .4rem;
  padding: .15rem .65rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .85rem; font-weight: 650;
}
.backlink {
  display: flex; width: fit-content; align-items: center; min-height: 44px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.backlink:hover { color: var(--text); }
.deck-title { font-size: 1.75rem; }

/* ---------- Bibliothek ---------- */

.fach { margin-top: 1.5rem; }
.fach-head { display: flex; align-items: center; gap: .25rem 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.fach-head h2 { margin: 0; }
.fach-mix { margin-left: auto; }

.deck-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
@media (min-width: 640px) { .deck-list { grid-template-columns: 1fr 1fr; } }

.deck-item {
  position: relative;
  display: flex; flex-direction: column; gap: .3rem;
  height: 100%;
  padding: .9rem 2.4rem .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.deck-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.deck-item-title { font-weight: 700; font-size: 1.05rem; }
.deck-item-meta { color: var(--muted); font-size: .9rem; }
.deck-item-last { color: var(--muted); font-size: .8rem; }
.deck-item-arrow {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  font-size: 1.6rem; color: var(--muted);
}

.mastery {
  display: flex; height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--neu); margin: .2rem 0;
}
.mastery-lg { height: 10px; }
.mastery span { display: block; height: 100%; transition: width .4s; }
.m-sicher { background: var(--ok); }
.m-unsicher { background: var(--warn); }

.summary { margin: .75rem 0; }
.legend { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; }
.dot-sicher { background: var(--ok); }
.dot-unsicher { background: var(--warn); }
.dot-neu { background: var(--neu); }

.empty { text-align: center; padding: 2.5rem 1rem; }
.empty-icon { font-size: 3rem; margin: 0; }

/* ---------- Deck-Seite ---------- */

.game-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }

.game-tile {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.game-main {
  flex: 1;
  display: flex; flex-direction: column; gap: .2rem;
  padding: 1rem; min-height: 112px;
  color: var(--text); text-decoration: none;
  transition: background-color .15s;
}
.game-main:hover { background: var(--primary-soft); }
.game-icon { font-size: 1.7rem; line-height: 1; margin-bottom: .3rem; }
.game-name { font-weight: 700; }
.game-desc { font-size: .85rem; color: var(--muted); }
.game-extra {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  border-top: 1px solid var(--border);
  font-size: .85rem; font-weight: 650; text-decoration: none; padding: .3rem .5rem; text-align: center;
}
.game-extra:hover { background: var(--surface-2); }
.game-tile.is-disabled { opacity: .55; box-shadow: none; }
.game-tile.is-disabled .game-main, .game-tile.is-disabled { padding: 1rem; gap: .2rem; min-height: 112px; }

.content-list ul { list-style: none; padding: 0; margin: 0; }
.content-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem;
  padding: .7rem 0; border-top: 1px solid var(--border);
}
.content-item p { margin: .15rem 0 0; }
.badge {
  flex-shrink: 0; padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.badge-neu { background: var(--surface-2); color: var(--muted); }
.badge-unsicher { background: var(--warn-soft); color: var(--warn); }
.badge-sicher { background: var(--ok-soft); color: var(--ok); }
.badge-count { font-weight: 500; }

/* ---------- Import ---------- */

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  min-height: 150px; padding: 1.25rem; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
#file-input:focus-visible + .dropzone { outline: 3px solid var(--focus); outline-offset: 2px; }
.dropzone-icon { font-size: 2rem; }
.dropzone-title { font-weight: 700; color: var(--primary); }
.dropzone-hint { font-size: .875rem; color: var(--muted); }

.label { display: block; font-weight: 700; margin-bottom: .25rem; }
textarea, input[type="text"] {
  width: 100%;
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .7rem .8rem;
}
textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .875rem; resize: vertical; min-height: 9rem; }
textarea:focus, input[type="text"]:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }

.import-results { display: grid; gap: .6rem; margin: 1rem 0; scroll-margin-top: 4.5rem; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-left-width: 5px;
  border-radius: var(--radius-sm); padding: .85rem 1rem;
}
.result-card.is-ok { border-left-color: var(--ok); }
.result-card.is-warn { border-left-color: var(--warn); }
.result-card.is-bad { border-left-color: var(--bad); }
.result-title { font-weight: 700; margin-bottom: .25rem; }
.warnings { margin: .5rem 0; font-size: .875rem; }
.warnings summary { cursor: pointer; color: var(--warn); font-weight: 650; min-height: 32px; }
.warnings ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.warnings li { margin: .2rem 0; }

.bundled-list { list-style: none; padding: 0; margin: 0; }
.bundled-item {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .7rem 0; border-top: 1px solid var(--border);
}
.bundled-item:first-child { border-top: 0; }
.bundled-item p { margin: .1rem 0 0; }
.bundled-item .btn { flex-shrink: 0; }

.code {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: .8rem; overflow-x: auto; font-size: .8rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Spiel-Rahmen ---------- */

.game-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.game-exit { justify-self: start; }
.game-head-right { justify-self: end; display: flex; align-items: center; }
.game-title { font-size: 1.1rem; margin: 0; text-align: center; }
.game-status { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-weight: 650; margin: .25rem 0 .4rem; }
.game-hint { margin-bottom: .75rem; }
.game-body.fade-in { animation: fade-in .25s ease-out; }
.timer { font-variant-numeric: tabular-nums; font-weight: 750; padding: .3rem .7rem; border-radius: 999px; background: var(--surface-2); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.game-counter { font-variant-numeric: tabular-nums; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s ease; }

/* ---------- Karteikarte ---------- */

.card-wrap {
  position: relative;
  perspective: 1200px;
  margin: 0 auto 1rem;
  max-width: 560px;
  touch-action: pan-y;
  will-change: transform;
}

.flashcard {
  display: block; width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: pointer; text-align: center;
  touch-action: pan-y;
  border-radius: 20px;
}
.flashcard-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.3, .7, .3, 1);
}
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard.no-anim .flashcard-inner { transition: none; }

.face {
  grid-area: 1 / 1;
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  min-height: min(52vh, 380px);
  padding: 2.25rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow-wrap: anywhere;
}
.face-back { transform: rotateY(180deg); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.face-label {
  position: absolute; top: .9rem; left: 0; right: 0;
  font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.face-hint { position: absolute; bottom: .9rem; left: 0; right: 0; font-size: .8rem; color: var(--muted); }
.face-text { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.3; max-width: 32ch; }
.face-back .face-text { font-weight: 550; font-size: 1.25rem; }
.face-text.is-long { font-size: 1.15rem; font-weight: 500; max-width: 42ch; }
.face-text.is-very-long { font-size: 1rem; font-weight: 450; line-height: 1.45; text-align: left; max-width: 52ch; }
.face:has(.is-very-long) { padding-top: 2.75rem; padding-bottom: 2.75rem; }

.swipe-badges { position: absolute; inset: 0; pointer-events: none; }
.swipe-badges span {
  position: absolute; top: 1.2rem;
  padding: .3rem .8rem; border-radius: 8px; border: 3px solid;
  font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .9rem;
  opacity: 0; background: var(--surface);
}
.swipe-no { right: 1rem; color: var(--bad); transform: rotate(10deg); }
.swipe-ok { left: 1rem; color: var(--ok); transform: rotate(-10deg); }
.card-wrap[data-swipe="ok"] .swipe-ok { opacity: var(--swipe, 0); }
.card-wrap[data-swipe="no"] .swipe-no { opacity: var(--swipe, 0); }

.answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; max-width: 560px; margin: 0 auto; }
.kbd-help { margin-top: 1rem; }
@media (hover: none) { .kbd-help { display: none; } }

/* ---------- Zuordnen ---------- */

.match-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .6rem; }
.match-col { display: flex; flex-direction: column; gap: .5rem; }
.match-tile {
  min-height: 56px; padding: .6rem .7rem;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
  transition: border-color .15s, background-color .15s, opacity .3s, transform .3s;
}
.match-tile:hover:not(:disabled) { border-color: var(--primary); }
.match-begriff { font-weight: 700; font-size: .95rem; }
.match-erklaerung { font-size: .85rem; line-height: 1.35; }
.match-tile[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary); }
.match-tile.is-correct { border-color: var(--ok); background: var(--ok-soft); color: var(--text); cursor: default; }
.match-tile.is-wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .3s; }
.match-tile.is-gone { opacity: 0; transform: scale(.94); visibility: hidden; transition: opacity .3s, transform .3s, visibility 0s .3s; }

/* ---------- Quiz ---------- */

.quiz-kind {
  display: inline-block; margin: .25rem 0 .5rem; padding: .1rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 700;
}
.quiz-q { font-size: 1.25rem; margin: 0 0 .75rem; }
.quiz-quote {
  margin: 0 0 1rem; padding: .85rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm); font-size: 1.02rem;
}
.answers { display: grid; gap: .6rem; }
.answer {
  display: flex; align-items: center; gap: .75rem;
  min-height: 56px; padding: .7rem .9rem;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, background-color .15s, opacity .2s;
}
.answer:hover:not(:disabled) { border-color: var(--primary); }
.answer:disabled { cursor: default; }
.answer-letter {
  flex: 0 0 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); font-weight: 750; font-size: .9rem;
}
.answer.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.answer.is-correct .answer-letter { background: var(--ok); color: var(--on-ok); }
.answer.is-wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .3s; }
.answer.is-wrong .answer-letter { background: var(--bad); color: var(--on-bad); }
.answer.is-dim { opacity: .55; }

.feedback:empty { display: none; }
.feedback {
  margin-top: 1rem; padding: .85rem 1rem;
  border-radius: var(--radius-sm); border-left: 5px solid var(--border);
  background: var(--surface); animation: fade-in .2s ease-out;
}
.feedback.is-ok { background: var(--ok-soft); border-left-color: var(--ok); }
.feedback.is-bad { background: var(--bad-soft); border-left-color: var(--bad); }
.feedback-title { font-weight: 800; margin: 0; }
.feedback-text { margin: .4rem 0 0; }
.next-btn { width: 100%; margin-top: 1rem; }

/* ---------- Lückentext ---------- */

.cloze {
  font-size: 1.1rem; line-height: 2.5;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1.1rem; box-shadow: var(--shadow); margin: 0;
}
.gap {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 5.5em; min-height: 40px; padding: 0 .6rem; margin: 0 .15rem;
  vertical-align: middle; line-height: 1.2;
  border: 2px dashed color-mix(in srgb, var(--muted) 60%, var(--border)); border-radius: 8px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 650; cursor: pointer;
}
.gap.is-filled { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.gap.is-target { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.gap.is-correct { border-style: solid; border-color: var(--ok); background: var(--ok-soft); color: var(--ok); cursor: default; }
.gap.is-wrong { border-style: solid; border-color: var(--bad); background: var(--bad-soft); color: var(--bad); cursor: default; }
.gap .gap-solution { color: var(--ok); font-weight: 750; }
.gap s { opacity: .85; }

.wordbank { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; justify-content: center; }
.word {
  min-height: 44px; padding: .4rem .95rem;
  border: 2px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: opacity .15s, border-color .15s;
}
.word:hover:not(:disabled) { border-color: var(--primary); }
.word[aria-pressed="true"] { opacity: .4; border-style: dashed; }
.word:disabled { cursor: default; }
.cloze-actions { display: grid; grid-template-columns: 1fr 2fr; gap: .6rem; }
.cloze-actions > .btn:nth-child(3) { grid-column: 1 / -1; }

/* ---------- Ergebnis ---------- */

.result { text-align: center; padding: 1rem 0; }
.score-ring {
  --size: 150px;
  width: var(--size); height: var(--size); margin: 1rem auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--bg) 79%, transparent 80% 100%),
    conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--surface-2) 0);
  animation: pop .5s ease-out;
}
.score-pct { font-size: 2rem; font-weight: 800; }
.score-line { font-size: 1.1rem; }
.result-msg { font-weight: 650; }

.review ul { list-style: none; padding: 0; margin: 0; }
.review-item { padding: .7rem 0; border-top: 1px solid var(--border); }
.review-item:first-child { border-top: 0; }
.review-q { font-weight: 700; margin: 0 0 .2rem; }
.review-a { margin: 0; }

@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Dialoge ---------- */

.dialog {
  width: min(92vw, 440px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 1.25rem; box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog[open] { animation: pop .18s ease-out; }
.dialog-title { font-size: 1.15rem; margin-top: 0; }
.dialog-text { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.field { margin-top: .75rem; }
.field label { display: block; font-weight: 650; margin-bottom: .25rem; font-size: .925rem; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: grid; gap: .5rem; z-index: 50;
  width: min(92vw, 460px); pointer-events: none;
}
.toast {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: .925rem;
  animation: toast-in .2s ease-out;
  pointer-events: auto;
}
.toast-ok { background: var(--ok); color: var(--on-ok); }
.toast-bad { background: var(--bad); color: var(--on-bad); }
.toast-warn { background: var(--warn); color: var(--bg); }
.toast-out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Desktop ---------- */

@media (min-width: 600px) {
  h1 { font-size: 1.9rem; }
  .container { padding-top: 1.5rem; }
  .face-text { font-size: 1.9rem; }
  .face-back .face-text { font-size: 1.35rem; }
}

/* ---------- Weniger Bewegung ---------- */

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