:root {
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #e6e1d8;
  --paper: #f6f4ef;
  --card: #fff;
  --accent: #1d4e89;
  --accent-ink: #fff;
  --soft: #e8f0fa;
  --good: #e7f6ee;
  --good-ink: #0f6b3c;
  --warn: #fff6e6;
  --warn-ink: #8a5a00;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.06);
  --nav: 300px;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  background: var(--card);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
button, input, textarea { font: inherit; color: inherit; }
.skip {
  position: absolute; left: -999px; top: 0;
}
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 5; }

.app { display: flex; min-height: 100%; }

.nav {
  width: var(--nav);
  flex: none;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 22px 20px 12px;
}
.brand a {
  color: inherit;
  text-decoration: none;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.toc {
  overflow: auto;
  padding: 8px 12px 16px;
  flex: 1;
}
.module-label {
  margin: 16px 8px 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-link {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}
.lesson-link:hover { background: rgba(255,255,255,0.7); }
.lesson-link[aria-current="page"] { background: #fff; box-shadow: var(--shadow); }
.lesson-link:disabled, .lesson-link[aria-disabled="true"] {
  color: #8b93a0;
  cursor: not-allowed;
}
.mark {
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid #b7c0cc;
  border-radius: 50%;
  margin-top: 2px;
  display: grid; place-items: center;
  font-size: 11px;
}
.mark.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.lesson-link span { font-size: 14.5px; line-height: 1.35; }
.nav-foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
}
.bar {
  height: 6px; background: #e3ddd3; border-radius: 99px; overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.nav-foot p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.reset {
  margin-top: 8px;
  background: none; border: 0; padding: 0;
  color: var(--muted); font-size: 13px; text-decoration: underline;
  cursor: pointer;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.menu { display: none; }
.crumb { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.top-progress { margin: 0; font-size: 14px; color: var(--ink); }

#haupt { padding: 36px 28px 120px; max-width: 820px; }
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 12px;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  margin: 28px 0 8px;
}
.lead { font-size: 18px; color: #334155; margin-top: 0; }
.prose p { margin: 0 0 12px; }
.note {
  background: var(--soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
}
.note strong { display: block; margin-bottom: 4px; }

.goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 28px; }
.goal {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.goal b { display: block; margin-bottom: 4px; }
.goal span { color: var(--muted); font-size: 14.5px; }

.module-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 0 0 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.module-card:hover { border-color: #c5d4ea; }
.module-card .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.module-card small { color: var(--muted); }

.actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .ghost {
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
}
a.primary { display: inline-block; text-decoration: none; }
a.module-card { text-decoration: none; color: inherit; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:disabled { background: #c5ced8; cursor: not-allowed; }
.ghost { background: #fff; border-color: var(--line); }

.choice, .swatch {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  cursor: pointer;
}
.choice[aria-pressed="true"], .swatch[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--soft);
}
.prompt { font-weight: 650; margin: 18px 0 8px; }
.table-wrap { overflow-x: auto; margin: 12px 0 18px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--paper); font-weight: 600; }
.ampel-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.swatches { display: flex; gap: 6px; }
.swatch { width: auto; margin: 0; padding: 6px 10px; border-radius: 999px; }
.swatch.gruen[aria-pressed="true"] { background: var(--good); border-color: var(--good-ink); }
.swatch.gelb[aria-pressed="true"] { background: var(--warn); border-color: var(--warn-ink); }
.swatch.rot[aria-pressed="true"] { background: #fdecec; border-color: #9b2c2c; }
label.field { display: block; margin: 12px 0; }
label.field span { display: block; font-weight: 650; margin-bottom: 6px; }
textarea, input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
textarea { min-height: 88px; resize: vertical; }
.feedback {
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 10px;
}
.feedback.ok { background: var(--good); color: var(--good-ink); }
.feedback.hin { background: var(--warn); color: var(--warn-ink); }
.dock {
  position: sticky;
  bottom: 0;
  margin: 28px -28px -120px;
  padding: 14px 28px;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.fine { color: var(--muted); font-size: 13px; max-width: 46ch; }

@media (max-width: 860px) {
  .menu { display: inline-flex; }
  .nav {
    position: fixed; z-index: 4; transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.08);
  }
  .nav.open { transform: none; }
  .goals { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  #haupt { padding: 24px 18px 120px; }
  .top, .dock { padding-left: 18px; padding-right: 18px; }
  .dock { margin-left: -18px; margin-right: -18px; }
  .ampel-row { grid-template-columns: 1fr; }
}
