/* Ball gegen Ball – Aussehen */
:root {
  --bg: #0a0f2c;
  --bg2: #111842;
  --karte: #161f52;
  --karte2: #1d2866;
  --rand: #2c3a8c;
  --text: #eef2ff;
  --leise: #9aa6d8;
  --blau: #1f2ff0;
  --blau-hell: #3d4bff;
  --cyan: #22e3ff;
  --pink: #ff4fd8;
  --gruen: #22c55e;
  --rot: #ef4444;
  --gold: #fbbf24;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #24308a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select { font: inherit; }
.versteckt { display: none !important; }

/* ---------- Kopfzeile ---------- */
#kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(10, 15, 44, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rand);
}
#kopf .logo { font-weight: 900; font-style: italic; letter-spacing: -.02em; font-size: 1.15rem; text-transform: uppercase; white-space: nowrap; }
#kopf .logo span { color: var(--cyan); }
#kopf .logo b { color: var(--pink); }
#kopf .zurueck { color: var(--leise); text-decoration: none; font-size: .85rem; font-weight: 700; white-space: nowrap; }
#kopf .platz { flex: 1; }
.geld-chip, .name-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--karte); border: 1px solid var(--rand);
  padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .9rem; white-space: nowrap;
}
.geld-chip { color: var(--gold); }
.name-chip { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.klein-knopf { background: var(--karte2); border: 1px solid var(--rand); padding: 6px 10px; border-radius: 10px; font-size: .8rem; font-weight: 700; color: var(--leise); }

main { max-width: 1120px; margin: 0 auto; padding: 16px; }

/* ---------- Allgemein ---------- */
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 18px; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.15; }
h2 { font-size: 1.35rem; font-weight: 900; }
h3 { font-size: 1.05rem; font-weight: 800; }
.leise { color: var(--leise); }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blau); color: #fff; font-weight: 800;
  padding: 12px 18px; border-radius: 12px; min-height: 46px;
  box-shadow: 0 4px 0 #1420a8; transition: transform .08s, background .15s;
}
.knopf:hover:not(:disabled) { background: var(--blau-hell); }
.knopf:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #1420a8; }
.knopf.grau { background: var(--karte2); box-shadow: 0 4px 0 #0d1440; }
.knopf.gruen { background: #16a34a; box-shadow: 0 4px 0 #0f6b31; }
.knopf.rot { background: #dc2626; box-shadow: 0 4px 0 #8f1717; }
.knopf.breit { width: 100%; }
.gesperrt-band {
  display: inline-flex; align-items: center; gap: 6px;
  background: #3a1730; color: #ffb4e6; border: 1px dashed #a3337f;
  padding: 6px 10px; border-radius: 10px; font-weight: 800; font-size: .82rem;
}
.fehler { color: #fca5a5; font-weight: 700; min-height: 1.3em; margin-top: 8px; }

/* ---------- Anmeldung ---------- */
#s-login { max-width: 440px; margin: 30px auto; }
.reiter { display: flex; gap: 6px; margin-bottom: 14px; }
.reiter button { flex: 1; background: var(--karte2); padding: 10px; border-radius: 10px; font-weight: 800; color: var(--leise); border: 1px solid var(--rand); }
.reiter button.aktiv { background: var(--blau); color: #fff; border-color: var(--blau); }
.feld { display: block; margin-bottom: 12px; }
.feld span { display: block; font-size: .85rem; font-weight: 700; color: var(--leise); margin-bottom: 4px; }
.feld input, .feld select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--rand);
  background: var(--bg2); color: var(--text); font-size: 1rem;
}
.feld input:focus, .feld select:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }

/* ---------- Lobby (wie die Roblox-Spielseite) ---------- */
.spiel-kopf { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.spiel-kopf .icon { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(135deg, #ef4444, #3b82f6); display: grid; place-items: center; font-size: 2rem; flex-shrink: 0; }
.spiel-kopf h1 { font-size: 1.6rem; font-weight: 900; margin: 0; }
.spiel-knopf {
  width: 100%; min-height: 72px; font-size: 1.6rem; border-radius: 14px;
  background: var(--blau); color: #fff; box-shadow: 0 5px 0 #1420a8; font-weight: 900;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.spiel-knopf:hover { background: var(--blau-hell); }
.spiel-knopf:active { transform: translateY(3px); box-shadow: 0 2px 0 #1420a8; }
.ereignis {
  margin: 14px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rand); background: var(--karte);
}
.ereignis .bild {
  height: 150px; position: relative; overflow: hidden;
  background:
    linear-gradient(transparent 0 0),
    repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 2px, transparent 2px 46px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, transparent 2px 46px),
    linear-gradient(160deg, #3b4fb8, #2a2f86 60%, #4a2a8a);
  display: grid; place-items: center;
}
.ereignis .schild {
  background: #0b1030; border: 3px solid var(--cyan); border-radius: 12px; padding: 8px 22px; text-align: center;
  box-shadow: 0 0 24px var(--cyan), inset 0 0 18px rgba(255, 79, 216, .5);
  font-weight: 900; font-size: 1.7rem; letter-spacing: .02em;
}
.ereignis .schild small { display: block; font-size: .9rem; color: var(--pink); }
.ereignis .text { padding: 12px 16px; }
.ereignis .text b { display: block; font-weight: 900; text-transform: uppercase; }
.beschreibung ul { list-style: none; padding: 0; margin: 8px 0 0; }
.beschreibung li { padding: 4px 0; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 18px 0 12px; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex-shrink: 0; background: var(--karte); border: 1px solid var(--rand); color: var(--leise);
  padding: 10px 14px; border-radius: 999px; font-weight: 800; font-size: .92rem;
}
.tabs button.aktiv { background: #fff; color: #0a0f2c; border-color: #fff; }

.lobby-raster { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) {
  .lobby-raster { grid-template-columns: 380px 1fr; align-items: start; }
}

/* ---------- Ball-Karten ---------- */
.ball-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ball-karte {
  position: relative; background: var(--karte2); border: 2px solid var(--rand); border-radius: 14px;
  padding: 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .1s;
}
button.ball-karte:hover:not(:disabled) { transform: translateY(-2px); }
.ball-karte canvas { width: 72px; height: 72px; }
.ball-karte .n { font-weight: 800; font-size: .9rem; line-height: 1.15; }
.ball-karte .s { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ball-karte .anz { font-size: .75rem; color: var(--leise); }
.ball-karte.fehlt { opacity: .45; filter: grayscale(.8); }
.ball-karte .schloss { position: absolute; top: 6px; right: 6px; font-size: .9rem; }
.variante-chip { font-size: .68rem; font-weight: 900; padding: 2px 7px; border-radius: 999px; }
.variante-chip.v1 { background: linear-gradient(90deg, #fde68a, #fbbf24); color: #422006; }
.variante-chip.v2 { background: linear-gradient(90deg, #f87171, #fbbf24, #4ade80, #60a5fa, #c084fc); color: #fff; text-shadow: 0 1px 2px #000; }
.werte { display: flex; gap: 8px; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--leise); flex-wrap: wrap; }

/* ---------- Laden ---------- */
.laden-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kiste-karte { text-align: center; }
.kiste-karte .emoji { font-size: 3rem; }
.chancen { font-size: .8rem; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; }
.robux-karte { opacity: .9; }
.robux-karte .emoji { font-size: 2rem; }

/* ---------- Rangliste ---------- */
.rangliste { width: 100%; border-collapse: collapse; }
.rangliste th, .rangliste td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--rand); font-size: .92rem; }
.rangliste th { color: var(--leise); font-size: .78rem; text-transform: uppercase; }
.rangliste td.zahl, .rangliste th.zahl { text-align: right; }
.rangliste tr.ich td { background: rgba(34, 227, 255, .12); font-weight: 800; }
.rangliste .platz { width: 40px; font-weight: 900; }

/* ---------- Fragen ---------- */
#s-fragen { max-width: 560px; margin: 20px auto; }
.punkte { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.punkte i { width: 18px; height: 18px; border-radius: 50%; background: var(--karte2); border: 2px solid var(--rand); }
.punkte i.voll { background: var(--gruen); border-color: #86efac; box-shadow: 0 0 10px var(--gruen); }
.frage-text { font-size: 1.7rem; font-weight: 900; text-align: center; margin: 14px 0 18px; word-break: break-word; }
.antwort-zeile { display: flex; gap: 8px; }
.antwort-zeile input { flex: 1; font-size: 1.4rem; text-align: center; padding: 12px; border-radius: 12px; border: 2px solid var(--rand); background: var(--bg2); color: var(--text); min-width: 0; }
.antwort-zeile input:focus { outline: none; border-color: var(--cyan); }
.optionen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optionen button { background: var(--karte2); border: 2px solid var(--rand); border-radius: 12px; padding: 14px 8px; font-weight: 800; font-size: 1.05rem; min-height: 56px; }
.optionen button:hover { border-color: var(--cyan); }
.rueckmeldung { text-align: center; font-weight: 900; font-size: 1.2rem; min-height: 1.6em; margin-top: 14px; }
.rueckmeldung.gut { color: #4ade80; }
.rueckmeldung.schlecht { color: #fca5a5; }

/* ---------- Suche ---------- */
#s-suche { max-width: 480px; margin: 30px auto; text-align: center; }
.suche-baelle { height: 110px; position: relative; margin: 10px auto 18px; width: 220px; }
.suche-baelle span { position: absolute; top: 30px; font-size: 3rem; animation: wackeln 1s ease-in-out infinite alternate; }
.suche-baelle span:first-child { left: 10px; }
.suche-baelle span:last-child { right: 10px; animation-delay: .5s; }
.suche-baelle b { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); font-size: 1.6rem; font-weight: 900; color: var(--pink); }
@keyframes wackeln { from { transform: translateX(0) rotate(-10deg); } to { transform: translateX(40px) rotate(20deg); } }
.suche-baelle span:last-child { animation-name: wackeln2; }
@keyframes wackeln2 { from { transform: translateX(0) rotate(10deg); } to { transform: translateX(-40px) rotate(-20deg); } }

/* ---------- Match ---------- */
#s-match { max-width: 1120px; margin: 0 auto; }
.match-leiste {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px;
}
.spieler-info { min-width: 0; }
.spieler-info.rechts { text-align: right; }
.spieler-info .nm { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spieler-info .kl { font-size: .72rem; color: var(--leise); font-weight: 700; }
.herzen { font-size: 1.25rem; letter-spacing: 2px; }
.herzen .leer { filter: grayscale(1); opacity: .35; }
.herzen .weg { display: inline-block; animation: herzweg 1s ease forwards; }
@keyframes herzweg { 0% { transform: scale(1); } 40% { transform: scale(1.6); } 100% { transform: scale(1); filter: grayscale(1); opacity: .35; } }
.match-mitte { text-align: center; }
.match-mitte .runde { font-size: .75rem; color: var(--leise); font-weight: 800; text-transform: uppercase; }
.match-mitte .uhr { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.match-mitte .uhr.knapp { color: var(--rot); }
.ich-farbe { color: var(--cyan); }
.er-farbe { color: var(--pink); }

.match-raster { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.match-raster > *, .lobby-raster > * { min-width: 0; }
@media (min-width: 900px) {
  .match-raster { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
}
.arena-huelle { position: relative; width: 100%; max-width: min(100%, calc(100vh - 170px), 620px); margin: 0 auto; aspect-ratio: 1 / 1; }
@media (max-width: 899px) { .arena-huelle { max-width: min(100%, calc(100vh - 230px)); } }
#arena { width: 100%; height: 100%; display: block; border-radius: 14px; touch-action: none; user-select: none; }
.arena-hinweis {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(10, 15, 44, .82); border: 1px solid var(--rand); padding: 6px 12px; border-radius: 999px;
  font-weight: 800; font-size: .85rem; white-space: nowrap; pointer-events: none;
}
.banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; font-weight: 900; text-transform: uppercase; font-style: italic;
  font-size: clamp(1.6rem, 6vw, 3rem); text-shadow: 0 4px 0 rgba(0,0,0,.5), 0 0 30px currentColor;
  animation: auftauchen .4s ease-out;
}
.banner small { display: block; font-size: .4em; font-style: normal; color: var(--text); text-shadow: 0 2px 4px #000; }
@keyframes auftauchen { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.panel h3 { margin-bottom: 6px; }
.wahl-karten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 900px) { .wahl-karten { grid-template-columns: 1fr; } .wahl-karten .ball-karte { flex-direction: row; text-align: left; } .wahl-karten .ball-karte .mitte { align-items: flex-start; } }
.wahl-karten .ball-karte { padding: 8px; }
.wahl-karten .ball-karte .mitte { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.wahl-karten .ball-karte canvas { width: 60px; height: 60px; flex-shrink: 0; }
.wahl-karten .faehigkeit { font-size: .72rem; color: var(--leise); line-height: 1.25; }
@media (max-width: 899px) { .wahl-karten .faehigkeit { display: none; } }
.wahl-karten .ball-karte.gewaehlt { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 227, 255, .5); }
.panel-zeile { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.panel-zeile > * { flex: 1 1 140px; }
.gegner-hinweis { font-size: .85rem; margin-top: 10px; color: var(--leise); }
.status-liste { font-size: .9rem; margin: 8px 0 0; padding: 0; list-style: none; }
.status-liste li { padding: 3px 0; }

/* ---------- Overlay ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(4, 6, 20, .78); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
}
#overlay .fenster {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--karte); border: 1px solid var(--rand); border-radius: 20px; padding: 20px; text-align: center;
  animation: auftauchen2 .25s ease-out;
}
#overlay .fenster.breit { max-width: 720px; }
@keyframes auftauchen2 { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.gross-ball { width: 140px; height: 140px; margin: 6px auto; display: block; }
.kiste-wackeln { font-size: 5rem; display: inline-block; animation: kiste .5s ease-in-out infinite; }
@keyframes kiste { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.1); } }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  background: #0b1030; border: 1px solid var(--cyan); color: var(--text); padding: 10px 16px; border-radius: 12px;
  font-weight: 800; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: calc(100vw - 32px); text-align: center;
}

.tausch-form { display: grid; gap: 10px; }
.tausch-eintrag { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--rand); }
.tausch-eintrag .info { flex: 1 1 200px; font-size: .9rem; }

@media (max-width: 520px) {
  main { padding: 12px; }
  #kopf { padding: 8px 12px; gap: 6px; }
  #kopf .logo { font-size: .95rem; }
  #kopf .zurueck, #kopf .name-chip { display: none !important; }
  .frage-text { font-size: 1.4rem; }
  .spiel-knopf { font-size: 1.35rem; min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
