:root {
  --bg: #f7f9ff;
  --bg2: #fdf7ff;
  --card: #ffffff;
  --card2: #eef4ff;
  --text: #1f2937;
  --text-muted: #e5e7eb;
  --muted: rgba(31, 41, 55, .65);
  --border: rgba(31, 41, 55, .12);

  --primary: #7dd3fc;
  --primary2: #a78bfa;

  --success: #34d399;
  --danger: #fb7185;

  --radius: 18px;
  --shadow: 0 12px 36px rgba(15, 23, 42, .14);
}

body.theme-dark {
  --bg: #0f172a;
  --bg2: #111827;
  --card: rgba(255, 255, 255, .04);
  --card2: rgba(255, 255, 255, .08);
  --text: #e5e7eb;
  --text-muted: #1f2937;
  --muted: rgba(229, 231, 235, .75);
  --border: rgba(255, 255, 255, .12);
  --primary: #7dd3fc;
  --primary2: #a78bfa;
  --shadow: 0 12px 36px rgba(0, 0, 0, .38);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
  color: var(--text);
  transition: background .25s ease, color .25s ease;
  background: radial-gradient(1400px 800px at 20% 20%, rgba(125, 211, 252, .25), transparent 60%),
    radial-gradient(1200px 900px at 80% 0%, rgba(167, 139, 250, .18), transparent 60%),
    linear-gradient(145deg, var(--bg), var(--bg2));
  background-attachment: fixed;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--border);
}

body.theme-dark .app-header {
  background: rgba(15, 23, 42, .82);
}

.app-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  max-width: 860px;
  margin: 0 auto;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #00121a;
  background: linear-gradient(145deg, var(--primary), var(--primary2));
}

.brand__title {
  font-weight: 800;
  line-height: 1.05;
}

.brand__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.container {
  max-width: 860px;
  padding: 18px 16px 44px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: fadeInUp 220ms ease;
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.input--search {
  flex: 1;
  min-width: 0;
}

.search-bar .btn {
  padding: 10px 12px;
  min-width: 44px;
}

.category-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}

.category-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.filter-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

.h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
  margin: 0 0 14px;
}

.form {
  display: grid;
  gap: 10px;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
  outline: none;
}

.input:focus {
  border-color: rgba(110, 231, 255, .6);
  box-shadow: 0 0 0 4px rgba(110, 231, 255, .12);
}

.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, .9);
  transition: transform .08s ease, background .12s ease, box-shadow .12s ease;
}

.btn:active {
  transform: scale(.99);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(110, 231, 255, .14);
}

.btn--primary {
  border: 0;
  color: #00121a;
  background: linear-gradient(145deg, var(--primary), var(--primary2));
}

.btn--secondary {
  background: rgba(255, 255, 255, .75);
}

.btn--ghost {
  background: transparent;
}

/* Dark Mode Buttons */
body.theme-dark .btn {
  background: rgba(255, 255, 255, .08);
}

body.theme-dark .btn--secondary {
  background: rgba(255, 255, 255, .12);
}

body.theme-dark .btn--ghost {
  background: transparent;
}

body.theme-dark .btn--primary {
  color: #0b1220;
  background: linear-gradient(145deg, var(--primary2), var(--primary));
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.category {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 12px;
  gap: 10px;
  transition: transform .08s ease, border-color .12s ease;
}

body.theme-dark .category {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.category:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.category:hover {
  border-color: rgba(110, 231, 255, .6);
  transform: translateY(-1px);
}

.category__name {
  text-align: left;
  font-weight: 800;
}

.category__hint {
  font-size: 12px;
  color: var(--muted);
  text-align: left;
}

body.theme-dark .category__hint {
  color: rgba(229, 231, 235, .75);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.state-box {
  padding: 14px;
  border-radius: 14px;
  border: 2px dashed var(--border);
  background: var(--bg);
  margin-top: 10px;
  color: var(--text);
}

.state-box__title {
  font-weight: 700;
  margin-bottom: 4px;
}

.state-box__actions {
  margin-top: 10px;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 14px 50px rgba(0, 0, 0, .4);
  backdrop-filter: blur(8px);
}

.toast:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ab ~600px etwas “desktopiger” */
@media (min-width: 600px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 18px;
  }
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.quiz-kicker {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.quiz-title {
  font-size: 18px;
  font-weight: 850;
  line-height: 1.25;
}

.quiz-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-loader[hidden] {
  display: none !important;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.options-mask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, .85);
}

.options-mask__hint {
  font-size: 13px;
  color: var(--muted);
}

.btn--reveal {
  width: 100%;
}

body.theme-dark .options-mask {
  background: rgba(255, 255, 255, .06);
}

.options-list {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

.options-list[hidden] {
  display: none;
}

.options-list--visible {
  animation: fadeInUp .16s ease;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.option-btn {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .9);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}

.option-btn:hover {
  border-color: rgba(110, 231, 255, .55);
  transform: translateY(-1px);
}

.option-btn:disabled {
  cursor: default;
  opacity: .95;
  transform: none;
}

.option-btn.option--selected {
  border-color: rgba(110, 231, 255, .9);
  box-shadow: 0 0 0 4px rgba(110, 231, 255, .10);
}

.option-btn.option--correct {
  border-color: rgba(52, 211, 153, .9);
  background: rgba(52, 211, 153, .12);
}

.option-btn.option--wrong {
  border-color: rgba(251, 113, 133, .9);
  background: rgba(251, 113, 133, .10);
}

body.theme-dark .option-btn {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

body.theme-dark .option-btn.option--correct {
  background: rgba(52, 211, 153, .12);
}

body.theme-dark .option-btn.option--wrong {
  background: rgba(251, 113, 133, .12);
}

.feedback {
  margin-top: 12px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  padding: 12px;
  background: rgba(0, 0, 0, .12);
}

.feedback--correct {
  border-color: rgba(52, 211, 153, .55);
}

.feedback--wrong {
  border-color: rgba(251, 113, 133, .55);
}

.feedback__headline {
  font-weight: 850;
  margin-bottom: 6px;
}

.feedback__details {
  color: var(--muted);
  font-size: 13px;
}

.explanation {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.explanation__title {
  font-weight: 850;
  margin-bottom: 6px;
}

.explanation__text {
  color: var(--text);
  opacity: .92;
  line-height: 1.35;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.hud__left {
  display: grid;
  gap: 8px;
}

.hud__right {
  display: grid;
  gap: 8px;
  justify-items: end;
}

/* Stats / Fortschritt */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .85);
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}

.chip--ok {
  border-color: rgba(52, 211, 153, .4);
  background: rgba(52, 211, 153, .14);
}

.chip--toggle {
  cursor: pointer;
}

.chip--toggle.is-active {
  border-color: rgba(110, 231, 255, .6);
  background: rgba(110, 231, 255, .12);
}

body.theme-dark .chip {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
  color: var(--text);
}

body.theme-dark .chip--ok {
  border-color: rgba(52, 211, 153, .4);
  background: rgba(52, 211, 153, .12);
}

body.theme-dark .chip--toggle.is-active {
  border-color: rgba(125, 211, 252, .5);
  background: rgba(125, 211, 252, .15);
}

.streak {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.progress {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, .18);
  margin: 8px 0 14px;
}

.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--primary), var(--primary2));
  transition: width .25s ease;
}

.site-footer {
  max-width: 860px;
  margin: 18px auto 40px;
  padding: 0 16px;
}

.footer-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .12);
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.footer-nav a:hover {
  color: var(--text);
  border-color: rgba(110, 231, 255, .35);
  background: rgba(110, 231, 255, .07);
}

.login-page .container {
  min-height: calc(100vh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
}

.login-page .card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.site-footer--login {
  margin-top: 14px;
}

.legal p {
  line-height: 1.45;
}

.legal a {
  color: var(--primary);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.check input {
  margin-top: 2px;
  accent-color: var(--primary);
}
