:root {
  --paper: #f5f1e8;
  --surface: #fffcf4;
  --surface-2: #ebe5d8;
  --ink: #17201c;
  --muted: #64706a;
  --line: #c8c1b3;
  --petrol: #0f5d5e;
  --petrol-2: #0a4142;
  --sand: #e8d6a7;
  --rust: #9b4d35;
  --green: #5b6f4d;
  --blue: #29485f;
  --code: #18231f;
  --shadow: 0 18px 34px rgba(31, 36, 33, .10);
  --radius: 8px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(23,32,28,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23,32,28,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 70%);
}
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 74px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(245, 241, 232, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--petrol);
  background: var(--surface);
}
.brand-mark svg { width: 28px; height: 28px; fill: none; stroke: var(--petrol); stroke-width: 3; }
.brand strong { display: block; font-size: 1.03rem; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 10px; }
.ghost, .step, .result-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  border-radius: 5px;
}
.ghost:hover, .step:hover, .result-button:hover { border-color: var(--petrol); color: var(--petrol-2); }
.rail {
  position: fixed;
  top: 74px;
  bottom: 0;
  left: 0;
  width: 226px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(235, 229, 216, .72);
  z-index: 20;
  overflow-y: auto;
}
.rail nav { display: grid; gap: 8px; }
.rail a {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  text-decoration: none;
  border-left: 4px solid transparent;
  background: transparent;
}
.rail a span { color: var(--muted); font-size: .77rem; }
.rail a strong { font-size: .94rem; }
.rail a.active {
  border-left-color: var(--petrol);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(15,93,94,.08);
}
.stage {
  position: relative;
  margin-left: 226px;
  padding: 104px 42px 80px;
  max-width: 1380px;
}
.page-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  color: var(--muted);
}
.hero, .chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}
.chapter-head { display: block; max-width: 980px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--petrol);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 760;
  font-size: .78rem;
}
h1 { font-size: clamp(2.2rem, 4vw, 4.2rem); line-height: 1.02; margin: 0 0 18px; letter-spacing: -.04em; }
h2 { margin: 0 0 12px; font-size: clamp(1.3rem, 2vw, 2rem); letter-spacing: -.025em; }
p { margin: 0 0 14px; }
.lead { font-size: clamp(1.15rem, 1.7vw, 1.55rem); color: #2c3631; max-width: 920px; }
.hero-panel, .board, .memory, .chapter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero-panel { padding: 26px; }
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.chapter-card {
  min-height: 158px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}
.chapter-card:hover { transform: translateY(-3px); border-color: var(--petrol); }
.chapter-card span { color: var(--petrol); font-weight: 750; }
.chapter-card strong { font-size: 1.15rem; line-height: 1.18; }
.chapter-card em { color: var(--muted); font-style: normal; font-size: .91rem; }
.board {
  padding: 26px;
  margin: 0 0 26px;
}
.board.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.board.split-image {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
}
figure { margin: 0; }
figcaption { margin-top: 8px; color: var(--muted); font-size: .88rem; }
img { max-width: 100%; height: auto; }
.inline-img { border: 1px solid var(--line); background: white; }
.image-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.image-compare figure { background: white; border: 1px solid var(--line); padding: 10px; }
.memory {
  border-left: 7px solid var(--sand);
  padding: 20px 22px;
  box-shadow: none;
}
.memory strong { display: block; color: var(--petrol-2); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; margin-bottom: 8px; }
.memory p { font-size: 1.28rem; line-height: 1.38; margin-bottom: 8px; }
.memory.wide { margin: 0 0 26px; }
.reveal {
  margin: 16px 0;
  border: 1px solid var(--line);
  background: #f9f5eb;
}
.reveal summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 760;
  color: var(--petrol-2);
}
.reveal-body { padding: 0 16px 16px; }
.sql {
  background: var(--code);
  color: #f2efe5;
  padding: 16px;
  overflow-x: auto;
  border-left: 5px solid var(--petrol);
  margin: 14px 0 0;
  font-size: .98rem;
  line-height: 1.55;
}
.sql.big { font-size: clamp(1.2rem, 2vw, 1.75rem); }
.clause { display: inline-block; padding: 2px 7px; margin: 1px 0; }
.clause.highlight { background: rgba(232, 214, 167, .22); outline: 1px solid rgba(232, 214, 167, .65); }
.applet-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.applet-head p { color: var(--muted); max-width: 520px; }
.toggle-row, .concept-buttons, .exercise-nav, .like-lab, .attribute-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px 0;
}
.toggle-row button, .concept-buttons button, .exercise-nav a, .like-lab button, .attribute-bank button, .term {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 13px;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
}
.toggle-row button.active, .concept-buttons button.active, .like-lab button.active, .attribute-bank button.active {
  background: var(--petrol);
  color: white;
  border-color: var(--petrol);
}
.structure-view { display: none; }
.structure-view.active { display: block; }
.loose-note {
  font-family: ui-serif, Georgia, serif;
  font-size: 1.35rem;
  background: #fffdf7;
  border: 1px dashed var(--line);
  padding: 22px;
}
.query-card {
  border: 1px solid var(--line);
  background: #fffdf7;
  padding: 22px;
}
.query-card span { color: var(--rust); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }
.query-card strong { display: block; font-size: 1.5rem; margin: 8px 0 10px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 1rem;
}
.data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
}
.data-table th { background: #e9dfcd; color: var(--ink); }
.data-table tr:nth-child(even) td { background: #fbf8f0; }
.table-name { display: inline-block; margin: 8px 0 10px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); }
.concept-table .marked, .table-name.marked { outline: 3px solid var(--rust); outline-offset: -3px; background: #f4e2ce !important; }
.concept-table tr.marked td { background: #f4e2ce !important; }
.concept-output, .explain-box, .like-output, .mini-output, .term-answer, .sql-demo-text {
  min-height: 58px;
  background: #fffdf7;
  border: 1px solid var(--line);
  padding: 16px;
  margin-top: 14px;
  font-size: 1.06rem;
}
.rule-list p {
  padding: 12px 14px;
  margin-bottom: 10px;
  border-left: 5px solid var(--petrol);
  background: #fffdf7;
}
.like-output mark { background: var(--sand); padding: 2px 4px; }
.mini-grid {
  display: grid;
  grid-template-columns: minmax(240px, .75fr) minmax(0, 1.25fr);
  gap: 22px;
  align-items: stretch;
}
.world-card {
  border: 1px solid var(--line);
  background: #fffdf7;
  padding: 20px;
}
.world-card svg { width: 100%; height: 180px; fill: #d9c99b; stroke: var(--petrol); stroke-width: 4; }
.attribute-bank button { min-width: 128px; }
.exercise-nav {
  position: sticky;
  top: 84px;
  z-index: 10;
  background: rgba(245, 241, 232, .9);
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}
.exercise { scroll-margin-top: 130px; }
.exercise h2 { color: var(--petrol-2); }
.result-button { margin: 2px 0 16px; background: var(--petrol); color: white; border-color: var(--petrol); }
.result-button:hover { color: white; background: var(--petrol-2); }
.result-area { margin-top: 12px; }
.term-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.term {
  min-height: 78px;
  font-size: 1.25rem;
  font-weight: 760;
  background: #fffdf7;
}
.term:hover, .term.active { border-color: var(--petrol); color: var(--petrol); background: #f7f0df; }
.source-note {
  color: var(--muted);
  font-size: .84rem;
  margin: 10px 0 0;
}
body.presentation { font-size: 1.16rem; }
body.presentation .rail { display: none; }
body.presentation .stage { margin-left: 0; max-width: none; padding-left: 70px; padding-right: 70px; }
body.presentation .topbar { height: 66px; }
body.presentation .stage { padding-top: 96px; }
body.presentation .board { padding: 34px; }
body.presentation .memory p { font-size: 1.55rem; }
body.presentation .page-tools { font-size: .95rem; }
@media (max-width: 1100px) {
  .rail { position: static; width: auto; margin-top: 74px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stage { margin-left: 0; padding: 30px 22px 70px; }
  .topbar { padding: 0 16px; }
  .hero, .board.two, .board.split-image, .mini-grid { grid-template-columns: 1fr; }
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar { position: static; height: auto; padding: 12px; align-items: flex-start; gap: 12px; flex-direction: column; }
  .rail { margin-top: 0; }
  .rail nav, .chapter-grid, .image-compare, .term-grid { grid-template-columns: 1fr; }
  .stage { padding: 22px 14px 60px; }
  .page-tools { gap: 10px; }
  .brand small { display: none; }
  h1 { font-size: 2.35rem; }
}

/* Dichte Beamerfassung, optimiert für 1920 x 1080 */
@media (min-width: 1200px) {
  .stage {
    padding: 88px 28px 42px;
    max-width: 1480px;
  }
  .page-tools {
    margin-bottom: 12px;
  }
  .hero, .chapter-head {
    margin-bottom: 16px;
  }
  .chapter-head {
    max-width: 1180px;
  }
  h1 {
    font-size: clamp(2rem, 3vw, 3.25rem);
    margin-bottom: 10px;
  }
  h2 {
    font-size: clamp(1.18rem, 1.55vw, 1.65rem);
    margin-bottom: 8px;
  }
  p {
    margin-bottom: 10px;
  }
  .lead {
    font-size: clamp(1.02rem, 1.2vw, 1.28rem);
    line-height: 1.42;
  }
  .board {
    padding: 18px;
    margin-bottom: 16px;
  }
  .hero-panel {
    padding: 18px;
  }
  .memory {
    padding: 14px 16px;
    border-left-width: 5px;
  }
  .memory p {
    font-size: 1.08rem;
    line-height: 1.32;
  }
  .memory.wide {
    margin-bottom: 16px;
  }
  .reveal {
    margin: 10px 0;
  }
  .reveal summary {
    padding: 10px 12px;
  }
  .reveal-body {
    padding: 0 12px 12px;
  }
  .sql {
    padding: 12px;
    font-size: .9rem;
    line-height: 1.38;
  }
  .sql.big {
    font-size: clamp(1.05rem, 1.4vw, 1.38rem);
  }
  .applet-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
    align-items: center;
  }
  .applet-head p {
    max-width: 620px;
    margin-bottom: 0;
  }
  .toggle-row, .concept-buttons, .exercise-nav, .like-lab, .attribute-bank {
    gap: 7px;
    margin: 10px 0;
  }
  .toggle-row button, .concept-buttons button, .exercise-nav a, .like-lab button, .attribute-bank button, .term {
    padding: 7px 10px;
  }
  .data-table {
    font-size: .92rem;
  }
  .data-table th, .data-table td {
    padding: 7px 9px;
  }
  .concept-output, .explain-box, .like-output, .mini-output, .term-answer, .sql-demo-text {
    min-height: 42px;
    padding: 11px 12px;
    margin-top: 10px;
    font-size: .98rem;
  }
  .loose-note, .query-card {
    padding: 15px;
  }
  .loose-note {
    font-size: 1.12rem;
  }
  .query-card strong {
    font-size: 1.24rem;
  }
  .world-card {
    padding: 14px;
  }
  .world-card svg {
    height: 130px;
  }
  .term {
    min-height: 58px;
    font-size: 1.04rem;
  }
  .term-grid {
    gap: 9px;
    margin: 10px 0;
  }
  .chapter-card {
    min-height: 122px;
    padding: 14px;
  }
  .chapter-grid {
    gap: 10px;
    margin-bottom: 16px;
  }
  .image-compare {
    gap: 10px;
  }
  .image-compare figure {
    padding: 7px;
  }
  figcaption {
    margin-top: 5px;
  }
}

/* Der Beamer Modus soll wie eine kompakte Folienansicht wirken, nicht wie eine vergrößerte Webseite. */
body.presentation {
  font-size: 1rem;
  line-height: 1.42;
}
body.presentation .topbar {
  height: 54px;
}
body.presentation .brand-mark {
  width: 34px;
  height: 34px;
}
body.presentation .brand-mark svg {
  width: 23px;
  height: 23px;
}
body.presentation .brand small {
  display: none;
}
body.presentation .ghost, body.presentation .step, body.presentation .result-button {
  padding: 7px 10px;
}
body.presentation .stage {
  padding: 66px 34px 26px;
  margin-left: 0;
  max-width: none;
}
body.presentation .page-tools {
  margin-bottom: 8px;
  font-size: .84rem;
}
body.presentation .hero, body.presentation .chapter-head {
  margin-bottom: 10px;
}
body.presentation .chapter-head {
  max-width: none;
}
body.presentation .eyebrow {
  margin-bottom: 4px;
  font-size: .66rem;
}
body.presentation h1 {
  font-size: clamp(1.8rem, 2.35vw, 2.65rem);
  margin-bottom: 6px;
  line-height: 1;
}
body.presentation h2 {
  font-size: clamp(1.05rem, 1.35vw, 1.45rem);
  margin-bottom: 6px;
}
body.presentation .lead {
  font-size: clamp(.98rem, 1.05vw, 1.12rem);
  line-height: 1.34;
  max-width: 1300px;
}
body.presentation .board {
  padding: 14px;
  margin-bottom: 10px;
}
body.presentation .board.two {
  gap: 14px;
}
body.presentation .board.split-image {
  gap: 16px;
}
body.presentation .hero {
  gap: 14px;
}
body.presentation .hero-panel {
  padding: 14px;
}
body.presentation .memory {
  padding: 11px 13px;
}
body.presentation .memory strong {
  font-size: .64rem;
  margin-bottom: 5px;
}
body.presentation .memory p {
  font-size: 1.02rem;
  line-height: 1.26;
  margin-bottom: 4px;
}
body.presentation .memory.wide {
  margin-bottom: 10px;
}
body.presentation .reveal {
  margin: 7px 0;
}
body.presentation .reveal summary {
  padding: 8px 10px;
}
body.presentation .reveal-body {
  padding: 0 10px 9px;
}
body.presentation .sql {
  padding: 9px 10px;
  line-height: 1.28;
  font-size: .83rem;
  margin-top: 8px;
}
body.presentation .sql.big {
  font-size: clamp(.98rem, 1.18vw, 1.25rem);
}
body.presentation .applet-head {
  margin-bottom: 7px;
  padding-bottom: 7px;
  align-items: center;
}
body.presentation .applet-head p {
  max-width: 720px;
  margin-bottom: 0;
  font-size: .92rem;
}
body.presentation .toggle-row, body.presentation .concept-buttons, body.presentation .exercise-nav, body.presentation .like-lab, body.presentation .attribute-bank {
  margin: 7px 0;
  gap: 6px;
}
body.presentation .toggle-row button, body.presentation .concept-buttons button, body.presentation .exercise-nav a, body.presentation .like-lab button, body.presentation .attribute-bank button, body.presentation .term {
  padding: 6px 9px;
  font-size: .9rem;
}
body.presentation .data-table {
  font-size: .84rem;
}
body.presentation .data-table th, body.presentation .data-table td {
  padding: 5px 7px;
}
body.presentation .concept-output, body.presentation .explain-box, body.presentation .like-output, body.presentation .mini-output, body.presentation .term-answer, body.presentation .sql-demo-text {
  min-height: 36px;
  padding: 8px 10px;
  margin-top: 7px;
  font-size: .9rem;
}
body.presentation .loose-note, body.presentation .query-card {
  padding: 11px;
}
body.presentation .loose-note {
  font-size: 1rem;
}
body.presentation .query-card strong {
  font-size: 1.08rem;
}
body.presentation .rule-list p {
  padding: 8px 10px;
  margin-bottom: 7px;
}
body.presentation .world-card {
  padding: 10px;
}
body.presentation .world-card svg {
  height: 92px;
}
body.presentation .mini-grid {
  gap: 12px;
}
body.presentation .attribute-bank button {
  min-width: 108px;
}
body.presentation .term-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0;
}
body.presentation .term {
  min-height: 48px;
  font-size: .94rem;
}
body.presentation .chapter-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
body.presentation .chapter-card {
  min-height: 104px;
  padding: 10px;
}
body.presentation .chapter-card strong {
  font-size: .96rem;
}
body.presentation .chapter-card em {
  font-size: .78rem;
}
body.presentation .board.source-note,
body.presentation .source-note {
  font-size: .72rem;
  margin-top: 4px;
}
body.presentation figcaption {
  margin-top: 3px;
  font-size: .76rem;
}
body.presentation .image-compare {
  gap: 8px;
}
body.presentation .image-compare figure {
  padding: 5px;
}
body.presentation .inline-img {
  max-height: 250px;
  object-fit: contain;
}
body.presentation .result-button {
  margin-bottom: 8px;
}

/* Die Übungsbesprechung ist im Beamerbetrieb eine Karte pro Aufgabe. */
.exercise-nav a.active {
  background: var(--petrol);
  color: white;
  border-color: var(--petrol);
}
.exercise {
  display: none;
}
.exercise.active {
  display: block;
}
body:not(.presentation) .exercise.active {
  display: block;
}

.task-ref {
  border: 1px solid var(--line);
  background: #f4ead2;
  padding: 13px 15px;
  margin: 8px 0 14px;
}
.task-ref strong {
  display: block;
  color: var(--petrol-2);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: .72rem;
  margin-bottom: 6px;
}
.task-ref p {
  margin: 0;
  font-weight: 650;
}
.task-ref ol {
  margin: 0;
  padding-left: 1.25rem;
}
.task-ref li {
  margin: 3px 0;
  font-weight: 650;
}
@media (min-width: 1200px) {
  .task-ref {
    padding: 10px 12px;
    margin: 6px 0 10px;
  }
  .task-ref li {
    margin: 1px 0;
  }
}
body.presentation .task-ref {
  padding: 8px 10px;
  margin: 5px 0 8px;
}
body.presentation .task-ref strong {
  font-size: .62rem;
  margin-bottom: 4px;
}
body.presentation .task-ref li,
body.presentation .task-ref p {
  font-size: .9rem;
  line-height: 1.25;
  margin-bottom: 0;
}

.bad-row td { background: #f2d7c8 !important; }
.error-table .bad-row td:last-child { font-weight: 780; color: var(--rust); }
.mini-schema.two-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}
.invalid-fk #fkCandidate {
  background: #f2d7c8;
  color: var(--rust);
  font-weight: 800;
}
.compact-terms.term-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.key-cards .term { min-height: 64px; }
@media (min-width: 1200px) {
  .rail { width: 244px; }
  .stage { margin-left: 244px; }
  .rail a { padding: 8px 10px; }
  .rail nav { gap: 5px; }
  .rail a strong { font-size: .86rem; }
  .rail a span { font-size: .68rem; }
  .mini-schema.two-mini { gap: 10px; }
}
body.presentation .compact-terms.term-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.presentation .mini-schema.two-mini { gap: 8px; }
body.presentation .key-cards .term { min-height: 44px; }
body.presentation .exercise-nav { top: 54px; }
@media (max-width: 760px) {
  .mini-schema.two-mini, .compact-terms.term-grid { grid-template-columns: 1fr; }
}
