/* ============================================================
   Daten & Statistik — Klausur-Lösungen | Styles
   ============================================================ */

/* ---------- Theme Variables ---------- */
:root {
  --bg: #0c0f0e;
  --panel: #141917;
  --panel-raise: #1a201d;
  --acc: #54e08a;
  --amber: #f0b54a;
  --bad: #f0715a;
  --ink: #dce5df;
  --muted: #8a968f;
  --border: rgba(255,255,255,0.07);
  --shadow: 0 4px 24px rgba(0,0,0,0.45);
  --radius: 12px;
}

[data-theme="light"] {
  --bg: #f1efe7;
  --panel: #ffffff;
  --panel-raise: #f6f4ec;
  --acc: #157a43;
  --amber: #9a6a12;
  --bad: #c0432c;
  --ink: #1e2622;
  --muted: #5b6660;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.12);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

/* ---------- Millimeter-Paper Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(84,224,138,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84,224,138,0.028) 1px, transparent 1px);
  background-size: 28px 28px;
}

[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(21,122,67,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21,122,67,0.05) 1px, transparent 1px);
}

/* Radial glow */
body::after {
  content: '';
  position: fixed;
  top: -20vh;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 60vh;
  background: radial-gradient(ellipse at center, rgba(84,224,138,0.04) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Layout Wrapper ---------- */
#app {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2.6rem);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 15, 14, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s;
}

[data-theme="light"] .topbar {
  background: rgba(241, 239, 231, 0.88);
}

.topbar .container {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(0.78rem, 2vw, 1rem);
  font-weight: 600;
  color: var(--acc);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  background: var(--panel-raise);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}

.theme-btn:hover {
  background: var(--acc);
  color: #0c0f0e;
  border-color: var(--acc);
}

/* ---------- Hero / Intro ---------- */
.hero {
  padding: 2.8rem 0 1.8rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--acc);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
  letter-spacing: 0.04em;
}

.hero-body {
  max-width: 680px;
  margin: 0 auto;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.75;
}

.ki-badge {
  display: inline-block;
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  padding: 0.1rem 0.45rem;
  color: var(--amber);
  margin: 0 0.15rem;
}

/* ---------- Jump Navigation ---------- */
.jump-nav {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem 1.4rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.jump-nav h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}

.jump-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.jump-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
  background: var(--panel-raise);
  color: var(--muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.jump-chip:hover,
.jump-chip.active {
  background: var(--acc);
  color: #0c0f0e;
  border-color: var(--acc);
}

/* ---------- Question Cards ---------- */
.question-section {
  margin-bottom: 2.8rem;
  scroll-margin-top: 70px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background: var(--panel-raise);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.frage-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--acc);
  color: #0c0f0e;
  padding: 0.18rem 0.6rem;
  border-radius: 6px;
}

.card-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}

.card-body {
  padding: 1.4rem;
}

/* Screenshot thumbnail */
.screenshot-wrap {
  margin-bottom: 1.4rem;
}

.screenshot-toggle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: color 0.15s, border-color 0.15s;
}

.screenshot-toggle:hover { color: var(--acc); border-color: var(--acc); }

.screenshot-img-wrap {
  display: none;
}

.screenshot-img-wrap.open {
  display: block;
}

.screenshot-img-wrap a { display: block; }

.screenshot-img-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

/* Frage text block */
.frage-text {
  background: var(--panel-raise);
  border-left: 3px solid var(--acc);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1rem;
  margin-bottom: 1.4rem;
  font-style: italic;
  color: var(--ink);
  font-size: 0.97rem;
}

/* Option list */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.option-item {
  border-radius: 8px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
}

.option-item.correct {
  background: rgba(84,224,138,0.07);
  border-color: rgba(84,224,138,0.3);
}

.option-item.wrong {
  background: rgba(240,113,90,0.06);
  border-color: rgba(240,113,90,0.2);
  opacity: 0.85;
}

.option-item.conditional {
  background: rgba(240,181,74,0.07);
  border-color: rgba(240,181,74,0.3);
}

.option-item.trivial {
  background: rgba(84,224,138,0.04);
  border-color: rgba(84,224,138,0.2);
  opacity: 0.9;
}

.option-marker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  padding-top: 0.05rem;
  user-select: none;
}

.option-item.correct .option-marker { color: var(--acc); }
.option-item.wrong .option-marker { color: var(--bad); }
.option-item.conditional .option-marker { color: var(--amber); }
.option-item.trivial .option-marker { color: var(--acc); }

.option-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.option-text {
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  font-style: italic;
}

.option-reason {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.option-item.correct .option-reason { color: var(--ink); }

/* Result summary */
.result-summary {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--acc);
  margin-bottom: 1.4rem;
  letter-spacing: 0.03em;
}

/* Section headings within card */
.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  margin-top: 1.4rem;
}

.section-label:first-of-type { margin-top: 0; }

/* Explanation / prose */
.explanation {
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}

/* Callout boxes */
.callout {
  border-radius: 8px;
  padding: 0.9rem 1rem 0.9rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  line-height: 1.65;
  border-left: 4px solid;
}

.callout-tip {
  background: rgba(84,224,138,0.07);
  border-color: var(--acc);
  color: var(--ink);
}

.callout-warn {
  background: rgba(240,181,74,0.08);
  border-color: var(--amber);
  color: var(--ink);
}

.callout-info {
  background: rgba(138,150,143,0.10);
  border-color: var(--muted);
  color: var(--ink);
}

.callout-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.callout-tip .callout-title { color: var(--acc); }
.callout-warn .callout-title { color: var(--amber); }
.callout-info .callout-title { color: var(--muted); }

/* Math / Formula blocks */
.formula-block {
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  text-align: center;
  font-size: 1.05rem;
}

/* Table for assignments */
.assign-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.93rem;
}

.assign-table th,
.assign-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.assign-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-raise);
}

.assign-table td:first-child {
  width: 45%;
  color: var(--ink);
}

.assign-table td:last-child {
  font-weight: 600;
  color: var(--acc);
}

.assign-table tr:last-child td { border-bottom: none; }

/* SVG Graphics */
.svg-wrap {
  margin: 1.2rem 0;
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  overflow: hidden;
}

.svg-caption {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.svg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

@media (max-width: 640px) {
  .svg-row { grid-template-columns: 1fr; }
}

/* Zuordnung result items */
.zuord-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.zuord-item {
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.zuord-scenario {
  font-size: 0.93rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  font-style: italic;
}

.zuord-answer {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--acc);
}

.zuord-arrow {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  margin: 0 0.3rem;
}

/* Notebook section */
.notebook-section {
  margin-bottom: 2.8rem;
  scroll-margin-top: 70px;
}

.code-preview {
  background: #0a0d0b;
  border: 1px solid rgba(84,224,138,0.2);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: #a8d5b8;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.65;
}

[data-theme="light"] .code-preview {
  background: #f0f0e8;
  color: #2a5c3a;
  border-color: rgba(21,122,67,0.2);
}

.code-preview .comment { color: var(--muted); }
.code-preview .kw { color: var(--acc); }
.code-preview .str { color: var(--amber); }
.code-preview .num { color: #a0c8f0; }

[data-theme="light"] .code-preview .num { color: #2255aa; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 1rem;
}

.footer p {
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer strong { color: var(--amber); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .card-body { padding: 1rem; }
  .formula-block { font-size: 0.9rem; }
  .topbar-title { font-size: 0.7rem; }
}

/* ---------- KaTeX overrides ---------- */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}

.katex { color: inherit; }
