:root {
  --bg-top: #1e2a4a;
  --bg-bottom: #0d1224;
  --panel: #f4f1e6;
  --panel-border: #3a3020;
  --ink: #2a2418;
  --accent: #ffcb3c;
  --accent-dark: #d99a00;
  --hp-high: #4caf50;
  --hp-mid: #ffb300;
  --hp-low: #e53935;
  --enemy: #c0392b;
  --player: #2e7d32;
  --status: #8e44ad;
  --radius: 14px;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}

* { box-sizing: border-box; }

/* ---------- Icon-Grafiken (ersetzen die frueheren Emojis) ---------- */
/* Skaliert wie ein Emoji mit der Schriftgroesse der Umgebung; einzelne
   Einsatzorte (Kampf-Log, Evolution-Blitz) haben unten eigene Groessen. */
.icon {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  min-width: 16px;
  min-height: 16px;
  object-fit: contain;
  vertical-align: -0.25em;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, var(--bg-top), var(--bg-bottom));
  color: var(--ink);
}

#app {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen { padding: 20px 16px 40px; }
.hidden { display: none !important; }

/* ---------- Header (gemeinsam) ---------- */

.header {
  text-align: center;
  color: #fff;
  margin-bottom: 24px;
}
.header h1 {
  margin: 6px 0 2px;
  font-size: 2rem;
  text-shadow: 0 2px 0 #000a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.header-logo {
  width: 1.4em;
  height: 1.4em;
  object-fit: contain;
  border-radius: 50%;
}
.subtitle { margin: 0 0 14px; opacity: 0.85; }

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.btn-link-danger { border-color: #ff8a80aa; color: #ffcdd2; }
.btn-link-danger:hover { background: #b71c1c55; }

.progress-bar-wrap {
  width: min(420px, 90%);
  height: 14px;
  background: #ffffff22;
  border-radius: 999px;
  margin: 0 auto 6px;
  overflow: hidden;
  border: 1px solid #ffffff44;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  transition: width 0.4s ease;
}
.progress-label { margin: 0 0 8px; font-size: 0.9rem; opacity: 0.85; }

.btn-link {
  background: none;
  border: 1px solid #ffffff55;
  color: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.btn-link:hover { background: #ffffff22; }

/* ---------- Monster-Auswahl ---------- */

.monster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.monster-card {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 4px 0 #0006;
}
.monster-card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 #0006; }
.monster-card:active { transform: translateY(0); box-shadow: 0 2px 0 #0006; }
.monster-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  margin-bottom: 6px;
}
.monster-card .name { font-weight: 700; font-size: 0.9rem; }
.monster-card.selected {
  background: #fff6d9;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent), 0 4px 0 #0006;
}

.monster-name-step {
  max-width: 320px;
  margin: 0 auto;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.monster-name-img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3));
}
.difficulty-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.difficulty-card {
  background: #fff;
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 20px;
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 3px 0 #0006;
}
.difficulty-card:hover { transform: translateY(-2px); background: #fff6d9; }
.difficulty-card .difficulty-name { font-weight: 700; display: block; margin-bottom: 4px; }
.difficulty-card .difficulty-time { font-size: 0.8rem; opacity: 0.75; }

.name-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 4px;
  font-family: inherit;
}

/* ---------- Trainer-Auswahl ---------- */

.trainer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.trainer-card {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 4px 0 #0006;
  position: relative;
}
.trainer-card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 #0006; }
.trainer-card:active { transform: translateY(0); box-shadow: 0 2px 0 #0006; }

.trainer-card .card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}
.trainer-card .name { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.trainer-card .count { font-size: 0.78rem; opacity: 0.65; margin-top: 4px; }

.trainer-card.defeated {
  background: #dfe7d8;
  opacity: 0.85;
  cursor: default;
}
.trainer-card.defeated:hover { transform: none; box-shadow: 0 4px 0 #0006; }
.defeated-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--player);
  color: #fff;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
}

.defeated-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  animation: logo-glow 2.2s ease-in-out infinite;
}
@keyframes logo-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 203, 60, 0.55)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 203, 60, 0.95)); }
}

.trainer-card.champion-card {
  background: linear-gradient(180deg, #fff2c9, #ffe093);
  border-color: #7a5c00;
}
.trainer-card.champion-card.locked {
  background: #d8d4c6;
  cursor: default;
  opacity: 0.75;
}
.trainer-card.champion-card.locked:hover { transform: none; box-shadow: 0 4px 0 #0006; }
.trainer-card.champion-card.locked img { filter: grayscale(1) brightness(0.6); }
.lock-note { font-size: 0.72rem; margin-top: 4px; opacity: 0.8; }

/* ---------- Kampf-Screen ---------- */

.battle-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.battle-timer {
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.85;
}
.btn-abandon {
  background: none;
  border: 1px solid #ffffff55;
  color: #ffcdd2;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.btn-abandon:hover { background: #b71c1c55; }

.battle-field {
  background: linear-gradient(180deg, #a7d8b5 0%, #79b98f 55%, #5f9c73 100%);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px 18px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 280px;
}

.combatant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 46%;
}
.player-side { align-self: flex-end; }
.enemy-side { align-self: flex-start; }

.name-plate {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  width: 100%;
  max-width: 220px;
  font-size: 0.85rem;
  font-weight: 700;
}
.hp-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.hp-label {
  font-size: 0.65rem;
  background: var(--accent-dark);
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
}
.hp-bar-wrap {
  flex: 1;
  height: 9px;
  background: #00000022;
  border-radius: 999px;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--hp-high);
  transition: width 0.5s ease, background-color 0.3s ease;
}

.status-badge {
  display: inline-block;
  margin-top: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: var(--status);
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.03em;
}

.monster-box {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sprite {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35));
  transition: filter 0.15s ease;
}

/* Angriffs-Lunge, zweiphasig (Spieler nach rechts zum Gegner, Gegner nach
   links zum Spieler): Phase 1 ("-go") bewegt das angreifende Monster ruckartig
   zur Zielposition und HAELT es dort (animation-fill-mode: forwards). Erst
   danach, in game.js zeitlich abgestimmt mit dem Treffer-Aufleuchten des
   Ziels, startet Phase 2 ("-back") und fuehrt das Monster zurueck zum
   Ausgangspunkt - so leuchtet das getroffene Monster auf, WAEHREND der
   Angreifer zurueckgeht, statt vorher/gleichzeitig mit dem Vorwaertsstoss. */
/* Vorwaertsstoss ("-go"): sehr kurz und mit leichtem Ueberschwingen ueber die
   Zielposition hinaus, statt gleichmaessig einzubremsen - dadurch wirkt die
   Bewegung ruckartig/schlagartig statt weich. */
.sprite.lunge-right-go { animation: lunge-right-go 0.13s cubic-bezier(0.3, 0, 0.4, 1) forwards; }
.sprite.lunge-right-back { animation: lunge-right-back 0.3s ease-in; }
.sprite.lunge-left-go { animation: lunge-left-go 0.13s cubic-bezier(0.3, 0, 0.4, 1) forwards; }
.sprite.lunge-left-back { animation: lunge-left-back 0.3s ease-in; }
@keyframes lunge-right-go {
  0% { transform: translateX(0) scale(1); }
  70% { transform: translateX(34px) scale(1.15); }
  100% { transform: translateX(28px) scale(1.12); }
}
@keyframes lunge-right-back {
  from { transform: translateX(28px) scale(1.12); }
  to { transform: translateX(0) scale(1); }
}
@keyframes lunge-left-go {
  0% { transform: translateX(0) scale(1); }
  70% { transform: translateX(-34px) scale(1.15); }
  100% { transform: translateX(-28px) scale(1.12); }
}
@keyframes lunge-left-back {
  from { transform: translateX(-28px) scale(1.12); }
  to { transform: translateX(0) scale(1); }
}

.sprite.hit { animation: hit-flash 0.45s ease; }
@keyframes hit-flash {
  0%, 100% { filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); transform: translateX(0); }
  25% { filter: brightness(2) saturate(0) drop-shadow(0 8px 6px rgba(0,0,0,0.35)); transform: translateX(8px); }
  50% { filter: brightness(0.6) saturate(2) drop-shadow(0 8px 6px rgba(0,0,0,0.35)); transform: translateX(-8px); }
}

/* Volltreffer: das getroffene Monster leuchtet zusaetzlich kurz rot auf
   (eigene, kombinierte Keyframes statt zweier Animationen auf "filter",
   da sich zwei gleichzeitige Animationen auf derselben Eigenschaft
   gegenseitig ueberschreiben wuerden). */
.sprite.crit-hit { animation: crit-hit-flash 0.45s ease; }
@keyframes crit-hit-flash {
  0%, 100% { filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); transform: translateX(0); }
  25% { filter: brightness(2) saturate(0) drop-shadow(0 0 18px rgba(229, 57, 53, 0.95)); transform: translateX(8px); }
  50% { filter: brightness(0.6) saturate(2) drop-shadow(0 0 22px rgba(229, 57, 53, 1)); transform: translateX(-8px); }
  75% { filter: drop-shadow(0 0 10px rgba(229, 57, 53, 0.6)); }
}

.sprite.fainted { transform: translateY(30px) rotate(8deg); opacity: 0.3; }

/* Streak-Bonus (Spieler) / verstaerkter Gegnerangriff (Gegner nach 3 Fehlern):
   das angreifende Monster vibriert und leuchtet zuerst kurz auf, bevor es
   (in einem separaten Schritt in game.js) die eigentliche Angriffsbewegung
   ausfuehrt. */
.sprite.streak-charge { animation: streak-charge-anim 0.5s ease; }
@keyframes streak-charge-anim {
  0%, 100% { transform: translateX(0); filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); filter: drop-shadow(0 0 18px rgba(255, 203, 60, 1)) brightness(1.3); }
  70% { filter: drop-shadow(0 0 22px rgba(255, 203, 60, 1)) brightness(1.4); }
}

/* Champion-Regeneration: Monster leuchtet kurz gruen auf */
.sprite.regen-glow { animation: regen-glow-pulse 0.8s ease; }
@keyframes regen-glow-pulse {
  0% { filter: drop-shadow(0 0 0 rgba(76, 175, 80, 0)); }
  40% { filter: drop-shadow(0 0 22px rgba(76, 175, 80, 1)) brightness(1.3); }
  100% { filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35)); }
}

/* Paralyse: leichtes Schwanken, gefolgt von kurzem lila Aufleuchten. */
.sprite.wobble { animation: wobble-paralysis 0.7s ease; }
@keyframes wobble-paralysis {
  0%, 100% { transform: translateX(0) rotate(0deg); filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); }
  20% { transform: translateX(-7px) rotate(-6deg); }
  40% { transform: translateX(6px) rotate(5deg); }
  60% { transform: translateX(-5px) rotate(-4deg); }
  75% { transform: translateX(4px) rotate(3deg); filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.95)); }
  90% { filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.95)); }
}
/* Wiederholtes Nichtantworten waehrend Paralyse: wanken + Selbstschaden-Flash +
   lila Aufleuchten kombiniert (eigene Keyframes statt mehrerer Animationen
   auf "filter", die sich sonst gegenseitig ueberschreiben wuerden). */
.sprite.wobble.hit { animation: wobble-hit-flash 0.7s ease; }
@keyframes wobble-hit-flash {
  0%, 100% { transform: translateX(0) rotate(0deg); filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); }
  20% { transform: translateX(-7px) rotate(-6deg); filter: brightness(2) saturate(0); }
  40% { transform: translateX(6px) rotate(5deg); filter: brightness(0.6) saturate(2); }
  60% { transform: translateX(-5px) rotate(-4deg); }
  75% { transform: translateX(4px) rotate(3deg); filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.95)); }
  90% { filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.95)); }
}

.battle-log-wrap {
  margin-top: 12px;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-height: 20px;
}
#battle-log { margin: 0; font-weight: 600; }
.log-icon { width: 1.5em; height: 1.5em; min-width: 20px; min-height: 20px; vertical-align: -0.35em; margin-right: 1px; }
#battle-log.streak-msg { color: #b8860b; }
#battle-log.enemy-bonus-msg { color: #b71c1c; }
#battle-log.champion-regen-msg { color: #1b5e20; }
#battle-log.sudden-death-msg { color: #7a0000; animation: sudden-death-shake 0.5s ease; }
@keyframes sudden-death-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.quiz-panel {
  margin-top: 12px;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
}

.timer-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.timer-bar-wrap {
  flex: 1;
  height: 10px;
  background: #00000022;
  border-radius: 999px;
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 1s linear, background-color 0.3s ease;
}
.timer-seconds { font-weight: 700; min-width: 2ch; text-align: right; }

.question-text {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 14px;
  line-height: 1.4;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.option-btn {
  background: #fff;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, filter 0.15s ease;
}
.option-btn:hover:not(:disabled) { background: #fff6d9; transform: translateY(-1px); }
.option-btn:disabled { cursor: default; }

.option-btn.correct { background: #c8e6c9; border-color: var(--player); }
.option-btn.wrong { background: #ffcdd2; border-color: var(--enemy); }

/* ---------- Ergebnis / Champion ---------- */

#screen-result, #screen-champion {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.result-box {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
  max-width: 420px;
}
.result-box h2 { margin-top: 0; }
.result-monster-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin-bottom: 6px;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.3));
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary, .btn-secondary, .btn-train {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, filter 0.15s ease;
}
.btn-primary { background: var(--accent); color: #3a2b00; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--player); color: #fff; }
.btn-secondary:hover { background: #1b5e20; }
.btn-train { background: #cc2b2b; color: #fff; }
.btn-train:hover { background: #a81f1f; }
.result-hint { font-size: 0.85rem; opacity: 0.8; margin-top: -6px; }

.champion-box { background: linear-gradient(180deg, #fff8dd, #ffe9a8); }
.champion-images {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 6px;
}
.champion-images .result-monster-img { margin-bottom: 0; }
.champion-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.champion-stats-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: #3a2b00;
}
.champion-stats-list li { display: flex; justify-content: space-between; gap: 10px; }
.champion-stats-list span { font-weight: 700; }

.learning-plan-status {
  margin: 14px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3a2b00;
}

/* ---------- Kampfbericht ---------- */

.battle-report-box {
  max-width: 640px;
  text-align: left;
}
.battle-report-box.win { background: linear-gradient(180deg, #fff8dd, #ffe9a8); }
.battle-report-box.loss { background: linear-gradient(180deg, #ffe8e6, #ffcfc9); }
.battle-report-box .champion-images,
.battle-report-box > h2 {
  text-align: center;
}
.battle-report-box .champion-stats-list { margin-top: 16px; }

.battle-report-section { margin-top: 20px; }
.battle-report-section h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
}

.wrong-answer-item {
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.wrong-answer-question { font-weight: 700; margin-bottom: 4px; }
.wrong-answer-chosen { color: var(--enemy); margin: 0 0 2px; font-size: 0.9rem; }
.wrong-answer-correct { color: var(--player); margin: 0; font-size: 0.9rem; }
.wrong-answer-perfect { font-weight: 700; color: var(--player); }

.report-video-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.report-video-info { flex: 1; min-width: 0; }
.report-video-title { font-weight: 700; margin-bottom: 2px; }
.report-video-link { color: var(--player); word-break: break-all; font-size: 0.85rem; }
.report-video-topic { font-weight: 700; margin: 14px 0 6px; }
.report-qr { width: 74px; height: 74px; flex-shrink: 0; border-radius: 6px; border: 1px solid #0002; }

/* ---------- Konfetti ---------- */

.confetti-piece {
  position: fixed;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  pointer-events: none;
  z-index: 9999;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(600deg); opacity: 0.4; }
}

/* ---------- Weiterentwicklung ---------- */

.evolution-box { background: linear-gradient(180deg, #eae6ff, #d8ccff); }
.evolution-stage {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 10px;
}
.evolution-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3));
}
.evolution-img.evolved-pop { animation: evolved-pop 0.5s ease; }
@keyframes evolved-pop {
  0% { transform: scale(0.3); opacity: 0.2; }
  60% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.evolution-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0);
  opacity: 0;
  pointer-events: none;
  border-radius: 50%;
}
.evolution-flash-icon {
  width: 3rem;
  height: 3rem;
  min-width: 0;
  min-height: 0;
  filter: drop-shadow(0 0 6px rgba(255, 203, 60, 0.7));
}
.evolution-flash.flash-active { animation: flash-pulse 1.2s ease; }
@keyframes flash-pulse {
  0% { background: rgba(255, 255, 255, 0); opacity: 0; }
  15% { background: rgba(255, 255, 255, 0.95); opacity: 1; }
  30% { background: rgba(255, 255, 255, 0.25); opacity: 1; }
  45% { background: rgba(255, 255, 255, 0.95); opacity: 1; }
  70% { background: rgba(255, 255, 255, 0.4); opacity: 1; }
  100% { background: rgba(255, 255, 255, 0); opacity: 0; }
}

/* Finale Weiterentwicklung (Stufe 3): mehr Blitze, laengerer/hellerer Flash */
.evolution-flash.flash-big { animation: flash-pulse-big 1.8s ease; }
.evolution-flash.flash-big .evolution-flash-icon { width: 2.3rem; height: 2.3rem; }
@keyframes flash-pulse-big {
  0% { background: rgba(255, 255, 255, 0); opacity: 0; }
  10% { background: rgba(255, 255, 255, 1); opacity: 1; }
  22% { background: rgba(255, 255, 255, 0.3); opacity: 1; }
  34% { background: rgba(255, 255, 255, 1); opacity: 1; }
  46% { background: rgba(255, 255, 255, 0.3); opacity: 1; }
  58% { background: rgba(255, 255, 255, 1); opacity: 1; }
  80% { background: rgba(255, 255, 255, 0.5); opacity: 1; }
  100% { background: rgba(255, 255, 255, 0); opacity: 0; }
}

.evolution-img.glow-final { animation: evolved-pop 0.5s ease, glow-final-pulse 1s ease 0.5s; }
@keyframes glow-final-pulse {
  0% { filter: drop-shadow(0 0 0 rgba(255, 203, 60, 0)); }
  50% { filter: drop-shadow(0 0 26px rgba(255, 203, 60, 1)) brightness(1.4); }
  100% { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
}

.evolution-text { font-weight: 700; }

/* ---------- Hover-Glow (Umrandung leuchtet bei Hover leicht auf) ---------- */

.btn-primary:hover,
.btn-secondary:hover,
.btn-train:hover,
.btn-link:hover,
.btn-abandon:hover,
.option-btn:not(:disabled):hover,
.trainer-card:not(.defeated):not(.locked):hover,
.monster-card:hover,
.difficulty-card:hover {
  filter: drop-shadow(0 0 6px rgba(255, 203, 60, 0.85));
}

/* Trainingsbereich (Gegner-Auswahl fuer "Trainieren"): gruenes statt goldenes
   Leuchten, damit er sich optisch vom Arena-Kampfbereich unterscheidet. */
.trainer-card.train-tile:not(.defeated):not(.locked):hover {
  filter: drop-shadow(0 0 6px rgba(76, 175, 80, 0.9));
}

/* ---------- Bildschirm-Flash beim Kampfstart ---------- */

.screen-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
}
.screen-flash.flash-active { animation: screen-flash-anim 0.5s ease; }
@keyframes screen-flash-anim {
  0% { opacity: 0; }
  40% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* Vor dem Champion: epischerer, laengerer Uebergang mit mehrfachem Aufblitzen */
.screen-flash.flash-epic { animation: screen-flash-epic-anim 1.1s ease; }
@keyframes screen-flash-epic-anim {
  0% { opacity: 0; }
  12% { opacity: 1; }
  24% { opacity: 0.15; }
  36% { opacity: 1; }
  48% { opacity: 0.15; }
  62% { opacity: 0.9; }
  85% { opacity: 0.5; }
  100% { opacity: 0; }
}
#app.epic-shake { animation: epic-shake-anim 1.1s ease; }
@keyframes epic-shake-anim {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* ---------- Eigener Bestaetigungs-Dialog (ersetzt window.confirm()) ----------
   Bewusst OHNE umrandeten Kasten/Karte - nur ein dunkles Overlay mit frei
   schwebendem Text und Buttons, damit es nicht wie eine Browser-/System-
   Meldung wirkt. */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 32px;
  background: rgba(6, 9, 20, 0.82);
  backdrop-filter: blur(2px);
  animation: confirm-overlay-fade-in 0.2s ease;
}
.confirm-overlay.hidden { display: none; }
#confirm-overlay-text {
  margin: 0;
  max-width: 480px;
  text-align: center;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.confirm-overlay-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
@keyframes confirm-overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Impressum & Datenschutz ---------- */

/* Bewusst unauffaellig: kein Icon, kleine Schrift, gedaempfte Farbe - passt
   sich damit an, statt wie ein normaler Aktions-Button auszusehen. */
.legal-footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 18px 0 10px;
}
.legal-link {
  background: none;
  border: none;
  color: #fff;
  opacity: 0.45;
  font-size: 0.78rem;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 6px;
}
.legal-link:hover { opacity: 0.8; }

.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 9, 20, 0.72);
  animation: confirm-overlay-fade-in 0.2s ease;
}
.legal-overlay.hidden { display: none; }
.legal-overlay-box {
  position: relative;
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 34px 28px 26px;
  color: var(--ink);
}
.legal-content.hidden { display: none; }
.legal-content h2 { margin: 0 0 18px; }
.legal-content p { margin: 0 0 14px; line-height: 1.55; }
.legal-content ul { margin: 0 0 14px; padding-left: 22px; line-height: 1.55; }
.legal-content a { color: var(--player); }
.legal-overlay-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink);
  opacity: 0.55;
  cursor: pointer;
  padding: 6px;
}
.legal-overlay-close:hover { opacity: 1; }

/* ---------- Zaubertränke ---------- */

#battle-log.potion-msg { color: #1b5e20; }

#potion-inventory-empty {
  color: #fff;
  text-align: center;
  opacity: 0.9;
}

.potion-detail-name { margin: 4px 0; }

.monster-card.potion-placeholder {
  background: linear-gradient(160deg, #34304a, #1c1826);
  border-color: #100e18;
  cursor: default;
}
.monster-card.potion-placeholder:hover {
  transform: none;
  box-shadow: 0 4px 0 #0006;
  filter: none;
}
.potion-placeholder-icon {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.potion-placeholder-icon .icon {
  width: 60%;
  height: 60%;
  min-width: 0;
  min-height: 0;
  opacity: 0.75;
}
.potion-placeholder .name { color: #6b6480; }
.potion-detail-text { margin-bottom: 0; }

.potion-unlock-box { background: linear-gradient(180deg, #eafff0, #cdf5da); }
.potion-unlock-img {
  width: 130px;
  height: 130px;
  margin: 0 auto 10px;
  animation: potion-unlock-pop 0.6s ease;
}
@keyframes potion-unlock-pop {
  0% { transform: scale(0.3); opacity: 0.2; filter: drop-shadow(0 0 0 rgba(76, 175, 80, 0)); }
  60% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 18px rgba(76, 175, 80, 0.9)); }
  100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
}
