:root {
  --bg: #e8eef2;
  --bg-panel: #f7fafc;
  --bg-code: #1c2430;
  --ink: #14202b;
  --ink-soft: #4a5d6e;
  --line: #c5d2dc;
  --accent: #0b6e4f;
  --accent-hover: #095a41;
  --accent-soft: #d4efe6;
  --highlight: #ffe08a;
  --highlight-border: #e0b84a;
  --mysql-header: #2c3e50;
  --radius: 10px;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", "Menlo", monospace;
  --shadow: 0 1px 0 rgba(20, 32, 43, 0.06), 0 8px 24px rgba(20, 32, 43, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9e8f0 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #d7ebe3 0%, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

body.page-home {
  overflow: auto;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  min-width: 48px;
  margin: 0 0 8px;
  padding: 10px 16px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.brand-home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e4edf3;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-home-label {
  padding-right: 2px;
}

.brand-home:hover,
.brand-home:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.brand-home:hover .brand-home-icon,
.brand-home:focus-visible .brand-home-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-home:active {
  transform: scale(0.98);
  background: #f3f7fa;
}

/* ── Startseite ─────────────────────────────────────────────────────── */

.home {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px) 20px 48px;
}

.home-hero {
  margin-bottom: clamp(28px, 5vw, 44px);
}

.home-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-title {
  margin: 0 0 12px;
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.home-lead {
  margin: 0;
  max-width: 36ch;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.home-modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  min-height: 220px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.module-card:hover {
  border-color: #9aafbf;
  transform: translateY(-2px);
}

.module-card-accent {
  background: linear-gradient(165deg, #f7fafc 0%, #e8f4ef 100%);
}

.module-card-wide {
  grid-column: 1 / -1;
  min-height: 200px;
}

.home-title-chapter {
  font-size: clamp(1.85rem, 4.5vw, 2.75rem);
  max-width: 16ch;
  line-height: 1.05;
}

.home-hero .brand-home {
  margin-bottom: 16px;
}

.module-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.module-card h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.module-card p {
  margin: 0;
  flex: 1;
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 0.98rem;
}

.module-card code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #e4edf3;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
}

.module-cta {
  margin-top: 8px;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.module-progress {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-progress-meta {
  display: flex;
  justify-content: flex-end;
}

.module-progress-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.module-progress-track {
  height: 6px;
  background: #cfdbe4;
  border-radius: 999px;
  overflow: hidden;
}

.module-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.25s ease;
}

@media (max-width: 700px) {
  .home-modules {
    grid-template-columns: 1fr;
  }
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 20px;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

#step-label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: #cfdbe4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-task {
  padding: 22px 22px 18px;
  overflow: auto;
}

.panel-output {
  padding: 0;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.task-title {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.task-body {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.98rem;
  max-width: 46ch;
}

.task-body strong {
  color: var(--ink);
  font-weight: 600;
}

.task-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #e4edf3;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
}

.code-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #121820;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #121820;
  color: #9eb0c0;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.code-hint {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-code);
  color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.code-block .tok-kw { color: #7dd3c0; }
.code-block .tok-str { color: #f0c674; }
.code-block .tok-num { color: #b8d4ff; }
.code-block .tok-cmt { color: #7a8a9a; font-style: italic; }
.code-block .tok-idx { color: #ffb86c; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 48px;
  padding: 12px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.btn:not(:disabled):active {
  transform: scale(0.98);
}

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

.btn-primary:not(:disabled):hover {
  background: var(--accent-hover);
}

.btn-primary.done {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #9fd0bc;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:not(:disabled):hover {
  border-color: #9aafbf;
  background: #f0f5f8;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:not(:disabled):hover {
  color: var(--ink);
  background: #f0f5f8;
  border-color: #9aafbf;
}

.output-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.output-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.output-badge {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

.output-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(180deg, #fbfcfd 0%, #f3f7fa 100%);
}

.output-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 220px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.output-empty p {
  margin: 0 0 8px;
}

.muted {
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

.quiz {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}

.quiz-prompt {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

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

.quiz-option {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: #9aafbf;
  background: #f4f8fb;
}

.quiz-option.is-selected:not(.is-correct):not(.is-wrong) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.quiz-option.is-correct {
  border-color: var(--accent);
  background: #e6f6ef;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.quiz-option.is-wrong {
  border-color: #c45c5c;
  background: #fceeee;
  box-shadow: inset 0 0 0 1px #c45c5c;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-letter {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e4edf3;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.quiz-option.is-selected .quiz-letter,
.quiz-option.is-correct .quiz-letter {
  background: var(--accent);
  color: #fff;
}

.quiz-option.is-wrong .quiz-letter {
  background: #c45c5c;
  color: #fff;
}

.quiz-label {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.quiz-feedback {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.quiz-feedback.is-ok {
  background: #e6f6ef;
  color: var(--accent);
}

.quiz-feedback.is-fail {
  background: #fceeee;
  color: #9a3333;
}

.output-result {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.result-caption {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid #9aafbf;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #d5e0e8;
  white-space: nowrap;
}

.data-table th {
  background: var(--mysql-header);
  color: #f0f4f8;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: none;
}

.data-table tbody tr:nth-child(even) {
  background: #f4f8fb;
}

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

.data-table .col-index {
  color: var(--ink-soft);
  width: 1%;
  font-weight: 500;
}

.data-table td.cell-highlight {
  background: var(--highlight);
  box-shadow: inset 0 0 0 1px var(--highlight-border);
  font-weight: 700;
  color: var(--ink);
}

.data-table tr.row-highlight td {
  background: #fff6d6;
}

.data-table tr.row-highlight td.cell-highlight {
  background: var(--highlight);
}

.result-note {
  margin: 14px 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
  max-width: 48ch;
}

.result-note:empty {
  display: none;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100%;
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(280px, 45vh);
  }

  .panel-task {
    overflow: visible;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .progress {
    width: 100%;
  }
}

@media (orientation: landscape) and (min-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }
}

/* ── Sortieren / Drag & Drop ────────────────────────────────────────── */

body.page-sort {
  overflow: hidden;
}

.workspace-sort {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
}

.sort-actions-top {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.panel-sort-build {
  overflow: auto;
}

.sort-build {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 4px;
  min-height: 280px;
}

.sort-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f5f8;
  overflow: hidden;
}

.sort-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #e4edf3;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sort-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.8;
}

.block-palette,
.block-program {
  flex: 1;
  min-height: 220px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.block-palette.is-drop-target,
.block-program.is-drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.block-empty {
  margin: auto;
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
  padding: 16px;
}

.code-block-chip {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-left: calc(var(--indent, 0) * 14px);
  width: calc(100% - var(--indent, 0) * 14px);
  text-align: left;
  border: 1px solid #2a3544;
  border-radius: 8px;
  background: var(--bg-code);
  color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 10px 12px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.code-block-chip-lg {
  padding: 14px 14px 12px;
  border-radius: 10px;
  gap: 12px;
}

.chip-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.chip-title {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7dd3c0;
}

.chip-code {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip-line {
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #e8eef4;
}

.code-block-chip:active,
.code-block-chip.is-dragging {
  cursor: grabbing;
  opacity: 0.45;
}

.chip-grip {
  flex-shrink: 0;
  width: 10px;
  height: 18px;
  margin-top: 4px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      to bottom,
      #7a8a9a 0 2px,
      transparent 2px 4px
    );
  opacity: 0.7;
}

.chip-text {
  min-width: 0;
}

.chip-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.95;
  margin-left: 0 !important;
  width: auto !important;
  box-shadow: 0 12px 28px rgba(20, 32, 43, 0.28);
  transform: scale(1.02);
}

.sort-output {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sort-feedback {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sort-feedback.is-ok {
  padding: 10px 12px;
  border-radius: 8px;
  background: #e6f6ef;
  color: var(--accent);
  font-weight: 600;
}

.sort-feedback.is-fail {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fceeee;
  color: #9a3333;
  font-weight: 600;
}

.array-viz {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.array-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 52px;
  padding: 10px 8px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #9aafbf;
  font-family: var(--font-mono);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.array-cell.is-hot {
  background: var(--highlight);
  border-color: var(--highlight-border);
  transform: translateY(-3px);
}

.array-idx {
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.array-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 900px) {
  body.page-sort {
    overflow: auto;
  }

  .workspace-sort {
    grid-template-columns: 1fr;
  }

  .sort-build {
    grid-template-columns: 1fr;
  }

  .sort-actions-top {
    width: 100%;
  }

  .sort-actions-top .btn {
    flex: 1;
  }
}

/* ── MySQL Blitz ────────────────────────────────────────────────────── */

body.page-mysql {
  overflow: hidden;
}

.workspace-mysql {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.mysql-help {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #eef4f8;
  border: 1px solid var(--line);
}

.mysql-help-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mysql-help ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.mysql-help code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--ink);
}

.mysql-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mysql-input-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mysql-input-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mysql-input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid #2a3544;
  border-radius: 10px;
  background: var(--bg-code);
  color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 14px 16px;
  -webkit-tap-highlight-color: transparent;
}

.mysql-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.mysql-result {
  min-height: 120px;
}

.panel-mysql .btn-primary {
  min-height: 48px;
  width: 100%;
}

@media (max-width: 900px) {
  body.page-mysql {
    overflow: auto;
  }

  .workspace-mysql {
    grid-template-columns: 1fr;
  }
}

/* ── Variablen ──────────────────────────────────────────────────────── */

body.page-var {
  overflow: hidden;
}

.workspace-var {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.py-editor {
  display: block;
  width: 100%;
  min-height: 180px;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  resize: vertical;
  appearance: none;
  background: var(--bg-code);
  color: #e8eef4;
  caret-color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.55;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}

.py-editor::placeholder {
  color: #7a8a9a;
}

.py-editor:focus {
  outline: none;
}

.var-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.py-console {
  margin: 0;
  min-height: 140px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--bg-code);
  color: #e8eef4;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.py-console:empty::before {
  content: ">>> ";
  color: #7a8a9a;
}

.var-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.given-block {
  display: block;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef4f8;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

.var-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 140px;
  max-width: 280px;
  border: 1px solid var(--highlight-border);
  border-radius: 10px;
  background: var(--highlight);
  overflow: hidden;
}

.var-box.hidden {
  display: none;
}

.var-box-label {
  padding: 8px 12px;
  background: #f3d56a;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.var-box-value {
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff8d6;
}

.panel-var .sort-feedback code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

@media (max-width: 900px) {
  body.page-var {
    overflow: auto;
  }

  .workspace-var {
    grid-template-columns: 1fr;
  }
}

/* ── Tag 1 · Binärzahlen ────────────────────────────────────────────── */

body.page-binaer {
  overflow: auto;
  height: auto;
}

.page-binaer .app {
  height: auto;
  min-height: 100%;
}

.bin-stage {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.bin-quote {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 600;
  text-align: center;
}

.bin-source {
  margin: 0 0 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.bin-lesson p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.bin-places,
.bin-candles,
.bin-bits {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.bin-places {
  gap: 8px;
  margin: 18px 0 22px;
}

.bin-place {
  min-width: 52px;
  text-align: center;
  font-family: var(--font-mono);
}

.bin-place-val {
  padding: 8px 6px;
  border: 1px solid var(--highlight-border);
  border-radius: 8px;
  background: var(--highlight);
  font-weight: 700;
}

.bin-place-lab {
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.bin-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.bin-kicker {
  margin: 0 0 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.bin-target {
  margin: 0 0 18px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.bin-candles {
  gap: 12px;
  margin: 8px 0;
}

.bin-candle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bin-candle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

.bin-flame {
  width: 16px;
  height: 22px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bin-candle.is-lit .bin-flame {
  opacity: 1;
  transform: scale(1);
}

.bin-wick {
  width: 3px;
  height: 6px;
  background: #3a3226;
}

.bin-wax {
  width: 22px;
  height: 58px;
  border-radius: 3px 3px 4px 4px;
  background: linear-gradient(180deg, #d5dde4, #b7c3cd);
  box-shadow: inset -3px 0 5px rgba(0, 0, 0, 0.12);
}

.bin-candle.is-lit .bin-wax {
  background: linear-gradient(180deg, #fff2c9, #ffe08a);
  box-shadow: inset -3px 0 5px rgba(0, 0, 0, 0.08), 0 0 16px rgba(224, 184, 74, 0.55);
}

.bin-base {
  width: 34px;
  height: 8px;
  margin-top: -1px;
  border-radius: 2px;
  background: #4a5d6e;
}

.bin-place-value,
.bin-bit {
  font-family: var(--font-mono);
  color: var(--ink-soft);
}

.bin-place-value {
  margin-top: 8px;
  font-size: 0.78rem;
}

.bin-bit {
  font-size: 0.95rem;
  font-weight: 700;
}

.bin-candle.is-lit .bin-place-value,
.bin-candle.is-lit .bin-bit {
  color: var(--ink);
}

.bin-sum {
  margin: 18px 0 0;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--ink-soft);
}

.bin-sum span {
  color: var(--ink);
  font-weight: 700;
}

.bin-bits {
  gap: 8px;
  margin: 8px 0 16px;
}

.bin-bitbox {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.bin-bitbox.is-on {
  background: var(--highlight);
  border-color: var(--highlight-border);
  color: var(--ink);
}

.bin-answer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bin-answer input {
  width: 120px;
  min-height: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.bin-answer input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.bin-feedback {
  min-height: 1.4em;
  margin: 16px 0 0;
  text-align: center;
  font-weight: 600;
}

.bin-feedback.is-ok {
  color: var(--accent);
}

.bin-feedback.is-bad {
  color: #9a3b3b;
}

.bin-result {
  text-align: center;
}

.bin-result h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
}

.bin-note {
  max-width: 820px;
  margin: 14px auto 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .bin-candles {
    gap: 6px;
  }

  .bin-wax {
    width: 18px;
    height: 48px;
  }

  .bin-base {
    width: 28px;
  }
}
