:root {
  --bg: #0a0614;
  --bg-2: #140b26;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #f6f1ff;
  --muted: #a99cc4;
  --pink: #ff2e88;
  --cyan: #22e4ff;
  --yellow: #ffd23f;
  --lime: #9dff5c;
  --danger: #ff4d5e;
  --radius: 24px;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Animierter Hintergrund ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%); }
.bg .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 22s ease-in-out infinite alternate; }
.bg .b1 { width: 55vmax; height: 55vmax; background: var(--pink); top: -25vmax; left: -15vmax; }
.bg .b2 { width: 45vmax; height: 45vmax; background: #6a2bff; bottom: -20vmax; right: -10vmax; animation-delay: -7s; }
.bg .b3 { width: 30vmax; height: 30vmax; background: var(--cyan); top: 40%; left: 45%; opacity: .25; animation-delay: -14s; }
.bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8vw, 6vh) scale(1.1); }
  100% { transform: translate(-6vw, 10vh) scale(.95); }
}

/* ---------- Typo ---------- */
.logo {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.03em;
  text-transform: uppercase;
}
.logo span {
  background: linear-gradient(100deg, var(--pink), var(--yellow) 60%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 46, 136, .45));
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .6em;
  font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  font-size: .85rem;
}
.live-dot { width: .6em; height: .6em; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.avatar {
  --h: 300;
  display: inline-grid; place-items: center; flex: none;
  width: 2.2em; height: 2.2em; border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: .8em;
  background: linear-gradient(135deg, hsl(var(--h) 95% 62%), hsl(calc(var(--h) + 50) 95% 55%));
  color: #10061f;
}

.offline {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 150%);
  padding: .7em 1.2em; border-radius: 999px; background: var(--danger); color: white; font-weight: 600;
  transition: transform .3s; z-index: 50;
}
.offline.show { transform: translate(-50%, 0); }

/* =========================================================
   TV
   ========================================================= */
body.tv { height: 100vh; overflow: hidden; cursor: none; font-size: clamp(14px, 1.15vw, 40px); }

.tv-lobby {
  height: 100vh; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 3vw; padding: 4vw;
}
.join-panel { display: flex; flex-direction: column; justify-content: center; gap: 2.2vw; }
.join-panel .logo { font-size: 7.2vw; }
.qr-wrap { display: flex; align-items: center; gap: 2vw; }
.qr-card {
  position: relative; flex: none;
  padding: 1.2vw; background: white; border-radius: 2vw;
  box-shadow: 0 0 0 .4vw rgba(255,255,255,.08), 0 0 80px rgba(255, 46, 136, .55), 0 0 160px rgba(34, 228, 255, .25);
  animation: float 6s ease-in-out infinite;
}
.qr-card canvas, .qr-card img { display: block; width: 17vw !important; height: 17vw !important; image-rendering: pixelated; }
@keyframes float { 50% { transform: translateY(-.8vw) rotate(-1deg); } }
.scan { font-family: var(--font-display); font-weight: 700; font-size: 2vw; line-height: 1.15; }
.scan small { display: block; margin-top: .6em; font-family: var(--font-body); font-weight: 400; font-size: .5em; color: var(--muted); word-break: break-all; }

.players-panel { display: flex; flex-direction: column; padding: 2.5vw; min-height: 0; }
.players-panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2vw; }
.players-panel h2 { font-family: var(--font-display); font-size: 2.2vw; font-weight: 700; }
.count {
  font-family: var(--font-display); font-weight: 900; font-size: 3vw; line-height: 1;
  padding: .25em .6em; border-radius: 999px; background: var(--pink); color: white;
  box-shadow: 0 0 40px rgba(255, 46, 136, .6);
}
.count.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.3); } }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 1vw; align-content: flex-start; overflow: hidden; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: .7em;
  padding: .45em 1.1em .45em .45em; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  font-size: 1.7vw; font-weight: 600;
  animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
.chips.many .chip { font-size: 1.25vw; }
.chips.lots .chip { font-size: 1vw; }
.chip.out { animation: out .3s forwards; }
@keyframes pop { from { opacity: 0; transform: scale(.3) translateY(20px); } }
@keyframes out { to { opacity: 0; transform: scale(.5); } }
.empty { margin: auto; text-align: center; color: var(--muted); font-size: 1.8vw; }
.empty b { display: block; font-size: 5vw; margin-bottom: .3em; animation: float 3s ease-in-out infinite; }

/* ---------- TV: Teams ---------- */
.tv-game { height: 100vh; display: flex; flex-direction: column; padding: 2vw 4vw 3vw; gap: 1.8vw; }
.game-head { display: flex; align-items: center; justify-content: space-between; }
.head-right { display: flex; align-items: center; gap: 2vw; }
.game-head .logo { font-size: 3vw; }
.round-badge { font-family: var(--font-display); font-size: 1.6vw; font-weight: 700; color: var(--yellow); letter-spacing: .1em; text-transform: uppercase; }

.teams { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; gap: 2.5vw; align-items: stretch; min-height: 0; }
.team { --c: var(--pink); position: relative; padding: 2.5vw; display: flex; flex-direction: column; overflow: hidden; }
.team-b { --c: var(--cyan); }
.team::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--c) 35%, transparent), transparent 65%);
}
.team { border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 0 60px color-mix(in srgb, var(--c) 30%, transparent), inset 0 0 40px color-mix(in srgb, var(--c) 10%, transparent); }
.team-label { position: relative; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--c); font-size: 1.1vw; }
.team h2 { position: relative; font-family: var(--font-display); font-weight: 900; font-size: 2.6vw; line-height: 1; margin: .3em 0 .8em; text-transform: uppercase; }
.team ul { position: relative; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1vw; align-content: start; }
.team ul.xdense { gap: .4vw; }
.team li span:last-child { min-width: 0; hyphens: auto; overflow-wrap: anywhere; line-height: 1.1; }
.team li {
  display: flex; align-items: center; gap: .8em; font-size: 1.6vw; font-weight: 600;
  padding: .4em .6em; border-radius: 1vw; background: rgba(255,255,255,.06);
  animation: slideIn .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.team ul.dense li { font-size: 1.4vw; }
.team ul.xdense li { font-size: 1.05vw; padding: .25em .5em; }
.team-a li { --from: -60px; }
.team-b li { --from: 60px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(var(--from)) scale(.8); } }

.vs {
  align-self: center;
  font-family: var(--font-display); font-weight: 900; font-size: 6vw; font-style: italic; padding: 0 .18em 0 .08em; line-height: 1.1;
  background: linear-gradient(180deg, var(--yellow), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 210, 63, .6));
  animation: vsIn 1s cubic-bezier(.2, 1.8, .4, 1) both, vsPulse 2.4s 1s ease-in-out infinite;
}
@keyframes vsIn { from { transform: scale(4) rotate(-20deg); opacity: 0; } }
@keyframes vsPulse { 50% { transform: scale(1.08); } }

/* Becher-Pyramide als Deko */
.team-top { position: relative; display: flex; align-items: center; justify-content: space-between; }
.cups { display: grid; gap: .25vw; opacity: .9; }
.cups div { display: flex; justify-content: center; gap: .25vw; }
.cups i { width: .9vw; height: .9vw; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 10%, var(--c) 30%, color-mix(in srgb, var(--c) 50%, black)); box-shadow: 0 0 10px var(--c); }

.mini-join { display: flex; align-items: center; gap: 1vw; padding: .8vw 1.2vw .8vw .8vw; font-size: 1vw; color: var(--muted); }
.mini-join .qr-mini { background: white; padding: .4vw; border-radius: .6vw; }
.mini-join canvas, .mini-join img { display: block; width: 4vw !important; height: 4vw !important; }

/* =========================================================
   Handy (Anmeldung) & Admin
   ========================================================= */
.page { min-height: 100svh; max-width: 520px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-direction: column; gap: 24px; }
.page .logo { font-size: clamp(3rem, 16vw, 4.6rem); }
.card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card h2 { font-family: var(--font-display); font-size: 1.3rem; }
.card p { color: var(--muted); line-height: 1.5; }

label.field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; color: var(--muted); font-size: .9rem; }
input[type=text], input[type=password], input[type=tel] {
  width: 100%; padding: 16px 18px; font: inherit; font-size: 1.25rem; color: var(--text);
  background: rgba(0,0,0,.3); border: 1.5px solid var(--glass-border); border-radius: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 46, 136, .25); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 16px 22px; border: 0; border-radius: 16px; cursor: pointer;
  font: inherit; font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .02em;
  color: white; background: linear-gradient(100deg, var(--pink), #b02bff);
  box-shadow: 0 10px 30px rgba(255, 46, 136, .35);
  transition: transform .15s, filter .2s, opacity .2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { padding: 22px; font-size: 1.15rem; }
.btn.cyan { background: linear-gradient(100deg, #10b8ff, var(--cyan)); color: #04121a; box-shadow: 0 10px 30px rgba(34, 228, 255, .3); }
.btn.ghost { background: rgba(255,255,255,.08); box-shadow: none; border: 1px solid var(--glass-border); }
.btn.danger { background: rgba(255, 77, 94, .15); color: #ff8a95; box-shadow: none; border: 1px solid rgba(255, 77, 94, .4); }
.btn.small { padding: 8px 12px; font-size: .8rem; border-radius: 10px; }

.error { color: #ff8a95; font-weight: 600; min-height: 1.2em; }

.welcome { text-align: center; align-items: center; }
.welcome .avatar { font-size: 2rem; }
.welcome h2 { font-size: 1.8rem; }
.big-emoji { font-size: 4rem; animation: float 3s ease-in-out infinite; }

.team-reveal { text-align: center; align-items: center; --c: var(--pink); border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 60px color-mix(in srgb, var(--c) 35%, transparent); }
.team-reveal.b { --c: var(--cyan); }
.team-reveal .team-name { font-family: var(--font-display); font-weight: 900; font-size: 2rem; text-transform: uppercase; color: var(--c); line-height: 1.05; }
.mates { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mates li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.08); font-weight: 600; }
.mates li.me { outline: 2px solid var(--c); }

.link-btn { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; align-self: center; }

/* Admin */
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.08); font-weight: 600; font-size: .9rem; }
.admin-actions { display: grid; gap: 12px; }
.admin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-list li { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 8px; border-radius: 14px; background: rgba(255,255,255,.05); font-weight: 600; }
.player-list li span.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: rgba(255, 46, 136, .2); color: var(--pink); }
.player-list .tag.b { background: rgba(34, 228, 255, .15); color: var(--cyan); }
.links { display: grid; gap: 8px; font-size: .9rem; }
.links a { color: var(--cyan); word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
