/* ===== Mobile-First: Basis gilt für Smartphones ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle at top, #2b2140 0%, #100a1c 70%);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #f1e9d2;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  overflow-x: hidden;
}

.dungeon-container {
  width: 100%;
  max-width: 600px;
  background: #1b1428;
  border: 3px solid #5c4a8a;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 0 30px rgba(120, 80, 200, 0.4);
}

h1 {
  text-align: center;
  color: #ffd873;
  text-shadow: 2px 2px 0 #6b4b1f;
  margin: 0 0 14px 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

/* ===== Statusanzeige ===== */
.status-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: #2a2040;
  border: 2px solid #5c4a8a;
  border-radius: 10px;
  padding: 10px 8px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: bold;
}

.status-item {
  text-align: center;
  line-height: 1.3;
}

/* ===== Gegner-Bereich ===== */
.game-screen {
  position: relative;
  overflow-x: clip;
}

.combat-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
}

.combat-popup {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 35;
  pointer-events: none;
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 24px currentColor,
    0 0 48px currentColor,
    3px 3px 0 #000;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
}

.combat-popup--hit {
  color: #9fff9f;
}

.combat-popup--hurt {
  color: #ff6b6b;
}

.anim-popup-slam {
  animation: popup-slam 0.9s cubic-bezier(0.18, 1.45, 0.32, 1) forwards;
}

.anim-flash-hit {
  animation: flash-hit 0.65s ease-out forwards;
}

.anim-flash-hurt {
  animation: flash-hurt 0.75s ease-out forwards;
}

.enemy-box {
  position: relative;
  text-align: center;
  background: #241a38;
  border: 2px solid #7a5cc0;
  border-radius: 12px;
  padding: 14px 12px;
  margin-bottom: 14px;
  overflow: hidden;
}

.attack-fx {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3.5rem;
  pointer-events: none;
  z-index: 4;
}

.attack-fx-player {
  filter: drop-shadow(0 0 14px rgba(255, 216, 115, 1)) drop-shadow(0 0 28px rgba(255, 180, 50, 0.8));
}

.attack-fx-impact {
  font-size: 4rem;
  z-index: 5;
  filter: drop-shadow(0 0 20px rgba(255, 120, 50, 1));
}

.hit-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.hit-particles .particle {
  position: absolute;
  left: 50%;
  top: 42%;
  font-size: 1.6rem;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.anim-particles-burst .particle:nth-child(1) { animation: particle-burst 0.85s ease-out 0.05s forwards; --burst-x: -70px; --burst-y: -55px; --burst-rot: -40deg; }
.anim-particles-burst .particle:nth-child(2) { animation: particle-burst 0.85s ease-out 0.08s forwards; --burst-x: 65px; --burst-y: -45px; --burst-rot: 35deg; }
.anim-particles-burst .particle:nth-child(3) { animation: particle-burst 0.85s ease-out 0.02s forwards; --burst-x: 0px; --burst-y: -80px; --burst-rot: 0deg; }
.anim-particles-burst .particle:nth-child(4) { animation: particle-burst 0.85s ease-out 0.12s forwards; --burst-x: -45px; --burst-y: 30px; --burst-rot: -25deg; }
.anim-particles-burst .particle:nth-child(5) { animation: particle-burst 0.85s ease-out 0.1s forwards; --burst-x: 55px; --burst-y: 25px; --burst-rot: 30deg; }
.anim-particles-burst .particle:nth-child(6) { animation: particle-burst 0.85s ease-out 0.06s forwards; --burst-x: -10px; --burst-y: 50px; --burst-rot: 15deg; }

.anim-attack-fx {
  animation: attack-fx-fly 0.9s cubic-bezier(0.2, 1.2, 0.4, 1) forwards;
}

.anim-impact-fx {
  animation: impact-fx-pop 0.75s cubic-bezier(0.15, 1.5, 0.35, 1) 0.12s forwards;
}

.anim-enemy-hit {
  animation: enemy-hit 0.9s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.anim-enemy-attack {
  animation: enemy-attack 0.9s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.anim-enemy-defeated {
  animation: enemy-defeated 0.4s ease-out forwards;
}

.anim-screen-shake {
  animation: screen-shake 0.75s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.anim-lives-hit {
  animation: lives-hit 0.7s ease;
}

.anim-score-pop {
  display: inline-block;
  animation: score-pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.anim-score-glow {
  animation: score-glow 0.7s ease;
}

.anim-boss-hp-hit {
  animation: boss-hp-hit 0.5s ease;
}

@keyframes popup-slam {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.15) rotate(-12deg);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1.45) rotate(4deg);
  }
  38% {
    transform: translate(-50%, -50%) scale(1.15) rotate(0deg);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -48%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -35%) scale(0.85);
  }
}

@keyframes flash-hit {
  0% {
    opacity: 1;
    background: radial-gradient(circle at 50% 40%, rgba(140, 255, 140, 0.65) 0%, rgba(80, 200, 80, 0.25) 55%, transparent 80%);
    box-shadow: inset 0 0 100px rgba(120, 255, 120, 0.5);
  }
  100% {
    opacity: 0;
    background: transparent;
    box-shadow: none;
  }
}

@keyframes flash-hurt {
  0% {
    opacity: 1;
    background: radial-gradient(circle at 50% 40%, rgba(255, 70, 70, 0.55) 0%, rgba(180, 30, 30, 0.3) 50%, transparent 75%);
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.45);
  }
  100% {
    opacity: 0;
    background: transparent;
    box-shadow: none;
  }
}

@keyframes attack-fx-fly {
  0% {
    opacity: 0;
    transform: translate(-140%, -50%) scale(0.3) rotate(-45deg);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.5) rotate(5deg);
  }
  55% {
    opacity: 1;
    transform: translate(-45%, -60%) scale(1.3) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(20%, -90%) scale(0.6) rotate(25deg);
  }
}

@keyframes impact-fx-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.8);
  }
  60% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.4);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(2.2);
  }
}

@keyframes particle-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
  20% {
    opacity: 1;
    transform: translate(calc(-50% + var(--burst-x) * 0.4), calc(-50% + var(--burst-y) * 0.4)) scale(1.3) rotate(var(--burst-rot));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.4) rotate(calc(var(--burst-rot) + 180deg));
  }
}

@keyframes enemy-hit {
  0% {
    transform: translateX(0) scale(1);
    filter: brightness(1);
    border-color: #7a5cc0;
  }
  8% {
    transform: translateX(-22px) scale(0.82) rotate(-4deg);
    filter: brightness(3) saturate(2.5);
    border-color: #fff;
    box-shadow: 0 0 30px rgba(255, 255, 200, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.3);
  }
  20% {
    transform: translateX(18px) scale(1.12) rotate(3deg);
    filter: brightness(2) saturate(1.8);
  }
  38% {
    transform: translateX(-12px) scale(0.94) rotate(-2deg);
    filter: brightness(1.4);
  }
  58% {
    transform: translateX(8px) scale(1.03);
  }
  100% {
    transform: translateX(0) scale(1);
    filter: brightness(1);
    border-color: #7a5cc0;
    box-shadow: none;
  }
}

@keyframes enemy-defeated {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.55;
    filter: grayscale(0.6);
  }
}

@keyframes enemy-attack {
  0%, 100% {
    transform: translateX(0) scale(1);
    filter: brightness(1);
    border-color: #7a5cc0;
  }
  18% {
    transform: translateX(-8px) scale(0.95);
  }
  35% {
    transform: translateX(28px) scale(1.28);
    filter: brightness(1.8) saturate(1.6);
    border-color: #ff6b6b;
    box-shadow: 0 0 35px rgba(255, 80, 80, 0.7);
  }
  55% {
    transform: translateX(-10px) scale(1.08);
    filter: brightness(1.3);
  }
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  8% { transform: translate(-14px, 6px) rotate(-1.2deg); }
  18% { transform: translate(16px, -8px) rotate(1.4deg); }
  30% { transform: translate(-18px, 5px) rotate(-1deg); }
  42% { transform: translate(14px, -4px) rotate(0.8deg); }
  55% { transform: translate(-10px, 3px) rotate(-0.5deg); }
  68% { transform: translate(8px, -2px) rotate(0.4deg); }
}

@keyframes lives-hit {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.5); color: #ff5555; text-shadow: 0 0 12px #ff0000; }
  40% { transform: scale(0.85); }
  65% { transform: scale(1.15); }
}

@keyframes score-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.55); color: #fff59d; text-shadow: 0 0 16px #ffd873; }
  55% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

@keyframes score-glow {
  0%, 100% { filter: none; }
  35% { filter: drop-shadow(0 0 10px rgba(255, 216, 115, 0.9)); }
}

@keyframes boss-hp-hit {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.04); filter: brightness(1.4); }
}

.boss-hp-bar {
  margin-top: 12px;
  text-align: left;
}

.boss-hp-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: bold;
}

.boss-hp-label {
  color: #ff9d9d;
}

.boss-hp-text {
  color: #ffd873;
}

.boss-hp-track {
  height: 14px;
  background: #100a1c;
  border: 2px solid #5c4a8a;
  border-radius: 8px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8a3c3c, #ff6b6b);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.enemy-emoji {
  font-size: 3rem;
  line-height: 1;
}

.enemy-name {
  margin-top: 6px;
  font-size: 1.15rem;
  color: #ff9d9d;
  font-weight: bold;
  word-break: break-word;
}

/* ===== Aufgaben-Bereich ===== */
.task-box {
  background: #2a2040;
  border: 2px solid #5c4a8a;
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
  margin-bottom: 14px;
}

.task-label {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  color: #cbb8f0;
  line-height: 1.4;
}

.boss-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid #7a5cc0;
}

.boss-quickview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #241a38;
  border: 2px solid #7a5cc0;
  border-radius: 10px;
}

.boss-quickview-emoji {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.boss-quickview-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.boss-quickview-name {
  font-size: 0.95rem;
  color: #ff9d9d;
  font-weight: bold;
  line-height: 1.2;
}

.boss-quickview-hp {
  font-size: 0.8rem;
  color: #ffd873;
  font-weight: bold;
}

.game-screen--boss > h1 {
  display: none;
}

.game-screen--boss > .status-bar {
  font-size: 0.75rem;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.game-screen--boss > .enemy-box {
  position: sticky;
  top: max(4px, env(safe-area-inset-top));
  z-index: 15;
  margin-bottom: 8px;
  padding: 8px 10px;
}

.game-screen--boss .enemy-emoji {
  font-size: 2.2rem;
}

.game-screen--boss .enemy-name {
  font-size: 1rem;
  margin-top: 4px;
}

.game-screen--boss .boss-hp-bar {
  margin-top: 8px;
}

.game-screen--boss .boss-title {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.game-screen--boss .boss-progress {
  font-size: 0.85rem;
}

.game-screen--boss .task-question {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.game-screen--boss #answer-input {
  scroll-margin-bottom: 12px;
}

.boss-title {
  margin: 0 0 6px 0;
  font-size: 1.25rem;
  color: #ffd873;
  text-shadow: 1px 1px 0 #6b4b1f;
  line-height: 1.3;
}

.boss-progress {
  margin: 0;
  font-size: 0.9rem;
  color: #ff9d9d;
  font-weight: bold;
  line-height: 1.4;
}

.task-question {
  font-size: 1.45rem;
  font-weight: bold;
  color: #ffd873;
  margin-bottom: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.answer-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#answer-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid #7a5cc0;
  background: #100a1c;
  color: #f1e9d2;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

#answer-input:focus {
  outline: 3px solid #ffd873;
  outline-offset: 2px;
}

button {
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  min-height: 48px;
  padding: 12px 18px;
  transition: transform 0.1s ease-in-out, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

button:active {
  transform: scale(0.97);
}

#check-button {
  width: 100%;
  background: #5c4a8a;
  color: #fff;
}

#check-button:hover {
  background: #7a5cc0;
}

#new-game-button {
  display: block;
  width: 100%;
  background: #8a3c3c;
  color: #fff;
}

#new-game-button:hover {
  background: #b04b4b;
}

.secondary-button {
  width: 100%;
  background: #3a3058;
  color: #f1e9d2;
  border: 2px solid #5c4a8a;
}

.secondary-button:hover {
  background: #4a4068;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ===== Startbildschirm ===== */
.start-screen {
  text-align: center;
}

.start-text {
  margin: 0 0 16px 0;
  color: #cbb8f0;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ===== Podium Top 3 ===== */
.podium-block {
  margin-top: 18px;
  margin-bottom: 0;
}

.podium-block-compact .podium {
  margin-bottom: 0;
}

.podium-block-compact .podium-step {
  height: 28px;
}

.podium-block-compact .podium-gold .podium-step {
  height: 40px;
}

.podium-title {
  margin: 0 0 8px 0;
  font-size: 0.85rem;
  font-weight: bold;
  color: #cbb8f0;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
}

.podium-place {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.podium-medal {
  font-size: 1.5rem;
  line-height: 1;
}

.podium-block-compact .podium-medal {
  font-size: 1.2rem;
}

.podium-name {
  font-size: 0.78rem;
  font-weight: bold;
  color: #f1e9d2;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-size: 0.9rem;
  font-weight: bold;
  color: #8ef58e;
}

.podium-step {
  width: 100%;
  border-radius: 6px 6px 0 0;
  margin-top: 4px;
}

.podium-gold .podium-step {
  height: 56px;
  background: linear-gradient(180deg, #ffd873, #b8860b);
  box-shadow: 0 0 12px rgba(255, 216, 115, 0.4);
}

.podium-silver .podium-step {
  height: 40px;
  background: linear-gradient(180deg, #d8d8d8, #8a8a8a);
}

.podium-bronze .podium-step {
  height: 30px;
  background: linear-gradient(180deg, #d4a574, #8b5a2b);
}

.podium-gold .podium-medal {
  font-size: 1.8rem;
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-button {
  width: 100%;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
  text-align: center;
}

.mode-button-campaign {
  background: #5c4a8a;
  color: #fff;
}

.mode-button-campaign:hover {
  background: #7a5cc0;
}

.mode-button-endless {
  background: #2d5a3d;
  color: #fff;
}

.mode-button-endless:hover {
  background: #3d7a52;
}

.mode-button-leaderboard {
  background: #4a4068;
  color: #ffd873;
  border: 2px solid #ffd873;
}

.mode-button-leaderboard:hover {
  background: #5c5080;
}

.mode-button-title {
  font-size: 1.1rem;
  font-weight: bold;
}

.mode-button-desc {
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: normal;
}

.error-text {
  color: #ff8a8a;
  font-weight: bold;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

.feedback {
  min-height: 2.6em;
  font-weight: bold;
  font-size: 1rem;
  margin: 12px 0 0 0;
  line-height: 1.4;
}

.feedback.correct {
  color: #8ef58e;
  text-shadow: 0 0 12px rgba(120, 255, 120, 0.6);
}

.feedback.wrong {
  color: #ff8a8a;
  text-shadow: 0 0 12px rgba(255, 100, 100, 0.5);
}

.anim-feedback-pop {
  animation: feedback-pop 0.75s cubic-bezier(0.2, 1.45, 0.4, 1);
}

@keyframes feedback-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(8px);
  }
  35% {
    opacity: 1;
    transform: scale(1.18) translateY(-2px);
  }
  55% {
    transform: scale(0.96) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.continue-button {
  width: 100%;
  margin-top: 12px;
  background: #4a6a8a;
  color: #fff;
}

.continue-button--loot {
  background: linear-gradient(180deg, #d4a82a 0%, #9a7218 100%);
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 16px rgba(255, 200, 80, 0.45);
}

.continue-button--loot:hover {
  background: linear-gradient(180deg, #e8bc3a 0%, #b08420 100%);
}

/* ===== Endbildschirm ===== */
.end-screen {
  text-align: center;
  background: #2a2040;
  border: 3px solid #ffd873;
  border-radius: 12px;
  padding: 16px 14px;
  margin-top: 14px;
}

.end-screen[hidden] {
  display: none !important;
}

.end-screen h2 {
  color: #ffd873;
  margin: 0 0 10px 0;
  font-size: 1.25rem;
  line-height: 1.35;
}

.end-screen p {
  font-size: 1rem;
  line-height: 1.45;
  margin: 0 0 8px 0;
}

/* ===== Endlos Highscore Share-Card ===== */
.endless-highscore {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-card {
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
  border-radius: 16px;
  border: 3px solid #ffd873;
  background: linear-gradient(160deg, #2b2140 0%, #1b1428 45%, #241a38 100%);
  box-shadow:
    0 0 24px rgba(255, 216, 115, 0.35),
    0 0 60px rgba(120, 80, 200, 0.25);
  animation: card-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.share-card-glow {
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(255, 216, 115, 0.15),
    transparent,
    rgba(138, 92, 192, 0.2),
    transparent
  );
  animation: glow-spin 6s linear infinite;
  pointer-events: none;
}

.share-card-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.share-card-confetti span {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 2.8s ease-in infinite;
}

.share-card-confetti span:nth-child(1)  { left: 8%;  background: #ffd873; animation-delay: 0s; }
.share-card-confetti span:nth-child(2)  { left: 18%; background: #ff9d9d; animation-delay: 0.3s; }
.share-card-confetti span:nth-child(3)  { left: 28%; background: #8ef58e; animation-delay: 0.6s; }
.share-card-confetti span:nth-child(4)  { left: 38%; background: #cbb8f0; animation-delay: 0.2s; }
.share-card-confetti span:nth-child(5)  { left: 48%; background: #ffd873; animation-delay: 0.8s; }
.share-card-confetti span:nth-child(6)  { left: 58%; background: #7a5cc0; animation-delay: 0.1s; }
.share-card-confetti span:nth-child(7)  { left: 68%; background: #8ef58e; animation-delay: 0.5s; }
.share-card-confetti span:nth-child(8)  { left: 78%; background: #ff9d9d; animation-delay: 0.7s; }
.share-card-confetti span:nth-child(9)  { left: 88%; background: #ffd873; animation-delay: 0.4s; }
.share-card-confetti span:nth-child(10) { left: 14%; background: #cbb8f0; animation-delay: 1s; }
.share-card-confetti span:nth-child(11) { left: 52%; background: #8ef58e; animation-delay: 1.2s; }
.share-card-confetti span:nth-child(12) { left: 82%; background: #7a5cc0; animation-delay: 0.9s; }

.share-card-brand {
  position: relative;
  margin: 0 0 6px 0;
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffd873;
  text-shadow: 1px 1px 0 #6b4b1f;
}

.share-card-mode {
  position: relative;
  margin: 0 0 18px 0;
  font-size: 0.95rem;
  font-weight: bold;
  color: #8ef58e;
}

.share-card-label {
  position: relative;
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  color: #cbb8f0;
}

.share-card-score {
  position: relative;
  margin: 0 0 10px 0;
  font-size: 3.5rem;
  font-weight: bold;
  line-height: 1;
  color: #ffd873;
  text-shadow:
    0 0 12px rgba(255, 216, 115, 0.8),
    0 0 30px rgba(255, 216, 115, 0.4),
    2px 2px 0 #6b4b1f;
  animation: score-pulse 1.6s ease-in-out infinite;
}

.share-card-stats {
  position: relative;
  margin: 0;
  font-size: 1.05rem;
  font-weight: bold;
  color: #f1e9d2;
}

.download-button {
  width: 100%;
  background: linear-gradient(135deg, #5c4a8a, #7a5cc0);
  color: #fff;
  font-size: 1.05rem;
}

.download-button:hover {
  background: linear-gradient(135deg, #7a5cc0, #9a7ce0);
}

.share-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #cbb8f0;
  opacity: 0.85;
}

/* ===== Bestenliste & Namenseingabe ===== */
.score-submit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid #5c4a8a;
  text-align: left;
}

.score-submit-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #cbb8f0;
  font-weight: bold;
}

.score-name-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid #7a5cc0;
  background: #100a1c;
  color: #f1e9d2;
  margin-bottom: 10px;
}

.score-name-input:focus {
  outline: 3px solid #ffd873;
  outline-offset: 2px;
}

.save-score-button {
  width: 100%;
  background: #2d5a3d;
  color: #fff;
}

.save-score-button:hover {
  background: #3d7a52;
}

.save-score-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.save-score-feedback {
  min-height: 1.4em;
  margin: 10px 0 0 0;
  font-size: 0.9rem;
  font-weight: bold;
}

.save-score-feedback.correct {
  color: #8ef58e;
}

.save-score-feedback.wrong {
  color: #ff8a8a;
}

.leaderboard-panel {
  margin-top: 14px;
  text-align: left;
}

.leaderboard-panel-title {
  margin: 0 0 10px 0;
  font-size: 1rem;
  color: #ffd873;
}

.leaderboard-screen {
  text-align: center;
}

.leaderboard-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-button {
  flex: 1;
  min-height: 44px;
  background: #3a3058;
  color: #f1e9d2;
  border: 2px solid #5c4a8a;
  font-size: 0.9rem;
}

.filter-button.active {
  background: #5c4a8a;
  border-color: #ffd873;
  color: #ffd873;
}

.leaderboard-list {
  list-style: none;
  margin: 0 0 14px 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  text-align: left;
}

.leaderboard-list-compact {
  max-height: 220px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 10px 8px;
  border-bottom: 1px solid #3a3058;
  align-items: center;
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-rank {
  grid-row: 1 / span 2;
  font-weight: bold;
  color: #ffd873;
  font-size: 1rem;
  text-align: center;
}

.leaderboard-name {
  font-weight: bold;
  color: #f1e9d2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-weight: bold;
  color: #8ef58e;
  font-size: 1.05rem;
  text-align: right;
}

.leaderboard-meta {
  grid-column: 2 / span 2;
  font-size: 0.75rem;
  color: #cbb8f0;
}

.leaderboard-empty {
  padding: 16px 8px;
  color: #cbb8f0;
  text-align: center;
  font-style: italic;
}

@keyframes card-pop {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    top: -10%;
    transform: translateX(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    top: 110%;
    transform: translateX(20px) rotate(360deg);
  }
}

@keyframes score-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* ===== Größere Smartphones / kleine Tablets ===== */
@media (min-width: 400px) {
  .dungeon-container {
    padding: 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .status-bar {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .enemy-emoji {
    font-size: 3.25rem;
  }

  .share-card-score {
    font-size: 4.5rem;
  }

  .share-card {
    padding: 28px 20px;
  }
}

/* ===== Desktop / große Tablets ===== */
@media (min-width: 600px) {
  body {
    padding-top: 20px;
  }

  .dungeon-container {
    padding: 24px;
    border-width: 4px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .status-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    font-size: 0.95rem;
    padding: 10px 14px;
    margin-bottom: 18px;
  }

  .status-item {
    text-align: center;
    white-space: nowrap;
  }

  .enemy-box,
  .task-box {
    padding: 18px;
    margin-bottom: 18px;
  }

  .enemy-emoji {
    font-size: 3.5rem;
  }

  .enemy-name {
    font-size: 1.3rem;
  }

  .task-question {
    font-size: 2rem;
  }

  .answer-area {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  #answer-input {
    flex: 1 1 140px;
    width: auto;
  }

  #check-button {
    width: auto;
    flex: 0 1 auto;
  }

  .feedback {
    font-size: 1.1rem;
  }

  .end-screen {
    padding: 20px;
    margin-top: 18px;
  }

  .end-screen h2 {
    font-size: 1.5rem;
  }

  .end-screen p {
    font-size: 1.1rem;
  }
}

/* ===== Querformat auf Smartphones ===== */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .dungeon-container {
    padding: 12px;
  }

  h1 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .enemy-box {
    padding: 8px;
    margin-bottom: 8px;
  }

  .enemy-emoji {
    font-size: 2rem;
  }

  .enemy-name {
    font-size: 1rem;
    margin-top: 4px;
  }

  .task-box {
    padding: 10px;
    margin-bottom: 8px;
  }

  .task-question {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }

  .game-screen--boss .enemy-emoji {
    font-size: 1.8rem;
  }

  .game-screen--boss .boss-quickview-emoji {
    font-size: 1.5rem;
  }

  .mode-button {
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .anim-attack-fx,
  .anim-impact-fx,
  .anim-enemy-hit,
  .anim-enemy-attack,
  .anim-enemy-defeated,
  .anim-screen-shake,
  .anim-popup-slam,
  .anim-flash-hit,
  .anim-flash-hurt,
  .anim-particles-burst .particle,
  .anim-lives-hit,
  .anim-score-pop,
  .anim-score-glow,
  .anim-boss-hp-hit,
  .anim-feedback-pop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .combat-flash,
  .combat-popup,
  .hit-particles {
    display: none !important;
  }
}
