:root {
  /* Game Bro: Charcoal + Electric Blue + Hot Orange */
  --primary: #3b82f6;          /* Blue-500 – primary buttons, links, focus */
  --primary-dark: #2563eb;     /* Blue-600 */
  --primary-soft: rgba(59, 130, 246, 0.10);
  --highlight: #f97316;        /* Orange-500 – streaks, accents, second gradient stop */
  --highlight-soft: rgba(249, 115, 22, 0.10);
  --pink: var(--highlight);    /* legacy alias */
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --orange: #fb923c;
  --green: #22c55e;
  --red: #ef4444;
  --correct: #22c55e;
  --wrong: #ef4444;
  --dark: #18181b;             /* Zinc-900 – brand surface */
  --dark-soft: #27272a;
  --bg: #fafafa;               /* Zinc-50 – page background */
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: rgba(24, 24, 27, 0.10);
  --border-strong: rgba(24, 24, 27, 0.18);
  --text: #18181b;             /* Zinc-900 */
  --text-muted: #71717a;       /* Zinc-500 */
  --shadow-sm: 0 2px 6px rgba(24, 24, 27, 0.06);
  --shadow: 0 8px 24px rgba(24, 24, 27, 0.08);
  --shadow-lg: 0 18px 48px rgba(24, 24, 27, 0.14);
  --shadow-blue: 0 10px 28px rgba(59, 130, 246, 0.30);
  --shadow-orange: 0 10px 28px rgba(249, 115, 22, 0.30);
  --accent: var(--highlight);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(59, 130, 246, 0.10) 0%, transparent 60%),
    radial-gradient(700px 400px at 95% 110%, rgba(249, 115, 22, 0.08) 0%, transparent 60%),
    var(--bg);
}

::selection {
  background: var(--primary);
  color: white;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(250, 250, 250, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.brand:hover { opacity: 0.85; }

.logo-badge {
  display: inline-flex;
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 6px 14px rgba(59, 130, 246, 0.25));
}

.logo-badge svg { display: block; }

.logo-badge-big {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(59, 130, 246, 0.35));
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--primary) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.brand h1 .bro {
  /* inherits the gradient – just to allow future override */
}

.brand .subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav {
  display: flex;
  gap: 6px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-weight: 600;
}

.nav-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

/* Profil-Chip */
.profile-area {
  position: relative;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.profile-chip:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18);
}

.profile-chip .profile-icon { font-size: 18px; }
.profile-chip .caret { color: var(--text-muted); font-size: 12px; }

.profile-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 30;
}

.profile-panel h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.profile-panel ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  max-height: 220px;
  overflow-y: auto;
}

.profile-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 15px;
  font-weight: 500;
}

.profile-panel li:hover {
  background: var(--primary-soft);
}

.profile-panel li.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.profile-panel li .delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.profile-panel li .delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--wrong);
}

#profile-add-form {
  display: flex;
  gap: 6px;
}

#profile-add-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: white;
}

#profile-add-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-size: 30px;
  margin: 0 0 6px;
  letter-spacing: -0.6px;
  font-weight: 800;
}

h3 {
  font-size: 17px;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 14px;
}

.section-icon {
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--primary-soft);
  border-radius: 12px;
}

.greeting {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--primary-soft);
  border-radius: 999px;
}

.greeting.hidden { display: none; }

.hint {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 15px;
}

/* Fach-Tabs */
.subject-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 24px;
  padding: 5px;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.subject-tab {
  background: transparent;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.subject-tab .subj-icon { font-size: 20px; }

.subject-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

.subject-tab:not(.active):hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Themenauswahl */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.topic-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 26px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  font-family: inherit;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topic-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
  opacity: 0;
  z-index: 0;
  transition: opacity 0.2s ease;
}

.topic-card > * { position: relative; z-index: 1; }

.topic-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 18px 40px rgba(59, 130, 246, 0.22);
}

.topic-card.mixed {
  background: linear-gradient(135deg, #fff4dc 0%, #ffd9b8 100%);
  border-color: var(--amber);
}

.topic-card.mixed:hover {
  border-color: var(--orange);
}

.topic-icon {
  font-size: 46px;
  margin-bottom: 4px;
}

.topic-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.topic-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Praxis-Ansicht */
.practice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.practice-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.practice-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb .subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 5px 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.breadcrumb .sep {
  color: var(--text-muted);
}

.breadcrumb .topic-name {
  color: var(--text);
  font-weight: 700;
}

.ghost-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.ghost-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.score {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.score #score-correct {
  color: var(--correct);
  font-weight: 800;
}

.problem-container {
  background: var(--bg-card);
  border-radius: 22px;
  padding: 40px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Schriftliche Rechnung */
.written-calc {
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 48px;
  letter-spacing: 8px;
  line-height: 1.2;
  text-align: right;
  font-weight: 500;
}

.written-calc .row {
  display: block;
}

.written-calc .op-row {
  border-bottom: 3px solid var(--text);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.written-calc .op {
  color: var(--primary);
  display: inline-block;
  width: 1ch;
  margin-right: 0.4ch;
}

/* Stepwise */
.written-step {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-row .lbl {
  width: 28px;
  text-align: right;
  font-size: 18px;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

.step-row .lbl.op {
  font-size: 40px;
  color: var(--primary);
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}

.step-row .digit-cell {
  width: 54px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 44px;
  color: var(--text);
}

.step-row.op-row .digit-cell {
  border-bottom: 3px solid var(--text);
  padding-bottom: 6px;
}

.step-row .carry-cell {
  width: 54px;
  height: 30px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 20px;
  text-align: center;
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.step-row .carry-cell:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--primary-soft);
}

.step-row .answer-cell {
  width: 54px;
  height: 60px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 40px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  padding: 0;
  transition: all 0.12s ease;
}

.step-row .answer-cell:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.step-row .answer-cell.correct {
  border-color: var(--correct);
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
}

.step-row .answer-cell.wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

/* Inline-Rechnung */
.inline-calc {
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 56px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 2px;
}

.inline-calc .equals {
  color: var(--primary);
  margin: 0 10px;
}

/* Sachrechnen */
.word-problem {
  font-size: 22px;
  line-height: 1.55;
  text-align: center;
  max-width: 640px;
  color: var(--text);
}

.word-problem .question {
  margin-top: 16px;
  font-weight: 700;
  color: var(--primary);
}

.word-problem .unit-hint {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Musik */
.music-problem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 640px;
}

.music-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  color: var(--text);
}

.music-visual svg { max-height: 180px; }

.music-text {
  font-size: 22px;
  text-align: center;
  color: var(--text);
  line-height: 1.45;
}

.note-anatomy .hl-part {
  fill: var(--pink);
  stroke: var(--pink);
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}

.choice-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.choice-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice-btn.correct {
  border-color: var(--correct);
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
}

.choice-btn.wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

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

/* Antwortbereich */
.answer-area {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

#answer-input {
  flex: 1;
  min-width: 200px;
  font-size: 28px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text);
  text-align: center;
  transition: all 0.15s ease;
}

#answer-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  min-width: 140px;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.40);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn.small {
  padding: 9px 16px;
  font-size: 13.5px;
  min-width: auto;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.28);
}

.primary-btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.32);
}

.primary-btn.danger:hover {
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.40);
}

.hidden {
  display: none !important;
}

.feedback {
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  min-height: 28px;
}

.feedback.correct {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.feedback.wrong {
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.feedback .explain {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 400;
}

/* Walkthrough */
.walkthrough {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 22px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.walkthrough h4 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.walkthrough ol {
  margin: 0;
  padding-left: 22px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}

.walkthrough li {
  margin-bottom: 8px;
}

.walkthrough li:last-child { margin-bottom: 0; }

.walkthrough .hl {
  background: rgba(245, 158, 11, 0.30);
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 800;
  color: #92400e;
}

.walkthrough .place {
  color: var(--primary);
  font-weight: 700;
}

/* Statistik – Kopf, Karten, Tabellen */
.stats-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.stats-head h2 { margin: 0; }

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card .value {
  font-size: 34px;
  font-weight: 900;
  background: linear-gradient(120deg, var(--primary) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

/* Charts */
.chart-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 22px 22px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Themen-Tabelle mit Note */
.stats-table {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stats-table .row {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.8fr 1fr 60px;
  padding: 14px 22px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.stats-table .row:last-child { border-bottom: none; }

.stats-table .row.header {
  background: var(--bg);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 16px;
  color: white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.grade-1 { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.grade-2 { background: linear-gradient(135deg, #34d399 0%, #10b981 100%); }
.grade-3 { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); }
.grade-4 { background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); }
.grade-5 { background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); }
.grade-6 { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }

/* Letzte Aufgaben */
.stats-recent {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 4px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: 360px;
  overflow-y: auto;
}

.stats-recent .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 14px;
}

.stats-recent .item:last-child { border-bottom: none; }

.stats-recent .problem {
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-recent .result {
  font-weight: 700;
  white-space: nowrap;
  font-size: 13px;
}

.stats-recent .result.correct { color: var(--correct); }
.stats-recent .result.wrong { color: var(--wrong); }

.stats-actions {
  margin-top: 24px;
  text-align: right;
}

/* Empty States – cool, nicht langweilig */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 24px;
  background: var(--bg-card);
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  color: var(--text-muted);
}

.empty-state .emoji {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.2));
}

.empty-state .title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.empty-state .msg {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  max-width: 360px;
  line-height: 1.5;
}

.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary);
  z-index: 100;
  font-weight: 600;
}

.loading.hidden { display: none; }

/* Migration-Overlay (auf noah.mallek.de) */
.migration-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.20) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.migration-card {
  background: var(--bg-card);
  border-radius: 26px;
  padding: 48px 36px 36px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.30);
}

.migration-card .big-emoji {
  font-size: 84px;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 22px rgba(59, 130, 246, 0.35));
}

.migration-card h2 {
  margin: 0 0 10px;
  background: linear-gradient(120deg, var(--primary) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.migration-card p {
  margin: 0 0 26px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.migration-card code {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 14px;
  font-weight: 700;
}

.migration-card strong { color: var(--primary); font-weight: 700; }

.migration-actions {
  margin-bottom: 16px;
}

.migration-actions .primary-btn {
  font-size: 17px;
  padding: 16px 28px;
  width: 100%;
}

.ghost-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
}

.ghost-link:hover {
  color: var(--primary);
}

/* Welcome-Overlay */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.welcome-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.30);
  border: 1px solid var(--border);
}

.welcome-card .monster-big {
  font-size: 72px;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 20px rgba(59, 130, 246, 0.30));
}

.welcome-card h2 {
  margin: 0 0 8px;
  background: linear-gradient(120deg, var(--primary) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-card p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

#welcome-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#welcome-form input {
  font-size: 20px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  text-align: center;
  color: var(--text);
  background: white;
}

#welcome-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px 30px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.30);
  border: 1px solid var(--border);
}

.modal-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 800;
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.modal-card .hint-small {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.share-url-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-url-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 12px;
  color: var(--text);
}

.share-url-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.share-url-row button { white-space: nowrap; }

/* Share-Banner */
.share-banner {
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  border: 1px solid #d8b4fe;
  border-radius: 16px;
  padding: 16px 22px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}

.share-banner strong { color: var(--primary); }
.share-banner #share-meta { color: var(--text-muted); }

@media (max-width: 700px) {
  .topbar { padding: 12px 16px; }
  .brand h1 { font-size: 22px; }
  .brand .monster { font-size: 30px; }
  main { padding: 22px 16px 60px; }
  h2 { font-size: 24px; }
  .written-calc { font-size: 36px; letter-spacing: 6px; }
  .inline-calc { font-size: 36px; }
  .word-problem { font-size: 17px; }
  .problem-container { padding: 24px 18px; }
  .stats-table .row { grid-template-columns: 1.4fr 0.7fr 1fr 50px; padding: 12px 14px; }
  .stats-table .row .col-richtig { display: none; }
  .step-row .digit-cell { width: 42px; height: 48px; font-size: 32px; }
  .step-row .carry-cell { width: 42px; height: 24px; font-size: 15px; }
  .step-row .answer-cell { width: 42px; height: 48px; font-size: 30px; }
  .step-row .lbl { width: 20px; font-size: 15px; }
  .step-row .lbl.op { font-size: 28px; }
  .section-head { margin: 24px 0 12px; }
}
