/* ===== Farben: hier kannst du sie ändern! ===== */
:root {
  --neon-blau: #00e5ff;
  --neon-pink: #ff2bd6;
  --lila: #7a2bff;
  --nacht: #05010f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--nacht);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#hintergrund {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ===== Bildschirme: immer nur einer ist sichtbar ===== */
.bildschirm {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 1rem;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.05);
  transition: opacity .45s ease, transform .45s ease, visibility .45s;
}

.bildschirm.aktiv {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* ===== Der große Titel ===== */
.titel {
  margin: 0;
  margin-top: -12vh;
  font-family: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(4rem, 22vw, 11rem);
  line-height: .85;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #fff;
  text-shadow:
    0 0 8px var(--neon-blau),
    0 0 24px var(--neon-blau),
    0 0 60px var(--neon-pink);
  animation: reinfliegen 1s cubic-bezier(.2, 1.4, .4, 1) both,
             flackern 7s 1.2s infinite;
}

.titel span {
  display: block;
  font-size: .42em;
  letter-spacing: .12em;
  color: transparent;
  -webkit-text-stroke: 2px var(--neon-pink);
  text-shadow: 0 0 18px var(--neon-pink);
}

@keyframes reinfliegen {
  from { opacity: 0; transform: translateY(-40px) scale(.7); }
  to   { opacity: 1; transform: none; }
}

@keyframes flackern {
  0%, 93%, 97%, 100% { opacity: 1; }
  95% { opacity: .55; }
}

/* ===== Der Knopf ===== */
.knopf {
  min-height: 64px;
  padding: .85em clamp(1.2em, 5vw, 2.4em);
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  font: 800 clamp(1.3rem, 5vw, 1.8rem)/1 system-ui, -apple-system, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--neon-pink), var(--lila));
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s ease;
  animation: reinfliegen .8s .5s both, pulsieren 1.6s 1.3s ease-in-out infinite;
}

.knopf:hover  { transform: scale(1.07); }
.knopf:active { transform: scale(.95); }
.knopf:focus-visible { outline: 3px solid var(--neon-blau); outline-offset: 5px; }

.knopf.klein {
  min-height: 52px;
  font-size: 1.1rem;
  padding: .7em 1.8em;
  animation: none;
  box-shadow: 0 0 18px rgba(255, 43, 214, .5);
}

@keyframes pulsieren {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 43, 214, .5), 0 0 0 0 rgba(255, 43, 214, .5); }
  50%      { box-shadow: 0 0 30px rgba(255, 43, 214, .9), 0 0 0 12px rgba(255, 43, 214, 0); }
}

.hinweis {
  margin: -1.5rem 0 0;
  font-size: .9rem;
  color: rgba(255, 255, 255, .45);
  letter-spacing: .1em;
  animation: reinfliegen .8s .8s both;
}

/* Auf dem Handy gibt es keine Leertaste */
@media (hover: none) {
  .hinweis { display: none; }
}

/* ===== Charakter-Auswahl ===== */
.ueberschrift {
  margin: 0;
  font-family: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  font-style: italic;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--neon-blau), 0 0 30px var(--neon-pink);
}

.karten {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(.45rem, 2vw, 1.2rem);
  justify-content: center;
}

.karte {
  position: relative;
  width: clamp(58px, min(16.5vw, 17vh), 140px);
  padding: .8rem .6rem .6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  border: 3px solid rgba(255, 255, 255, .15);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 60%, #7b45b0 0%, #3a1a5a 60%, #1a0a2e 100%);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .2s ease, border-color .2s, box-shadow .2s;
}

.karte canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.karte.gewaehlt {
  border-color: var(--neon-blau);
  box-shadow: 0 0 22px var(--neon-blau), inset 0 0 18px rgba(0, 229, 255, .3);
  transform: translateY(-8px);
}

/* Der gewählte Charakter wippt ein bisschen */
.karte.gewaehlt canvas {
  animation: wippen .9s ease-in-out infinite alternate;
}

@keyframes wippen {
  from { transform: translateY(0); }
  to   { transform: translateY(-5px); }
}

.karte.gesperrt {
  background: radial-gradient(circle at 50% 60%, #3a2a4f 0%, #1d1230 60%, #0f0819 100%);
  cursor: not-allowed;
}

.karte.gesperrt::after {
  content: "?";
  position: absolute;
  inset: 0 0 2rem;
  display: grid;
  place-items: center;
  font: 900 clamp(2.5rem, 9vw, 4.5rem) "Arial Black", Impact, sans-serif;
  color: var(--neon-pink);
  text-shadow: 0 0 16px var(--neon-pink);
}

.name {
  font-weight: 800;
  font-size: clamp(.75rem, 2.8vw, 1rem);
  letter-spacing: .04em;
  white-space: nowrap;
}

.karte.gesperrt .name { color: rgba(255, 255, 255, .45); }

.werte {
  margin-top: -.3rem;
  font-size: clamp(.62rem, 2.3vw, .85rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: rgba(255, 255, 255, .8);
}

.pokale-anzeige {
  margin: -1.6rem 0 0;
  padding: .35rem 1rem;
  border-radius: 999px;
  background: rgba(20, 10, 40, .6);
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffd93b;
}

/* ===== Musik-Knopf ===== */
.ton-knopf {
  position: fixed;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(20, 10, 40, .72);
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}

/* Im Spiel rutscht der Musik-Knopf neben den ✕-Knopf */
body.im-spiel .ton-knopf {
  right: calc(max(14px, env(safe-area-inset-right)) + 54px);
}

/* ===== Ergebnis nach der Runde ===== */
.ergebnis {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 1rem;
  text-align: center;
  background: rgba(10, 4, 24, .75);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: reinfliegen .5s both;
}

.ergebnis[hidden] { display: none; }

.ergebnis-titel {
  margin: 0;
  font-family: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  font-style: italic;
  font-size: clamp(2.6rem, 12vw, 5.5rem);
  text-shadow: 0 0 12px var(--neon-pink), 0 0 40px var(--neon-pink);
}

.ergebnis.sieg .ergebnis-titel {
  color: #ffd93b;
  text-shadow: 0 0 12px #ffb300, 0 0 40px #ff8a00;
}

.ergebnis-text {
  margin: 0;
  max-width: 34rem;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-line;
}

.knopfreihe {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ===== Bildschirm 3: die Arena ===== */
.arena-bildschirm {
  padding: 0;
  background: #1c1230;
}

#arena {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
}

.menue-knopf {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(20, 10, 40, .72);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  touch-action: manipulation;
}

/* Wer weniger Bewegung mag, bekommt keine Animationen */
@media (prefers-reduced-motion: reduce) {
  .titel, .knopf, .hinweis, .karte canvas, .spieler-bild { animation: none; }
}

/* ===== Karte und Modus wählen ===== */
.kartenliste {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(.7rem, 3vw, 1.4rem);
}

.map-karte {
  width: clamp(96px, 28vw, 160px);
  padding: .6rem .6rem .5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  border: 3px solid rgba(255, 255, 255, .15);
  border-radius: 16px;
  background: rgba(20, 10, 40, .7);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .2s ease, border-color .2s, box-shadow .2s;
}

.map-karte canvas {
  width: 100%;
  height: auto;
  border-radius: 8px;
  image-rendering: pixelated;
}

.map-karte.gewaehlt {
  border-color: var(--neon-blau);
  box-shadow: 0 0 22px var(--neon-blau);
  transform: translateY(-6px);
}

.modus-wahl {
  display: flex;
  gap: .6rem;
  padding: .35rem;
  border-radius: 999px;
  background: rgba(20, 10, 40, .7);
}

.modus-knopf {
  min-height: 48px;
  padding: .5rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .7);
  font: 800 clamp(.95rem, 3.6vw, 1.1rem) system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.modus-knopf.aktiv {
  color: #fff;
  background: linear-gradient(135deg, var(--neon-pink), var(--lila));
  box-shadow: 0 0 16px rgba(255, 43, 214, .6);
}

/* ===== Shop ===== */
.shop-knopf {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  min-height: 44px;
  padding: .5rem 1.1rem;
  border: 2px solid rgba(255, 217, 59, .6);
  border-radius: 999px;
  background: rgba(20, 10, 40, .78);
  color: #ffd93b;
  font: 900 1.05rem system-ui, -apple-system, sans-serif;
  letter-spacing: .03em;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 14px rgba(255, 217, 59, .35);
}

.shop-knopf:hover { transform: scale(1.05); }

#shop.bildschirm {
  gap: 1.3rem;
  justify-content: flex-start;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) 1rem 2.5rem;
  -webkit-overflow-scrolling: touch;
}

.skinliste {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(.6rem, 2.5vw, 1.2rem);
  max-width: 44rem;
}

.skin-karte {
  width: clamp(96px, 28vw, 150px);
  padding: .7rem .5rem .6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  border: 3px solid rgba(255, 255, 255, .15);
  border-radius: 16px;
  background: radial-gradient(circle at 50% 55%, #7b45b0 0%, #3a1a5a 60%, #1a0a2e 100%);
}

.skin-karte.angezogen {
  border-color: var(--neon-blau);
  box-shadow: 0 0 18px var(--neon-blau);
}

.skin-karte canvas {
  width: 62%;
  height: auto;
  image-rendering: pixelated;
}

.skin-knopf {
  width: 100%;
  min-height: 40px;
  margin-top: .2rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--neon-pink), var(--lila));
  color: #fff;
  font: 800 .9rem system-ui, -apple-system, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.skin-knopf.aktiv {
  background: rgba(0, 229, 255, .2);
  color: var(--neon-blau);
  box-shadow: inset 0 0 0 2px var(--neon-blau);
}

.skin-knopf:disabled {
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .45);
  cursor: not-allowed;
}

.shop-tipp {
  margin: -.6rem 0 0;
  font-size: .9rem;
  color: rgba(255, 255, 255, .6);
}

/* ===== Handy-Knöpfe in der Arena: Ulti und Sprinten ===== */
.rund-knopf {
  position: absolute;
  z-index: 2;
  display: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .5);
  background: rgba(20, 10, 40, .55);
  font-size: 1.7rem;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

body.touch .rund-knopf { display: block; }

.sprint-knopf {
  right: max(26px, env(safe-area-inset-right));
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 200px);
}

.sprint-knopf.gedrueckt {
  background: rgba(79, 195, 255, .55);
  transform: scale(.94);
}

.ulti-knopf {
  right: calc(max(26px, env(safe-area-inset-right)) + 82px);
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 222px);
  opacity: .5;
}

.ulti-knopf.bereit {
  opacity: 1;
  border-color: #ffd23f;
  background: rgba(255, 210, 63, .35);
  box-shadow: 0 0 22px rgba(255, 210, 63, .9);
  animation: pulsieren 1.2s ease-in-out infinite;
}

.schild-knopf {
  right: calc(max(26px, env(safe-area-inset-right)) + 30px);
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 282px);
  opacity: .45;
}

.schild-knopf.bereit {
  opacity: 1;
  border-color: #7fd4ff;
}

.schild-knopf.an {
  opacity: 1;
  border-color: #7fd4ff;
  background: rgba(127, 212, 255, .45);
  box-shadow: 0 0 20px rgba(127, 212, 255, .9);
}

/* Bei vielen Karten darf man scrollen */
#kartenwahl.bildschirm {
  justify-content: flex-start;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) 1rem 2.5rem;
  gap: 1.5rem;
}

.namens-feld {
  width: 100%;
  padding: .35rem .5rem;
  border: 2px solid rgba(0, 229, 255, .5);
  border-radius: 10px;
  background: rgba(10, 4, 24, .7);
  color: #fff;
  font: 700 .85rem system-ui, -apple-system, sans-serif;
  text-align: center;
}

.namens-feld::placeholder { color: rgba(255, 255, 255, .45); }

/* Legendäre Charaktere: goldener Rahmen */
.karte.legendaer,
.skin-karte.legendaer {
  border-color: #ffd23f;
  box-shadow: 0 0 18px rgba(255, 210, 63, .7);
  background: radial-gradient(circle at 50% 55%, #8a5bd0 0%, #4a1f7a 55%, #1a0a2e 100%);
}

/* Bei 4 Modi dürfen die Knöpfe umbrechen */
.modus-wahl {
  flex-wrap: wrap;
  justify-content: center;
  border-radius: 24px;
}

/* ===== Freunde und Lobby ===== */
.freunde-knopf { margin-top: -1rem; }

.scroll-bildschirm.bildschirm {
  justify-content: flex-start;
  overflow-y: auto;
  gap: 1.1rem;
  padding: max(24px, env(safe-area-inset-top)) 1rem 2.5rem;
}

.freunde-block {
  width: min(30rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
  padding: 1rem;
  border: 2px solid rgba(255, 255, 255, .15);
  border-radius: 18px;
  background: rgba(20, 10, 40, .72);
}

.freunde-block[hidden] { display: none; }

.freunde-block h3 { margin: 0; font-size: 1.15rem; }

.feld-zeile {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
}

.feld-zeile .namens-feld { width: 11rem; font-size: 1rem; padding: .5rem .7rem; }

.beitreten-zeile { display: flex; gap: .5rem; align-items: center; }

.code-feld {
  width: 7rem;
  font-size: 1.3rem;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.fehler-text { margin: 0; color: #ff9db0; font-weight: 700; text-align: center; }
.fehler-text[hidden] { display: none; }

.lobby-code { color: #ffd93b; letter-spacing: .15em; }

.lobby-oben { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.lobby-qr canvas { width: 150px; height: 150px; border-radius: 10px; image-rendering: pixelated; display: block; }

#lobby-link { color: var(--neon-blau); word-break: break-all; }

.lobby-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
}

.lobby-mitglied {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: rgba(20, 10, 40, .72);
  font-weight: 800;
}

.lobby-mitglied canvas { height: 40px; width: auto; image-rendering: pixelated; }

#lobby-start[hidden], #lobby-warten[hidden], #nochmal[hidden] { display: none; }

.modus-knopf:disabled { cursor: default; }

.skin-karte.angebot {
  border-color: #ffd23f;
  box-shadow: 0 0 16px rgba(255, 210, 63, .5);
  justify-content: space-between;
}

.angebot-symbol { font-size: 3.2rem; line-height: 1.4; }
