/* Schrift Montserrat (SIL Open Font License), lokal eingebunden – keine fremden Server */
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --deep: #04202f;
  --deep-2: #062f45;
  --surface: #0b3d5c;
  --panel: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.14);
  --ink: #eaf6ff;
  --muted: #9fc2d8;
  --accent: #f9ca4f;
  --accent-strong: #f6b304;
  --brand-gradient: linear-gradient(135deg, #fbd566, #f6b304);
  --accent-2: #7cc4ff;
  --warn: #ff9f5a;
  --bad: #ff7676;
  --good: #6ee7a8;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }

body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% -10%, var(--surface), var(--deep) 55%, #021320 100%);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
}

.topbar {
  padding: 14px clamp(16px, 4vw, 40px) 0;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 19, 32, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand > div { min-width: 0; }
.brand h1, .brand p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
  font-size: 34px; line-height: 1; color: var(--accent);
  border: 2px solid var(--accent); border-radius: 12px;
  width: 52px; height: 52px; display: grid; place-items: center;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.2px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent; border: 0; color: var(--muted);
  padding: 10px 16px; font-size: 14px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink); background: var(--panel); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

main { padding: clamp(16px, 3vw, 32px) clamp(16px, 4vw, 40px) 48px; max-width: 1200px; margin: 0 auto; }
.view.is-active { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px;
}
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 10px; font-size: 17px; color: var(--accent-2); }
.card ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.card p { margin: 8px 0; }

.formula {
  font-family: "Cascadia Code", Consolas, monospace;
  background: rgba(249, 202, 79, 0.1);
  border-left: 3px solid var(--accent);
  padding: 8px 12px; border-radius: 0 8px 8px 0; color: var(--accent);
}
.warn { color: var(--warn); }
.hint { color: var(--muted); font-size: 13px; }
.disclaimer {
  border: 1px solid rgba(255, 180, 87, 0.4); background: rgba(255, 180, 87, 0.08);
  color: var(--warn); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin: 0 0 18px;
}

form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
fieldset {
  grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 14px; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input, select {
  background: rgba(2, 19, 32, 0.6); border: 1px solid var(--line); color: var(--ink);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[readonly] { opacity: 0.7; }
form > button[type="submit"] { grid-column: 1 / -1; justify-self: start; white-space: nowrap; }

button {
  background: var(--brand-gradient);
  color: #04202f; border: 0; border-radius: 9px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); font-weight: 500; }

.result { display: block; margin-top: 14px; font-size: 14px; }
.result:empty { display: none; }
.result dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.result dt { color: var(--muted); }
.result dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.result .error { color: var(--bad); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; margin-right: 6px;
}
.badge.ok { background: rgba(110, 231, 168, 0.16); color: var(--good); }
.badge.bad { background: rgba(255, 118, 118, 0.16); color: var(--bad); }
.badge.warn { background: rgba(255, 180, 87, 0.16); color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; }
tr.is-hit td { background: rgba(249, 202, 79, 0.12); }

.tissues { display: grid; gap: 4px; margin-top: 16px; }
.tissue { display: grid; grid-template-columns: 84px 1fr 52px; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.bar { height: 9px; background: rgba(255, 255, 255, 0.08); border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #fbd566, #f6b304); border-radius: 5px; }
.bar span.high { background: linear-gradient(90deg, var(--accent), var(--warn)); }
.bar span.over { background: linear-gradient(90deg, var(--warn), var(--bad)); }

.question { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.question h3 { font-size: 15px; margin: 0 0 12px; }
.options { display: grid; gap: 8px; }
.option {
  text-align: left; background: rgba(2, 19, 32, 0.5); border: 1px solid var(--line);
  color: var(--ink); font-weight: 400; padding: 12px 14px; border-radius: 10px; cursor: pointer;
  display: flex; gap: 10px; align-items: center; font-size: 15px; transition: transform 0.08s ease, border-color 0.15s ease;
}
.option:active:not(:disabled) { transform: scale(0.99); }
.option.correct { animation: pop 0.3s ease; }
.option.wrong { animation: shake 0.3s ease; }
.option:hover:not(:disabled) { border-color: var(--accent); }
.option:disabled { cursor: default; opacity: 0.85; }
.option.correct { border-color: var(--good); background: rgba(110, 231, 168, 0.12); }
.option.wrong { border-color: var(--bad); background: rgba(255, 118, 118, 0.12); }
.explanation { margin-top: 10px; padding: 10px 14px; border-left: 3px solid var(--accent-2); background: rgba(124, 196, 255, 0.08); border-radius: 0 8px 8px 0; font-size: 13px; }
.progress { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.score { font-size: 15px; margin-top: 14px; }

footer { padding: 20px clamp(16px, 4vw, 40px) 32px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  form { grid-template-columns: 1fr; }
  .brand p { display: none; }
  .brand { gap: 10px; }
  .brand h1 { font-size: 16px; }
  .brand-mark { width: 36px; height: 36px; font-size: 22px; border-radius: 9px; flex: none; }
  .player { gap: 8px; flex: none; }
  .player-text { display: none; }
  .tissue { grid-template-columns: 74px 1fr 46px; }
}

/* ---------------- Datenreihen & Diagramme ---------------- */
/* Reihenfarben: geprüft mit dem Validator (Helligkeitsband, Chroma,
   Farbfehlsichtigkeit, Kontrast) gegen den dunklen Diagrammgrund. */
:root {
  --series-1: #0d9488;
  --series-2: #d97706;
  --chart-surface: #0a2c40;
}

.chart { position: relative; margin-top: 12px; }
.chart svg { width: 100%; height: auto; display: block; background: var(--chart-surface); border-radius: 10px; touch-action: pan-y; }
.grid { stroke: rgba(255, 255, 255, 0.09); stroke-width: 1; }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.axis-text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.series-label { font-size: 12px; font-weight: 600; }
.marker-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.55; }
.marker-text { fill: var(--ink); font-weight: 600; }
.limit-line { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 6 4; opacity: 0.8; }
.limit-text { fill: var(--bad); }
.alert-dot { fill: var(--bad); stroke: var(--chart-surface); stroke-width: 2; }
.phase-band { fill: rgba(255, 255, 255, 0.05); }
.crosshair { stroke: var(--ink); stroke-width: 1; opacity: 0.35; }
.hover-dot { stroke: var(--chart-surface); stroke-width: 2; }

.chart-tooltip {
  position: absolute; top: 8px; transform: translateX(-50%);
  background: rgba(2, 19, 32, 0.95); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 11px; font-size: 12px; pointer-events: none;
  display: grid; gap: 2px; white-space: nowrap; z-index: 2;
}
.chart-tooltip .tt-row { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chart-tooltip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { background: rgba(2, 19, 32, 0.45); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile-label { display: block; color: var(--muted); font-size: 12px; }
.tile-value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-unit { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 5px; }
input[type="range"] { padding: 0; accent-color: var(--accent); height: 28px; background: transparent; border: 0; }
h3.sub { font-size: 14px; color: var(--accent-2); margin: 18px 0 4px; }

.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }


/* ================= Spiel: Kopfzeile, Rang, Chips ================= */
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #04202f; padding: 8px 14px; border-radius: 8px; z-index: 100; font-weight: 600; }
.skip-link:focus { left: 12px; }
.topbar-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.player { display: flex; align-items: center; gap: 10px; }
.player-text { display: grid; gap: 4px; min-width: 130px; font-size: 13px; }
.player-xp { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); font-size: 14px; white-space: nowrap; }
:root { --gold: #ffd166; }

.rank-badge {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 26px; font-weight: 800; color: #04202f; border: 2px solid rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at 32% 28%, #7ff0de, #1aa890 45%, #0b4f5c 100%);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.rank-badge.small { width: 36px; height: 36px; font-size: 16px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1); }
.xp-bar, .meter { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.xp-bar span, .meter span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width 0.5s ease; }
.meter { margin: 10px 0 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.09); color: var(--ink); white-space: nowrap; }
.chip.is-accent { background: rgba(249, 202, 79, 0.2); color: var(--accent); }
.chip.is-gold { background: rgba(255, 209, 102, 0.18); color: var(--gold); }
kbd { font-family: inherit; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
button kbd { background: rgba(4, 32, 47, 0.18); border-color: rgba(4, 32, 47, 0.3); color: inherit; }
.option kbd { background: rgba(255, 255, 255, 0.1); border-color: var(--line); color: var(--muted); }

.stars { display: inline-flex; gap: 2px; }
.star { color: rgba(255, 255, 255, 0.18); font-size: 18px; line-height: 1; }
.star.is-on { color: var(--gold); text-shadow: 0 0 10px rgba(255, 209, 102, 0.5); }

button.round { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(2, 19, 32, 0.6); border: 1px solid var(--line); color: var(--ink); font-size: 15px; }
button.round.big { width: 58px; height: 58px; font-size: 24px; font-weight: 700; }
button.primary { background: var(--brand-gradient); color: #04202f; }
button.big { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; }

.xp-toasts { position: fixed; right: 16px; top: 76px; z-index: 60; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.xp-toast { background: rgba(4, 32, 47, 0.95); border: 1px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; animation: xp-rise 2.6s ease forwards; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.xp-toast.is-gold { border-color: var(--gold); color: var(--gold); }
@keyframes xp-rise { 0% { opacity: 0; transform: translateY(10px) scale(0.9); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes pop { 0% { transform: scale(0.96); } 60% { transform: scale(1.02); } 100% { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes star-in { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 70% { transform: scale(1.35) rotate(8deg); opacity: 1; } 100% { transform: none; opacity: 1; } }

/* ================= Missionsübersicht ================= */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: clamp(20px, 4vw, 36px); border-radius: 20px; border: 1px solid var(--line); overflow: hidden; position: relative;
  background:
    radial-gradient(circle at 85% 0%, rgba(124, 196, 255, 0.35), transparent 55%),
    linear-gradient(180deg, #1773a8 0%, #0e4f80 45%, #062a4a 100%);
}
.hero h2 { margin: 4px 0 10px; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.15; max-width: 22ch; }
.hero p { margin: 0 0 18px; max-width: 60ch; color: #d6ecfa; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; font-weight: 700; color: var(--accent); }
.hero .eyebrow { color: #aef3ea; }
.hero-rank { display: grid; justify-items: center; gap: 8px; text-align: center; background: rgba(2, 19, 32, 0.45); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; min-width: 210px; }
.hero-rank .xp-bar { width: 100%; }
.hero-rank .hint { margin: 0; }
.hero-stars { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.section-title { margin: 28px 0 12px; font-size: 16px; color: var(--accent-2); }

.missions { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.mission {
  position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 10px; text-align: left; min-height: 190px;
  padding: 16px; border-radius: 16px; border: 1px solid var(--line); color: var(--ink); font-weight: 400; overflow: hidden;
  background: linear-gradient(180deg, #14639a, #072a4a);
  background: linear-gradient(180deg,
    color-mix(in srgb, #1c7fb4 calc((1 - var(--shade)) * 100%), #0a3a63) 0%,
    color-mix(in srgb, #0d4a78 calc((1 - var(--shade)) * 100%), #031426) 100%);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.mission:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35); filter: none; }
.mission.is-next { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 26px rgba(249, 202, 79, 0.25); }
.mission.is-locked { opacity: 0.55; filter: saturate(0.4); }
.mission-number { font-size: 13px; font-weight: 800; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.16); }
.mission-depth { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(2, 19, 32, 0.5); }
.mission-body { display: grid; gap: 3px; align-content: end; }
.mission-topic { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: #aef3ea; font-weight: 700; }
.mission-title { font-size: 19px; font-weight: 700; line-height: 1.2; }
.mission-tagline { font-size: 13px; color: #cfe6f5; }
.mission-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.lock { font-size: 12px; color: var(--muted); }
.logbook td, .logbook th { white-space: nowrap; }
.card.wide:has(.logbook) { overflow-x: auto; }
.card.narrow { max-width: 760px; margin: 0 auto; }
.quiz-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.quiz-head .progress { margin: 0 auto 0 0; }
.quiz-result { text-align: center; padding-top: 18px; }
.score { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quiz-result .score { justify-content: center; }
.tile-value.is-text { font-size: 15px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-rank { grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 14px; }
  .hero-rank .rank-badge { grid-row: span 4; }
}

/* ================= Spielbühne ================= */
body.is-diving { overflow: hidden; }
.stage { position: fixed; inset: 0; z-index: 50; background: #04202f; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.hud-panel { position: absolute; background: rgba(2, 16, 28, 0.72); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hud-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.hud-label b { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.hud-computer { top: 12px; left: 12px; display: grid; grid-template-columns: repeat(4, auto); gap: 2px 18px; padding: 10px 16px; }
.hud-cell { display: grid; gap: 0; }
.hud-value { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 20px; line-height: 1.15; white-space: nowrap; }
.hud-value small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.hud-depth .hud-value { font-size: 28px; color: var(--accent); }
.hud-cell.is-warn .hud-value { color: var(--warn); }
.hud-cell.is-bad .hud-value { color: var(--bad); animation: blink 0.6s steps(2) infinite; }
.hud-gauges { top: 86px; left: 12px; display: grid; gap: 8px; padding: 10px 14px; width: 232px; }
.gauge { display: grid; gap: 4px; }
.gauge-track { position: relative; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); overflow: hidden; display: block; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--accent); }
.gauge-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.6); }
.gauge.is-warn .gauge-fill { background: var(--warn); }
.gauge.is-bad .gauge-fill { background: var(--bad); }
.gauge.is-bad .hud-label b { color: var(--bad); }
[data-cell="risk"] .gauge-fill { background: var(--accent-2); }
@keyframes blink { 50% { opacity: 0.45; } }

.hud-goals { position: absolute; right: 12px; top: 64px; margin: 0; padding: 10px 14px; list-style: none; display: grid; gap: 4px; background: rgba(2, 16, 28, 0.6); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; font-size: 13px; font-weight: 600; }
.hud-goals li { display: flex; gap: 8px; align-items: center; }
.hud-goals li span { width: 14px; color: var(--muted); }
.hud-goals li.is-done { color: var(--good); }
.hud-goals li.is-done span { color: var(--good); }

.hud-toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px)); width: max-content; padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; text-align: center; background: rgba(2, 16, 28, 0.88); border: 1px solid var(--accent-2); animation: toast-in 0.25s ease; }
.hud-toast.is-good { border-color: var(--good); color: var(--good); }
.hud-toast.is-warn { border-color: var(--warn); color: var(--warn); }
.hud-toast.is-bad { border-color: var(--bad); color: #ffd6d6; background: rgba(90, 14, 20, 0.9); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
.hud-stop { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: rgba(2, 16, 28, 0.75); border: 1px solid rgba(110, 231, 168, 0.5); color: var(--good); font-variant-numeric: tabular-nums; }
.hud-stop.is-active { background: rgba(20, 90, 60, 0.85); color: #fff; }

.stage-buttons { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.bcd { position: absolute; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 6px; padding: 10px 12px; border-radius: 16px; background: rgba(2, 16, 28, 0.72); border: 1px solid rgba(255, 255, 255, 0.16); }
.bcd-buttons { display: flex; align-items: center; gap: 10px; }
.bcd-state { font-size: 13px; font-weight: 800; color: var(--good); min-width: 86px; text-align: center; }
.bcd.is-up .bcd-state { color: var(--warn); }
.bcd.is-down .bcd-state { color: var(--accent-2); }
.bcd-meter { position: relative; width: 12px; height: 54px; border-radius: 6px; background: linear-gradient(180deg, rgba(255, 180, 87, 0.6), rgba(110, 231, 168, 0.6) 50%, rgba(124, 196, 255, 0.6)); }
.bcd-meter span { position: absolute; left: -4px; right: -4px; height: 4px; margin-top: -2px; border-radius: 2px; background: #fff; top: 50%; }
.bcd .round.big { touch-action: none; }

.stage-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 16px; background: rgba(2, 12, 22, 0.66); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); overflow-y: auto; user-select: text; -webkit-user-select: text; touch-action: auto; }
.overlay-card { width: 100%; max-width: 680px; min-width: 0; flex: none; margin: auto; background: linear-gradient(180deg, #0c3854, #06243a); border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 3vw, 30px); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); animation: pop 0.25s ease; }
.overlay-card h2 { margin: 4px 0 10px; font-size: clamp(22px, 3vw, 30px); }
.overlay-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--accent-2); }
.lesson { margin: 0 0 16px; padding: 12px 14px; border-left: 3px solid var(--accent); background: rgba(249, 202, 79, 0.09); border-radius: 0 10px 10px 0; }
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.checklist li::before { content: "◎"; color: var(--accent); margin-right: 8px; }
.plan { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.plan dt { color: var(--muted); }
.plan dd { margin: 0; font-weight: 600; }
.plan small { color: var(--warn); font-weight: 500; }
.controls-help { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.overlay-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.overlay-actions button { padding: 12px 20px; font-size: 15px; }

.debrief-stars { text-align: center; margin: 4px 0 10px; }
.debrief-stars .star { font-size: 52px; }
.debrief-stars .star.is-on { animation: star-in 0.45s ease backwards; }
.is-debrief h2, .is-debrief .eyebrow { text-align: center; }
.star-rules { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.star-rules li { display: flex; gap: 8px; align-items: center; }
.star-rules li.is-on { color: var(--ink); }
.debrief-tiles { grid-template-columns: repeat(4, 1fr); }
.profile { width: 100%; height: auto; display: block; margin-top: 12px; background: var(--chart-surface); border-radius: 10px; }
.profile-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.profile-area { fill: rgba(249, 202, 79, 0.14); }
.stop-band { fill: rgba(110, 231, 168, 0.14); }
.feedback { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.feedback li { padding: 9px 12px; border-radius: 0 10px 10px 0; border-left: 3px solid var(--accent-2); background: rgba(124, 196, 255, 0.08); }
.feedback li.is-bad { border-color: var(--bad); background: rgba(255, 118, 118, 0.1); }
.feedback li.is-warn { border-color: var(--warn); background: rgba(255, 180, 87, 0.1); }
.feedback li.is-good { border-color: var(--good); background: rgba(110, 231, 168, 0.1); }
.xp-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 16px 0 0; }
.xp-pill { font-weight: 800; font-size: 18px; color: var(--gold); padding: 4px 16px; border-radius: 999px; background: rgba(255, 209, 102, 0.14); border: 1px solid rgba(255, 209, 102, 0.5); }
.bonus { margin-top: 18px; padding: 14px; border: 1px dashed rgba(255, 209, 102, 0.5); border-radius: 14px; }
.bonus h3 { color: var(--ink); font-size: 15px; margin: 6px 0 10px; }

@media (max-width: 760px) {
  .hud-computer { grid-template-columns: repeat(2, auto); padding: 8px 12px; gap: 2px 14px; }
  .hud-value { font-size: 16px; }
  .hud-depth .hud-value { font-size: 20px; }
  .hud-gauges { top: auto; bottom: 12px; left: 12px; width: 170px; padding: 8px 10px; gap: 6px; }
  .hud-goals { top: 60px; font-size: 12px; padding: 8px 10px; }
  .hud-stop { top: auto; bottom: 150px; font-size: 12px; }
  .hud-toast { bottom: 190px; font-size: 14px; }
  .brief-grid { grid-template-columns: 1fr; }
  .debrief-tiles { grid-template-columns: repeat(2, 1fr); }
  .debrief-stars .star { font-size: 40px; }
}
@media (max-height: 520px) {
  .hud-gauges { top: auto; bottom: 12px; }
  .hud-goals { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ================= Lektion: Labor mit Grafik und Reglern ================= */
.lesson-lab { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(220px, 1fr); gap: 20px; margin: 14px 0 0; align-items: start; }
.lesson-svg { width: 100%; height: auto; display: block; border-radius: 14px; font-family: inherit; }
.lesson-note { margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent-2); background: rgba(124, 196, 255, 0.08); border-radius: 0 10px 10px 0; font-size: 14px; min-height: 3.2em; }
.controls { display: grid; gap: 14px; margin: 0 0 16px; }
.control { display: grid; gap: 6px; font-size: 14px; color: var(--ink); }
.control-label output { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button { background: rgba(2, 19, 32, 0.6); border: 1px solid var(--line); color: var(--ink); font-weight: 500; padding: 8px 14px; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #04202f; border-color: var(--accent); font-weight: 700; }
.lesson-readouts { grid-template-columns: 1fr; gap: 8px; }
.lesson-readouts .tile { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.lesson-readouts .tile-value { text-align: right; font-size: 15px; }
.ghost-link { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.ghost-link:hover { text-decoration: underline; }
@media (max-width: 860px) {
  .lesson-lab { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .player-text { display: none; }
}

/* ================= Prüfungssimulation ================= */
.exam-verdict { font-size: 26px; margin: 4px 0 6px; }
.exam-verdict.is-pass { color: var(--good); }
.exam-verdict.is-fail { color: var(--warn); }
.topic-table { max-width: 520px; margin: 14px auto; }
.topic-table td:last-child { width: 40%; }
.topic-table .meter { margin: 0; }
.meter span.is-low { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.quiz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
select:disabled, input:disabled { opacity: 0.45; }
.owd-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255, 180, 87, 0.45); background: rgba(255, 180, 87, 0.09); color: var(--warn); font-size: 14px; }
.mission-depth.is-deep { color: var(--warn); }

/* ================= Buddy, Album, Abzeichen ================= */
.ok-button { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); padding: 14px 22px; font-size: 17px; border-radius: 999px; background: #fff; color: #04202f; box-shadow: 0 0 0 4px rgba(255, 180, 87, 0.7), 0 10px 30px rgba(0, 0, 0, 0.45); animation: ok-pulse 0.8s ease-in-out infinite alternate; }
.ok-button kbd { background: rgba(4, 32, 47, 0.12); border-color: rgba(4, 32, 47, 0.25); color: #04202f; margin-left: 6px; }
@keyframes ok-pulse { to { transform: translateX(-50%) scale(1.06); } }
.hud-goals small { color: var(--gold); letter-spacing: 1px; }
.quip { text-align: center; font-style: italic; color: var(--muted); margin: -4px 0 8px; }
.photo-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 14px 0 4px; }
.hint.center { text-align: center; margin-top: 0; }
.album { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.album-card { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #f4f1e8; color: #1c2a33; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); transform: rotate(-0.6deg); }
.album-card:nth-child(even) { transform: rotate(0.7deg); }
.album-card canvas { width: 100%; height: auto; display: block; aspect-ratio: 120 / 78; }
.album-card figcaption { display: grid; gap: 2px; padding: 8px 10px 10px; font-size: 12px; }
.album-card strong { font-size: 13px; }
.album-card .star { font-size: 13px; color: rgba(0, 0, 0, 0.15); text-shadow: none; }
.album-card .star.is-on { color: #d99a00; }
.album-text { color: #4a5a64; line-height: 1.35; }
.album-card.is-unknown { background: rgba(255, 255, 255, 0.05); color: var(--muted); box-shadow: none; }
.album-card.is-unknown .album-text { color: var(--muted); }
.badges { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.badge-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--muted); opacity: 0.55; }
.badge-card strong { color: var(--ink); font-size: 14px; }
.badge-card span:last-child { grid-column: 2; }
.badge-icon { grid-row: span 2; font-size: 28px; filter: grayscale(1); }
.badge-card.is-earned { opacity: 1; border-color: rgba(255, 209, 102, 0.55); background: rgba(255, 209, 102, 0.08); }
.badge-card.is-earned .badge-icon { filter: none; }
@media (max-width: 760px) { .ok-button { bottom: 256px; font-size: 15px; } }

/* ================= Feinschliff: ruhigere, erwachsenere Oberfläche ================= */
.hero { background:
    radial-gradient(circle at 82% -10%, rgba(120, 220, 235, 0.28), transparent 50%),
    linear-gradient(180deg, #0f6585 0%, #0a3f66 48%, #051d38 100%); }
.hero h2 { letter-spacing: -0.01em; }
.mission { background: linear-gradient(180deg,
    color-mix(in srgb, #14708f calc((1 - var(--shade)) * 100%), #06284a) 0%,
    color-mix(in srgb, #0a3d63 calc((1 - var(--shade)) * 100%), #020c1c) 100%); }
.mission::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 38px); mask-image: linear-gradient(180deg, #000, transparent 55%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 55%); }
.mission-title { letter-spacing: -0.01em; }
.hud-panel, .hud-goals, .bcd { border-radius: 10px; }
.hud-value { font-family: "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace; letter-spacing: -0.02em; }
.ok-button { background: rgba(3, 18, 30, 0.9); color: var(--ink); border: 1.5px solid var(--warn); box-shadow: 0 0 24px rgba(255, 180, 87, 0.45); }
.ok-button kbd { background: rgba(255, 255, 255, 0.12); border-color: var(--line); color: var(--ink); }
.album-card, .album-card:nth-child(even) { transform: none; background: #0d2a3d; color: var(--ink); border-color: var(--line); }
.album-text { color: var(--muted); }
.album-card .star { color: rgba(255, 255, 255, 0.18); }
.album-card .star.is-on { color: var(--gold); }

/* ================= Lernweg: Kapitel für Kapitel in die Tiefe ================= */
.tab-note { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--gold); margin-left: 4px; }
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 0 !important; }
button.ghost.is-bonus { border-color: rgba(255, 209, 102, 0.45); }
.icon { display: block; flex: none; }

.path-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px;
  padding: clamp(18px, 3vw, 26px); border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(249, 202, 79, 0.16), rgba(124, 196, 255, 0.08));
}
.path-hero-text { flex: 1 1 300px; min-width: 0; }
.path-hero h2 { margin: 4px 0 12px; font-size: clamp(20px, 3vw, 26px); line-height: 1.2; letter-spacing: -0.01em; }
.path-hero .hint { margin: 8px 0 0; }
.path-meter { height: 10px; max-width: 420px; border-radius: 5px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.path-meter span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width 0.5s ease; }
.path-hero .primary.big { display: inline-flex; align-items: center; gap: 10px; text-align: left; line-height: 1.3; }

.path {
  --amp: 1; position: relative; margin-top: 18px; padding: 6px 0 40px; border-radius: 24px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(180deg, #2b9fbe 0%, #167ba4 12%, #0e5a87 30%, #0a3f69 52%, #072b50 74%, #041a33 100%);
}
.path::before {   /* Lichtstrahlen nahe der Oberfläche */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 360px; pointer-events: none;
  background: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.07) 0 26px, transparent 26px 92px);
  mask-image: linear-gradient(#000, transparent); -webkit-mask-image: linear-gradient(#000, transparent);
}
.zone { position: relative; padding-bottom: 8px; }
.zone-head {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 20px 16px 26px; padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.22); font-size: 14px; color: #eaf6ff;
}
.zone:first-child .zone-head { border-top: 0; padding-top: 6px; }
.zone-depth { font-family: "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(2, 19, 32, 0.5); color: #aef3ea; white-space: nowrap; }
.zone-title { flex: 1; min-width: 0; }
.zone-title strong { margin-right: 4px; }
.zone-count { font-size: 12px; font-weight: 700; color: rgba(234, 246, 255, 0.8); }

.trail { display: grid; }
.trail-item { position: relative; display: flex; justify-content: center; transform: translateX(calc(var(--x) * var(--amp) * 1px)); }
.trail-gap { position: relative; height: 36px; }
.trail-gap span {
  position: absolute; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.32); transform: translateX(calc(var(--x) * var(--amp) * 1px));
}
.trail-gap span:nth-child(1) { top: 5px; }
.trail-gap span:nth-child(2) { top: 14px; width: 6px; height: 6px; margin-left: -3px; }
.trail-gap span:nth-child(3) { top: 23px; }
.trail-gap.is-done span { background: rgba(110, 231, 168, 0.85); }

.node { position: relative; display: grid; justify-items: center; gap: 6px; width: 132px; padding: 0; background: none; border: 0; color: var(--ink); font-weight: 600; }
.node:hover { filter: none; }
.node-disc {
  position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(2, 19, 32, 0.55); border: 2px solid rgba(255, 255, 255, 0.28); color: rgba(234, 246, 255, 0.85);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.28); transition: transform 0.15s ease;
}
.node:hover .node-disc { transform: translateY(-3px); }
.node-label { font-size: 13px; line-height: 1.25; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); display: grid; }
.node-label small { font-size: 11px; font-weight: 700; color: var(--gold); }
.node-badge { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #04202f; border: 2px solid #062a45; }
.node.is-done .node-disc { background: linear-gradient(135deg, #34c9b6, #2392d4); border-color: rgba(255, 255, 255, 0.65); color: #04202f; }
.node.is-current { margin-top: 34px; }
.node.is-current .node-disc {
  width: 82px; height: 82px; background: var(--brand-gradient); color: #04202f; border-color: #fff;
  box-shadow: 0 0 0 6px rgba(249, 202, 79, 0.28), 0 8px 24px rgba(0, 0, 0, 0.4); animation: node-pulse 1.8s ease-in-out infinite;
}
.node.is-current .node-label { font-size: 15px; }
@keyframes node-pulse { 50% { box-shadow: 0 0 0 13px rgba(249, 202, 79, 0.1), 0 8px 24px rgba(0, 0, 0, 0.4); } }
.node-cta {
  position: absolute; top: -38px; left: 50%; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  padding: 6px 14px; border-radius: 10px; background: #fff; color: #04202f; font-size: 14px; font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); animation: cta-bob 1.8s ease-in-out infinite;
}
.node-cta::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
@keyframes cta-bob { 50% { transform: translate(-50%, -4px); } }
.node.is-test .node-disc { border-radius: 20px; border-style: dashed; border-color: rgba(255, 209, 102, 0.75); color: var(--gold); }
.node.is-test.is-done .node-disc { background: linear-gradient(135deg, #ffd166, #f2a93b); border-style: solid; border-color: #fff3cf; color: #3a2400; }
.node.is-test.is-current .node-disc { border-radius: 24px; border-style: solid; }
.node.is-exam .node-disc { width: 92px; height: 92px; background: radial-gradient(circle at 35% 30%, #ffe7a8, #f2a93b 60%, #b46f1a); border-color: #fff3cf; color: #3a2400; }
.node.is-exam .node-label { font-size: 15px; }

.dives { position: absolute; top: 10px; left: calc(50% + 66px); display: grid; gap: 8px; }
.trail-item.is-right .dives { left: auto; right: calc(50% + 66px); }
.dive-node { display: grid; justify-items: center; gap: 3px; padding: 0; background: none; border: 0; color: #d7ecff; font-size: 11px; font-weight: 600; }
.dive-node:hover { filter: none; }
.dive-disc { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(124, 196, 255, 0.18); border: 1.5px dashed rgba(190, 225, 255, 0.75); color: #eaf6ff; transition: transform 0.15s ease; }
.dive-node:hover .dive-disc { transform: translateY(-2px); }
.dive-node.is-played .dive-disc { border-style: solid; background: rgba(124, 196, 255, 0.35); }
.dive-node.is-locked { opacity: 0.55; }
.dive-stars { font-size: 10px; letter-spacing: 1px; color: var(--gold); }
.zone.is-final .trail { padding-top: 6px; }

.path-extras { margin-top: 22px; }
.extras { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-top: 8px; }
.extra { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.extra .icon { color: var(--accent); }
.extra.is-bonus .icon { color: var(--gold); }
.extra:hover { border-color: var(--accent); filter: none; }

@media (min-width: 900px) {
  .path { --amp: 1.6; }
}
@media (max-width: 560px) {
  .path { --amp: 0.72; }
  .path-hero { padding: 16px; gap: 12px; }
  .path-hero h2 { font-size: 19px; margin-bottom: 10px; }
  .path-hero .primary.big { width: 100%; justify-content: center; }
  .node { width: 108px; }
  .dives { left: calc(50% + 52px); }
  .trail-item.is-right .dives { right: calc(50% + 52px); }
  .zone-head { margin-left: 12px; margin-right: 12px; }
}

/* ================= Fokus-Modus: nur die Lektion, nichts drumherum ================= */
body.is-focus .topbar, body.is-focus > footer { display: none; }
body.is-focus main { max-width: 880px; padding-top: 0; }

/* ================= Lektion als Folge von Karten ================= */
.lesson-player { display: grid; gap: 10px; }
.player-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 8px 0 2px;
  background: linear-gradient(180deg, var(--deep) 75%, rgba(4, 32, 47, 0));
}
.player-close { width: 42px; height: 42px; flex: none; padding: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--ink); font-size: 18px; }
.player-close:hover { border-color: var(--accent); filter: none; }
.player-progress { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
/* Die Tippfläche ist höher als der sichtbare Balken */
.seg { position: relative; height: 36px; padding: 0; border: 0; background: none; }
.seg::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.14); }
.seg.is-done::before { background: var(--accent); }
.seg.is-current::before { background: linear-gradient(90deg, #fbd566, #f6b304); box-shadow: 0 0 10px rgba(249, 202, 79, 0.6); }
.seg:hover { filter: brightness(1.2); }
.player-count { min-width: 34px; text-align: right; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; display: grid; justify-items: end; }
.player-count .icon { color: var(--good); }
.player-crumb { margin: 0; color: var(--muted); font-size: 13px; }
.player-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: clamp(20px, 4vw, 34px);
  min-height: min(52vh, 460px); animation: card-in 0.25s ease;
}
@keyframes card-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.card-icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 18px; background: var(--brand-gradient); color: #04202f; box-shadow: 0 10px 26px rgba(249, 202, 79, 0.25); }
.card-question { margin: 6px 0 16px; font-size: clamp(24px, 4.2vw, 34px); line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.card-question.is-check { font-size: clamp(20px, 3.2vw, 26px); }
.card-task { margin: 8px 0 16px; font-size: clamp(19px, 3vw, 24px); line-height: 1.3; color: var(--ink); }
.card-text { margin: 0; max-width: 62ch; font-size: 18px; line-height: 1.6; color: #d6ecfa; }
.card-text.is-lead { font-size: 16px; margin: 6px 0 4px; }
.merksatz { margin: 14px 0 20px; font-size: clamp(21px, 3.4vw, 28px); font-weight: 700; line-height: 1.35; color: var(--ink); }
.player-card .formula { display: inline-block; font-size: 17px; }
.reveal { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 10px; font-size: 17px; }
.reveal li { animation: card-in 0.25s ease; }
.reveal li::marker { color: var(--accent); font-weight: 800; }
.reveal-next { font-size: 15px; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tips li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: rgba(2, 19, 32, 0.45); font-size: 16px; line-height: 1.45; }
.tips .icon { color: var(--good); margin-top: 1px; }
.player-card .options { gap: 10px; }
.player-card .option { font-size: 16px; padding: 14px 16px; }
.explanation.is-good { border-left-color: var(--good); background: rgba(110, 231, 168, 0.1); font-size: 15px; }
.explanation.is-bad { border-left-color: var(--warn); background: rgba(255, 180, 87, 0.1); font-size: 15px; }
.player-nav {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; gap: 12px;
  padding: 14px 0 max(14px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, var(--deep) 70%, rgba(4, 32, 47, 0));
}
.player-nav button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; font-size: 16px; border-radius: 12px; }
.player-nav .primary { min-width: 160px; }
.player-nav button:disabled { opacity: 0.45; }

.player-card.is-finish { display: grid; place-items: center; text-align: center; }
.finish { display: grid; justify-items: center; gap: 10px; max-width: 520px; }
.finish h2 { margin: 6px 0 0; font-size: clamp(26px, 4vw, 34px); color: var(--ink); }
.finish .hint { margin: 0; }
.finish-badge { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #04202f; box-shadow: 0 0 0 10px rgba(110, 231, 168, 0.18); animation: star-in 0.6s ease; }
.finish .primary.big { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; text-align: left; line-height: 1.3; }
.finish-more { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.finish-extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.finish-extras button { display: inline-flex; align-items: center; gap: 8px; }
.link-button { margin-top: 6px; background: none; border: 0; color: var(--accent); font-weight: 600; padding: 8px; }
.link-button:hover { text-decoration: underline; filter: none; }

/* Kapiteltest im Fokus-Modus: ohne Formular, mit Leiste zum Schließen */
.test-bar { display: none; }
.view.is-path-test .test-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 16px; }
.view.is-path-test #quiz-start, .view.is-path-test .card > h2, .view.is-path-test .card > .hint, .view.is-path-test .chip-chapter { display: none; }
.view.is-path-test .card { background: transparent; border: 0; padding: 12px 0 0; }

@media (max-width: 560px) {
  .player-nav .primary { min-width: 0; flex: 1; }
  .card-text { font-size: 17px; }
}

/* ================= 3D-Modelle der Ausrüstung ================= */
.model-stage {
  position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 42%, #9fd3e6 0%, #4c9fc0 34%, #1a5c80 68%, #0b3552 100%);
}
.model-title { position: absolute; top: 12px; left: 12px; z-index: 3; margin: 0; padding: 5px 13px; border-radius: 999px; font-size: 15px; font-weight: 700; color: var(--ink); background: rgba(2, 19, 32, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.viewer3d { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: min(54vh, 440px); }
.viewer3d-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9%; transition: opacity 0.35s ease; z-index: 1; }
.viewer3d model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.35s ease; background: transparent; --poster-color: transparent; --progress-bar-color: transparent; }
.viewer3d.is-ready model-viewer { opacity: 1; }
.viewer3d.is-ready .viewer3d-poster { opacity: 0; pointer-events: none; }
.viewer3d-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; padding: 3px 11px; border-radius: 999px; font-size: 12px; color: rgba(234, 246, 255, 0.85); background: rgba(2, 19, 32, 0.5); pointer-events: none; white-space: nowrap; }
.rig { position: absolute; right: 10px; bottom: 10px; z-index: 3; width: clamp(76px, 22%, 120px); display: grid; gap: 2px; justify-items: center; pointer-events: none; }
.rig svg { border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.rig span { font-size: 10px; font-weight: 600; color: rgba(234, 246, 255, 0.85); text-shadow: 0 1px 2px #000; }

/* ================= Grafiken auf schmalen Bildschirmen ================= */
.views { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 14px; }
.views::-webkit-scrollbar { display: none; }
.view-slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; }
.views.is-multi .view-slide { flex-basis: 90%; }
.view-slide .lesson-svg { width: min(100%, calc(318px * var(--ratio, 1))); aspect-ratio: var(--ratio, 1); height: auto; }
.view-dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); }
.view-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.view-dots span.is-on { background: var(--accent); }
.view-dots small { margin-left: 6px; font-size: 11px; }

/* Schrittlisten (Notfälle, Gesundheit) */
.steps { background: #0a2c40; border-radius: 14px; padding: 16px; }
.steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 18px; }
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps-list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; background: rgba(2, 19, 32, 0.55); border: 1px solid rgba(124, 196, 255, 0.45); }
.steps-list p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink); }
.steps-list strong { color: var(--accent-2); font-size: 15px; }
.steps-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #04202f; background: var(--accent-2); }
.steps-list li.is-accent { border-color: rgba(249, 202, 79, 0.6); }
.steps-list li.is-accent strong { color: var(--accent); }
.steps-list li.is-accent .steps-num { background: var(--accent); }
.steps-list li.is-bad { border-color: rgba(255, 118, 118, 0.6); }
.steps-list li.is-bad strong { color: var(--bad); }
.steps-list li.is-bad .steps-num { background: var(--bad); }

/* Lange Texte in den Kacheln: Beschriftung oben, Text darunter */
.lesson-readouts .tile.is-long { display: grid; gap: 3px; }
.lesson-readouts .tile.is-long .tile-value { text-align: left; font-size: 14.5px; font-weight: 500; line-height: 1.45; }

@media (max-width: 860px) {
  /* Erst die Grafik, direkt darunter die Regler, dann Hinweis und Werte */
  .lesson-lab { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .lesson-lab > *, [data-graphic] { min-width: 0; }
  .lesson-figure, .lesson-side { display: contents; }
  [data-graphic] { order: 1; }
  .lesson-lab .controls { order: 2; margin: 0; }
  .lesson-note { order: 3; margin: 0; min-height: 0; }
  .lesson-readouts { order: 4; }
  /* Viele Auswahlknöpfe: eine Leiste zum Wischen statt vier Zeilen */
  .segmented.is-long { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px 2px; scroll-snap-type: x proximity; }
  .segmented.is-long::-webkit-scrollbar { display: none; }
  .segmented.is-long button { flex: none; white-space: nowrap; scroll-snap-align: center; }
  .card-text.is-lead { font-size: 15px; line-height: 1.5; }
  /* Schrittlisten: erst die Situation wählen, dann lesen */
  .lesson-lab.is-list .controls { order: 0; }
  /* Tippflächen */
  .lesson-lab input[type="range"] { height: 42px; }
  .segmented button { min-height: 42px; }
}

/* ================= Bedienung mit dem Finger ================= */
@media (pointer: coarse) {
  input[type="range"] { height: 42px; }
  .segmented button { min-height: 42px; }
  .ghost-link { display: inline-block; padding: 11px 4px; }
  select, input:not([type="range"]) { min-height: 44px; font-size: 16px; }   /* 16 px verhindert das Hineinzoomen in iOS */
}

/* ================= Handy: Navigation unten mit Symbolen ================= */
.tab .icon { display: none; }
.tab-short { display: none; }
@media (max-width: 720px) {
  .topbar { padding-bottom: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(2, 19, 32, 0.94); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; overflow: visible;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px;
    padding: 5px 6px max(5px, env(safe-area-inset-bottom)); background: rgba(2, 16, 28, 0.97); border-top: 1px solid var(--line);
  }
  .tab { display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 7px 2px 5px; font-size: 10.5px; font-weight: 600; border: 0; border-radius: 12px; }
  .tab .icon { display: block; }
  .tab-long, .tab-note { display: none; }
  .tab-short { display: block; }
  .tab.is-active { background: rgba(249, 202, 79, 0.14); border: 0; }
  main { padding-bottom: 92px; }
  body > footer { padding-bottom: 96px; }
  .xp-toasts { top: 10px; right: 10px; }
  .xp-toast { font-size: 13px; padding: 6px 12px; }
}

/* Tastaturhinweise nur dort zeigen, wo es eine Tastatur gibt */
@media (pointer: coarse) {
  button kbd, .ok-button kbd { display: none; }
}

/* ================= Titelbild auf der ersten Karte einer Lektion ================= */
.card-intro { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: clamp(18px, 3vw, 30px); align-items: center; }
.card-cover { position: relative; margin: 0; border-radius: 18px; overflow: hidden; aspect-ratio: 1 / 1; background: #0a2c40; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover-icon { position: absolute; left: 12px; bottom: 12px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-gradient); color: #04202f; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.card-intro .card-question { margin-top: 0; }
@media (max-width: 700px) {
  .card-intro { grid-template-columns: 1fr; gap: 16px; }
  .card-cover { aspect-ratio: 16 / 10; }
}

/* Foto zur gewählten Situation (Notfälle, Gesundheit) */
.steps-photo { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 40%; border-radius: 12px; margin-bottom: 14px; background: #06202f; }

/* ================= Auftritt: Schriftzug statt Logo ================= */
.wordmark { display: flex; align-items: baseline; gap: 0.32em; font-size: 21px; line-height: 1.1; letter-spacing: 0.01em; }
.wordmark span { font-weight: 400; color: var(--ink); }
.wordmark strong { font-weight: 800; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.brand { padding-left: 14px; border-left: 3px solid var(--accent); }
.footer-school { color: var(--ink); font-size: 13px; }
.footer-school strong { font-weight: 700; }
@media (max-width: 560px) {
  .wordmark { font-size: 17px; }
  .brand { padding-left: 10px; }
}

/* ================= Farben und Schrift angelehnt an tauchsportcenter-hagen.de ================= */
.topbar { border-top: 4px solid var(--accent-strong); }
h1, h2, h3, button, .tab, .node-label { font-family: "Montserrat", "Segoe UI", system-ui, sans-serif; }
h2, h3, .card-question, .merksatz { font-weight: 700; }
button { color: #111; }
button.ghost, button.round, .option, .segmented button, .extra, .step, .node, .dive-node, .player-close, .link-button, .seg { color: var(--ink); }
.segmented button[aria-pressed="true"], button.primary, .node-cta { color: #111; }
.link-button, .ghost-link { color: var(--accent); }
.tab.is-active { color: var(--accent); }
.wordmark strong { color: var(--accent); }
