/* Abenteuer-Modus (js/abenteuer.js): Aufgaben-Anzeige und Gesprächsfenster im Stil der Menüs */
#aufgabe {
  position: fixed; top: 58px; right: 12px; z-index: 30; max-width: min(320px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 11px;
  background: rgba(27, 35, 51, 0.92); color: #f4f4f4; border: 2px solid #141414; border-left: 6px solid #ffd400;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); font: 14px/1.45 system-ui, sans-serif; pointer-events: none;
}
#aufgabe b { font: 800 16px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase; color: #ffd400; letter-spacing: 0.02em; }
#aufgabe span { white-space: pre-line; }
#aufgabe-kapitel {
  pointer-events: auto; align-self: flex-start; margin-top: 4px; padding: 3px 9px; cursor: pointer;
  background: transparent; color: #ffd400; border: 2px solid #ffd400; font: 700 12px/1.2 system-ui, sans-serif;
}
#aufgabe-kapitel:hover, #aufgabe-kapitel:focus-visible { background: #ffd400; color: #141414; }

/* Story-Modus: Kapitel geschafft und Kapitelübersicht */
#kapitel-geschafft, #kapitel-uebersicht {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 14, 22, 0.6); animation: dialog-auf 0.2s ease-out;
}
#kapitel-geschafft.hidden, #kapitel-uebersicht.hidden { display: none; }
.kg-karte {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; padding: 18px 22px 16px;
  background: #fffdf3; color: #141414; border: 3px solid #141414; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.4); font: 15px/1.5 system-ui, sans-serif;
}
.kg-karte h2 { margin: 2px 0 8px; font: 800 30px/1.05 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase; }
#kg-nr { font: 700 13px/1 system-ui, sans-serif; color: #6a6a6a; text-transform: uppercase; letter-spacing: 0.05em; }
.kg-geschafft { display: inline-block; margin-left: 8px; padding: 2px 8px; background: #45c46a; border: 2px solid #141414; font: 800 14px/1.2 "Barlow Condensed", sans-serif; text-transform: uppercase; }
#kg-gelernt { margin: 4px 0 14px; padding-left: 20px; }
#kg-gelernt li { margin: 3px 0; }
#kg-weiter, #ku-zu {
  display: block; width: 100%; padding: 10px 14px; cursor: pointer; background: #ffd400; color: #141414; border: 3px solid #141414;
  font: 800 18px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase; box-shadow: 0 4px 0 #141414;
}
#kg-weiter:focus-visible, #ku-zu:focus-visible { outline: 3px solid #5fb4ff; outline-offset: 2px; }
#ku-liste { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
#ku-liste li { padding: 7px 10px; border: 2px solid #141414; background: #fff; display: grid; gap: 2px; }
#ku-liste li.fertig { background: #e4f6e9; }
#ku-liste .ku-intro { justify-self: start; margin-top: 4px; font: 700 13px/1 system-ui, sans-serif; padding: 5px 9px; border: 2px solid #141414; background: #ffd400; cursor: pointer; }
#ku-liste .ku-intro:hover, #ku-liste .ku-intro:focus-visible { background: #ffe25c; }
#ku-liste .ku-regel { font-size: 13px; color: #2a5d36; font-style: italic; }
#ku-liste li.jetzt { background: #fff3b0; }
#ku-liste li.zu { color: #8a8a8a; background: #f0eee6; }
#ku-liste span { font-size: 13px; }

#dialog {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40;
  width: min(700px, calc(100vw - 24px)); box-sizing: border-box; padding: 14px 18px 12px;
  display: flex; gap: 14px; align-items: flex-start;
  background: #fffdf3; color: #141414; border: 3px solid #141414; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  font: 16px/1.5 system-ui, sans-serif; cursor: pointer; animation: dialog-auf 0.18s ease-out;
}
#dialog.hidden { display: none; }
#dialog-bild { width: 84px; height: 84px; flex: none; object-fit: contain; image-rendering: pixelated; background: #1b2333; border: 3px solid #141414; margin-top: 4px; }
#dialog.ich #dialog-bild { order: 2; }   /* eigene Antworten: Bild rechts */
#dialog.ich #dialog-name { background: #5fb4ff; }
.dialog-rechts { flex: 1; min-width: 0; }
#dialog-name {
  position: absolute; top: -16px; left: 14px; padding: 3px 10px; background: #ffd400; border: 2px solid #141414;
  font: 800 16px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase;
}
/* 🔊 oben rechts am Gespräch: Vorlesen an/aus (sprache.js) */
#dialog-vorlesen {
  position: absolute; top: -16px; right: 14px; width: 34px; height: 30px; padding: 0; display: grid; place-items: center;
  background: #fffdf3; border: 2px solid #141414; font-size: 16px; line-height: 1; cursor: pointer;
}
#dialog-vorlesen[aria-pressed="true"] { background: #ffd400; }
#dialog-vorlesen:focus-visible { outline: 3px solid #5fb4ff; outline-offset: 2px; }
#dialog.erzaehler #dialog-text { font-style: italic; color: #3a3a3a; }
#dialog p { margin: 6px 0 8px; min-height: 3em; }
#dialog-weiter {
  float: right; padding: 6px 12px; background: #ffd400; color: #141414; border: 2px solid #141414;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.dialog-wahl { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.dialog-wahl button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; text-align: left; cursor: pointer;
  background: #fff; color: #141414; border: 2px solid #141414; font: 600 15px/1.3 system-ui, sans-serif;
}
.dialog-wahl button .nr { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; background: #141414; color: #ffd400; font-size: 13px; }
.dialog-wahl button:hover, .dialog-wahl button:focus-visible, .dialog-wahl button:focus { background: #ffd400; outline: none; box-shadow: 4px 4px 0 #141414; }
@keyframes dialog-auf { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Rucksack unten links: Teil anklicken (oder Taste 1–3, Controller X) wählt es aus */
#rucksack {
  position: fixed; left: 12px; bottom: 12px; z-index: 30; display: flex; flex-direction: column; gap: 4px;
  padding: 6px 8px 8px; background: rgba(27, 35, 51, 0.92); border: 2px solid #141414; border-top: 5px solid #ffd400;
  color: #ffd400; font: 800 14px/1 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase;
}
#rucksack.hidden { display: none; }
#rucksack-plaetze { display: flex; gap: 6px; }
.rs-platz { position: relative; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; cursor: pointer; background: #2b3549; border: 2px solid #5b8fd6; }
.rs-platz img { width: 36px; height: 36px; image-rendering: pixelated; }
.rs-platz .rs-nr { position: absolute; left: 2px; top: 1px; font: 700 12px/1 system-ui, sans-serif; color: #a9bbdc; }
.rs-platz[aria-pressed="true"] { background: #ffd400; border-color: #141414; box-shadow: 0 0 0 3px #ffd400, 0 0 14px #ffd400; }
.rs-platz[aria-pressed="true"] .rs-nr { color: #141414; }
.rs-platz:hover { border-color: #ffd400; }
html.abenteuer:has(#dialog:not(.hidden)) #rucksack { visibility: hidden; }

/* allein im Abenteuer: kein Chat, keine Online-Anzeige, keine Gespräche */
html.abenteuer #chat, html.abenteuer #chat-toggle, html.abenteuer #hud-online, html.abenteuer #btn-ruhe { display: none !important; }

@media (max-width: 640px) {
  #aufgabe { top: auto; bottom: 150px; font-size: 13px; padding: 8px 10px; }
  #dialog { bottom: 10px; font-size: 15px; gap: 10px; padding: 12px 12px 10px; }
  #dialog-bild { width: 56px; height: 56px; }
  html.abenteuer:has(#dialog:not(.hidden)) #aufgabe { display: none; }
  #rucksack { bottom: auto; top: 58px; left: 8px; }
  .rs-platz { width: 46px; height: 46px; }
}

/* Story-Modus Schluss: Album und Abspann */
#album, #abspann { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, 0.7); }
#album.hidden, #abspann.hidden { display: none; }
#album-liste { margin: 0 0 14px; padding-left: 0; list-style: none; display: grid; gap: 6px; }
#album-liste li { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: start; padding: 6px 8px; border: 2px solid #141414; background: #fff; }
#album-liste li b { display: block; font: 800 16px/1.1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
#album-liste .nr { display: grid; place-items: center; width: 30px; height: 30px; background: #ffd400; border: 2px solid #141414; font: 800 16px/1 "Barlow Condensed", sans-serif; }
#album-liste span { font-size: 13px; }
#album-weiter, #abspann-weiter {
  display: block; width: 100%; padding: 10px 14px; cursor: pointer; background: #ffd400; color: #141414; border: 3px solid #141414;
  font: 800 18px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; text-transform: uppercase; box-shadow: 0 4px 0 #141414;
}
#abspann { background: #0b0f17; }
.abspann-text { width: min(620px, 100%); color: #f4f4f4; text-align: center; font: 17px/1.6 system-ui, sans-serif; animation: abspann-auf 2.4s ease-out; }
.abspann-zitat { font: 800 clamp(24px, 4.4vw, 40px)/1.15 "Barlow Condensed", "Arial Narrow", sans-serif; color: #ffd400; text-transform: uppercase; margin: 0 0 24px; }
.abspann-klein { color: #8a93a3; font-size: 13px; margin: 26px 0 18px; }
#abspann-weiter { width: auto; margin: 0 auto; }
@keyframes abspann-auf { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* Zwischensequenzen (story/szene.js): Kinobalken, Untertitel, Überspringen; alles andere ausgeblendet */
.szene-balken { position: fixed; left: 0; right: 0; height: 12vh; background: #000; z-index: 60; pointer-events: none;
  transition: transform .6s ease; display: flex; align-items: center; justify-content: center; }
#szene-oben { top: 0; transform: translateY(-100%); justify-content: flex-end; padding-right: 16px; }
#szene-unten { bottom: 0; transform: translateY(100%); }
html.szene #szene-oben, html.szene #szene-unten { transform: none; }
html.szene #szene-weg { pointer-events: auto; }
#szene-weg { background: none; border: 1px solid rgba(255,255,255,.35); color: rgba(255,255,255,.8); border-radius: 6px;
  padding: 4px 10px; font: 13px system-ui, sans-serif; cursor: pointer; }
#szene-text { margin: 0 16px; color: #fff; font: 17px/1.35 system-ui, sans-serif; text-align: center; max-width: 900px; }
html.szene #aufgabe, html.szene #rucksack, html.szene #hud, html.szene #hint, html.szene #touch-steuerung { visibility: hidden !important; }
