/* CHAOS ARENA */
:root { --pink: #ff4fd8; --cyan: #00e5ff; --yellow: #ffd93d; --dark: #1b1035; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1035; color: #fff; font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ------------------------------------------------ Menü */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; z-index: 50;
  background: radial-gradient(circle at 30% 20%, #ff4fd8 0%, transparent 45%), radial-gradient(circle at 80% 80%, #00e5ff 0%, transparent 45%), linear-gradient(135deg, #3b1c7a, #1b1035); overflow: auto; }
.logo { font-family: 'Arial Black', Impact, sans-serif; font-size: clamp(48px, 11vw, 120px); line-height: 0.9; text-align: center; letter-spacing: 2px; transform: rotate(-3deg); }
.logo span { display: block; color: var(--yellow); text-shadow: 0 6px 0 #d1436f, 0 12px 0 #5a1a6b, 0 18px 30px rgba(0,0,0,.5); animation: wob 2.4s ease-in-out infinite; }
.logo span:nth-child(2) { color: #fff; animation-delay: -1.2s; }
@keyframes wob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
.tag { margin: 0; font-size: 18px; opacity: .95; text-align: center; max-width: 640px; }
.card { background: rgba(20,10,50,.75); border: 3px solid var(--cyan); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; width: min(380px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.card label { display: flex; flex-direction: column; gap: 4px; font-weight: bold; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--cyan); }
.card input { padding: 12px; border-radius: 12px; border: 2px solid #5a3a9a; background: #120a2a; color: #fff; font-size: 18px; font-weight: bold; outline: none; user-select: text; }
.card input:focus { border-color: var(--yellow); }
#join { padding: 16px; border: 0; border-radius: 14px; font-size: 22px; font-weight: 900; color: #2a0a3a; background: linear-gradient(180deg, #ffe66d, #ffb703); cursor: pointer; box-shadow: 0 6px 0 #b36b00; transition: transform .08s; font-family: 'Arial Black', sans-serif; }
#join:hover { transform: translateY(-2px) scale(1.02); }
#join:active { transform: translateY(4px); box-shadow: 0 2px 0 #b36b00; }
#menuErr { color: #ff8a8a; min-height: 18px; font-weight: bold; text-align: center; }
.help { max-width: 700px; display: grid; gap: 8px; font-size: 14px; text-align: center; opacity: .95; }
.help .keys { color: var(--yellow); font-weight: bold; }

/* ------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; }
#phase { font-size: 13px; letter-spacing: 3px; font-weight: bold; opacity: .85; }
#timer { font-family: 'Arial Black', sans-serif; font-size: 34px; }
#goal { font-size: 13px; opacity: .9; }
#eventBanner { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, #ff4fd8, #ffb703); padding: 6px 18px; border-radius: 30px; font-size: 18px; display: flex; gap: 12px; align-items: center; animation: pulse .6s ease-in-out infinite alternate; }
#eventBanner span { background: rgba(0,0,0,.35); padding: 2px 10px; border-radius: 20px; font-size: 14px; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.06); } }
#announce { position: absolute; top: 24%; left: 0; right: 0; text-align: center; }
#annText { font-family: 'Arial Black', Impact, sans-serif; font-size: clamp(34px, 6vw, 84px); color: var(--yellow); -webkit-text-stroke: 3px #5a1a6b; text-shadow: 0 6px 0 #5a1a6b, 0 12px 20px rgba(0,0,0,.4); opacity: 0; transform: scale(.4); }
#annText.show { animation: annpop 2.6s ease-out forwards; }
#annText.big { color: #fff; -webkit-text-stroke-color: #d1436f; }
@keyframes annpop { 0% { opacity: 0; transform: scale(.3) rotate(-6deg); } 10% { opacity: 1; transform: scale(1.15) rotate(2deg); } 18% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
#annSub { font-size: clamp(16px, 2vw, 26px); font-weight: bold; margin-top: 6px; opacity: 0; }
#annSub.show { animation: annsub 2.6s ease-out forwards; }
@keyframes annsub { 0%,10% { opacity: 0; } 20%,80% { opacity: 1; } 100% { opacity: 0; } }
#killfeed { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; max-width: 46vw; }
#killfeed div { background: rgba(20,10,50,.7); padding: 5px 12px; border-radius: 10px; font-size: 14px; font-weight: bold; animation: kf 6s forwards; border-left: 4px solid var(--pink); }
#killfeed div.me { border-color: var(--yellow); background: rgba(90,40,120,.85); }
@keyframes kf { 0% { transform: translateX(100%); opacity: 0; } 5% { transform: translateX(0); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%,-50%); }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 4px #000; }
#crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; opacity: .0; }
#crosshair::after { left: 0; top: 10px; width: 22px; height: 2px; opacity: 0; }
#crosshair { border: 2px solid rgba(255,255,255,.85); border-radius: 50%; width: 18px; height: 18px; box-shadow: 0 0 4px #000, inset 0 0 4px #000; }
#crosshair.dead { display: none; }
#hitmark { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; transform: translate(-50%,-50%) rotate(45deg) scale(0); opacity: 0; }
#hitmark::before, #hitmark::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 6px #f00; }
#hitmark::before { left: 18px; top: 0; width: 4px; height: 40px; } #hitmark::after { left: 0; top: 18px; width: 40px; height: 4px; }
#hitmark.on { animation: hm .25s ease-out; }
@keyframes hm { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.4); } 100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(.8); } }
#dmgflash { position: absolute; inset: 0; background: radial-gradient(circle, transparent 40%, rgba(255,0,0,.55)); opacity: 0; }
#dmgflash.on { animation: df .4s ease-out; }
@keyframes df { 0% { opacity: 1; } 100% { opacity: 0; } }
#labels { position: absolute; inset: 0; overflow: hidden; }
.lbl { position: absolute; transform: translate(-50%, -100%); text-align: center; font-weight: bold; font-size: 14px; white-space: nowrap; }
.lbl .bar { width: 60px; height: 6px; background: rgba(0,0,0,.6); border-radius: 4px; margin: 2px auto 0; overflow: hidden; }
.lbl .bar i { display: block; height: 100%; background: #69f0ae; }
.lbl .bub { background: #fff; color: #222; padding: 3px 10px; border-radius: 12px; margin-bottom: 4px; text-shadow: none; font-size: 15px; animation: bub .3s ease-out; }
.pop { position: absolute; transform: translate(-50%, -50%); font-family: 'Arial Black', sans-serif; font-size: 22px; font-weight: 900; -webkit-text-stroke: 1px #000; white-space: nowrap; }
.pop.big { font-size: 34px; }
@keyframes bub { from { transform: scale(0); } to { transform: scale(1); } }
#bl { position: absolute; left: 18px; bottom: 18px; width: 300px; }
#myname { font-family: 'Arial Black', sans-serif; font-size: 20px; margin-bottom: 4px; }
#hpbar { position: relative; height: 26px; background: rgba(0,0,0,.55); border: 3px solid #fff; border-radius: 16px; overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #69f0ae, #00e676); transition: width .15s; }
#hptext { position: absolute; inset: 0; text-align: center; font-weight: 900; line-height: 20px; }
#dashbar { position: relative; margin-top: 6px; height: 14px; background: rgba(0,0,0,.5); border-radius: 10px; overflow: hidden; }
#dashfill { height: 100%; width: 100%; background: var(--cyan); }
#dashbar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 14px; font-weight: bold; }
#br { position: absolute; right: 18px; bottom: 18px; text-align: right; }
#wemoji { font-size: 54px; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.6)); }
#wname { font-weight: bold; font-size: 15px; }
#wammo { font-family: 'Arial Black', sans-serif; font-size: 34px; }
#respawn { position: absolute; left: 0; right: 0; top: 55%; text-align: center; font-family: 'Arial Black', sans-serif; font-size: 34px; }
#respawn small { display: block; font-size: 16px; font-family: inherit; opacity: .9; font-weight: bold; }
#warmup { position: absolute; left: 50%; top: 82px; transform: translateX(-50%); text-align: center; background: rgba(20,10,50,.72); padding: 12px 22px; border-radius: 18px; border: 2px solid var(--cyan); max-width: 90vw; }
#wuTitle { font-weight: 900; font-size: 20px; color: var(--yellow); }
#wuSub { font-size: 14px; margin: 4px 0; }
#wuPlayers { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
#wuPlayers span { padding: 3px 10px; border-radius: 14px; background: rgba(255,255,255,.15); font-weight: bold; font-size: 14px; }
#wuPlayers span.rdy { background: #00c853; }
#wuHint { font-size: 12px; opacity: .85; }
#stats { position: absolute; left: 8px; top: 8px; font-size: 11px; opacity: .7; font-family: monospace; }
#tips { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11px; opacity: .55; }

#scoreboard { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20; pointer-events: none; }
.sb { background: rgba(20,10,50,.88); border: 3px solid var(--pink); border-radius: 20px; padding: 18px 26px; min-width: 420px; }
.sb h2 { margin: 0 0 8px; font-family: 'Arial Black', sans-serif; text-align: center; color: var(--yellow); }
.sb table { width: 100%; border-collapse: collapse; font-size: 18px; }
.sb th { text-align: right; opacity: .6; font-size: 12px; text-transform: uppercase; } .sb th:first-child { text-align: left; }
.sb td { padding: 6px 4px; text-align: right; font-weight: bold; } .sb td:first-child { text-align: left; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: middle; border: 2px solid #fff; }

#over { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 30; background: rgba(20,10,50,.72); pointer-events: none; }
#over h1 { font-family: 'Arial Black', sans-serif; font-size: clamp(36px, 7vw, 90px); margin: 0; color: var(--yellow); text-shadow: 0 6px 0 #5a1a6b; animation: wob 1.4s ease-in-out infinite; text-align: center; }
#overList { display: grid; gap: 8px; min-width: 340px; }
#overList div { display: flex; justify-content: space-between; gap: 30px; background: rgba(255,255,255,.12); border-radius: 14px; padding: 10px 18px; font-weight: bold; font-size: 20px; }
#overList div:first-child { background: linear-gradient(90deg, #ffd93d, #ff9f43); color: #2a0a3a; font-size: 26px; }
#overSub { font-weight: bold; opacity: .9; }
#pause { position: fixed; inset: 0; z-index: 40; background: rgba(20,10,50,.65); display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; font-family: 'Arial Black', sans-serif; font-size: 44px; cursor: pointer; }
#pause small { font-size: 16px; font-family: 'Trebuchet MS', sans-serif; }

/* ------------------------------------------------ Menü v2: zweispaltig, passt in den Bildschirm */
#menu { flex-direction: row; align-items: stretch; justify-content: center; gap: 20px; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow: hidden; }
.mLeft { flex: 0 0 340px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; min-height: 0; }
.mLeft .logo { font-size: clamp(34px, 9vh, 84px); }
.mLeft .card { padding: 14px; gap: 10px; width: 100%; }
.mLeft .card input { padding: 9px; font-size: 16px; }
.mLeft .keys { font-size: 12px; color: var(--yellow); font-weight: bold; text-align: center; }
.mRight { flex: 1 1 0; max-width: 780px; display: flex; flex-direction: column; min-height: 0; align-self: center; max-height: 100%; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab { flex: 1; padding: 10px 6px; border: 2px solid #5a3a9a; border-radius: 12px; background: #120a2a; color: #fff; font-weight: 900; font-size: 15px; cursor: pointer; font-family: inherit; }
.tab.on { background: linear-gradient(180deg, #ffe66d, #ffb703); color: #2a0a3a; border-color: #ffb703; }
.tabBody { flex: 1 1 auto; min-height: 0; max-height: calc(100vh - 90px); overflow-y: auto; background: rgba(20,10,50,.72); border: 3px solid var(--cyan); border-radius: 18px; padding: 12px; -webkit-overflow-scrolling: touch; }
.tp { display: none; }
.tp.on { display: block; }
@media (max-height: 520px) and (orientation: landscape) {
  .mLeft { flex-basis: 280px; }
  .mLeft .logo { font-size: 34px; }
  .mLeft .tag, .mLeft .keys { display: none; }
  .tabBody { max-height: calc(100vh - 70px); }
}
@media (max-width: 700px), (orientation: portrait) {
  #menu { flex-direction: column; overflow-y: auto; justify-content: flex-start; }
  .mLeft { flex: none; width: min(420px, 100%); }
  .mRight { width: 100%; max-width: none; align-self: stretch; max-height: none; }
  .tabBody { max-height: 60vh; }
}

/* kurze Bildschirme (Handy quer): HUD tiefer setzen, damit die Bildmitte frei bleibt */
@media (max-height: 520px) {
  #pwSlots { bottom: 64px !important; transform: translateX(-50%) scale(.85); }
  #abil { bottom: 6px !important; }
  #tips { display: none; }
}
