* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', monospace; }
body { background: radial-gradient(ellipse at center, #101024 0%, #06060d 100%); color: #e0e0ff; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.screen { text-align: center; background: rgba(16,16,32,.6); border: 1px solid rgba(120,120,200,.2); border-radius: 16px; padding: 48px 56px; backdrop-filter: blur(9px); box-shadow: 0 20px 60px #0008; animation: fadeUp .28s ease-out; }
h1 { font-size: 64px; letter-spacing: 8px; color: #00e5ff; text-shadow: 0 0 30px #00e5ff88; }
h1 span { color: #ff4081; text-shadow: 0 0 30px #ff408188; }
h2 { font-size: 32px; margin-bottom: 20px; }
#roomCode { color: #00e5ff; letter-spacing: 4px; font-size: 40px; text-shadow: 0 0 20px #00e5ff66; }
input, select, button { background: #181828; color: #e0e0ff; border: 1px solid #333; padding: 12px 18px; font-size: 18px; border-radius: 8px; margin: 6px; }
input:focus { outline: 1px solid #00e5ff; }
button { cursor: pointer; transition: all .15s; border: 1px solid #2a2a4a; }
button:active { transform: scale(.95); }
button:hover { background: #00e5ff; color: #000; box-shadow: 0 0 20px #00e5ff66; border-color: #00e5ff; }
#nick { width: 280px; text-align: center; font-size: 22px; }
#joinCode { width: 110px; text-transform: uppercase; text-align: center; letter-spacing: 3px; }
.row { margin-top: 20px; }
.joinRow { display: flex; justify-content: center; margin-top: 10px; }
.err { color: #ff4081; margin-top: 15px; min-height: 24px; }
.modeBar { margin: 15px 0; }
.modeBtn.sel { background: #00e5ff; color: #000; }
.teamBtn { min-width: 110px; }
.teamBtn.sel { background: #ff4081; color: #fff; }
#plist { list-style: none; margin: 20px auto; width: 380px; text-align: left; }
#plist li { padding: 12px 16px; margin: 6px 0; background: #14141f; border-left: 4px solid; border-radius: 6px; display: flex; justify-content: space-between; font-size: 18px; }
#plist li.dead { opacity: .4; }
.tag { font-size: 12px; opacity: .7; }
#game { position: fixed; inset: 0; }
#cv { position: fixed; inset: 0; transition: filter .45s ease; }
#cv.blurred { filter: blur(7px) saturate(.75) brightness(.65); }
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; background: rgba(4,4,12,.82); backdrop-filter: blur(6px); text-align: center; z-index: 10; }
#overlay h2 { font-size: 56px; color: #ffd500; text-shadow: 0 0 40px #ffd50066; margin-bottom: 8px; }
#overlay small { font-size: 20px; margin-top: 10px; opacity: .8; }
#overlay button { font-size: 24px; padding: 14px 36px; }
#overlay button:disabled { opacity: .5; cursor: default; }
.rmList { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.rmRow { display: flex; justify-content: space-between; gap: 24px; font-size: 17px; padding: 4px 14px; background: rgba(255,255,255,.05); border-radius: 8px; }
.rmBtns { display: flex; gap: 14px; margin-top: 30px; }
.ghostBtn { background: transparent !important; border-color: #555577 !important; color: #9999bb !important; font-size: 18px !important; }
.rejoin { display: block; margin: 14px auto 0; font-size: 15px; padding: 9px 20px; background: transparent; border-color: #555577; color: #9999bb; }
.rejoin:hover { border-color: #00e5ff; color: #00e5ff; }
.modeRow { display: flex; gap: 18px; justify-content: center; margin-top: 30px; }
.bigBtn { font-size: 24px; padding: 26px 38px; min-width: 240px; background: linear-gradient(180deg, #1c1c32, #14141f); border-radius: 12px; }
.bigBtn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px #00e5ff55; }
#stagelist { list-style: none; margin: 10px auto; max-width: 460px; max-height: 55vh; overflow-y: auto; text-align: left; }
#stagelist li.chapter { margin: 14px 0 4px; padding: 4px 8px; font-weight: 700; font-size: .85em; letter-spacing: .08em; text-transform: uppercase; color: #ffd54a; border-bottom: 1px solid #2a2a4a; }
#stagelist li.chapter:first-child { margin-top: 0; }
.stage { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; margin: 5px 0; background: #14141f; border-left: 4px solid #2a2a4a; border-radius: 6px; cursor: pointer; }
.stage:hover { border-left-color: #00e5ff; background: #181828; }
.stage b { color: #e0e0ff; min-width: 130px; }
.stage span { flex: 1; font-size: 14px; opacity: .75; }
.stage em { font-style: normal; font-size: 14px; color: #8f8fb8; }
.stage.done { border-left-color: #3dff7a; }
.stage.done em { color: #3dff7a; }
.stage.locked { opacity: .45; cursor: default; }
.stage.locked:hover { border-left-color: #2a2a4a; background: #14141f; }
#spGoal { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(16,16,30,.85); border: 1px solid rgba(0,229,255,.4); border-radius: 20px; padding: 8px 22px; font-size: 17px; color: #e0e0ff; z-index: 5; pointer-events: none; box-shadow: 0 0 20px #00e5ff22; }
#spProgress { width: 300px; margin: 0 auto 14px; font-size: 15px; color: #8f8fb8; }
.bar { height: 8px; background: #0d0d18; border: 1px solid #2a2a4a; border-radius: 5px; overflow: hidden; margin-top: 7px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #00e5ff, #3dff7a); border-radius: 4px; transition: width .5s ease; box-shadow: 0 0 12px #00e5ff88; }
.stage em { white-space: nowrap; }
.stage { transition: all .12s; }
.stage:hover { transform: translateX(3px); }
#stagelist::-webkit-scrollbar { width: 6px; }
#stagelist::-webkit-scrollbar-thumb { background: #2a2a4a; border-radius: 3px; }
.padFocus { outline: 2px solid #00e5ff !important; box-shadow: 0 0 18px #00e5ff88 !important; }
.stage.padFocus { transform: translateX(3px); border-left-color: #00e5ff; }
.padHint { position: fixed; bottom: 10px; width: 100%; text-align: center; font-size: 12px; color: #555577; pointer-events: none; z-index: 5; }
#padToast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(60px); background: #14141f; border: 1px solid #00e5ff; color: #00e5ff; padding: 8px 18px; border-radius: 20px; font-size: 14px; opacity: 0; transition: all .25s; pointer-events: none; }
#padToast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- touch controls (nur wenn #touchUI.on, touch.js haengt es ein) ---------- */
#touchUI { position: fixed; inset: 0; z-index: 8; pointer-events: none; display: none; }
#touchUI.on { display: block; }
.tcl { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; pointer-events: none; }
.tcl-move { left: calc(14px + env(safe-area-inset-left, 0px)); grid-template-columns: 76px 76px; grid-template-areas: "l r" "s s"; }
.tb-move[data-k="left"] { grid-area: l; } .tb-move[data-k="right"] { grid-area: r; }
.tb-soft { grid-area: s; }
.tcl-act { right: calc(14px + env(safe-area-inset-right, 0px)); grid-template-columns: 58px 58px 76px 76px 58px; align-items: end; }
.tb { pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(0,229,255,.35); border-radius: 16px; background: rgba(10,10,24,.55); color: #cfefff;
  font-size: 30px; height: 76px; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); box-shadow: 0 4px 14px #0006; transition: transform .06s, background .06s; }
.tb.held { background: rgba(0,229,255,.22); transform: scale(.93); }
.tb-sm { height: 58px; font-size: 22px; border-radius: 12px; opacity: .9; }
.tb-big { font-size: 36px; }
.tb-drop { background: rgba(255,213,0,.16); border-color: rgba(255,213,0,.45); color: #ffe97a; }
.tb-drop.held { background: rgba(255,213,0,.34); }
@media (orientation: landscape) and (max-height: 500px) {
  .tcl { bottom: 10px; }
  .tb { height: 62px; font-size: 24px; }
  .tb-sm { height: 48px; font-size: 18px; }
}

/* ---------- mobile: kompakte Screens ---------- */
@media (max-width: 640px) {
  .screen { padding: 26px 20px; width: min(96vw, 440px); }
  .screen h1 { font-size: 34px; }
  .screen input, .screen select, .screen button { font-size: 16px; }
  .row, .modeRow { flex-wrap: wrap; justify-content: center; }
}

/* ---------- touch: manueller Toggle + Hint ---------- */
#touchToggle { position: fixed; left: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 9;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(0,229,255,.4);
  background: rgba(10,10,24,.7); font-size: 22px; display: none; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; }
#touchToggle.on { display: flex; }
#touchHint { position: absolute; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0;
  text-align: center; font-size: 13px; color: #8f8fb8; pointer-events: none; transition: opacity .8s; }
#touchUI.hintOut #touchHint { opacity: 0; }
.tb-txt { font-size: 14px; font-weight: 700; letter-spacing: .5px; height: 58px; border-radius: 12px; opacity: .9; }
@media (max-width: 700px) {
  .tcl-act { grid-template-columns: 50px 50px 68px 68px 50px; }
  .tb-txt { font-size: 12px; height: 50px; }
}
