:root{--bg:#0a0b2a;--card:rgba(17,19,48,.94);--line:#323a78;--ink:#f3f5ff;--mute:#aab2dd;--green:#2ee59d;--blue:#38bdf8;--orange:#ff8a30;--red:#ff5a6e;--gold:#ffd34d;
  --safe-t:env(safe-area-inset-top,0px);--safe-b:env(safe-area-inset-bottom,0px);--safe-l:env(safe-area-inset-left,0px);--safe-r:env(safe-area-inset-right,0px)}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;overscroll-behavior:none}
#stage{position:fixed;inset:0;touch-action:none;cursor:crosshair}
#stage canvas{display:block;width:100%;height:100%}
#boot{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;margin:0;color:var(--mute);letter-spacing:.2em}
button,input,textarea{font:inherit;color:inherit}
button{min-height:48px;padding:10px 18px;border-radius:14px;border:1px solid var(--line);background:#1d2158;font-weight:700;cursor:pointer;touch-action:manipulation}
button:hover{border-color:var(--blue)}
button:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
button:disabled{opacity:.55;cursor:default}
button.primary{background:linear-gradient(135deg,#ff9a3d,#ff5f6d);border-color:transparent;color:#1a0b05}
button.friend{background:linear-gradient(135deg,#2ee59d,#38bdf8);border-color:transparent;color:#04201a}
button.ghost{background:transparent}
input[type=text],textarea{width:100%;min-height:48px;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:#0c0e2c;-webkit-user-select:text;user-select:text;font-size:16px}
textarea{resize:none;font-family:ui-monospace,Consolas,monospace;font-size:13px}
label{display:block;margin:10px 0 4px;color:var(--mute);font-size:.85rem}

.sheet{position:fixed;inset:0;z-index:20;display:flex;overflow:auto;padding:calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));background:linear-gradient(180deg,rgba(6,7,24,.35),rgba(6,7,24,.75))}
.sheet.dim{background:rgba(6,7,24,.55)}
.card{margin:auto;width:min(420px,100%);display:flex;flex-direction:column;gap:10px;padding:20px;border-radius:22px;background:var(--card);border:1px solid var(--line);box-shadow:0 24px 70px rgba(0,0,0,.55)}
.card.small{width:min(340px,100%);text-align:center}
h1{margin:0;text-align:center;line-height:.95;font-size:clamp(2.4rem,11vw,3.4rem);font-weight:900;font-style:italic;letter-spacing:.01em}
h1 span{display:block}h1 em{display:block;color:var(--orange);text-shadow:0 0 28px rgba(255,138,48,.55)}
h2{margin:0;font-size:1.5rem}
h2.good{color:var(--green)}h2.bad{color:var(--red)}
.sub{margin:0;text-align:center;color:var(--mute)}
.note{margin:0;color:var(--mute);font-size:.85rem}
.err{margin:0;color:var(--red);font-size:.9rem;min-height:0}
.err:empty{display:none}
.row{display:flex;gap:8px}.row>*{flex:1}.row input{flex:3;min-width:0}.row input+button,.row input+button+button{flex:0 0 auto}
.seg{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.seg button{padding:8px 4px}
.seg button[aria-pressed=true]{background:var(--blue);color:#04121f;border-color:var(--blue)}
#hostBox,#guestBox,#answerBox,#pasteBox{display:flex;flex-direction:column;gap:8px}
details{font-size:.9rem;color:var(--mute)}summary{cursor:pointer;min-height:32px;display:flex;align-items:center;color:var(--ink)}
details p{margin:6px 0}

#hud{position:fixed;z-index:10;left:0;right:0;top:0;padding:calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:none}
.score{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px;width:min(560px,100%);padding:8px 12px;border-radius:16px;background:rgba(10,12,34,.82);border:1px solid var(--line)}
.side{min-width:0;display:flex;flex-direction:column;gap:4px;opacity:.7}.side.active{opacity:1}
.side.right{align-items:flex-end;text-align:right}
.nm{font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
#side0 .nm{color:var(--team0,var(--green))}#side1 .nm{color:var(--team1,var(--blue))}
.mid{text-align:center}.mid b{font-size:1.9rem;font-variant-numeric:tabular-nums;display:flex;gap:8px;justify-content:center;line-height:1}.mid i{font-style:normal;color:var(--mute)}
.mid small{color:var(--mute);font-size:.72rem;white-space:nowrap}
.tools{display:flex;gap:8px;align-items:center;align-self:flex-end;pointer-events:auto}
.tools button{min-width:48px;padding:6px 10px;background:rgba(10,12,34,.82);position:relative}
#badge{position:absolute;top:-6px;right:-6px;min-width:20px;border-radius:99px;background:var(--red);font-size:.75rem;line-height:20px}
#conn{font-size:.75rem;color:var(--mute)}#conn[data-s=open]{color:var(--green)}#conn[data-s=lost],#conn[data-s=failed]{color:var(--red)}

#banner{position:fixed;z-index:11;left:50%;top:34%;transform:translate(-50%,-50%);pointer-events:none;font-weight:900;font-style:italic;font-size:clamp(2.2rem,10vw,5rem);white-space:nowrap;text-shadow:0 4px 0 rgba(0,0,0,.45),0 0 30px currentColor;animation:pop .35s cubic-bezier(.2,1.6,.4,1)}
#banner.role{top:58%}
#banner.good{color:var(--green)}#banner.bad{color:var(--red)}#banner.role{color:var(--gold);font-size:clamp(1.8rem,8vw,3.4rem)}#banner.keep{color:var(--blue)}
@keyframes pop{from{transform:translate(-50%,-50%) scale(.4);opacity:0}to{transform:translate(-50%,-50%) scale(1);opacity:1}}
#hint{position:fixed;z-index:9;left:50%;bottom:calc(14px + var(--safe-b));transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);margin:0;padding:8px 14px;border-radius:99px;background:rgba(10,12,34,.85);border:1px solid var(--line);font-size:.88rem;text-align:center;pointer-events:none}
#toast{position:fixed;z-index:40;left:50%;bottom:calc(70px + var(--safe-b));transform:translateX(-50%);margin:0;max-width:calc(100vw - 24px);padding:8px 14px;border-radius:12px;background:#222a6b;font-size:.9rem;pointer-events:none}

#chat{position:fixed;z-index:30;right:calc(10px + var(--safe-r));bottom:calc(10px + var(--safe-b));width:min(330px,calc(100vw - 20px));height:min(380px,55vh);display:flex;flex-direction:column;border-radius:16px;background:var(--card);border:1px solid var(--line);overflow:hidden}
#chat .head{display:flex;justify-content:space-between;align-items:center;padding:6px 10px;border-bottom:1px solid var(--line)}
#chat .head button{min-height:36px;padding:4px 10px;margin-left:6px;font-size:.8rem}
#chat .head button[aria-pressed=true]{border-color:var(--red);color:var(--red)}
#chatList{flex:1;overflow:auto;display:flex;flex-direction:column;gap:4px;padding:8px 10px}
#chatList p{margin:auto;color:var(--mute);font-size:.82rem}
#chatList div{max-width:85%;padding:6px 10px;border-radius:12px;word-break:break-word;font-size:.92rem}
#chatList .me{align-self:flex-end;background:#2b6e58}#chatList .opp{align-self:flex-start;background:#252a62}
.quick{display:flex;gap:5px;flex-wrap:wrap;padding:4px 8px}.quick button{min-height:34px;padding:2px 10px;font-size:.78rem;border-radius:99px}
#chatForm{display:flex;gap:6px;padding:8px;border-top:1px solid var(--line)}#chatForm input{flex:1;min-width:0;min-height:42px}#chatForm button{min-height:42px;padding:6px 12px}

/* Handy quer: alles flacher */
@media (max-width:520px){.score{gap:6px;padding:6px 9px}.mid b{font-size:1.5rem}.nm{font-size:.85rem}.card{padding:16px;border-radius:18px}}
@media (orientation:landscape) and (max-height:520px){
  #hud{flex-direction:row;justify-content:center;align-items:flex-start}
  .score{width:min(430px,60vw);padding:4px 10px}.mid b{font-size:1.3rem}.tools{position:fixed;right:calc(8px + var(--safe-r));top:calc(8px + var(--safe-t))}
  #banner{top:45%}#hint{bottom:calc(6px + var(--safe-b));font-size:.75rem;padding:4px 10px}
  .card{width:min(560px,100%);padding:12px 16px;gap:6px}h1{font-size:1.8rem}h1 span,h1 em{display:inline;margin:0 .15em}.sub{display:none}
  #menu label{display:none}
  .card button{min-height:42px}input[type=text]{min-height:42px}
}
@media (prefers-reduced-motion:reduce){#banner{animation:none}}

.side{opacity:1}
/* ---------- Touch-Steuerung ---------- */
#touch{position:fixed;inset:0;z-index:8;pointer-events:none}
body:not([data-screen=play]) #touch{display:none}
#stickZone{position:absolute;left:0;bottom:0;width:46%;height:58%;pointer-events:auto;touch-action:none}
#stickBase{position:absolute;left:calc(22px + var(--safe-l));top:auto;bottom:calc(28px + var(--safe-b));width:128px;height:128px;border-radius:50%;background:rgba(255,255,255,.07);border:2px solid rgba(255,255,255,.22);display:flex;align-items:center;justify-content:center}
#stickBase.on{bottom:auto;background:rgba(255,255,255,.12)}
#stickKnob{width:58px;height:58px;border-radius:50%;background:rgba(255,255,255,.55);box-shadow:0 4px 14px rgba(0,0,0,.4)}
#actions{position:absolute;right:calc(16px + var(--safe-r));bottom:calc(22px + var(--safe-b));display:flex;flex-direction:row-reverse;flex-wrap:wrap-reverse;align-items:flex-end;gap:12px;max-width:52%;pointer-events:none}
#touch .act{--c:#ff8a30;pointer-events:auto;touch-action:none;width:76px;height:76px;min-height:76px;padding:4px;border-radius:50%;border:2px solid var(--c);background:color-mix(in srgb,var(--c) 22%,rgba(10,12,34,.6));font-size:.78rem;letter-spacing:.04em;line-height:1.1}
#touch .act:first-child{width:92px;height:92px;min-height:92px;font-size:.9rem}
#touch .act.on{background:var(--c);color:#0a0b2a;transform:scale(.94)}
body.has-touch #hint{bottom:auto;top:calc(128px + var(--safe-t))}
@media (max-width:360px){#stickBase{width:108px;height:108px}#stickKnob{width:48px;height:48px}#touch .act{width:64px;height:64px;min-height:64px;font-size:.7rem}#touch .act:first-child{width:80px;height:80px;min-height:80px}}
@media (orientation:landscape) and (max-height:520px){#stickZone{width:38%;height:76%}#stickBase{width:112px;height:112px;bottom:calc(14px + var(--safe-b))}#actions{bottom:calc(12px + var(--safe-b));max-width:40%}#touch .act{width:66px;height:66px;min-height:66px}#touch .act:first-child{width:82px;height:82px;min-height:82px}body.has-touch #hint{top:auto;bottom:calc(4px + var(--safe-b))}}
@media (min-width:768px) and (pointer:coarse){#stickBase{width:160px;height:160px}#stickKnob{width:72px;height:72px}#touch .act{width:96px;height:96px;min-height:96px;font-size:.95rem}#touch .act:first-child{width:116px;height:116px;min-height:116px}}
@media (min-width:1200px){.score{width:640px}.mid b{font-size:2.3rem}}

/* ==================== Neon Kicker ==================== */
:root{--team0:#22d3ee;--team1:#ff4fa3}
#stage{cursor:grab}#stage:active{cursor:grabbing}
/* Gast: eigener Name steht auf der eigenen Seite (links) */
.mirror .score>*{grid-row:1}.mirror .score .mid{grid-column:2}
.mirror #side1{grid-column:1;align-items:flex-start;text-align:left}.mirror #side0{grid-column:3;align-items:flex-end;text-align:right}
.mirror .mid b{flex-direction:row-reverse}
h1 span{text-shadow:0 0 30px rgba(34,211,238,.6)}h1 em{color:var(--team1);text-shadow:0 0 30px rgba(255,79,163,.65)}
.autoToggle[aria-pressed=true]{border-color:var(--gold);color:var(--gold)}
.score{box-shadow:0 0 22px rgba(124,108,255,.28)}
.mid small{font-variant-numeric:tabular-nums;font-size:.8rem}
#rodbar{position:fixed;z-index:9;left:calc(10px + var(--safe-l));top:50%;transform:translateY(-50%);display:flex;flex-direction:column;gap:6px}
body:not([data-screen=play]):not([data-screen=pause]) #rodbar,body:not([data-screen=play]) #charge{display:none}
#rodbar button{width:84px;min-height:52px;padding:3px 4px;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.1;background:rgba(10,12,34,.85);border-radius:12px;touch-action:none}
#rodbar button b{font-size:.95rem;letter-spacing:.05em}
#rodbar button small{font-size:.66rem;color:var(--mute);font-weight:600}
#rodbar button[aria-pressed=true]{background:var(--gold);border-color:var(--gold);color:#160f00;box-shadow:0 0 18px rgba(255,211,77,.6)}
#rodbar button[aria-pressed=true] small{color:#3a2b00}
#charge{position:fixed;z-index:9;left:50%;transform:translateX(-50%);bottom:calc(3px + var(--safe-b));width:min(260px,60vw);height:6px;border-radius:9px;background:rgba(255,255,255,.14);overflow:hidden;pointer-events:none}
#charge i{display:block;height:100%;width:0;background:linear-gradient(90deg,#ffd34d,#ff5a6e)}
#touch .act[data-act=a]{box-shadow:0 0 18px rgba(255,211,77,.35)}
@media (min-width:700px){.tools{position:fixed;right:calc(10px + var(--safe-r));top:calc(10px + var(--safe-t))}}
@media (min-width:700px) and (max-width:900px){.score{width:min(430px,calc(100vw - 380px))}}
@media (orientation:portrait){
  #rodbar{top:auto;transform:none;bottom:calc(14px + var(--safe-b));display:grid;grid-template-columns:repeat(2,auto)}
  #rodbar button{width:62px;min-height:50px}#rodbar button small{display:none}
  #actions{bottom:calc(14px + var(--safe-b))}
  #touch .act{width:70px;height:70px;min-height:70px;font-size:.68rem;letter-spacing:0}#touch .act:first-child{width:90px;height:90px;min-height:90px;font-size:.85rem}
}
@media (orientation:portrait) and (max-width:360px){
  #rodbar{left:calc(8px + var(--safe-l));bottom:calc(10px + var(--safe-b));gap:5px}#rodbar button{width:54px;min-height:48px}
  #actions{right:calc(8px + var(--safe-r));bottom:calc(10px + var(--safe-b));gap:8px;max-width:60%}
  #touch .act{width:66px;height:66px;min-height:66px;font-size:.62rem}#touch .act:first-child{width:82px;height:82px;min-height:82px;font-size:.76rem}
  .score{padding:3px 10px}.mid b{font-size:1.3rem}#hint{font-size:.76rem;padding:5px 10px}
}
@media (orientation:portrait) and (min-width:700px){#rodbar button{width:84px;min-height:64px}#rodbar button small{display:block}#touch .act{width:96px;height:96px;min-height:96px;font-size:.85rem}#touch .act:first-child{width:112px;height:112px;min-height:112px;font-size:1rem}}
@media (orientation:landscape){
  #actions{flex-direction:column-reverse;flex-wrap:nowrap;align-items:center;max-width:none}
}
@media (orientation:landscape) and (max-height:520px){
  #rodbar{left:calc(8px + var(--safe-l));top:auto;transform:none;bottom:calc(10px + var(--safe-b));gap:5px}
  #rodbar button{width:64px;min-height:48px}#rodbar button small{display:none}
  #actions{right:calc(10px + var(--safe-r));gap:12px}
  .autoToggle{font-size:.85rem}
}
@media (prefers-reduced-motion:reduce){#rodbar button{box-shadow:none}}
