@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url(fonts/atkinson-next-latin.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* Farbschemata – per Verwaltung oder Geräte-Einstellungen umschaltbar */
:root, body[data-thema="dunkel"] {
  --bg: #000; --fg: #fff; --fl: #161616; --fl2: #262626; --linie: #fff;
  --akzent: #ffd60a; --auf-akzent: #000; --ja: #2fd16b; --nein: #ff5a4f; --gedimmt: #d6d6d6;
}
body[data-thema="gelb"] {
  --bg: #000; --fg: #ffe600; --fl: #141400; --fl2: #262600; --linie: #ffe600;
  --akzent: #fff; --auf-akzent: #000; --ja: #2fd16b; --nein: #ff5a4f; --gedimmt: #f0e070;
}
body[data-thema="hell"] {
  --bg: #fff; --fg: #000; --fl: #f0f0f0; --fl2: #e2e2e2; --linie: #000;
  --akzent: #0038b8; --auf-akzent: #fff; --ja: #0b7a35; --nein: #b3161b; --gedimmt: #333;
}
body[data-thema="blau"] {
  --bg: #001a4d; --fg: #fff; --fl: #0a2a66; --fl2: #143a80; --linie: #fff;
  --akzent: #ffd60a; --auf-akzent: #000; --ja: #2fd16b; --nein: #ff7a70; --gedimmt: #dfe6f5;
}

:root { --s: 1; --rand: max(16px, 2.2vmin); }
* { box-sizing: border-box; }
html { font-size: calc(22px * var(--s)); }
@media (min-width: 900px) { html { font-size: calc(26px * var(--s)); } }

body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font-family: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  line-height: 1.35; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .voll { fill: currentColor; stroke: none; }
a { color: var(--akzent); }
[hidden] { display: none !important; }
:focus-visible { outline: 5px solid var(--akzent); outline-offset: 4px; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Kopfzeile ---------- */
.kopf {
  display: flex; align-items: center; gap: 16px; padding: var(--rand) var(--rand) 8px;
  padding-top: max(var(--rand), env(safe-area-inset-top));
}
.titel { flex: 1; margin: 0; font-size: 1.7rem; text-align: center; }
.uhr { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; line-height: 1.1; }
#uhrzeit { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#datum { font-size: 1.05rem; color: var(--gedimmt); }
body.start .uhr { align-items: center; margin: 0 auto; }
body.start .titel { display: none; }
body.start #uhrzeit { font-size: 3.6rem; }
body.start #datum { font-size: 1.3rem; }

.zurueck {
  display: flex; align-items: center; gap: 6px; min-height: 88px; padding: 0 28px 0 16px;
  border: 4px solid var(--linie); border-radius: 22px; background: var(--fl); font-size: 1.4rem; font-weight: 700;
}
.zurueck svg { font-size: 1.8rem; stroke-width: 3; }

main { flex: 1; display: flex; flex-direction: column; padding: 0 var(--rand) calc(var(--rand) + 170px); }
.screen { display: none; flex-direction: column; gap: 18px; }
.screen.aktiv { display: flex; }

/* ---------- Start ---------- */
#s-start { flex: 1; justify-content: space-between; gap: 2vh; padding-bottom: 0; min-height: 0; }
body.start main { padding-bottom: var(--rand); }
body.start #app { height: 100dvh; }
body.start main { min-height: 0; }
@media (max-height: 760px) { body.start #uhrzeit { font-size: 2.6rem; } .kachel svg { font-size: 3.2rem; } }
.dialog { flex: 1; min-height: 2.8em; display: flex; flex-direction: column; justify-content: center; gap: 10px; text-align: center; overflow: auto; }
.dialog .antwort { font-size: 1.6rem; margin: 0; }
.du { color: var(--gedimmt); font-size: 1.15rem; margin: 0; font-style: italic; }
.du:empty { display: none; }
.du::before { content: "Sie: „"; } .du::after { content: "“"; }
body.duzen .du::before { content: "Du: „"; }

.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--rand); }
@media (max-width: 640px) { .kacheln { grid-template-columns: 1fr; } }
.kachel {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: clamp(120px, 22vh, 260px); padding: 16px; border: 5px solid var(--linie); border-radius: 30px; background: var(--fl);
  font-size: 1.6rem; font-weight: 700;
}
@media (max-width: 640px) { .kachel { flex-direction: row; min-height: 120px; justify-content: flex-start; gap: 24px; } }
.kachel svg { font-size: 4.2rem; stroke-width: 1.7; }
.kachel:active, .knopf:active, .zeile-knopf:active { transform: scale(0.97); background: var(--fl2); }
.badge {
  position: absolute; top: 14px; right: 14px; min-width: 64px; height: 64px; padding: 0 14px; border-radius: 32px;
  background: var(--akzent); color: var(--auf-akzent); font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
}

/* ---------- Sprechknopf ---------- */
.mikro {
  position: fixed; z-index: 20; right: var(--rand); bottom: max(var(--rand), env(safe-area-inset-bottom));
  width: 150px; height: 150px; border-radius: 50%; border: 0; padding: 0;
  background: var(--akzent); color: var(--auf-akzent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 10px var(--akzent);
}
.mikro svg { font-size: 3.4rem; stroke-width: 2.2; position: relative; z-index: 1; }
.mikro-text { font-size: 0.85rem; font-weight: 800; position: relative; z-index: 1; }
body.start .mikro {
  position: relative; right: auto; bottom: auto; align-self: center; margin: 0 auto;
  width: clamp(150px, 28vmin, 300px); height: clamp(150px, 28vmin, 300px);
}
body.start .mikro svg { font-size: min(14vmin, 7rem); }
body.start .mikro-text { font-size: 1.3rem; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 8px solid var(--akzent); opacity: 0; pointer-events: none; }
body.hoeren .ring { opacity: 1; transform: scale(var(--pegel, 1.08)); transition: transform 80ms linear; }
body.hoeren .mikro { background: var(--fg); color: var(--bg); }
body.denken .ring { opacity: 1; border-color: var(--fg) transparent var(--fg) transparent; animation: drehen 1s linear infinite; inset: -14px; }
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body.denken .ring { animation-duration: 3s; } }

#mikro-platz { display: flex; justify-content: center; padding: 1vh 0; }

/* ---------- Abschnitte, Listen, Knöpfe ---------- */
.abschnitt { font-size: 1.3rem; margin: 18px 0 0; color: var(--gedimmt); }
.gross { font-size: 1.7rem; font-weight: 700; margin: 0; }
.klein { font-size: 1.1rem; margin: 0; color: var(--gedimmt); }
.liste { display: flex; flex-direction: column; gap: 14px; }
.liste.zeilen { flex-direction: row; flex-wrap: wrap; }
.zeile-knopf {
  display: flex; align-items: center; gap: 20px; width: 100%; min-height: 100px; padding: 16px 22px; text-align: left;
  border: 4px solid var(--linie); border-radius: 22px; background: var(--fl); font-size: 1.35rem; font-weight: 700;
}
.liste.zeilen .zeile-knopf { width: auto; flex: 1 1 260px; }
.zeile-knopf.gewaehlt { background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent); }
.zeile-knopf svg { font-size: 2.6rem; flex: none; }
.zeile-knopf .unter { display: block; font-size: 1rem; font-weight: 400; color: var(--gedimmt); margin-top: 4px; }
.zeile-knopf.gewaehlt .unter { color: inherit; }
.zeile-knopf .zahl { margin-left: auto; min-width: 56px; height: 56px; border-radius: 28px; padding: 0 12px; background: var(--akzent); color: var(--auf-akzent); display: flex; align-items: center; justify-content: center; }
.vorschau { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; flex: none; background: var(--fl2); }

.steuerung { display: flex; gap: var(--rand); justify-content: center; flex-wrap: wrap; }
.knopf {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: 140px; min-height: 140px; padding: 14px 18px; border: 4px solid var(--linie); border-radius: 28px;
  background: var(--fl); font-size: 1.1rem; font-weight: 700;
}
.knopf svg { font-size: 3.4rem; }
.knopf.haupt { background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent); min-width: 190px; }
.knopf.breit { flex: 1; flex-direction: row; gap: 18px; font-size: 1.5rem; }
.knopf.flach { min-height: 100px; flex-direction: row; gap: 14px; font-size: 1.2rem; }
.knopf.flach svg { font-size: 2.4rem; }
.knopf.ja { background: var(--ja); border-color: var(--ja); color: #000; flex: 1; font-size: 1.5rem; }
.knopf.nein { background: var(--nein); border-color: var(--nein); color: #000; flex: 1; font-size: 1.5rem; }
.steuerung.unten { position: sticky; bottom: 0; padding: 14px 170px 14px 0; background: var(--bg); }

/* ---------- Player ---------- */
.player { display: flex; flex-direction: column; gap: 14px; padding: 22px; border: 4px solid var(--linie); border-radius: 30px; background: var(--fl); }
.fortschritt { height: 22px; border-radius: 11px; background: var(--fl2); overflow: hidden; border: 2px solid var(--linie); }
#hb-balken { height: 100%; width: 0; background: var(--akzent); }
.video-rahmen { position: relative; width: 100%; aspect-ratio: 16/9; max-height: 58vh; background: #000; border-radius: 18px; overflow: hidden; }
.video-rahmen iframe, #yt-player, #mt-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

/* ---------- Nachrichten ---------- */
.verlauf { display: flex; flex-direction: column; gap: 16px; }
.blase { max-width: 88%; padding: 16px 20px; border-radius: 24px; border: 3px solid var(--linie); background: var(--fl); font-size: 1.35rem; text-align: left; user-select: text; }
.blase.ich { align-self: flex-end; background: var(--fl2); }
.blase.neu { border-color: var(--akzent); border-width: 5px; }
.blase .wer { display: block; font-size: 1rem; color: var(--gedimmt); margin-bottom: 4px; font-weight: 700; }
.blase img { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 14px; margin: 6px 0; background: #000; }
.blase .knopfreihe { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.blase .knopfreihe .knopf { min-height: 84px; min-width: 0; flex: 1; flex-direction: row; font-size: 1.1rem; }
.blase .knopfreihe .knopf svg { font-size: 2rem; }
.blase .beschreibung { font-size: 1.15rem; font-style: italic; margin: 8px 0 0; }

/* ---------- Sprechblase, Hinweis ---------- */
.sprechblase {
  position: fixed; z-index: 15; left: var(--rand); right: calc(var(--rand) + 180px); bottom: max(var(--rand), env(safe-area-inset-bottom));
  padding: 18px 24px; border-radius: 26px; background: var(--fg); color: var(--bg); font-size: 1.45rem; max-height: 45vh; overflow: auto;
  box-shadow: 0 0 0 4px var(--bg);
}
.sprechblase p { margin: 0; }
.sprechblase .du { color: inherit; opacity: .75; font-size: 1.05rem; margin-bottom: 6px; }
body.start .sprechblase { display: none !important; }

.hinweis {
  position: fixed; z-index: 25; top: var(--rand); left: var(--rand); right: var(--rand);
  display: flex; align-items: center; gap: 20px; padding: 18px 22px; border-radius: 26px;
  background: var(--akzent); color: var(--auf-akzent); font-size: 1.5rem; font-weight: 700; box-shadow: 0 0 0 5px var(--bg);
}
.hinweis span { flex: 1; }
.hinweis .knopf { background: var(--auf-akzent); color: var(--akzent); border-color: var(--auf-akzent); min-height: 96px; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.overlay.mitte { align-items: center; justify-content: center; padding: var(--rand); background: rgba(0,0,0,.85); }
.karte { width: min(900px, 100%); padding: 32px; border-radius: 30px; border: 5px solid var(--linie); background: var(--bg); display: flex; flex-direction: column; gap: 22px; }
.karte .gross { font-size: 1.9rem; user-select: text; }
.bild-buehne { flex: 1; overflow: hidden; position: relative; touch-action: none; background: #000; }
.bild-buehne img { position: absolute; left: 50%; top: 50%; max-width: 100%; max-height: 100%; transform-origin: center; }
.bild-buehne.kontrast img { filter: contrast(1.6) saturate(1.4) brightness(1.1); }
.bild-buehne.umgekehrt img { filter: invert(1) contrast(1.5) grayscale(0.3); }
.bild-text { margin: 0; padding: 16px var(--rand); font-size: 1.4rem; max-height: 28vh; overflow: auto; border-top: 4px solid var(--linie); }
.steuerung.leiste { padding: var(--rand); gap: 12px; border-top: 4px solid var(--linie); }
.steuerung.leiste .knopf { flex: 1; min-width: 120px; min-height: 120px; }

/* ---------- Kinomodus: Video bildschirmfüllend, große Knöpfe bleiben sichtbar ---------- */
body.kino { overflow: hidden; }
body.kino .kopf, body.kino #yt-titel, body.kino #s-youtube .abschnitt, body.kino #s-youtube .liste { display: none !important; }
body.kino .video-rahmen { position: fixed; inset: 0 0 160px 0; width: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; z-index: 10; }
body.kino #yt-bereich .steuerung { position: fixed; left: 0; right: 0; bottom: 0; height: 160px; z-index: 11; padding: 10px 180px 10px var(--rand); background: #000; justify-content: flex-start; flex-wrap: nowrap; }
body.kino #yt-bereich .steuerung .knopf { min-height: 136px; min-width: 120px; padding: 8px; }
body.kino .mikro { z-index: 12; }
body.kino .sprechblase { z-index: 13; bottom: 172px; }

/* Eingabefelder (nur in den Geräte-Einstellungen) */
input, textarea { user-select: text; -webkit-user-select: text; }
.feld { width: 100%; min-height: 90px; padding: 12px 20px; font: inherit; font-size: 1.5rem; color: var(--fg); background: var(--fl); border: 4px solid var(--linie); border-radius: 22px; }
.feld:focus { outline: 5px solid var(--akzent); outline-offset: 2px; }

/* Live-Fernsehen: bewusst zurückhaltend, zugeklappt */
details.dezent { margin-top: 28px; }
details.dezent summary { cursor: pointer; font-size: 1.15rem; color: var(--gedimmt); padding: 14px 4px; list-style-position: inside; }
details.dezent[open] summary { margin-bottom: 10px; }
details.dezent .zeile-knopf { min-height: 80px; font-size: 1.15rem; }
.vorschau.symbol { display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--gedimmt); }

/* Anhalten-Leiste (auf Seiten ohne eigene Steuerung) */
.laeuft-leiste {
  display: flex; align-items: center; gap: 18px; margin: 0 var(--rand) 12px; min-height: 96px; padding: 10px 24px;
  border: 4px solid var(--akzent); border-radius: 24px; background: var(--fl); font-size: 1.4rem; font-weight: 700; text-align: left;
}
.laeuft-leiste svg { font-size: 2.6rem; flex: none; color: var(--akzent); }
.laeuft-leiste span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.kino .laeuft-leiste { display: none !important; }
/* Zeitanzeige im Video */
.zeitanzeige { align-self: center; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 7.5em; text-align: center; }
.zeitanzeige:empty { display: none; }
body.kino #yt-bereich .steuerung .zeitanzeige { color: #fff; font-size: 1.1rem; min-width: 6em; }
body.start.laeuft .mikro { width: clamp(130px, 22vmin, 240px); height: clamp(130px, 22vmin, 240px); }
body.start.laeuft .kachel { min-height: clamp(100px, 17vh, 220px); }
body.start.laeuft #mikro-platz { padding: 0; }

/* Auswahl-Overlay */
#auswahl .karte { max-height: 92vh; overflow: auto; }
.nummer { flex: none; width: 64px; height: 64px; border-radius: 32px; background: var(--akzent); color: var(--auf-akzent); font-size: 1.8rem; display: flex; align-items: center; justify-content: center; }

/* Ohne Textanzeige: Start nur mit Uhr, Sprechknopf und Kacheln */
body.ohne-text .dialog { display: none; }
body.ohne-text #s-start { justify-content: space-evenly; }
body.ohne-text.start #mikro-platz { padding: 2vh 0; }
body.ohne-text.start .mikro { width: clamp(170px, 36vmin, 340px); height: clamp(170px, 36vmin, 340px); }
body.ohne-text.start.laeuft .mikro { width: clamp(140px, 28vmin, 280px); height: clamp(140px, 28vmin, 280px); }

/* Usability-Test 16.10.: Kapitelname groß, Empfänger groß, Video-Knöpfe größer und mittig */
#hb-kapitel { font-size: 1.35rem; color: var(--fg); font-weight: 700; }
#best-an { font-size: 1.4rem; color: var(--fg); font-weight: 700; }
body.kino #yt-bereich .steuerung { justify-content: center; }
body.kino #yt-bereich .steuerung .knopf { min-width: 150px; }
