:root {
  --bg: #12101c;
  --panel: rgba(20, 18, 32, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f1ff;
  --muted: #a9a3c4;
  --accent: #ff6b3d;
  --accent2: #ffd23d;
  --good: #7dffb0;
  --gold: #ffd23d;
  --silver: #d6dbe6;
  --bronze: #e0935a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, "Segoe UI", sans-serif; overflow: hidden; }
button { font: inherit; cursor: pointer; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#game.aiming { cursor: crosshair; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

.hidden { display: none !important; }

/* ---------- Join ---------- */
#join {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, #2b1d3f 0%, var(--bg) 70%);
}
.join-card { width: min(460px, calc(100% - 32px)); text-align: center; }
.logo { font-size: clamp(44px, 8vw, 72px); font-weight: 900; letter-spacing: -1px; line-height: 1; margin: 0 0 8px;
  background: linear-gradient(180deg, var(--accent2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); margin: 0 0 28px; }
.join-card form { display: flex; gap: 8px; }
.join-card input {
  flex: 1; font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--text); outline: none;
}
.join-card input:focus { border-color: var(--accent); }
.btn { font-weight: 700; padding: 12px 18px; border-radius: 10px; border: 0; background: var(--accent); color: #1a0d05; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.btn.secondary { background: rgba(255,255,255,0.1); color: var(--text); }
.btn.danger { background: #ff4d6d; color: #fff; }
.controls-help { margin-top: 28px; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; text-align: left; color: var(--muted); }
kbd { display: inline-block; min-width: 28px; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 3px; background: rgba(255,255,255,0.06); color: var(--text); font: 600 13px system-ui; text-align: center; }
.error { color: #ff8095; min-height: 1.4em; margin-top: 10px; }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 10; pointer-events: none; }
.hud-top-left { top: 16px; left: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.hud-top-left .round { font-weight: 800; font-size: 18px; }
.hud-top-left .alive { color: var(--muted); font-size: 14px; }
.hud-top-right { top: 16px; right: 16px; width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hud-top-right h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.hud-bottom-hint { bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }

.standings { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.standings li { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.standings li.me { background: rgba(255,255,255,0.12); font-weight: 700; }
.standings li.offline { opacity: 0.45; }
.standings .rank { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.standings .top1 .rank { color: var(--gold); font-weight: 800; }
.standings .top2 .rank { color: var(--silver); font-weight: 800; }
.standings .top3 .rank { color: var(--bronze); font-weight: 800; }
.standings .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings .pts { font-variant-numeric: tabular-nums; font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex: none; }

#center { position: fixed; inset: 0; z-index: 9; display: grid; place-content: center; text-align: center; pointer-events: none; }
#center .big { font-size: clamp(64px, 14vw, 180px); font-weight: 900; text-shadow: 0 6px 30px rgba(0,0,0,0.6); color: #fff; line-height: 1; }
/* Hinweise oben statt in der Mitte – dort steht der eigene Spieler */
#center .small { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 560px); text-align: center;
  font-size: 17px; font-weight: 600; background: var(--panel); border-radius: 999px; padding: 8px 16px; }
#center .small:empty { display: none; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: rgba(10, 8, 18, 0.55); pointer-events: none; }
.overlay > .card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px 28px; min-width: min(520px, calc(100% - 32px)); max-height: calc(100% - 64px); overflow: auto; }
.overlay h2 { margin: 0 0 14px; text-align: center; font-size: 26px; }
.overlay table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.overlay th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 4px 8px; }
.overlay td { padding: 6px 8px; border-top: 1px solid var(--line); }
.overlay tr.me td { background: rgba(255,255,255,0.1); font-weight: 700; }
.overlay .hint { color: var(--muted); text-align: center; margin: 14px 0 0; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin-top: 20px; }
.step { width: 200px; text-align: center; }
.step .who { font-size: 20px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .stats { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.step .block { border-radius: 12px 12px 0 0; font-size: 56px; font-weight: 900; display: grid; place-items: center; color: rgba(0,0,0,0.55); }
.step1 .block { height: 190px; background: linear-gradient(180deg, #ffe680, var(--gold)); }
.step2 .block { height: 140px; background: linear-gradient(180deg, #f3f5f9, var(--silver)); }
.step3 .block { height: 100px; background: linear-gradient(180deg, #f2b98c, var(--bronze)); }
.step1 .who { font-size: 26px; }
.you { color: var(--good); }

/* ---------- Host ---------- */
.host-panel { position: fixed; z-index: 25; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; max-width: calc(100% - 560px); }
.host-panel label { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.host-panel select { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: #1e1a2c; color: var(--text); }
.host-panel input { width: 56px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--text); }
.host-panel .btn { padding: 8px 12px; font-size: 14px; }
.host-sidebar { position: fixed; z-index: 10; top: 16px; right: 16px; bottom: 16px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.host-sidebar h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.host-sidebar .standings { overflow: auto; flex: 1; }
.host-sidebar .kick { pointer-events: auto; border: 0; background: transparent; color: var(--muted); padding: 0 4px; }
.host-sidebar .kick:hover { color: #ff8095; }
.join-banner { position: fixed; z-index: 11; left: 16px; bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
.join-banner .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.join-banner .url { font-size: clamp(22px, 3vw, 40px); font-weight: 900; color: var(--accent2); }
.join-banner .count { color: var(--muted); margin-top: 4px; }
.host-hint { position: fixed; z-index: 11; left: 16px; top: 16px; color: var(--muted); font-size: 12px; }

/* Host: Mitteltexte über der Arena zentrieren, nicht über der Seitenleiste */
body.host #center, body.host .overlay { right: 300px; }

/* ---------- Shooter-HUD ---------- */
.feed { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.feed:empty { display: none; }
.feed li { background: rgba(0,0,0,0.35); border-radius: 6px; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .icon { margin: 0 4px; }
.feed .me { font-weight: 800; text-decoration: underline; }
.hud-top-left .feed { max-width: 320px; }

.hud-bottom-bar { bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; }
.hud-bottom-bar.dead { opacity: 0.35; }
.hp { position: relative; width: 220px; height: 22px; background: rgba(0,0,0,0.5); border-radius: 999px; overflow: hidden; }
.hp-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: #6ee06e; transition: width 0.15s; }
#hp-text { position: relative; display: block; text-align: center; font-weight: 800; font-size: 13px; line-height: 22px; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.weapon { min-width: 170px; }
#weapon-name { font-weight: 700; font-size: 14px; }
.ammo-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.reload { width: 70px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
#reload-fill { height: 100%; width: 0; background: var(--accent2); }
.extras { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
#dash.ready { color: var(--good); }
#kills { color: var(--text); font-weight: 700; }
#center .small.alert { background: rgba(200, 40, 0, 0.85); color: #fff; animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.05); } }
.join-card { width: min(560px, calc(100% - 32px)); }
.controls-help { font-size: 14px; }

/* ---------- Host-Login ---------- */
.login { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 8, 18, 0.85); }
.login-card { width: min(380px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 0; color: var(--muted); }
.login-card input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--text); outline: none; }
.login-card input:focus { border-color: var(--accent); }
