* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1a2233;
  --muted: #5c6675;
  --primary: #2456c7;
  --primary-dark: #1a409a;
  --green: #1e8a4c;
  --green-bg: #e5f5ec;
  --red: #c93030;
  --red-bg: #fdeaea;
  --border: #dbe1ea;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  padding: 24px 16px;
}

#app {
  max-width: 760px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 2px 12px rgba(20, 30, 60, 0.08);
}

h1 {
  font-size: 1.7rem;
  margin-bottom: 6px;
}

h2 {
  font-size: 1.05rem;
  margin: 22px 0 10px;
  color: var(--text);
}

.subtitle {
  color: var(--muted);
  margin-bottom: 8px;
}

/* --- Startseite --- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.cat-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fafbfd;
}

.cat-check:hover {
  border-color: var(--primary);
}

.cat-check em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.85em;
}

.count-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.count-opt {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fafbfd;
}

.count-opt:hover {
  border-color: var(--primary);
}

.set-btn {
  background: #e8eefb;
  color: var(--primary);
  border: 1.5px solid #c3d2f0;
  font-weight: 700;
}

.set-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* --- Buttons --- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.secondary {
  background: #eef1f6;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: #e2e7ef;
}

.btn.danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #f0c4c4;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Quiz --- */
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.badge {
  background: #e8eefb;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.progress-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn-quit {
  border: 1px solid var(--border);
  background: #fafbfd;
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-quit:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

.question-text {
  font-size: 1.15rem;
  margin: 0 0 18px;
  line-height: 1.5;
}

.question-img {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  background: #fff;
}

.multi-hint {
  background: #fff8e1;
  border: 1px solid #f0e0a0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  text-align: left;
  font-size: 1rem;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fafbfd;
  cursor: pointer;
  line-height: 1.45;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-color 0.12s, background 0.12s;
}

.option:hover:not(:disabled) {
  border-color: var(--primary);
  background: #f0f4fc;
}

.option .letter {
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.option.correct {
  border-color: var(--green);
  background: var(--green-bg);
}

.option.correct .letter {
  color: var(--green);
}

.option.wrong {
  border-color: var(--red);
  background: var(--red-bg);
}

.option.wrong .letter {
  color: var(--red);
}

.option.selected {
  border-color: var(--primary);
  background: #e8eefb;
}

.option.selected .letter {
  color: var(--primary);
}

.option.muted {
  opacity: 0.55;
}

.option:disabled {
  cursor: default;
}

/* --- Feedback --- */
.feedback {
  margin-top: 18px;
  padding: 16px;
  border-radius: 10px;
  font-size: 0.97rem;
}

.feedback p {
  margin-top: 8px;
}

.fb-correct {
  background: var(--green-bg);
  border: 1px solid #bfe5cf;
}

.fb-correct strong {
  color: var(--green);
}

.fb-wrong {
  background: var(--red-bg);
  border: 1px solid #f0c4c4;
}

.fb-wrong strong {
  color: var(--red);
}

.merksatz {
  font-weight: 600;
  background: #fff8e1;
  border: 1px solid #f0e0a0;
  border-radius: 8px;
  padding: 10px 12px;
}

.explanation {
  white-space: pre-line;
  margin-top: 10px;
  font-size: 0.93rem;
  line-height: 1.5;
}

.q-ref {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.feedback + .btn {
  margin-top: 16px;
}

/* --- Auswertung --- */
.verdict {
  text-align: center;
  padding: 26px;
  border-radius: var(--radius);
  margin: 18px 0;
}

.verdict.pass {
  background: var(--green-bg);
  border: 1px solid #bfe5cf;
}

.verdict.fail {
  background: var(--red-bg);
  border: 1px solid #f0c4c4;
}

.big-pct {
  font-size: 3rem;
  font-weight: 800;
}

.verdict.pass .big-pct {
  color: var(--green);
}

.verdict.fail .big-pct {
  color: var(--red);
}

.verdict-text {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 4px;
}

.verdict-sub {
  color: var(--muted);
  margin-top: 6px;
}

.cat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.cat-table th,
.cat-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.cat-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.mini-bar {
  display: inline-block;
  width: 90px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}

.mini-bar.big {
  width: 100%;
  flex: 1;
}

.mini-fill {
  height: 100%;
  border-radius: 4px;
}

.mini-fill.ok {
  background: var(--green);
}

.mini-fill.bad {
  background: var(--red);
}

.tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
}

.tag.pass {
  background: var(--green-bg);
  color: var(--green);
}

.tag.fail {
  background: var(--red-bg);
  color: var(--red);
}

/* --- Statistik --- */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-label {
  width: 180px;
  flex-shrink: 0;
  font-size: 0.92rem;
}

.stat-val {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.88rem;
  color: var(--muted);
}

.attribution {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* --- Spickzettel --- */
.cheat-cat {
  margin-top: 26px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}

.cheat-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.5;
}

.cheat-lo {
  flex-shrink: 0;
  width: 74px;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.8rem;
  padding-top: 2px;
}

.cheat-text {
  flex: 1;
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }

  .card {
    box-shadow: none;
    padding: 0;
  }

  .no-print,
  .btn-row {
    display: none !important;
  }

  .cheat-cat {
    break-after: avoid;
  }

  .cheat-row {
    break-inside: avoid;
  }
}

@media (max-width: 560px) {
  .card {
    padding: 18px;
  }

  .stat-label {
    width: 120px;
  }
}
