:root {
  --navy: #14213d;
  --red: #c8102e;
  --red-dark: #9d0c24;
  --blue: #1d4ed8;
  --sun: #ffc93c;
  --mint: #d8f3e5;
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1b2437;
  --muted: #56617a;
  --line: #d9e0ec;
  --ok: #157347;
  --ok-bg: #dff5e8;
  --bad: #b42318;
  --bad-bg: #fde4e1;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(20, 33, 61, .10);
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
main { width: min(1000px, 100%); margin: 0 auto; padding: 1rem 1rem 3rem; flex: 1; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; color: var(--navy); }
h2 { margin-top: 2rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: .5rem 1rem; z-index: 10; }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  background: var(--navy); color: #fff; padding: .6rem 1rem;
}
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.top nav a { color: #cfe0ff; text-decoration: none; font-size: .9rem; }
.top nav a::before { content: "› "; }
.top nav a:hover { text-decoration: underline; }
.foot { text-align: center; color: var(--muted); padding: 1.5rem 1rem; font-size: .9rem; }

.hero { text-align: center; padding: 1.5rem 1rem .5rem; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 .4rem; }
.hero.compact { padding-top: .5rem; }
.motivation {
  display: inline-block; background: var(--mint); border: 2px solid #9fd8b8; border-radius: var(--radius);
  padding: .7rem 1.1rem; font-weight: 700; margin: .5rem auto; max-width: 42rem;
}
.hint { color: var(--muted); margin: .25rem 0; }
.notice { background: #fff8e1; border: 2px solid var(--sun); border-radius: 12px; padding: .8rem 1rem; }

.cards { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: .35rem; height: 100%;
  background: var(--card); border: 3px solid transparent; border-radius: var(--radius);
  padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--red); }
.card strong { font-size: 1.15rem; color: var(--navy); }
.card .emoji { font-size: 2.4rem; line-height: 1; }
.card.subject { align-items: center; text-align: center; padding: 2rem 1rem; }
.card.subject .emoji { font-size: 3.5rem; }
.pill { display: inline-block; align-self: flex-start; background: #eef2fb; border-radius: 999px; padding: .1rem .7rem; font-size: .8rem; font-weight: 700; color: var(--navy); }

.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--red); color: #fff; font: inherit; font-weight: 800; padding: .65rem 1.3rem;
  border-radius: 999px; box-shadow: 0 4px 0 var(--red-dark); transition: transform .08s ease;
}
.btn:hover { background: #d81b3a; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn.big { font-size: 1.15rem; padding: .85rem 1.8rem; }
.btn.small { font-size: .85rem; padding: .35rem .9rem; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--navy); border: 3px solid var(--navy); box-shadow: none; }
.btn.ghost:hover { background: #eef2fb; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.exam-box { background: #fff; border-radius: var(--radius); padding: 1rem 1.5rem 1.5rem; box-shadow: var(--shadow); text-align: center; border: 3px dashed var(--red); }
.history { list-style: none; padding: 0; display: grid; gap: .5rem; }
.history a { display: grid; grid-template-columns: 7rem 1fr auto; align-items: center; gap: .8rem; background: #fff; padding: .6rem 1rem; border-radius: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 560px) { .history a { grid-template-columns: 1fr; } }

progress { width: 100%; height: 14px; accent-color: var(--red); }
.table progress { width: 90px; vertical-align: middle; }

.grade { display: inline-block; font-weight: 800; border-radius: 10px; padding: .05rem .6rem; color: #fff; }
.g1 { background: #157347; } .g2 { background: #3a8f3f; } .g3 { background: #8a6d00; }
.g4 { background: #b45309; } .g5 { background: #c2410c; } .g6 { background: #b42318; }
.pill.grade { color: #fff; font-size: .8rem; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.table thead th { background: var(--navy); color: #fff; }

/* Klausur */
.exam .skill { margin-top: 2rem; }
.exam .skill > h2 { background: var(--navy); color: #fff; padding: .5rem 1rem; border-radius: 12px; font-size: 1.15rem; margin: 0 0 1rem; }
.passage { background: #fffdf3; border-left: 8px solid var(--sun); padding: .5rem 1.2rem; border-radius: 12px; margin: 1rem 0; box-shadow: var(--shadow); }
.passage h3 { margin: .4rem 0; }
.q { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: .8rem 1.1rem 1rem; margin: 0 0 1rem; }
.q legend { display: flex; gap: .6rem; align-items: baseline; padding: 0 .3rem; font-weight: 700; width: 100%; }
.q .num { background: var(--red); color: #fff; border-radius: 50%; min-width: 2rem; height: 2rem; display: inline-grid; place-items: center; font-size: .9rem; flex: none; }
.q .qtext { flex: 1; }
.pts { color: var(--muted); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.note { color: var(--muted); font-size: .85rem; margin: .2rem 0 .5rem; }
.opt { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .8rem; margin: .35rem 0; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.opt:hover { border-color: var(--blue); }
.opt input { margin-top: .35rem; width: 1.1rem; height: 1.1rem; accent-color: var(--red); }
.opt:has(input:checked) { border-color: var(--red); background: #fff1f3; }
.txt { width: 100%; font: inherit; padding: .6rem .8rem; border: 3px solid var(--line); border-radius: 12px; }
.txt:focus { border-color: var(--blue); outline: none; }
.submit-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: rgba(244, 247, 251, .96); padding: .8rem 1rem; border-top: 3px solid var(--navy); margin-top: 1.5rem; flex-wrap: wrap; }
#progress-text { font-weight: 700; }
#progress-text.warn { color: var(--bad); }

.order .answer-line, .puzzle-area .answer-line {
  min-height: 3.2rem; border: 3px dashed var(--line); border-radius: 12px; padding: .4rem; display: flex; flex-wrap: wrap; gap: .4rem; background: #f8fafe; margin-bottom: .6rem;
}
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { font: inherit; font-weight: 700; padding: .35rem .8rem; border: 2px solid var(--navy); background: #fff; color: var(--navy); border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.chip:hover { background: #eef2fb; }
.chip.used { visibility: hidden; }
.answer-line .chip { background: var(--sun); }

/* Ergebnis */
.result .big-grade { width: 9rem; height: 9rem; margin: 0 auto 1rem; border-radius: 50%; color: #fff; display: grid; place-content: center; box-shadow: var(--shadow); text-align: center; }
.big-grade .g { font-size: 4rem; font-weight: 800; line-height: 1; }
.big-grade .l { font-size: .95rem; font-weight: 700; }
.big-grade.g1 { background: #157347; } .big-grade.g2 { background: #3a8f3f; } .big-grade.g3 { background: #8a6d00; }
.big-grade.g4 { background: #b45309; } .big-grade.g5 { background: #c2410c; } .big-grade.g6 { background: #b42318; }
.score { font-size: 1.2rem; font-weight: 700; margin: 0; }
.skillbars { list-style: none; padding: 0; display: grid; gap: .6rem; }
.skillbars li { display: grid; grid-template-columns: 14rem 1fr 4rem; align-items: center; gap: .8rem; background: #fff; padding: .5rem 1rem; border-radius: 12px; }
@media (max-width: 640px) { .skillbars li { grid-template-columns: 1fr; } }
.review { list-style: none; padding: 0; display: grid; gap: .6rem; }
.review li { display: flex; gap: .8rem; padding: .7rem 1rem; border-radius: 12px; border-left: 8px solid; }
.review li.ok { background: var(--ok-bg); border-color: var(--ok); }
.review li.near { background: #fff6dd; border-color: #e0a800; }
.review li.bad { background: var(--bad-bg); border-color: var(--bad); }
.review p { margin: .15rem 0; }
.review .mark { font-size: 1.4rem; font-weight: 800; }
.review .alt { color: var(--muted); font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin: 2rem 0; align-items: center; }

/* Spiele */
.game-title { text-align: center; margin: .5rem 0; }
#game { max-width: 760px; margin: 0 auto; }
.panel { background: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: var(--shadow); margin: 1rem 0; }
.hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; font-weight: 800; margin-bottom: .6rem; }
.hud .hearts { letter-spacing: .1em; }
.bigword { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 800; text-align: center; color: var(--navy); margin: .6rem 0 1.2rem; overflow-wrap: anywhere; }
.dir { text-align: center; color: var(--muted); font-weight: 700; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr; } }
.choice { font: inherit; font-weight: 700; padding: .8rem 1rem; border: 3px solid var(--navy); border-radius: 14px; background: #fff; cursor: pointer; color: var(--ink); min-height: 3.4rem; }
.choice:hover:not([disabled]) { background: #eef2fb; }
.choice.right { background: var(--ok-bg); border-color: var(--ok); }
.choice.wrong { background: var(--bad-bg); border-color: var(--bad); }
.feedback { min-height: 2.2rem; font-weight: 800; text-align: center; margin: .8rem 0 0; }
.feedback.ok { color: var(--ok); } .feedback.bad { color: var(--bad); }
.endscreen { text-align: center; }
.endscreen .trophy { font-size: 4rem; }
.endscreen ul { list-style: none; padding: 0; }
.endscreen li { margin: .3rem 0; }
.wrong-list { text-align: left; background: #fff8e1; border-radius: 12px; padding: .6rem 1rem; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
@media (max-width: 480px) { .mem-grid { grid-template-columns: repeat(3, 1fr); } }
.mem-card { font: inherit; font-weight: 800; min-height: 5rem; border: 3px solid var(--navy); border-radius: 14px; background: var(--navy); color: transparent; cursor: pointer; padding: .3rem; overflow-wrap: anywhere; font-size: .9rem; position: relative; }
.mem-card::after { content: "❓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; color: #fff; }
.mem-card.open, .mem-card.done { background: #fff; color: var(--ink); }
.mem-card.open::after, .mem-card.done::after { content: ""; }
.mem-card.done { background: var(--ok-bg); border-color: var(--ok); cursor: default; }
.mem-card.en.open, .mem-card.en.done { border-bottom-color: var(--red); }
.map { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; margin: .5rem 0 1rem; }
.stop { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; background: #e6ebf5; font-size: 1.3rem; filter: grayscale(1); opacity: .6; }
.stop.done { background: var(--ok-bg); filter: none; opacity: 1; }
.stop.now { background: var(--sun); filter: none; opacity: 1; transform: scale(1.15); }
.stop.lost { background: var(--bad-bg); filter: none; opacity: 1; }
.place { text-align: center; font-weight: 800; color: var(--red); }
.sentence { font-size: 1.3rem; font-weight: 700; text-align: center; margin: .8rem 0; overflow-wrap: anywhere; }
.speak-row { display: flex; gap: .8rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.picker { display: grid; gap: .7rem; }
.readtext { background: #fffdf3; border-left: 8px solid var(--sun); padding: .3rem 1.1rem; border-radius: 12px; margin-bottom: 1rem; max-height: 16rem; overflow: auto; }
.tfrow { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.q, .opt, .txt { scroll-margin-bottom: 7rem; scroll-margin-top: 1rem; }
