/* DuckDuckFail — Look des Prototyps, erweitert um Menü/Lobby/Online-HUD */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0d1117;
  font-family: 'Segoe UI', system-ui, sans-serif;
  touch-action: none;
  color: #e6edf3;
}
#wrap { position: relative; width: 100vw; height: 100vh; }
canvas { display: block; touch-action: none; position: absolute; inset: 0; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  max-width: 70vw;
  color: #fff; font-size: 17px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  pointer-events: none; z-index: 5;
}
.pill {
  background: rgba(0,0,0,0.35);
  padding: 5px 12px; border-radius: 20px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
#comboPill { color: #feca57; }

#playersHud {
  position: absolute; top: max(60px, calc(env(safe-area-inset-top) + 46px)); left: 14px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 5; pointer-events: none;
  font-size: 13px; font-weight: 600;
}
#playersHud .phRow {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.3); border-radius: 12px; padding: 3px 10px;
}
#playersHud .phDot { width: 10px; height: 10px; border-radius: 50%; }
#playersHud .phRow.dead { opacity: 0.45; }
#playersHud .phRow.offline .phName::after { content: ' 🔌'; }

#levelToast {
  position: absolute; top: 40%; left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 44px; font-weight: 800; color: #feca57;
  text-shadow: 0 0 20px rgba(254,202,87,0.8), 0 2px 6px rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none; z-index: 7;
  transition: opacity 0.25s, transform 0.25s;
}
#levelToast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

#countdownOverlay {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#countdownVal {
  font-size: 120px; font-weight: 800; color: #48dbfb;
  text-shadow: 0 0 40px rgba(72,219,251,0.7), 0 4px 10px rgba(0,0,0,0.6);
}

#netStatus {
  position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(255,107,107,0.25); border: 1px solid rgba(255,107,107,0.5);
  padding: 8px 16px; border-radius: 20px; font-size: 14px; z-index: 9;
}

#rotateHint {
  position: absolute; top: 30%; left: 50%; transform: translateX(-50%);
  background: rgba(254,202,87,0.18); border: 1px solid rgba(254,202,87,0.5);
  color: #feca57; padding: 10px 18px; border-radius: 20px;
  font-size: 15px; font-weight: 600; z-index: 9; pointer-events: none;
  white-space: nowrap;
}

#pauseBtn {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 6;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.35);
  color: #fff; font-size: 18px; cursor: pointer;
}

/* ---------- Steuerung ---------- */
.ctrlGroup {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; z-index: 6;
}
#p1Controls { bottom: max(20px, env(safe-area-inset-bottom)); }
#p2Controls { top: 78px; transform: translateX(-50%) rotate(180deg); }
.ctrlBtn {
  pointer-events: auto;
  width: 60px; height: 60px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(3px);
  color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.ctrlBtn:active, .ctrlBtn.pressed { background: rgba(72,219,251,0.35); transform: scale(0.92); }
.p2 .ctrlBtn:active, .p2 .ctrlBtn.pressed { background: rgba(255,159,243,0.35); }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,17,23,0.93);
  text-align: center; padding: 20px; overflow-y: auto;
}
.screenInner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 460px; width: 100%;
  padding: max(10px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
}
.gradTitle {
  font-size: 34px; font-weight: 800;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: 14px; color: #9da7b3; }
.hint { font-size: 12px; color: #7d8590; }
.msg {
  font-size: 14px; color: #ff6b6b;
  background: rgba(255,107,107,0.12); border-radius: 8px; padding: 8px 14px;
}

input[type="text"] {
  padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 15px; width: 100%;
  text-align: center; text-transform: uppercase;
}
input::placeholder { color: #7d8590; text-transform: none; }

.menuButtons { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.menuBtn {
  padding: 12px 18px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer; width: 100%;
}
.menuBtn:active { transform: scale(0.97); }
.menuBtn.accent {
  border: none; color: #0d1117;
  background: linear-gradient(90deg, #48dbfb, #1dd1a1);
  box-shadow: 0 4px 14px rgba(72,219,251,0.35);
  font-weight: 700;
}
.menuBtn.big { font-size: 18px; padding: 14px 20px; }
.menuBtn.subtle { border-color: transparent; background: none; color: #7d8590; font-size: 14px; }
.joinRow { display: flex; gap: 8px; }
.joinRow input { width: 110px; letter-spacing: 3px; font-weight: 700; }
#localSetup { display: flex; gap: 8px; width: 100%; }

#skinPicker { display: flex; gap: 10px; justify-content: center; }
.skinDot {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.skinDot.selected { border-color: #fff; transform: scale(1.15); }

/* ---------- Lobby ---------- */
#lobbyCode {
  font-size: 44px; font-weight: 800; letter-spacing: 10px;
  color: #48dbfb; text-shadow: 0 0 20px rgba(72,219,251,0.5);
}
#lobbyPlayers { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.lobbyPlayer {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 14px;
  font-size: 15px; font-weight: 600;
}
.lobbyPlayer .dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.lobbyPlayer .lname { flex: 1; text-align: left; }
.lobbyPlayer .status { font-size: 13px; color: #7d8590; }
.lobbyPlayer.offline { opacity: 0.5; }
.lobbyPlayer .hostBadge { font-size: 12px; color: #feca57; }

.modeRow { display: flex; gap: 10px; }
.modeBtn {
  padding: 10px 18px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.modeBtn.active { border-color: #48dbfb; background: rgba(72,219,251,0.18); }
.modeBtn:disabled { opacity: 0.6; cursor: default; }

/* ---------- Game Over ---------- */
#goResults { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.goRow {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px 14px;
  font-size: 15px; font-weight: 600;
}
.goRow .place { width: 34px; }
.goRow .gname { flex: 1; text-align: left; }
.goRow .gscore { color: #1dd1a1; font-weight: 700; }
.goRow.winner { border: 1px solid rgba(254,202,87,0.5); }
#goSubmitRow { display: flex; flex-direction: column; gap: 8px; width: 100%; align-items: center; }

/* ---------- Leaderboard ---------- */
#leaderboard {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border-radius: 10px; padding: 12px 14px;
}
#leaderboard h3 { font-size: 14px; color: #58a6ff; margin-bottom: 8px; text-align: left; }
.lbTabs { display: flex; gap: 6px; margin-bottom: 6px; }
.lbTabs button {
  flex: 1; padding: 5px 8px; font-size: 12px; font-weight: 600;
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  background: none; color: #9da7b3; cursor: pointer;
}
.lbTabs button.active { border-color: #48dbfb; color: #fff; background: rgba(72,219,251,0.15); }
#lbList { max-height: 200px; overflow-y: auto; }
.lbRow {
  display: flex; justify-content: space-between; gap: 8px; font-size: 13px;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lbRow:last-child { border-bottom: none; }
.lbRow.me { color: #feca57; }
.lbRank { color: #feca57; font-weight: 700; width: 28px; text-align: left; }
.lbName { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbScore { font-weight: 700; color: #1dd1a1; }
.lbEmpty { font-size: 13px; color: #7d8590; padding: 6px 0; }
