:root {
  --bg: #140f24;
  --panel: #231a3d;
  --panel-rand: #5b43a8;
  --text: #f1ecff;
  --leise: #a99bd6;
  --gold: #ffd34d;
  --xp: #4fc3ff;
  --rot: #ff4d6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Press Start 2P", ui-monospace, monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#screen {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 3px solid var(--panel-rand);
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 #0008;
  touch-action: manipulation;
}
button:hover, button:focus-visible { border-color: var(--gold); outline: none; }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #0008; }
button.big { font-size: 16px; padding: 16px 28px; background: #4a2f9a; }

/* Eingabefelder sehen aus wie in den Knopf-Rahmen eingelassen: gleiche
   Schrift, gleicher Pixelrahmen, nur vertieft statt erhaben. */
input[type="text"] {
  font-family: inherit;
  font-size: 16px; /* unter 16px zoomt iOS beim Antippen hinein */
  width: 12em;
  max-width: 100%;
  padding: 12px;
  color: var(--text);
  background: #0b0814;
  border: 3px solid var(--panel-rand);
  border-radius: 0;
  box-shadow: inset 0 4px 0 #0008;
  caret-color: var(--gold);
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
}
input[type="text"]::placeholder { color: var(--leise); opacity: 0.7; }
input[type="text"]:hover { border-color: #7a5fd0; }
input[type="text"]:focus { outline: none; border-color: var(--gold); }
input[type="text"].code-feld { width: 6.5em; text-align: center; letter-spacing: 0.15em; }

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
#xpbar {
  height: 10px;
  background: #0009;
  border-bottom: 2px solid #000;
}
#xpfill {
  height: 100%;
  width: 0;
  background: var(--xp);
  box-shadow: inset 0 -3px 0 #1f6fb0;
}
#hudrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 11px;
  text-shadow: 2px 2px 0 #000;
}
#hud-time { font-size: 14px; }
#hud-kills-icon { width: 12px; height: 12px; image-rendering: pixelated; vertical-align: -1px; }
#btn-pause {
  pointer-events: auto;
  font-size: 10px;
  padding: 8px 10px;
  min-width: 40px;
  min-height: 36px;
}
#hud-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 10px;
  max-width: 60%;
}
#hud-items img, #pause-items img, .card img {
  image-rendering: pixelated;
  width: 20px;
  height: 20px;
  background: #0007;
  border: 1px solid #000;
}
#banner {
  position: absolute;
  top: 28%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
  line-height: 1.8;
  padding: 0 12px;
}

/* ---------- Bildschirme ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Kein justify-content: center -- ist der Inhalt hoeher als der Schirm,
     ragt er sonst oben hinaus und laesst sich nicht mehr hinscrollen. Die
     Platzhalter vor und nach dem Inhalt (unten) zentrieren genauso, solange
     Platz ist. */
  justify-content: flex-start;
  gap: 14px;
  padding: 16px;
  text-align: center;
  background: #140f24cc;
  overflow-y: auto;
}
#scr-title { background: radial-gradient(circle at 50% 40%, #2c1f55 0%, #140f24 70%); }
h1 {
  margin: 0;
  font-size: clamp(28px, 9vw, 56px);
  line-height: 1.25;
  color: var(--gold);
  text-shadow: 4px 4px 0 #6a2fb8, 8px 8px 0 #000;
}
h2 {
  margin: 0;
  font-size: 20px;
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
}
p { margin: 0; font-size: 11px; line-height: 1.8; max-width: 34em; }
p.small { font-size: 9px; }
p.dim { color: var(--leise); }
#title-wizard {
  width: 72px;
  height: 96px;
  image-rendering: pixelated;
  animation: schweben 1.6s ease-in-out infinite;
}
@keyframes schweben {
  50% { transform: translateY(-6px); }
}

#cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 100%);
}
.card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  line-height: 1.6;
}
.card img { width: 48px; height: 48px; grid-row: span 2; }
.card .name { font-size: 11px; color: var(--gold); }
.card .name small { color: var(--xp); font-size: 9px; margin-left: 6px; }
.card .desc { font-size: 9px; color: var(--text); }
.card .taste { color: var(--leise); font-size: 8px; margin-right: 6px; }

#pause-items, #over-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 420px;
  font-size: 10px;
  line-height: 2;
}
#pause-items div { display: flex; align-items: center; gap: 6px; }
#over-stats { flex-direction: column; }
#over-stats .rekord { color: var(--gold); }

/* ---------- Boss, Figurenwahl, Entwicklungen ---------- */

#hud-time.nacht { color: #e07bff; }
#bossbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 64px);
  width: min(360px, 80%);
  text-align: center;
  font-size: 9px;
  color: #ffb3c1;
  text-shadow: 2px 2px 0 #000;
}
#bosshp {
  margin-top: 4px;
  height: 8px;
  background: #000a;
  border: 2px solid #000;
}
#bossfill {
  height: 100%;
  width: 100%;
  background: var(--rot);
  box-shadow: inset 0 -2px 0 #9c1f33;
}

#chars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(640px, 100%);
}
@media (max-width: 560px) {
  #chars { grid-template-columns: minmax(0, 1fr); }
}
.card.figur img:first-child { width: 48px; height: 64px; background: none; border: 0; }
.card .desc img.mini { width: 12px; height: 12px; vertical-align: -2px; }
.card .rek { color: var(--gold); margin-top: 6px; }
.card.evo {
  border-color: var(--gold);
  background: #3b2463;
  animation: gluehen 0.9s ease-in-out infinite alternate;
}
.card.evo .name small { color: var(--gold); }
@keyframes gluehen {
  to { box-shadow: 0 0 18px #ffd34d88, 0 4px 0 #0008; }
}
#pause-evo {
  font-size: 8px;
  line-height: 2;
  color: var(--leise);
  max-width: 460px;
}
#pause-evo .bereit { color: var(--gold); }

/* ---------- Zwei Reihen: oben Zauber, unten Gegenstaende ---------- */

#hud-items { flex-direction: column; gap: 3px; flex-wrap: nowrap; }
.reihe { display: flex; gap: 3px; flex-wrap: wrap; justify-content: inherit; }
.leer {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px dashed #ffffff33;
  background: #0004;
}
#pause-items { flex-direction: column; align-items: center; gap: 4px; }
#pause-items .reihe { justify-content: center; gap: 8px; }
#pause-items .platz { display: flex; align-items: center; gap: 4px; }
.reihen-titel { font-size: 8px; color: var(--leise); margin-top: 6px; }

/* ---------- Gesperrtes, Karten, Mysterien ---------- */

#chars { width: min(760px, 100%); }
.card.gesperrt { opacity: 0.75; cursor: default; border-style: dashed; }
.card.gesperrt .name { color: var(--leise); }
.card.gesperrt .desc { color: var(--leise); font-style: italic; }
.card.gesperrt:hover { border-color: var(--panel-rand); }
.card.gesperrt:active { transform: none; }
#maps { display: flex; flex-direction: column; gap: 10px; width: min(460px, 100%); }
.card .probe {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  border: 3px solid;
  box-shadow: inset 0 0 0 3px #0003;
}
#quests { display: flex; flex-direction: column; gap: 12px; width: min(520px, 100%); text-align: left; }
.quest { background: var(--panel); border: 3px solid var(--panel-rand); padding: 10px 12px; }
.quest.geloest { border-color: var(--gold); }
.quest-text { font-size: 10px; line-height: 1.7; }
.quest-balken { height: 6px; background: #0008; margin: 8px 0 6px; }
.quest-fuell { height: 100%; background: var(--xp); }
.quest.geloest .quest-fuell { background: var(--gold); }
.quest-lohn { font-size: 8px; color: var(--leise); }
.quest.geloest .quest-lohn { color: var(--gold); }
#over-neu { color: var(--gold); font-size: 11px; line-height: 2; text-align: center; }

/* Zwei unsichtbare Platzhalter statt Raender am ersten und letzten Kind:
   das letzte Kind kann ausgeblendet sein (die Werkzeugleiste beim Arkanum),
   dann griffe der Rand ins Leere und alles rutschte nach unten. */
.screen::before, .screen::after { content: ''; flex: 1 0 0; }

/* ---------- Gold, Laden, Werkzeuge beim Aufstieg, Arkana ---------- */

#hud-gold-icon { width: 12px; height: 12px; image-rendering: pixelated; vertical-align: -1px; }
.titel-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#shop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
}
@media (max-width: 560px) { #shop { grid-template-columns: minmax(0, 1fr); } }
.card.ware .preis { color: var(--gold); margin-top: 6px; }
.card.ware.voll .preis { color: var(--leise); }
.card:disabled:not(.gesperrt) { opacity: 0.55; cursor: default; }
#card-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#card-tools button { font-size: 9px; padding: 10px 12px; }
#btn-banish.aktiv { border-color: var(--rot); color: #ffb3c1; }
#cards.bannen .card { border-color: var(--rot); }
.card.arkana { border-color: #e07bff; background: #2c1650; }
.card.arkana .name small { color: #e07bff; }
.card.arkana img { height: 58px; }
.screen button:focus-visible, .screen button.pad-fokus { border-color: var(--gold); box-shadow: 0 0 0 3px #ffd34d66, 0 4px 0 #0008; }

/* ---------- Bestiarium und Statistik ---------- */

#best {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
  text-align: left;
}
@media (max-width: 560px) { #best { grid-template-columns: minmax(0, 1fr); } }
.wesen {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 3px solid var(--panel-rand);
  padding: 10px;
  line-height: 1.6;
}
.wesen img { max-width: 72px; max-height: 72px; image-rendering: pixelated; justify-self: center; }
.wesen .name { font-size: 11px; color: var(--gold); }
.wesen .desc { font-size: 8px; }
.wesen .zahl { font-size: 8px; color: var(--xp); margin-top: 4px; }
.wesen.unbekannt { border-style: dashed; opacity: 0.7; }
.wesen.unbekannt .name { color: var(--leise); }
#stats { display: flex; flex-direction: column; gap: 6px; width: min(520px, 100%); }
.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 9px;
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--panel);
  border: 2px solid var(--panel-rand);
  text-align: left;
}
.stat span:last-child { color: var(--gold); text-align: right; }

/* ---------- Taegliche Herausforderung ---------- */

#btn-daily { border-color: var(--gold); }
#daily-fig { width: 64px; height: 88px; image-rendering: pixelated; }
#daily-text { font-size: 10px; line-height: 2; max-width: 520px; }
#daily-text div:last-child { color: var(--gold); }
#daily-hist { display: flex; flex-direction: column; gap: 6px; width: min(460px, 100%); }

/* ---------- Gemeinsame Bestenliste ---------- */

.name-zeile { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; justify-content: center; font-size: 9px; }
#daily-name { width: 12em; }
#daily-online { display: flex; flex-direction: column; gap: 6px; width: min(460px, 100%); font-size: 9px; line-height: 1.8; }
#daily-online .stat.ich { border-color: var(--gold); }
#over-online { color: var(--xp); }

/* ---------- Zauberbuch ---------- */

#book {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
  text-align: left;
}
@media (max-width: 560px) { #book { grid-template-columns: minmax(0, 1fr); } }
.buch-titel { grid-column: 1 / -1; font-size: 11px; color: var(--gold); margin-top: 8px; }
#book .wesen img { width: 40px; height: 40px; }

/* ---------- Zauberwerkstatt ---------- */

.werk-gruppe { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 560px; }
.werk-gruppe button { font-size: 9px; padding: 8px 10px; }
.werk-gruppe button.aktiv { border-color: var(--gold); background: #4a2f9a; }
.werk-vorschau { display: flex; gap: 12px; align-items: center; max-width: 520px; text-align: left; }
.werk-vorschau img { width: 48px; height: 48px; image-rendering: pixelated; flex: none; }
.werk-vorschau p { font-size: 9px; }
#werk-name, #werk-code { width: 14em; }
#werk-code { font-size: 12px; }
#werk-meldung { color: var(--gold); min-height: 1.8em; }

/* ---------- Zauberbuch als Nachschlagewerk ---------- */

#book-tabs button.aktiv { border-color: var(--gold); background: #4a2f9a; }
#book .desc.stufe { color: var(--leise); margin-top: 2px; }
#book .wesen { align-items: start; }

/* ---------- Runenknopf ---------- */

#btn-rune {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  padding: 0;
  pointer-events: auto;
  overflow: hidden;
  border-radius: 50%;
  background: #140f24cc;
}
#rune-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: #6a2fb8;
}
#btn-rune .rune-text { position: relative; font-size: 9px; }
#btn-rune.bereit { border-color: #e07bff; animation: gluehen 0.9s ease-in-out infinite alternate; }
#btn-rune.bereit #rune-fill { background: #b050e0; }
#btn-rune.zeichnen { border-color: var(--gold); }

/* ---------- Vertraute ---------- */

#familiars button { display: flex; align-items: center; gap: 4px; }
#familiars button.aktiv { border-color: var(--gold); background: #4a2f9a; }
#familiars img { width: 18px; height: 18px; image-rendering: pixelated; }

/* ---------- Tagebuch ---------- */

#diary { display: flex; flex-direction: column; gap: 10px; width: min(560px, 100%); text-align: left; }
.seite {
  background: #efe6cf;
  color: #3b2a1a;
  border: 3px solid #a8642e;
  padding: 12px 14px;
  box-shadow: 0 4px 0 #0008;
}
.seite .name { font-size: 9px; color: #9c1f33; margin-bottom: 6px; }
.seite p { font-size: 10px; line-height: 1.8; max-width: none; }
.seite.fehlt { background: #2c2440; color: var(--leise); border-style: dashed; border-color: var(--panel-rand); }
.seite.fehlt .name { color: var(--leise); }
#over-stats div:first-child:not(:only-child) { max-width: 34em; line-height: 1.8; }

/* ---------- Wanderhaendler, Pakte ---------- */

#trader { display: flex; flex-direction: column; gap: 10px; width: min(420px, 100%); }
#trader .card:disabled { opacity: 0.45; }
#pacts-box { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; }
#pacts-box p { max-width: 34em; }

#title-season { color: #ff9a3c; max-width: 34em; }

/* ---------- Zauberturm, Schmuck ---------- */

#tower-img { image-rendering: pixelated; }
#tower { display: flex; flex-direction: column; gap: 10px; width: min(420px, 100%); }
#hats button img, #trails button img { height: 12px; vertical-align: middle; image-rendering: pixelated; }
.werk-gruppe button:disabled { opacity: 0.5; }

/* ---------- Spielmodi ---------- */

#modes-text { display: flex; flex-direction: column; gap: 6px; max-width: 34em; font-size: 10px; line-height: 1.8; text-align: center; }
#modes-list { display: flex; flex-direction: column; gap: 4px; width: min(420px, 100%); font-size: 10px; }
#modes-list .stat.ich { border-color: var(--gold); }

/* ---------- Duell, Freunde ---------- */

#duel-hud {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  width: min(360px, 80vw); padding: 6px 8px; background: #140f24cc; border: 2px solid #6a2fb8;
  font-size: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.duel-kopf { display: flex; justify-content: space-between; color: #e07bff; }
#duel-bar { height: 6px; background: #0b0814; }
#duel-fill { height: 100%; width: 0; background: #e07bff; }
#duel-actions { display: flex; justify-content: space-between; gap: 4px; color: var(--leise); }
#duel-actions span.bereit { color: #ffffff; }
#duel-actions span { pointer-events: auto; cursor: pointer; padding: 6px 2px; }
#modes-extra { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#modes-list .stat button.klein { font-size: 8px; padding: 4px 6px; }
.quest.bereit { border-color: var(--xp); }
.quest.bereit .quest-lohn { color: var(--xp); }
#over-neu .dim { color: var(--leise); font-size: 9px; }

#btn-reset { font-size: 8px; padding: 6px 10px; opacity: 0.7; }
#btn-reset.warnung { border-color: #ff4d4d; color: #ff4d4d; opacity: 1; }

/* ---------- Runen ueben ---------- */

#runes-pad { width: min(320px, 80vw); height: min(320px, 80vw); border: 3px solid var(--panel-rand); touch-action: none; cursor: crosshair; background: #140f24; }
#runes-progress { display: flex; gap: 8px; }
.ueb-punkt { width: 14px; height: 14px; border: 2px solid #e07bff; }
.ueb-punkt.voll { background: #e07bff; }
#runes-text, #runes-msg { max-width: 30em; text-align: center; }

/* ---------- Runa, Zaehmen ---------- */

.runa { display: flex; align-items: flex-start; gap: 10px; max-width: 34em; }
.runa img { width: 48px; image-rendering: pixelated; }
.runa p { background: #efe6cf; color: #3b2a1a; border: 3px solid #a8642e; padding: 8px 10px; font-size: 9px; line-height: 1.8; margin: 0; position: relative; }
#tame-pad { width: min(540px, 92vw); aspect-ratio: 3 / 2; border: 3px solid var(--panel-rand); image-rendering: pixelated; touch-action: none; cursor: pointer; }
#tame-bar { width: min(360px, 80vw); height: 8px; background: #0b0814; border: 2px solid var(--panel-rand); }
#tame-fill { height: 100%; width: 0; background: #ff4d4d; }
#tame-text, #tame-msg { max-width: 34em; text-align: center; }

/* ---------- Startseite ---------- */

#scr-title { gap: 12px; }
#scr-title #title-wizard { width: 54px; height: 72px; }
.titel-satz { font-size: 10px; color: var(--text); max-width: 30em; }
#scr-title .big { min-width: min(280px, 90vw); }
.titel-modi { min-width: min(280px, 90vw); border-color: var(--gold); }
.titel-neu { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.titel-neu:not(:has(button:not([hidden]))) { display: none; }
.titel-neu button { border-color: var(--gold); color: var(--gold); animation: schweben 1.6s ease-in-out infinite; }
.titel-raster {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(720px, 100%);
}
.titel-raster button { font-size: 9px; padding: 10px 6px; min-width: 0; }
@media (max-width: 560px) {
  .titel-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.titel-hilfe summary { cursor: pointer; font-size: 9px; color: var(--leise); list-style: none; }
.titel-hilfe summary::before { content: '+ '; }
.titel-hilfe[open] summary::before { content: '– '; }
.titel-hilfe p { margin-top: 6px; }
#title-season { font-size: 8px; }

/* ---------- Aufgabenbrett ---------- */

.brett { display: flex; flex-direction: column; gap: 6px; width: min(520px, 100%); text-align: left; }
.brett-zeile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 8px; border: 2px solid var(--panel-rand); background: #1c1533cc; }
.brett-zeile.myst { border-color: #6a2fb8; }
.brett-text { font-size: 9px; line-height: 1.6; }
.brett-lohn { font-size: 8px; color: var(--leise); grid-column: 1; }
.brett-balken { grid-column: 1; height: 4px; background: #0b0814; }
.brett-balken div { height: 100%; background: var(--xp); }
.brett-zeile.myst .brett-balken div { background: #e07bff; }
.brett-zahl { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-size: 9px; color: var(--gold); }
.quest.verborgen .quest-text { color: var(--leise); }

/* ---------- Online ---------- */

#net-hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 10px 14px; background: #140f24dd; border: 2px solid var(--gold); color: var(--gold); font-size: 10px; pointer-events: none; }
.online-code { font-size: 28px; letter-spacing: 6px; color: var(--gold); text-shadow: 3px 3px 0 #000; }

.online-titel { margin-top: 12px; color: var(--gold); }
#modes-list .quest { width: 100%; }
#modes-list .stat.dim { color: var(--leise); }

.titel-zwei { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.titel-zwei .titel-modi { min-width: min(220px, 90vw); }
.titel-online { border-color: #e07bff; color: #e07bff; }
#online-text { display: flex; flex-direction: column; gap: 6px; max-width: 34em; font-size: 10px; line-height: 1.8; text-align: center; }
#online-extra { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#online-list { display: flex; flex-direction: column; gap: 4px; width: min(460px, 100%); font-size: 10px; }
#online-list .quest { width: 100%; }
#online-list .stat.dim { color: var(--leise); }

#signs { position: absolute; right: calc(12px + env(safe-area-inset-right)); bottom: calc(92px + env(safe-area-inset-bottom)); pointer-events: auto; display: flex; flex-direction: column; gap: 6px; }
#signs button { font-size: 8px; padding: 8px; min-width: 70px; }
#btn-sign-here { border-color: #5fe36b; color: #5fe36b; }
#btn-sign-help { border-color: #ff4d4d; color: #ff4d4d; }
#signs[hidden] { display: none; }
#net-ready { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: auto; padding: 16px 20px; background: #140f24ee; border: 2px solid var(--gold); text-align: center; min-width: 220px; }
#net-ready[hidden] { display: none; }
#net-ready p { color: var(--gold); margin: 0 0 10px; }
#net-ready-text { font-size: 10px; line-height: 1.8; margin-bottom: 12px; }
#net-ready-text .ok { color: #5fe36b; }
#btn-ready:disabled { opacity: 0.7; }
#net-ready .countdown { font-size: 48px; color: var(--gold); line-height: 1.2; }
#btn-ready[hidden] { display: none; }

/* ---------- Rueckblick einer Runde ---------- */
#over-chronik { width: min(460px, 100%); font-size: 9px; line-height: 1.8; text-align: left; }
#over-chronik summary { cursor: pointer; text-align: center; color: var(--gold); padding: 8px; border: 3px solid var(--panel-rand); background: var(--panel); list-style: none; }
#over-chronik summary::-webkit-details-marker { display: none; }
#over-chronik[open] summary { border-color: var(--gold); }
.chronik-liste { max-height: 40vh; overflow-y: auto; padding: 8px 10px; background: #0b0814; border: 3px solid var(--panel-rand); border-top: 0; }
.chronik-zeit { color: var(--leise); display: inline-block; min-width: 5.5em; }
.chronik-titel { color: var(--gold); margin: 10px 0 2px; }
.card.verderbt { border-color: #9c1030; background: #2a0f22; }
.card.verderbt .name { color: #ff6b85; }
.card.verderbt:hover, .card.verderbt:focus-visible { border-color: #ff3050; }
#scr-runa .runa { max-width: 36em; }
#scr-runa .runa img { width: 64px; }
#scr-runa .runa p { font-size: 10px; line-height: 2; text-align: left; }
.runa-seite p { font-style: italic; }
#fork-box { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 34em; text-align: center; }
#btn-fork { font-size: 9px; padding: 8px 10px; }
#btn-fork.aktiv { border-color: var(--gold); background: #4a2f9a; }
.card .lage { color: var(--xp); margin-top: 4px; }
#trader-quest { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 34em; text-align: center; border: 3px dashed #a8642e; padding: 8px 10px; }
.card .meister { color: var(--gold); margin-top: 4px; }

/* ---------- Figurenwahl wie in Vampire Survivors ---------- */
#chars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: min(560px, 100%); }
.card.figur-kachel { position: relative; display: block; aspect-ratio: 1 / 1.1; padding: 0; overflow: hidden; }
.card.figur-kachel img { width: auto; height: auto; background: none; border: 0; padding: 0; grid-row: auto; }
.figur-kachel .name { position: absolute; left: 5px; top: 4px; right: 4px; font-size: 8px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.figur-kachel .taste { display: none; }
.card.figur-kachel .bild { position: absolute; left: 44%; bottom: 8%; transform: translateX(-50%); height: 60%; image-rendering: pixelated; }
.card.figur-kachel .waffe { position: absolute; right: 5%; bottom: 7%; width: 26%; image-rendering: pixelated; }
.figur-kachel.gewaehlt { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset, 0 4px 0 #0008; }
.figur-kachel.ungekauft .bild { filter: brightness(0); }
.figur-kachel.ungekauft .name { color: var(--leise); }
.figur-kachel.verborgen { opacity: 0.4; }
.figur-kachel.verborgen .bild { filter: brightness(0.15); }
.figur-kachel.gesperrt { border-style: solid; cursor: pointer; }
/* Die Auswahl klebt unten wie in Vampire Survivors: ohne Scrollen sichtbar. */
.char-unten { position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(560px, 100%);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 85%, transparent); }
#char-detail { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 8px 10px; background: var(--panel); border: 3px solid var(--panel-rand); text-align: left; }
#char-detail .links { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
#char-detail img.bild { width: 56px; height: auto; image-rendering: pixelated; }
#char-detail img.waffe { width: 30px; height: auto; padding: 3px; background: #0b0814; border: 2px solid var(--panel-rand); image-rendering: pixelated; }
#char-detail .text { font-size: 9px; line-height: 1.7; display: flex; flex-direction: column; gap: 2px; }
#char-detail .name { color: var(--gold); font-size: 11px; }
#char-detail .meister { color: var(--gold); }
#char-detail .dim { color: var(--leise); font-style: italic; }
.char-gold { color: var(--gold); margin: 0; }
.char-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.char-knoepfe .big { padding: 12px 22px; font-size: 13px; }
#btn-char-ok { background: #2e8f3e; border-color: #5fd35f; }
#btn-char-buy { background: #8a6a1a; border-color: var(--gold); }
#btn-char-buy:disabled { opacity: 0.5; cursor: default; }
#code-input { width: 14em; text-transform: uppercase; }
#code-msg.ok { color: #5fe36b; }
#code-msg.fehler { color: var(--rot); }

/* ---------- Sterben: das Bild verschwimmt, dann kommt der Endbildschirm ---------- */
#screen { transition: filter 0.9s ease-out; }
#screen.sterben { filter: blur(3px) grayscale(0.75) brightness(0.55); }
#hud { transition: opacity 0.6s ease-out; }
#hud.sterben { opacity: 0; }
#scr-over:not([hidden]) { animation: endeEin 0.45s ease-out; }
@keyframes endeEin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#absturz { position: fixed; left: 50%; top: 20%; transform: translateX(-50%); z-index: 99; width: min(360px, calc(100% - 32px));
  background: #140f24f2; border: 3px solid var(--rot); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; text-align: center; font-size: 10px; line-height: 1.7; }
#absturz .klein { color: var(--leise); font-size: 8px; overflow-wrap: anywhere; margin: 0; }
#absturz p { margin: 0; }
#weather-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#weather-pick button { font-size: 9px; padding: 6px 8px; }
#weather-pick button.aktiv { border-color: var(--gold); background: #4a2f9a; }
.turm-stock { display: flex; flex-direction: column; gap: 6px; width: min(560px, 100%); padding: 8px; border: 2px dashed #3f4252; }
.turm-stock.gebaut { border-style: solid; border-color: var(--panel-rand); }
.turm-kopf { font-size: 9px; color: var(--leise); }
.card.turm-raum.verworfen { opacity: 0.45; }
.turm-umbau { font-size: 8px; padding: 6px 8px; align-self: flex-end; }
#tower { display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, 100%); }
#tower-gift { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 12px; border: 3px dashed var(--gold); max-width: 34em; text-align: center; }
#tower-gift .gabe-inhalt { color: var(--gold); }
.turm-bewohner { font-size: 8px; color: var(--leise); font-style: italic; margin: 0; line-height: 1.7; }
.trophaeen-titel { align-self: flex-start; color: var(--gold); margin-top: 6px; }
.trophaeen { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 6px; width: min(560px, 100%); }
.trophaee { font-size: 8px; line-height: 1.6; padding: 8px; border: 2px solid #2c2440; color: var(--leise); background: #0b0814; display: flex; flex-direction: column; gap: 4px; }
.trophaee.teil { border-color: var(--panel-rand); color: var(--text); }
.trophaee.erreicht { border-color: var(--gold); color: var(--gold); background: #231a3d; }
.trophaee-balken { height: 4px; background: #231a3d; }
.trophaee-balken div { height: 100%; background: var(--gold); }

/* Online-Gast: die gewaehlte Figur als Kachel im Raum */
.gast-figur { display: block; width: 120px; margin: 10px auto; }

/* Schwebender Zurueck-Pfeil oben links in allen Menues */
#btn-pfeil-zurueck {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: calc(env(safe-area-inset-left) + 8px);
  z-index: 60;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  background: rgba(20, 12, 36, 0.9);
}
#btn-pfeil-zurueck[hidden] { display: none; }
/* Platz fuer den Pfeil: die Ueberschrift laeuft nicht darunter, sondern bricht um. */
.screen > h2:first-child { box-sizing: border-box; max-width: 100%; padding: 0 52px; text-align: center; }

/* Pause: Stufen je Zauber und Gegenstand */
#pause-items { width: min(100%, 26rem); align-items: stretch; }
#pause-items .reihen-titel { align-self: center; font-size: 10px; margin-top: 10px; }
#pause-items .stufen-zeile { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 8px; background: #0006; border: 2px solid #3a2d5c; }
#pause-items .stufen-zeile img { width: 24px; height: 24px; }
.stufen-name { text-align: left; font-size: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stufen-stand { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.stufen-kaesten { display: flex; gap: 2px; }
.stufen-kaesten i { width: 6px; height: 6px; background: #2a2140; border: 1px solid #5a4a8a; }
.stufen-kaesten i.an { background: var(--gold); border-color: var(--gold); }
.stufen-text { font-size: 8px; color: var(--leise); white-space: nowrap; }
.stufen-text.voll { color: var(--gold); }
.stufen-leer { align-self: center; font-size: 9px; color: var(--leise); }

/* Plaetze: am Altar versiegelt (rot gekreuzt) und noch nicht gekauft (Schloss-grau) */
.leer.versiegelt { border: 1px solid #c83a3a99; background: repeating-linear-gradient(45deg, #c83a3a33 0 3px, transparent 3px 6px), #0006; }
.leer.zu { border: 1px solid #ffffff26; background: repeating-linear-gradient(0deg, #ffffff0d 0 2px, transparent 2px 5px), #0003; opacity: 0.7; }

/* Meldungsverlauf: am Desktop per Enter, am Handy in der Pause */
#meldungen {
  position: absolute;
  left: calc(env(safe-area-inset-left) + 10px);
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: min(26rem, calc(100% - 20px));
  max-height: 38vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 9, 26, 0.88);
  border: 2px solid #5a4a8a;
  z-index: 20;
}
#meldungen[hidden] { display: none; }
.meldungen-kopf { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; font-size: 10px; color: var(--gold); border-bottom: 2px solid #3a2d5c; }
.meldungen-kopf span { color: var(--leise); font-size: 8px; }
#meldungen-liste, #pause-meldungen-liste { overflow-y: auto; padding: 4px 8px; display: flex; flex-direction: column; gap: 4px; }
.meldung { font-size: 9px; line-height: 1.6; text-align: left; }
.meldung-zeit { color: var(--gold); }
.meldung.leer-text { color: var(--leise); }
#meldungen-hinweis { position: absolute; left: calc(env(safe-area-inset-left) + 10px); bottom: calc(env(safe-area-inset-bottom) + 6px); font-size: 8px; color: #ffffff55; pointer-events: none; display: none; }
@media (hover: hover) and (pointer: fine) { #meldungen-hinweis { display: block; } }
#meldungen:not([hidden]) ~ #meldungen-hinweis { display: none; }
#pause-meldungen { width: min(100%, 26rem); margin: 8px 0; border: 2px solid #3a2d5c; background: #0006; }
#pause-meldungen summary { cursor: pointer; padding: 8px; font-size: 10px; color: var(--gold); }
#pause-meldungen-liste { max-height: 40vh; }

/* Aufgabenbrett: Erfuelltes wartet auf das Abholen */
.brett-zeile.fertig { border-color: var(--gold); background: #2a2010e6; animation: abholbar 1.6s ease-in-out infinite; }
@keyframes abholbar { 50% { box-shadow: 0 0 0 2px #ffd34d55; } }
.brett-zeile.fertig .brett-text { color: var(--gold); }
.brett-zeile .abholen, .quest .abholen { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 10px; padding: 8px 12px; background: #2e8f3e; border-color: #5fe36b; color: #fff; }
.quest .abholen { margin-top: 6px; }
.brett-zeile.abgeholt { border-color: #5fe36b; }
.brett-zeile.abgeholt .brett-text { color: #5fe36b; }
@media (prefers-reduced-motion: reduce) { .brett-zeile.fertig { animation: none; } }

/* Truhe als Spielautomat */
.walzen-buehne { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px; cursor: pointer; user-select: none; }
.walzen-truhe { width: 54px; height: auto; image-rendering: pixelated; animation: truhe-wackeln 0.35s ease-in-out infinite; }
@keyframes truhe-wackeln { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-2px); } }
.walzen { display: flex; gap: 10px; }
.walze { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: #0b0814; border: 3px solid var(--panel-rand); box-shadow: inset 0 6px 8px #000a, inset 0 -6px 8px #000a; }
.walze img { width: 40px; height: 40px; image-rendering: pixelated; filter: blur(0.4px); opacity: 0.85; }
.walze.steht { border-color: var(--gold); box-shadow: 0 0 0 2px #ffd34d55, 0 0 14px #ffd34d88; animation: walze-halt 0.3s ease-out; }
.walze.steht img { filter: none; opacity: 1; }
@keyframes walze-halt { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.walzen-hinweis { font-size: 8px; color: var(--leise); }
.walzen-buehne.jackpot .walzen-truhe { animation-duration: 0.18s; filter: drop-shadow(0 0 6px #ffd34d); }
.walzen-buehne.spannung .walze:not(.steht) { border-color: #ff6a2a; animation: walze-zittern 0.12s linear infinite; }
@keyframes walze-zittern { 0%, 100% { transform: translateX(-1px); } 50% { transform: translateX(1px); } }
.walzen-buehne.gewonnen .walze { animation: walze-jubel 0.5s ease-in-out infinite alternate; }
@keyframes walze-jubel { to { box-shadow: 0 0 0 3px #ffd34d, 0 0 26px #ffd34d; } }
@media (prefers-reduced-motion: reduce) { .walzen-truhe, .walze, .walzen-buehne * { animation: none !important; } }
.walzen-spalte { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; min-width: 0; }
.walze-name { width: 100%; font-size: 8px; line-height: 1.6; color: var(--gold); text-align: center; overflow-wrap: anywhere; hyphens: auto; animation: walze-halt 0.3s ease-out; }
.walze-stufe { color: var(--text, #f4f2ff); }

/* Tutorials */
#tipp { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 5, 18, 0.72); }
#tipp[hidden] { display: none; }
.tipp-karte { width: min(26rem, 100%); padding: 18px 16px 12px; background: #1c1533; border: 3px solid var(--gold); box-shadow: 0 6px 0 #000a; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.tipp-karte h2 { padding: 0; }
#tipp-text { font-size: 11px; line-height: 1.9; }
#tipp-punkte { font-size: 10px; color: var(--gold); letter-spacing: 4px; min-height: 1em; }
.tipp-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.tipp-aus { font-size: 8px; padding: 4px 8px; background: none; border: none; color: var(--leise); text-decoration: underline; min-height: 0; box-shadow: none; }
#coach { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 26px); width: min(30rem, calc(100% - 24px));
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; padding: 8px 10px;
  background: rgba(28, 21, 51, 0.94); border: 2px solid var(--gold); box-shadow: 0 4px 0 #000a; pointer-events: auto; }
#coach-text { grid-column: 1 / -1; grid-row: 1; }
#coach-schritt { grid-row: 2; }
.coach-knoepfe { grid-row: 2; display: flex; gap: 8px; }
#btn-coach-weiter { font-size: 10px; padding: 6px 14px; min-height: 0; background: #2e8f3e; border-color: #5fe36b; color: #fff; }
#btn-coach-weiter[hidden] { display: none; }
#coach.liest { box-shadow: 0 0 0 9999px rgba(8, 5, 18, 0.45), 0 4px 0 #000a; }
#coach[hidden] { display: none; }
#coach-schritt { font-size: 8px; color: var(--gold); }
#coach-text { font-size: 10px; line-height: 1.7; text-align: left; }
#btn-coach-weg { font-size: 8px; padding: 6px 8px; min-height: 0; }
