:root {
  --bg: #0b1020;
  --bg-soft: rgba(18, 24, 47, 0.84);
  --panel: rgba(14, 20, 39, 0.88);
  --card: rgba(18, 24, 47, 0.88);
  --card-2: rgba(24, 31, 58, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef3ff;
  --muted: #a8b4d8;
  --primary: #7c5cff;
  --primary-2: #9f8bff;
  --accent: #21d0b2;
  --warn: #ffb74d;
  --danger: #ff7c7c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --surface-1: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.06);
  --surface-3: rgba(255,255,255,0.08);
  --hero-sheen: linear-gradient(145deg, rgba(124, 92, 255, 0.2), rgba(255,255,255,0.04));
  --profile-sheen: linear-gradient(145deg, rgba(124, 92, 255, 0.22), rgba(255,255,255,0.04));
  --body-grad-1: rgba(124, 92, 255, 0.28);
  --body-grad-2: rgba(33, 208, 178, 0.14);
  --body-bg-start: #0b1020;
  --body-bg-end: #121830;
  --input-bg: rgba(255,255,255,0.04);
  --input-border: rgba(255,255,255,0.11);
  --placeholder: #8390b2;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, var(--body-grad-1), transparent 28%),
    radial-gradient(circle at right center, var(--body-grad-2), transparent 22%),
    linear-gradient(180deg, var(--body-bg-start) 0%, var(--body-bg-end) 100%);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

.bg-orb {
  position: fixed;
  inset: auto;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
}

.orb-1 { top: -8rem; left: -6rem; background: var(--primary); }
.orb-2 { bottom: -10rem; right: -5rem; background: var(--accent); }

.topbar,
.shell,
.footer-note {
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  padding: 2rem 0 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.25rem); }
h2 { font-size: clamp(1.45rem, 2vw, 2rem); }
h3 { font-size: 1.12rem; margin-bottom: 0; }

.session-badge {
  padding: 0.95rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--muted);
  font-size: 0.94rem;
}

.panel,
.card,
.hero-card,
.profile-card,
.stat-box,
.result-box {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel { border-radius: var(--radius-xl); padding: 1.2rem; }
.card,
.hero-card,
.profile-card,
.result-box {
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.compact-card { padding: 1rem; }

.auth-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.2rem;
}

.hero-card {
  min-height: 100%;
  background:
    var(--hero-sheen),
    var(--card);
}

.tag,
.pill,
.option-tag,
.badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.tag { background: rgba(33, 208, 178, 0.13); color: var(--accent); margin-bottom: 1rem; }
.pill { background: rgba(124, 92, 255, 0.15); color: #cbbfff; }
.badge { background: var(--surface-3); color: var(--muted); }
.score-pill { background: rgba(33, 208, 178, 0.12); color: var(--accent); }

.hero-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.hero-list li {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
}

.stack { display: grid; gap: 1rem; }
.stack-gap { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 0.95rem; margin-top: 0.8rem; }
label { display: grid; gap: 0.45rem; }
label span, .section-label { color: var(--muted); font-weight: 600; font-size: 0.92rem; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text);
  padding: 0.95rem 1rem;
  font: inherit;
  outline: none;
}

input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(159, 139, 255, 0.8);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
}

textarea { min-height: 180px; resize: vertical; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(33,208,178,0.92), rgba(55,231,206,0.76));
  color: #07241f;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-soft {
  background: var(--surface-2);
  color: var(--text);
}

.btn-block { width: 100%; }

.card-head, .card-head-wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.9rem;
}

.card-head-wrap { flex-wrap: wrap; }
.muted { color: var(--muted); line-height: 1.6; }
.inline-message {
  margin-top: 0.8rem;
  color: var(--muted);
  min-height: 1.2rem;
}

.result-box {
  margin-top: 1rem;
  background: rgba(33, 208, 178, 0.08);
}

.result-box strong {
  display: inline-block;
  min-width: 7.5rem;
  color: var(--accent);
}

.app-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.2rem;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.profile-card {
  background:
    var(--profile-sheen),
    var(--card-2);
}

.profile-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.profile-meta > div,
.topic-pill,
.transfer-answer,
.duel-item {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.profile-meta > div { padding: 0.85rem; }
.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-box {
  padding: 0.9rem;
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.stat-box strong { font-size: 1.1rem; }

.topic-overview {
  display: grid;
  gap: 0.55rem;
}

.topic-pill {
  padding: 0.85rem 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.content { min-height: 70vh; }

.tabbar {
  display: flex;
  gap: 0.7rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--muted);
  padding: 0.82rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.tab.active {
  background: linear-gradient(135deg, rgba(124,92,255,0.28), rgba(33,208,178,0.18));
  color: var(--text);
  border-color: rgba(124,92,255,0.45);
}

.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 1rem; }

.topic-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.topic-chip {
  position: relative;
}

.topic-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.topic-chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.topic-chip input:checked + span {
  background: rgba(124, 92, 255, 0.22);
  color: var(--text);
  border-color: rgba(124,92,255,0.55);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.segmented span {
  display: inline-block;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.segmented input:checked + span {
  background: rgba(33, 208, 178, 0.16);
  color: var(--text);
  border-color: rgba(33,208,178,0.4);
}

.question-head,
.transfer-head,
.duel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.question-prompt,
.transfer-prompt {
  font-size: 1.15rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.options-list {
  display: grid;
  gap: 0.8rem;
  margin: 1rem 0;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: start;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.option:hover { transform: translateY(-1px); }
.option input { width: auto; margin-top: 0.2rem; }
.option.correct {
  border-color: rgba(33,208,178,0.55);
  background: rgba(33,208,178,0.1);
}
.option.wrong {
  border-color: rgba(255,124,124,0.55);
  background: rgba(255,124,124,0.08);
}

.feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  line-height: 1.65;
}

.feedback.success { background: rgba(33,208,178,0.1); border: 1px solid rgba(33,208,178,0.3); }
.feedback.fail { background: rgba(255,124,124,0.08); border: 1px solid rgba(255,124,124,0.26); }

.row-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.transfer-checklist {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}

.transfer-answer {
  padding: 1rem;
  margin-top: 1rem;
}

.duel-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
}

.duel-list {
  display: grid;
  gap: 0.75rem;
}

.duel-item {
  padding: 0.9rem;
  display: grid;
  gap: 0.7rem;
}

.duel-item-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.duel-score {
  font-weight: 800;
  font-size: 1.05rem;
}

.duel-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.score-card {
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}

.score-card.active-turn {
  border-color: rgba(124,92,255,0.45);
  background: rgba(124,92,255,0.1);
}

.score-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.score-card strong { font-size: 1.3rem; }

.empty-state {
  color: var(--muted);
  padding: 0.5rem 0;
}

.footer-note {
  padding: 1rem 0 2rem;
  color: var(--muted);
}

.hidden { display: none !important; }

@media (max-width: 1080px) {
  .app-grid,
  .auth-grid,
  .duel-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar,
  .shell,
  .footer-note {
    width: min(100% - 1rem, 1280px);
  }

  .panel,
  .card,
  .hero-card,
  .profile-card,
  .result-box {
    border-radius: 20px;
  }

  .stats-grid,
  .profile-meta,
  .scoreboard {
    grid-template-columns: 1fr;
  }
}



.library-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.material-card {
  background: linear-gradient(180deg, rgba(18, 24, 47, 0.94), rgba(24, 31, 58, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.material-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.material-head h3 {
  margin: 0.45rem 0 0;
  font-size: 1.12rem;
}

.material-intro {
  margin: 0 0 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.material-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}

.focus-pill,
.mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(159, 139, 255, 0.28);
  color: var(--text);
  font-size: 0.88rem;
}

.module-list {
  display: grid;
  gap: 0.75rem;
}

.module-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.module-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  font-weight: 700;
}

.module-item summary::-webkit-details-marker {
  display: none;
}

.module-item p {
  margin: 0;
  padding: 0 1rem;
  color: var(--text);
  line-height: 1.6;
}

.module-item ul {
  margin: 0;
  padding: 0.75rem 1.2rem 1rem 2rem;
  color: var(--muted);
  line-height: 1.55;
}

.module-item li + li {
  margin-top: 0.4rem;
}

.source-block {
  margin-top: 0.95rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.source-label {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.source-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.source-list a:hover {
  text-decoration: underline;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
}

.search-field {
  flex: 1 1 18rem;
}

.material-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.muted-card {
  padding: 1.4rem;
  border-radius: var(--radius-lg);
}

.transfer-answer {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}

.transfer-answer p {
  margin: 0.55rem 0 0;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .material-head {
    flex-direction: column;
  }

  .filter-row {
    align-items: stretch;
  }
}


body[data-theme="light"] {
  --bg: #eef3fb;
  --bg-soft: rgba(255, 255, 255, 0.92);
  --panel: rgba(255, 255, 255, 0.92);
  --card: rgba(255, 255, 255, 0.92);
  --card-2: rgba(248, 250, 255, 0.96);
  --line: rgba(17, 28, 54, 0.12);
  --text: #11213d;
  --muted: #5d6d8b;
  --primary: #5c4fff;
  --primary-2: #867bff;
  --accent: #0f9f8a;
  --warn: #b97a18;
  --danger: #c55167;
  --shadow: 0 18px 46px rgba(31, 49, 88, 0.12);
  --surface-1: rgba(17, 28, 54, 0.045);
  --surface-2: rgba(17, 28, 54, 0.065);
  --surface-3: rgba(17, 28, 54, 0.1);
  --hero-sheen: linear-gradient(145deg, rgba(92, 79, 255, 0.12), rgba(15, 159, 138, 0.04));
  --profile-sheen: linear-gradient(145deg, rgba(92, 79, 255, 0.12), rgba(15, 159, 138, 0.04));
  --body-grad-1: rgba(92, 79, 255, 0.12);
  --body-grad-2: rgba(15, 159, 138, 0.08);
  --body-bg-start: #f7f9fe;
  --body-bg-end: #e6edf9;
  --input-bg: rgba(255,255,255,0.88);
  --input-border: rgba(17, 28, 54, 0.14);
  --placeholder: #7b88a2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle {
  min-width: 9.5rem;
}

.meta-pills {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.mini-badge,
.difficulty-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.mini-badge {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.difficulty-pill {
  border: 1px solid var(--line);
}

.difficulty-basis {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.difficulty-mittel {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary-2);
}

.difficulty-schwer {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
}

@media (max-width: 760px) {
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .theme-toggle {
    min-width: 0;
  }
}
