/* style.css — Pong Royale: Neon-Pink/Cyan-Theme (gleiches Geruest wie BTM/TRS) */
:root {
  --acc: #f472b6;
  --acc2: #67e8f9;
  --bg: #0b0712;
  --panel: rgba(19, 11, 28, .88);
  --line: rgba(244, 114, 182, .25);
  --txt: #f5ecf3;
  --dim: #9c8fa8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
}
#cv { position: fixed; inset: 0; width: 100%; height: 100%; }
/* Dim-Overlay statt Canvas-blur(): ein statischer Layer kostet nichts,
   blur() auf animiertem Canvas rastert die Dirty-Region pro Frame neu (Stutter) */
#dim { position: fixed; inset: 0; background: rgba(5, 3, 10, .55); z-index: 1;
  opacity: 0; pointer-events: none; transition: opacity .3s ease; }
#dim.on { opacity: 1; }

.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px;
  animation: fadeUp .35s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

h1 {
  font-size: clamp(38px, 7vw, 74px); letter-spacing: .06em; font-weight: 900;
  color: var(--acc); text-shadow: 0 0 32px rgba(244, 114, 182, .5), 0 3px 0 #4a0e33;
}
h1 span { display: block; font-size: .42em; color: var(--acc2); letter-spacing: .5em; text-shadow: 0 0 22px rgba(103,232,249,.4); }
h2 { font-size: 30px; letter-spacing: .04em; }
h2 span { color: var(--acc2); font-family: ui-monospace, monospace; letter-spacing: .15em; }
.tag { color: var(--dim); margin-top: -6px; }

button {
  font: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: 10px;
  background: #22102e; color: var(--txt); padding: 10px 22px;
  transition: transform .12s, background .15s, box-shadow .15s;
}
button:hover:not(:disabled) { background: #33173f; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.4); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button.navFocus { outline: 2px solid var(--acc); outline-offset: 2px; box-shadow: 0 0 14px rgba(244,114,182,.4); }
.bigBtn {
  font-size: 20px; font-weight: 700; padding: 16px 34px; min-width: 280px;
  background: linear-gradient(160deg, #3d1245, #22102e); border-color: var(--acc);
}
.bigBtn:hover:not(:disabled) { background: linear-gradient(160deg, #521c5c, #33173f); }
.ghostBtn { background: transparent; border-color: transparent; color: var(--dim); }
.ghostBtn:hover { color: var(--txt); background: transparent; box-shadow: none; }

input, select {
  font: inherit; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #170c20; color: var(--txt);
}
input { width: 280px; text-align: center; }
#joinCode { width: 110px; text-transform: uppercase; letter-spacing: .2em; font-family: ui-monospace, monospace; }
select { width: auto; }

.col { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; }
.joinRow { display: flex; gap: 8px; }
.soloRow { display: flex; gap: 8px; align-items: center; }
.soloRow button { min-width: 140px; }
.err { color: #ff6d8a; min-height: 1.2em; font-size: 14px; }
.rejoin { color: var(--acc2); border-color: var(--acc2); }

#plist { list-style: none; display: flex; flex-direction: column; gap: 8px; min-width: 300px; }
#plist li {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
#plist .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
#plist .nm { flex: 1; font-weight: 600; }
#plist .st { color: var(--dim); font-size: 13px; }
#plist .st.rdy { color: #7cfc00; }
#plist .host { color: var(--acc2); font-size: 12px; }
#plist .off { opacity: .45; font-style: italic; }

/* HUD im Spiel */
#hud {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; pointer-events: none;
  background: linear-gradient(transparent, rgba(8, 4, 12, .8));
}
#chips { display: flex; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 7px; padding: 5px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; font-size: 13px;
}
.chip .dot { width: 11px; height: 11px; border-radius: 50%; }
.chip.me { border-color: var(--acc2); }
.chip.dead { opacity: .4; text-decoration: line-through; }
#stats { display: flex; gap: 12px; font-size: 15px; }
#stats span { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
#pauseBtn { pointer-events: auto; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); color: var(--txt); font-size: 16px; line-height: 1; }
#pauseBtn:hover { border-color: var(--acc2); }
#count {
  position: fixed; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center;
  font-size: clamp(80px, 18vw, 200px); font-weight: 900; color: var(--acc2);
  text-shadow: 0 0 60px rgba(103, 232, 249, .6); pointer-events: none;
}
#count.tick { animation: cpop .5s ease both; }
@keyframes cpop { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#overlay {
  position: fixed; inset: 0; z-index: 9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: rgba(8, 4, 12, .88); /* kein backdrop-filter: zwingt Frame-fuer-Frame Backdrop-Raster ueberm Canvas */
  animation: fadeUp .3s ease both;
}
#overlay h2 { font-size: clamp(34px, 6vw, 60px); color: var(--acc2); text-shadow: 0 0 40px rgba(103,232,249,.4); }
#overlay .sub { color: var(--dim); }

#sfxBtn {
  position: fixed; top: 12px; right: 12px; z-index: 12;
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  background: var(--panel); font-size: 18px; line-height: 1;
}
#padToast, .padHint { font-size: 13px; }
.padHint { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); color: var(--dim); z-index: 5; pointer-events: none; }
body.ingame .padHint { display: none; }
#padToast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 8px 18px; opacity: 0; transition: opacity .3s; pointer-events: none;
}
#padToast.show { opacity: 1; }

/* ---------- touch controls (floating stick + charge button) ---------- */
#touchUI { position: fixed; inset: 0; z-index: 8; pointer-events: none; display: none; }
#touchUI.on { display: block; }
#stickZone { position: absolute; left: 0; bottom: 0; width: 58%; height: 72%; pointer-events: auto; touch-action: none; }
#stickBase { position: fixed; width: 140px; height: 140px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(244,114,182,.4); background: rgba(24,10,30,.6); /* kein backdrop-filter ueberm Canvas */
  display: flex; align-items: center; justify-content: center; }
#stickNub { width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f9a8d4, #db2777 70%);
  box-shadow: 0 4px 16px #000a, inset 0 -5px 10px #0006; }
#chargeBtn { position: absolute; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  width: 96px; height: 96px; border-radius: 50%; pointer-events: auto; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  border: 2px solid var(--acc2); font-size: 44px; background: radial-gradient(circle at 35% 30%, #1c3345, #0d1420 75%);
  color: var(--txt); box-shadow: 0 6px 20px #000a, 0 0 24px rgba(103,232,249,.25);
  display: flex; align-items: center; justify-content: center; transition: transform .06s; }
#chargeBtn.held { transform: scale(.9); background: radial-gradient(circle at 35% 30%, #2b5270, #14202e 75%); }
@media (orientation: landscape) and (max-height: 500px) {
  #chargeBtn { width: 80px; height: 80px; font-size: 36px; }
}

/* ---------- mobile: kompaktere Eingaben ---------- */
@media (max-width: 640px) {
  .screen { gap: 10px; padding: 14px; }
  .screen h1 { font-size: 30px; }
  .screen input, .screen select, .screen button { font-size: 16px; }
  .soloRow, .joinRow { flex-wrap: wrap; justify-content: center; }
}

/* ---------- touch: manueller Toggle ---------- */
#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 var(--line);
  background: var(--panel); font-size: 22px; display: none; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; }
#touchToggle.on { display: flex; }
