:root {
  --bg: #f4f5f3;
  --flaeche: #ffffff;
  --flaeche-2: #eceeeb;
  --text: #1a1d1c;
  --text-2: #545c59;
  --rand: #d3d8d4;
  --akzent: #0e6a6a;
  --akzent-text: #ffffff;
  --akzent-weich: #dcefee;
  --ich: #e3edf7;
  --ich-text: #13283d;
  --gut: #2f6b3a;
  --gut-weich: #e2f0e4;
  --stopp: #a3271f;
  --stopp-weich: #fbe5e2;
  --aus: #b9b1a6;
  --bot: #6b4fa0;
  --bot-weich: #ece6f6;
  --radius: 12px;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131615;
    --flaeche: #1c201f;
    --flaeche-2: #262b29;
    --text: #eaefec;
    --text-2: #a9b3af;
    --rand: #353c39;
    --akzent: #5cc8bf;
    --akzent-text: #0b1b1a;
    --akzent-weich: #173533;
    --ich: #1f3347;
    --ich-text: #dbe9f7;
    --gut: #7cc78a;
    --gut-weich: #1f3324;
    --stopp: #f08a80;
    --stopp-weich: #3d1f1c;
    --aus: #5a534a;
    --bot: #b9a2e6;
    --bot-weich: #2b2438;
    --schatten: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131615;
  --flaeche: #1c201f;
  --flaeche-2: #262b29;
  --text: #eaefec;
  --text-2: #a9b3af;
  --rand: #353c39;
  --akzent: #5cc8bf;
  --akzent-text: #0b1b1a;
  --akzent-weich: #173533;
  --ich: #1f3347;
  --ich-text: #dbe9f7;
  --gut: #7cc78a;
  --gut-weich: #1f3324;
  --stopp: #f08a80;
  --stopp-weich: #3d1f1c;
  --aus: #5a534a;
  --bot: #b9a2e6;
  --bot-weich: #2b2438;
  --schatten: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.25rem; margin: 0 0 0.6em; }
p { margin: 0.4em 0; }
h3 { font-size: 1.05rem; margin: 0.8em 0 0.4em; }
a { color: var(--akzent); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.klein { font-size: 0.88rem; color: var(--text-2); }
.lead { color: var(--text-2); max-width: 62ch; }
.fehler { color: var(--stopp); font-size: 0.92rem; }
.gut { color: var(--gut); }
.zeile { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.zeile.rechts { justify-content: flex-end; }
.zeile.weit { justify-content: space-between; }
.stapel > * + * { margin-top: 1rem; }

/* ---------- Kopf ---------- */

.kopf {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.6rem 16px; border-bottom: 1px solid var(--rand); background: var(--flaeche);
}
.marke {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem;
}
.kopf nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.kopf nav a { font-size: 0.9rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1.2rem 16px 3rem; }

/* ---------- Elemente ---------- */

button {
  font: inherit; cursor: pointer; border: 1px solid var(--akzent);
  background: var(--akzent); color: var(--akzent-text);
  padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.zweit { background: transparent; color: var(--akzent); }
button.gefahr { background: transparent; color: var(--stopp); border-color: var(--stopp); }
button.link {
  background: none; border: none; padding: 0; color: var(--akzent);
  font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--akzent); outline-offset: 2px;
}
input, textarea, select {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 8px; padding: 0.5rem 0.7rem; min-width: 0;
}
textarea { width: 100%; resize: vertical; }
label { font-weight: 600; }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--schatten);
}
.hinweis {
  background: var(--akzent-weich); border-radius: 8px; padding: 0.7rem 0.9rem;
  margin: 0.8rem 0; font-size: 0.95rem;
}
.hinweis.ki { background: var(--bot-weich); }
.badge {
  display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.55rem;
  border-radius: 999px; background: var(--flaeche-2); color: var(--text-2); vertical-align: middle;
}
.badge.an { background: var(--akzent-weich); color: var(--akzent); }
.badge.bot { background: var(--bot-weich); color: var(--bot); }
.badge.stopp { background: var(--stopp-weich); color: var(--stopp); }
.badge.gut { background: var(--gut-weich); color: var(--gut); }

/* ---------- Start ---------- */

.start { max-width: 600px; margin: 1rem auto; padding: 1.5rem; }
.start h1 { text-align: center; }
.logo { display: block; margin: 0 auto 0.5rem; }
.formular { margin-top: 1rem; }
.formular label { display: block; margin-bottom: 0.3rem; }
.formular input { flex: 1; }
.code-feld { text-transform: uppercase; letter-spacing: 0.05em; }
.wahl { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 1rem; }

/* ---------- Runde / Chat ---------- */

.runde { max-width: 760px; margin: 0 auto; }
.rolle {
  border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 0.8rem;
  background: var(--akzent-weich);
}
.rolle strong { display: block; font-size: 1.1rem; }
.uhr {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.2rem;
  padding: 0.15rem 0.6rem; border-radius: 8px; background: var(--flaeche); border: 1px solid var(--rand);
}
.uhr.knapp { color: var(--stopp); border-color: var(--stopp); }
.balken { height: 6px; border-radius: 3px; background: var(--flaeche-2); overflow: hidden; margin: 0.5rem 0 0; }
.balken > span { display: block; height: 100%; background: var(--akzent); transition: width 0.5s linear; }

.chat {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); display: flex; flex-direction: column;
}
.verlauf {
  overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem;
  height: 52vh; min-height: 260px;
}
.verlauf.kurz { height: auto; max-height: 50vh; min-height: 0; }
.blase { max-width: 82%; padding: 0.45rem 0.8rem; border-radius: 14px; background: var(--flaeche-2);
  align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; border-top-left-radius: 4px; }
.blase.ich { align-self: flex-end; background: var(--ich); color: var(--ich-text);
  border-top-left-radius: 14px; border-top-right-radius: 4px; }
.blase.system { align-self: center; background: none; color: var(--text-2); font-size: 0.85rem; text-align: center; }
.tippt { color: var(--text-2); font-size: 0.88rem; padding: 0 1rem 0.4rem; min-height: 1.6em; }
.tippt span { animation: puls 1.2s ease-in-out infinite; }
@keyframes puls { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .tippt span { animation: none; } .balken > span { transition: none; } }
.chat-form { border-top: 1px solid var(--rand); padding: 0.6rem; display: flex; gap: 0.5rem; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 2.6rem; }
.zaehler { font-size: 0.78rem; color: var(--text-2); }

.urteil { max-width: 560px; margin: 0 auto; }
.knopfwahl { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.knopfwahl button {
  background: var(--flaeche); color: var(--text); border: 2px solid var(--rand); padding: 0.8rem; font-size: 1.05rem;
}
.knopfwahl button[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-weich); color: var(--akzent); }
.knopfwahl.gross button { font-size: 1.3rem; padding: 1.1rem; }
.aufloesung { text-align: center; padding: 1.5rem 1rem; }
.aufloesung .gross { font-size: 1.6rem; font-weight: 700; margin: 0.3rem 0; }
.aufloesung .symbol { font-size: 2.6rem; line-height: 1; }

/* ---------- Team ---------- */

.tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--rand); margin: 1rem 0; flex-wrap: wrap; }
.tabs button {
  background: none; color: var(--text-2); border: none; border-bottom: 3px solid transparent;
  border-radius: 0; padding: 0.5rem 0.8rem;
}
.tabs button[aria-selected="true"] { color: var(--akzent); border-bottom-color: var(--akzent); }
.zwei { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.feld { margin-bottom: 0.9rem; }
.feld label { display: block; }
.feld .klein { margin: 0.1rem 0 0.3rem; }
.vorschau {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem;
  background: var(--flaeche-2); border-radius: 8px; padding: 0.7rem; max-height: 320px; overflow: auto; margin: 0.4rem 0;
}
.quote { display: grid; grid-template-columns: 3.2rem 1fr 4.5rem; gap: 0.5rem; align-items: center; margin: 0.35rem 0; }
.quote .spur { height: 1.1rem; background: var(--flaeche-2); border-radius: 4px; overflow: hidden; }
.quote .spur > span { display: block; height: 100%; background: var(--akzent); }
.quote .wert { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.liste { padding-left: 1.2rem; margin: 0.4rem 0; }
.liste li + li { margin-top: 0.3rem; }
details.verlauf-box { border: 1px solid var(--rand); border-radius: 8px; padding: 0.5rem 0.8rem; margin: 0.5rem 0; background: var(--flaeche); }
details.verlauf-box summary { cursor: pointer; font-weight: 600; }
.tipp { border-left: 4px solid var(--akzent); padding: 0.4rem 0.8rem; margin: 0.6rem 0; background: var(--flaeche-2); border-radius: 0 8px 8px 0; }

/* ---------- Lehrperson ---------- */

.phasen { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.phasen button { background: var(--flaeche); color: var(--text); border-color: var(--rand); }
.phasen button[aria-current="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.kennzahlen { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 1rem 0; }
.kennzahlen .karte strong { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.tabelle-wrap { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tabelle th, .tabelle td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.dialog {
  border: none; border-radius: var(--radius); padding: 1.2rem; max-width: 640px; width: calc(100% - 32px);
  background: var(--flaeche); color: var(--text);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.schmal { max-width: 440px; margin: 2rem auto; }

/* ---------- Beamer ---------- */

body.beamer main { max-width: 1400px; }
.beamer-seite { font-size: 1.35rem; }
.beamer-seite h1 { font-size: 2.4rem; }
.beamer-seite h2 { font-size: 1.7rem; }
.beamer-seite .quote { grid-template-columns: minmax(8rem, 14rem) 1fr 6rem; }
.beamer-seite .quote .spur { height: 1.8rem; }
.wolke { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; align-items: baseline; }
.wolke span { font-weight: 700; color: var(--akzent); }
.wolke.bot span { color: var(--bot); }
.spalten { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.gross-zahl { font-size: 3.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

.text-seite { max-width: 720px; }

@media (max-width: 820px) {
  .zwei { grid-template-columns: minmax(0, 1fr); }
  .verlauf { height: 48vh; }
  .blase { max-width: 92%; }
  .beamer-seite { font-size: 1.1rem; }
}
.voll { width: 100%; }
.sr-reset { border: 0; padding: 0; margin: 0; min-width: 0; }
.abstand-oben { margin-top: 0.6rem; }
.knopf-link {
  display: inline-block; background: var(--akzent); color: var(--akzent-text); padding: 0.5rem 1rem;
  border-radius: 8px; text-decoration: none; font-weight: 600;
}
.untertitel { text-align: center; font-weight: 600; color: var(--akzent); margin-top: -0.3rem; }
.beamer-seite .klein, .beamer-seite .quote .wert, .beamer-seite .tabs button { font-size: 0.9em; }
.beamer-seite .blase { font-size: 1em; }
.beamer-seite .verlauf.kurz { max-height: none; }
