:root {
  --bg: #0b1020;
  --bg2: #121a33;
  --panel: #18224a;
  --panel2: #1f2c5c;
  --text: #eaf0ff;
  --muted: #93a0c8;
  --accent: #ffb020;
  --accent2: #32d6a6;
  --win: #32d6a6;
  --loss: #ff6b6b;
  --draw: #93a0c8;
  --line: rgba(255,255,255,.08);
  --a: #4f9dff;
  --b: #ff7a59;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #1a2550, transparent),
              radial-gradient(1000px 700px at 110% 10%, #102a44, transparent),
              var(--bg);
  color: var(--text);
}

/* ====================== SCOREBOARD / BEAMER ====================== */
.board {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 1.4vh 2vw;
  gap: 1.2vh;
}
.board-header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--line); padding-bottom: 1vh;
}
.brand { display: flex; align-items: center; gap: 1.2vw; }
.logo { font-size: 4.5vh; }
.board-header h1 { font-size: 4vh; letter-spacing: .5px; }
.header-right { text-align: right; }
.view-name { font-size: 2.4vh; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 2px; }
.clock { font-size: 2.2vh; color: var(--muted); font-variant-numeric: tabular-nums; }

.current-banner {
  background: linear-gradient(90deg, rgba(79,157,255,.22), rgba(255,122,89,.22));
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 1.4vh 2vw;
  display: flex; flex-direction: column; align-items: center; gap: .6vh;
  box-shadow: 0 0 40px rgba(255,176,32,.15);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{box-shadow:0 0 30px rgba(255,176,32,.12);} 50%{box-shadow:0 0 55px rgba(255,176,32,.30);} }
.cb-top { display: flex; align-items: center; justify-content: center; gap: 2vw; }
.cb-label { font-size: 2.2vh; color: var(--accent); font-weight: 800; letter-spacing: 2px; }
.cb-timer {
  font-size: 4.4vh; font-weight: 900; font-variant-numeric: tabular-nums;
  color: var(--text); background: rgba(0,0,0,.3); padding: .2vh 1.4vw; border-radius: 12px;
  min-width: 9vw; text-align: center; letter-spacing: 1px;
}
.cb-timer.low { color: var(--accent); }
.cb-timer.zero { color: var(--loss); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.cb-teams { display: flex; align-items: center; gap: 2.5vw; }
.cb-team { font-size: 5.2vh; font-weight: 900; }
.cb-a { color: var(--a); }
.cb-b { color: var(--b); }
.cb-score { font-size: 6vh; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 10vw; text-align: center; }
.cb-meta { font-size: 2vh; color: var(--muted); }

.next-banner {
  display: flex; align-items: center; justify-content: center; gap: 1.6vw;
  background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--accent2);
  border-radius: 12px; padding: 1vh 2vw;
}
.nb-label { font-size: 2vh; color: var(--accent2); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.nb-teams { font-size: 3vh; font-weight: 800; }
.nb-vs { color: var(--muted); font-weight: 600; font-size: 2.2vh; }
.nb-meta { font-size: 1.9vh; color: var(--muted); }

.trend { font-size: 1.7vh; margin-left: .4vw; }
.trend.up { color: var(--win); }
.trend.down { color: var(--loss); }
.trend.flat { color: var(--muted); opacity: .45; }

.stage { flex: 1; display: flex; min-height: 0; }
.panel {
  flex: 1; background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: 16px;
  padding: 2vh 2vw; display: flex; flex-direction: column; min-height: 0;
  animation: fade .5s ease;
}
@keyframes fade { from{opacity:0; transform: translateY(10px);} to{opacity:1; transform:none;} }
.panel h2 { font-size: 3vh; margin-bottom: 1.4vh; color: var(--text); }
.panel .grid-groups { display: flex; gap: 1.6vw; flex: 1; min-height: 0; }
.group-card { flex: 1; background: var(--panel2); border-radius: 14px; padding: 1.4vh 1.2vw; display: flex; flex-direction: column; min-height: 0; }
.group-card h3 { font-size: 2.6vh; margin-bottom: 1vh; color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 1.9vh; color: var(--muted); text-align: left; font-weight: 600;
  padding: .7vh .6vw; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { font-size: 2.4vh; padding: .9vh .6vw; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
.col-rank { width: 3vw; color: var(--muted); font-weight: 800; }
.col-num { text-align: center; width: 4vw; font-variant-numeric: tabular-nums; }
.col-pts { font-weight: 900; color: var(--accent); text-align: center; }
.rank-1 { background: linear-gradient(90deg, rgba(255,176,32,.18), transparent); }
.rank-2 { background: linear-gradient(90deg, rgba(147,160,200,.14), transparent); }
.team-name { font-weight: 700; }

.results-list { display: flex; flex-direction: column; gap: 1vh; overflow: hidden; }
.result-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--panel2); border-radius: 12px; padding: 1.2vh 1.4vw; gap: 1vw;
}
.result-row .ra { text-align: right; }
.result-row .rb { text-align: left; }
.r-team { font-size: 2.6vh; font-weight: 700; }
.r-score { font-size: 3vh; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 6vw; text-align: center; }
.r-win { color: var(--win); }
.r-lose { color: var(--muted); }
.badge { font-size: 1.6vh; padding: .2vh .6vw; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); margin-left: .6vw; }
.badge.final { background: rgba(255,176,32,.2); color: var(--accent); }

/* Finalrunde / Bracket */
.bracket { display: flex; gap: 2vw; flex: 1; align-items: stretch; overflow: auto; }
.bracket-round { display: flex; flex-direction: column; justify-content: space-around; gap: 1.4vh; min-width: 22vw; }
.bracket-round h3 { font-size: 2.4vh; color: var(--accent); margin-bottom: .6vh; text-align: center; }
.bmatch { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bmatch .brow { display: flex; justify-content: space-between; align-items: center; padding: 1.1vh 1.2vw; font-size: 2.4vh; }
.bmatch .brow + .brow { border-top: 1px solid var(--line); }
.bmatch .bwin { color: var(--win); font-weight: 800; }
.bmatch .bscore { font-weight: 900; font-variant-numeric: tabular-nums; }
.bmatch .bpending { color: var(--muted); }

.empty { color: var(--muted); font-size: 2.4vh; text-align: center; margin: auto; }

/* ====================== SIEGEREHRUNG / PODIUM ====================== */
.fx-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 60; display: none;
}
.fx-canvas.on { display: block; }

.podium-panel {
  position: relative; overflow: hidden;
  background:
    radial-gradient(60vw 50vh at 50% 8%, rgba(255,196,64,.18), transparent 60%),
    linear-gradient(180deg, #0c1330, #0a0f24);
}
.ceremony-title {
  text-align: center; font-size: 4.2vh; font-weight: 900; letter-spacing: 2px;
  margin: 1vh 0 .4vh; background: linear-gradient(90deg,#ffd76a,#fff6d0,#ffb020,#fff6d0,#ffd76a);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: shimmer 3.5s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.ceremony-sub { text-align: center; color: var(--muted); font-size: 2vh; margin-bottom: 1vh; letter-spacing: 1px; }

.podium {
  flex: 1; display: flex; align-items: flex-end; justify-content: center;
  gap: 2.2vw; padding: 1vh 2vw 0; min-height: 0;
}
.pcol { display: flex; flex-direction: column; align-items: center; width: 20vw; max-width: 320px; }

.pteam {
  display: flex; flex-direction: column; align-items: center; gap: .4vh;
  margin-bottom: 1.2vh; opacity: 0; transform: translateY(24px) scale(.9);
  animation: teamIn .6s cubic-bezier(.22,1,.36,1) forwards;
}
.medal { font-size: 5vh; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); animation: medalDrop .7s cubic-bezier(.3,1.5,.5,1) backwards; }
.pname { font-size: 3vh; font-weight: 800; text-align: center; line-height: 1.05; }
.psub { font-size: 1.8vh; color: var(--muted); }

.pblock {
  position: relative; width: 100%; border-radius: 12px 12px 0 0;
  display: flex; align-items: flex-start; justify-content: center;
  transform: translateY(105%); animation: rise .9s cubic-bezier(.16,1,.3,1) forwards;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 -6px 30px rgba(0,0,0,.35);
}
.pblock .prank { font-size: 6vh; font-weight: 900; color: rgba(0,0,0,.35); margin-top: 1.2vh; }

/* Höhen & Farben */
.first  .pblock { height: 34vh; background: linear-gradient(180deg,#ffe488,#f6b21a 60%,#d98e00); }
.second .pblock { height: 25vh; background: linear-gradient(180deg,#eef3ff,#c3cede 60%,#9aa8c0); }
.third  .pblock { height: 18vh; background: linear-gradient(180deg,#f6c79a,#cd7f43 60%,#9c5a2a); }

/* Staffelung: erst 3., dann 2., dann 1. */
.third  .pblock { animation-delay: .15s; } .third  .pteam { animation-delay: .85s; } .third  .medal { animation-delay: .95s; }
.second .pblock { animation-delay: .45s; } .second .pteam { animation-delay: 1.15s; } .second .medal { animation-delay: 1.25s; }
.first  .pblock { animation-delay: .8s; }  .first  .pteam { animation-delay: 1.6s; }  .first  .medal { animation-delay: 1.7s; }

/* Champion-Extras */
.crown {
  font-size: 5.5vh; margin-bottom: -.4vh; opacity: 0;
  animation: crownIn .8s cubic-bezier(.3,1.6,.5,1) 1.5s forwards, floatY 2.4s ease-in-out 2.4s infinite;
  filter: drop-shadow(0 0 14px rgba(255,196,64,.8));
}
.first .pname { color: #ffe488; text-shadow: 0 0 18px rgba(255,196,64,.5); }
.rays {
  position: absolute; top: 50%; left: 50%; width: 60vh; height: 60vh; transform: translate(-50%,-50%);
  background: conic-gradient(from 0deg, rgba(255,210,90,.0) 0deg, rgba(255,210,90,.16) 18deg, rgba(255,210,90,0) 36deg,
    rgba(255,210,90,.16) 54deg, rgba(255,210,90,0) 72deg, rgba(255,210,90,.16) 90deg, rgba(255,210,90,0) 108deg,
    rgba(255,210,90,.16) 126deg, rgba(255,210,90,0) 144deg, rgba(255,210,90,.16) 162deg, rgba(255,210,90,0) 180deg,
    rgba(255,210,90,.16) 198deg, rgba(255,210,90,0) 216deg, rgba(255,210,90,.16) 234deg, rgba(255,210,90,0) 252deg,
    rgba(255,210,90,.16) 270deg, rgba(255,210,90,0) 288deg, rgba(255,210,90,.16) 306deg, rgba(255,210,90,0) 324deg,
    rgba(255,210,90,.16) 342deg, rgba(255,210,90,0) 360deg);
  border-radius: 50%; opacity: 0; z-index: -1;
  animation: raysIn 1.2s ease 1.6s forwards, spin 18s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 18%, #000 55%, transparent 75%);
          mask: radial-gradient(circle, transparent 18%, #000 55%, transparent 75%);
}

@keyframes rise { from { transform: translateY(105%); } to { transform: translateY(0); } }
@keyframes teamIn { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes medalDrop { from { opacity: 0; transform: translateY(-40px) rotate(-25deg); } to { opacity: 1; transform: none; } }
@keyframes crownIn { from { opacity: 0; transform: translateY(-30px) scale(.4) rotate(-15deg); } to { opacity: 1; transform: none; } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes raysIn { to { opacity: 1; } }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.board-footer { display: flex; align-items: center; justify-content: space-between; padding-top: .6vh; }
.dots { display: flex; gap: .8vw; }
.dot { width: 1.2vh; height: 1.2vh; border-radius: 50%; background: var(--line); }
.dot.active { background: var(--accent); }
.footer-hint { font-size: 1.7vh; color: var(--muted); }
.footer-hint a { color: var(--muted); }
.hidden { display: none !important; }

/* ====================== ADMIN ====================== */
.admin { padding: 24px; max-width: 1200px; margin: 0 auto; }
.admin h1 { font-size: 26px; margin-bottom: 4px; }
.admin .sub { color: var(--muted); margin-bottom: 20px; }
.login-wrap { max-width: 380px; margin: 12vh auto; text-align: center; }
.login-wrap .card { background: var(--panel); border:1px solid var(--line); border-radius: 16px; padding: 32px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 20px; }
.card h2 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font-size: 15px; font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--a); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
button {
  cursor: pointer; border: none; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; font-weight: 700; font-family: inherit; background: var(--a); color: #fff;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.warn { background: var(--loss); }
button.ok { background: var(--accent2); color: #06251c; }
button.small { padding: 6px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.admin table { margin-top: 8px; }
.admin thead th { color: var(--muted); }
.admin tbody td { font-size: 14px; }
.tag { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,.08); }
.tag.done { background: rgba(50,214,166,.18); color: var(--win); }
.tag.pending { background: rgba(255,176,32,.18); color: var(--accent); }
.tag.current { background: rgba(79,157,255,.22); color: var(--a); }
.tag.next { background: rgba(50,214,166,.18); color: var(--accent2); }
.flash { position: fixed; top: 16px; right: 16px; background: var(--accent2); color:#06251c; padding: 12px 18px; border-radius: 10px; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.4); opacity:0; transform: translateY(-10px); transition:.25s; z-index: 50; }
.flash.show { opacity: 1; transform: none; }
.flash.err { background: var(--loss); color: #fff; }
.muted { color: var(--muted); }
.topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 18px; }
.topbar .links a { color: var(--muted); margin-left: 16px; text-decoration: none; }
.score-input { max-width: 70px; }
.inline { display:flex; gap:6px; align-items:center; }

/* Live-Steuerung */
.live-card { border-color: var(--loss); }
.live-empty { color: var(--muted); padding: 6px 0; }
.live-grid { display:flex; align-items:center; justify-content:center; gap:24px; flex-wrap:wrap; }
.live-team { text-align:center; min-width:200px; }
.live-team .ln { font-size:20px; font-weight:800; margin-bottom:8px; }
.live-team.a .ln { color: var(--a); }
.live-team.b .ln { color: var(--b); }
.live-score { font-size:54px; font-weight:900; font-variant-numeric:tabular-nums; line-height:1; margin:6px 0; }
.live-btns { display:flex; gap:8px; justify-content:center; }
.bigbtn { font-size:22px; font-weight:900; width:54px; height:48px; padding:0; }
.bigminus { background: var(--panel2); border:1px solid var(--line); color:var(--text); }
.live-mid { text-align:center; min-width:170px; }
.live-timer { font-size:46px; font-weight:900; font-variant-numeric:tabular-nums; letter-spacing:1px; }
.live-timer.low { color: var(--accent); }
.live-timer.zero { color: var(--loss); }
.live-timer-ctrls { display:flex; gap:6px; justify-content:center; margin-top:8px; flex-wrap:wrap; }
.live-meta { text-align:center; color:var(--muted); margin-top:12px; }
.live-finish { margin-top:14px; text-align:center; }
