:root {
  --navy: #001e50;
  --navy-2: #0a2c66;
  --navy-3: #13387a;
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #b7c3d9;
  --neon: #c6ff00;
  --red: #ff5a5f;
  --radius: 14px;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(198, 255, 0, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(90, 140, 255, 0.18), transparent 60%),
    var(--navy);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--neon);
}

h1, h2, h3 { margin: 0; line-height: 1.05; }

.bracket {
  display: inline-block;
  border-left: 4px solid var(--neon);
  border-top: 4px solid var(--neon);
  border-bottom: 4px solid var(--neon);
  width: 14px;
  align-self: stretch;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.6rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: var(--neon);
  color: var(--navy);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { background: var(--red); color: #fff; }

/* ---------- Schnee ---------- */
.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.snow i {
  position: absolute;
  top: -10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translate3d(var(--drift, 30px), 110vh, 0); }
}
@media (prefers-reduced-motion: reduce) { .snow { display: none; } }

/* =========================================================
   Anmeldung (Handy)
   ========================================================= */
.join {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 22px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.join header { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; }
.join header .logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--neon); }
.join header span { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.85rem; }

.join h1 { font-size: 2.4rem; font-weight: 800; margin: 10px 0 14px; }
.join h1 em { font-style: normal; color: var(--neon); }
.join p.lead { color: var(--muted); font-size: 1.05rem; line-height: 1.5; margin: 0 0 28px; }

.join form { display: flex; flex-direction: column; gap: 14px; }
.join label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.join input {
  width: 100%;
  padding: 1rem 1.1rem;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.join input:focus { border-color: var(--neon); }
.join .error { color: var(--red); min-height: 1.3em; font-size: 0.95rem; }

.result { text-align: center; padding-top: 10px; }
.result .icon { font-size: 5rem; line-height: 1; margin: 18px 0 10px; animation: pop 0.6s cubic-bezier(.2,1.6,.4,1); }
.result .team {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--neon);
  margin: 6px 0 18px;
}
.result p { color: var(--muted); line-height: 1.5; }
.result .mates {
  margin-top: 26px;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.result .mates h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 10px; }
.result .mates ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.result .mates li { background: var(--navy-3); padding: 6px 12px; border-radius: 999px; font-size: 0.95rem; }
.result .mates li.me { background: var(--neon); color: var(--navy); font-weight: 700; }

.rolling { font-size: 2rem; font-weight: 800; text-align: center; margin: 40px 0; color: var(--muted); }

@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.join footer { margin-top: auto; padding-top: 40px; color: var(--muted); font-size: 0.8rem; text-align: center; }

/* =========================================================
   Großer Screen
   ========================================================= */
.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 24vw) 1fr;
  gap: 2.2vw;
  padding: 2.4vw;
  overflow: hidden;
}

.side { display: flex; flex-direction: column; gap: 2vh; min-height: 0; }
.side h1 { font-size: clamp(2rem, 3.4vw, 4.4rem); font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em; }
.side h1 em { font-style: normal; color: var(--neon); display: block; }
.side .sub { color: var(--muted); font-size: clamp(1rem, 1.1vw, 1.4rem); line-height: 1.4; }

.qr-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.1vw;
  box-shadow: 0 0 0 6px rgba(198, 255, 0, 0.9), 0 20px 60px rgba(0, 0, 0, 0.35);
  margin-top: 1vh;
}
.qr-card img { width: 100%; display: block; aspect-ratio: 1; }
.qr-url { color: var(--muted); font-size: clamp(0.85rem, 0.9vw, 1.1rem); word-break: break-all; text-align: center; }

.stats { margin-top: auto; display: flex; align-items: stretch; gap: 14px; }
.stats .num { font-size: clamp(2.8rem, 5vw, 6rem); font-weight: 800; color: var(--neon); line-height: 0.9; }
.stats .lbl { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.85rem; font-weight: 700; align-self: flex-end; }

.teams {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.2vw;
  min-height: 0;
}

.team-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1vw 1.2vw;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}
.team-card.flash { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon), 0 0 40px rgba(198, 255, 0, 0.35); }

.team-head { display: flex; align-items: center; gap: 0.7vw; margin-bottom: 1vh; }
.team-head .ic { font-size: clamp(1.4rem, 2.2vw, 3rem); line-height: 1; flex-shrink: 0; }
.team-head h2 { font-size: clamp(0.95rem, 1.35vw, 1.8rem); font-weight: 800; flex: 1; min-width: 0; overflow-wrap: normal; hyphens: manual; overflow: hidden; }
.team-head .count {
  min-width: 2.2em;
  text-align: center;
  background: var(--neon);
  color: var(--navy);
  font-weight: 800;
  border-radius: 999px;
  padding: 0.2em 0.6em;
  font-size: clamp(0.9rem, 1vw, 1.3rem);
  flex-shrink: 0;
}

.members {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-size: var(--member-size, clamp(0.95rem, 1.15vw, 1.6rem));
  line-height: 1.35;
  columns: var(--member-cols, 1);
  column-gap: 1vw;
}
.members li {
  padding: 0.18em 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  break-inside: avoid;
}
.members li.new { animation: slidein 0.8s ease, glow 3s ease; }
.members li.empty { color: var(--muted); font-style: italic; border: 0; }
.admin .members li { cursor: pointer; }
.admin .members li:hover { color: var(--red); text-decoration: line-through; }

@keyframes slidein { from { transform: translateX(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glow { 0%, 40% { color: var(--neon); } 100% { color: inherit; } }

/* Begrüßung neuer Teilnehmer */
.toast {
  position: fixed;
  left: 50%;
  bottom: 4vh;
  transform: translate(-50%, 250%);
  visibility: hidden;
  background: var(--neon);
  color: var(--navy);
  font-weight: 800;
  font-size: clamp(1.2rem, 1.8vw, 2.4rem);
  padding: 0.7em 1.4em;
  border-radius: 999px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: transform 0.45s cubic-bezier(.2,1.3,.4,1);
  z-index: 5;
  white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }

.admin-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.admin-bar .btn { padding: 0.5rem 1rem; font-size: 0.85rem; }

.conn {
  position: fixed;
  bottom: 10px;
  right: 14px;
  font-size: 0.75rem;
  color: var(--muted);
  z-index: 6;
}
.conn.off { color: var(--red); }

.team-card.filler { align-items: center; justify-content: center; text-align: center; gap: 1vh; border-style: dashed; background: transparent; }
.team-card.filler .big { font-size: clamp(3rem, 5vw, 7rem); }
.team-card.filler .sub { color: var(--muted); font-size: clamp(1rem, 1.2vw, 1.6rem); }

/* Kleinere Bildschirme / Fenster: Teams umbrechen statt quetschen */
@media (max-width: 1300px) {
  .teams { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-template-rows: none; grid-auto-rows: max-content; align-content: start; overflow-y: auto; }
  .team-card { overflow: visible; min-height: auto; }
  .members { overflow: visible; }
  .team-card.filler { display: none; }
}
@media (max-width: 800px) {
  .screen { grid-template-columns: 1fr; height: auto; min-height: 100vh; overflow: visible; }
  .side .qr-card { max-width: 320px; }
  .teams { overflow: visible; }
}
