* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050608;
  color: #8dffdf;
  font-family: Consolas, "Courier New", monospace;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  background: #050608;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: grid;
  gap: 8px;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 255, 199, 0.65);
}

.brand {
  color: #f3264c;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

#connectionHud,
#debug,
#teamHud,
#skillHud {
  width: 220px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 255, 199, 0.32);
  background: rgba(3, 10, 12, 0.78);
  box-shadow: 0 0 24px rgba(0, 255, 199, 0.1);
  color: #8dffdf;
  font-size: 13px;
  line-height: 1.45;
}

#connectionHud {
  display: grid;
  gap: 6px;
  border-color: rgba(215, 255, 245, 0.34);
  color: #d7fff5;
}

.connection-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  align-items: center;
}

.connection-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f3264c;
  box-shadow: 0 0 10px rgba(243, 38, 76, 0.75);
}

.connection-row.online .connection-light {
  background: #0dff6a;
  box-shadow: 0 0 10px rgba(13, 255, 106, 0.75);
}

.connection-row.connecting .connection-light,
.connection-row.grace .connection-light {
  background: #ffd94a;
  box-shadow: 0 0 10px rgba(255, 217, 74, 0.75);
}

#teamHud {
  display: grid;
  gap: 8px;
  border-color: rgba(215, 255, 245, 0.34);
  color: #d7fff5;
}

#teamHud[hidden] {
  display: none;
}

.team-hud-title {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  color: #8dffdf;
  font-size: 12px;
  font-weight: 700;
}

.team-hud-role {
  color: #f3264c;
}

.team-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 7px;
  align-items: center;
}

.team-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.team-name {
  min-width: 0;
  overflow: hidden;
  color: #d7fff5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-status {
  color: #8dffdf;
  font-size: 11px;
}

.team-row.dead .team-status,
.team-row.disconnected .team-status {
  color: #f3264c;
}

.team-health {
  grid-column: 2 / 4;
  height: 6px;
  border: 1px solid rgba(215, 255, 245, 0.24);
  background: rgba(5, 6, 8, 0.76);
}

.team-health-fill {
  height: 100%;
  background: linear-gradient(90deg, #0dff6a, #00ffc7);
  box-shadow: 0 0 10px rgba(13, 255, 106, 0.36);
}

.team-row.dead .team-health-fill,
.team-row.disconnected .team-health-fill {
  background: #f3264c;
  box-shadow: 0 0 10px rgba(243, 38, 76, 0.36);
}

#skillHud {
  border-color: rgba(243, 38, 76, 0.38);
  color: #d7fff5;
}

#healthBar {
  width: 220px;
  height: 14px;
  border: 1px solid rgba(141, 255, 223, 0.55);
  background: rgba(3, 10, 12, 0.78);
  box-shadow: 0 0 18px rgba(0, 255, 199, 0.12);
}

#healthFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0dff6a, #00ffc7);
  box-shadow: 0 0 14px rgba(13, 255, 106, 0.42);
}

#musicToggle {
  width: 220px;
  padding: 7px 10px;
  border: 1px solid rgba(0, 255, 199, 0.32);
  background: rgba(3, 10, 12, 0.78);
  color: #8dffdf;
  font: inherit;
  text-align: left;
  box-shadow: 0 0 18px rgba(0, 255, 199, 0.1);
  pointer-events: auto;
}

#musicToggle:hover {
  border-color: rgba(13, 255, 106, 0.7);
  color: #d7fff5;
}

#bossHud {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(520px, calc(100vw - 32px));
  gap: 7px;
  padding: 10px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(243, 38, 76, 0.46);
  background: rgba(3, 10, 12, 0.84);
  box-shadow: 0 0 26px rgba(243, 38, 76, 0.14);
  color: #d7fff5;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(243, 38, 76, 0.58);
}

#bossHud[hidden] {
  display: none;
}

.boss-hud-title {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  color: #f3264c;
  font-size: 16px;
  font-weight: 700;
}

.boss-hud-meta {
  color: #8dffdf;
  font-size: 12px;
  font-weight: 400;
}

.boss-hud-bar {
  height: 11px;
  border: 1px solid rgba(215, 255, 245, 0.28);
  background: rgba(5, 6, 8, 0.86);
}

.boss-hud-fill {
  height: 100%;
  background: linear-gradient(90deg, #f3264c, #ffb5bf);
  box-shadow: 0 0 16px rgba(243, 38, 76, 0.42);
}

.boss-hud-shield {
  height: 5px;
  background: rgba(5, 6, 8, 0.78);
}

.boss-hud-shield-fill {
  height: 100%;
  background: linear-gradient(90deg, #9ffcff, #ffffff);
  box-shadow: 0 0 12px rgba(159, 252, 255, 0.5);
}

#bootManual,
#mainMenu,
#highScoresOverlay,
#lobbyOverlay,
#pauseOverlay,
#gameOver {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 14px;
  pointer-events: none;
  background: rgba(5, 6, 8, 0.62);
  text-align: center;
  text-shadow: 0 0 16px rgba(243, 38, 76, 0.8);
}

#infoOverlay {
  position: fixed;
  top: 24%;
  left: 50%;
  z-index: 4;
  min-width: min(520px, calc(100vw - 48px));
  padding: 18px 24px;
  transform: translateX(-50%);
  border: 1px solid rgba(0, 255, 199, 0.36);
  background: rgba(3, 10, 12, 0.82);
  box-shadow: 0 0 30px rgba(0, 255, 199, 0.16);
  pointer-events: none;
  text-align: center;
  text-shadow: 0 0 14px rgba(0, 255, 199, 0.65);
  transition: opacity 160ms ease-out;
}

#serverOverlay {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 5;
  width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(243, 38, 76, 0.58);
  background: rgba(20, 3, 7, 0.9);
  box-shadow: 0 0 28px rgba(243, 38, 76, 0.22);
  pointer-events: none;
  text-align: center;
  text-shadow: 0 0 14px rgba(243, 38, 76, 0.7);
}

#infoOverlay[hidden],
#serverOverlay[hidden] {
  display: none;
}

.server-overlay-title {
  color: #f3264c;
  font-size: 18px;
  font-weight: 700;
}

.server-overlay-text {
  margin-top: 4px;
  color: #d7fff5;
  font-size: 13px;
}

.info-title {
  color: #f3264c;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 700;
}

.info-subtitle {
  margin-top: 6px;
  color: #d7fff5;
  font-size: 17px;
}

#bootManual {
  padding: 24px;
}

#mainMenu[hidden],
#bootManual[hidden],
#highScoresOverlay[hidden],
#lobbyOverlay[hidden],
#pauseOverlay[hidden],
#gameOver[hidden] {
  display: none;
}

.overlay-title {
  color: #f3264c;
  font-size: clamp(34px, 7vw, 78px);
  font-weight: 700;
}

.overlay-subtitle,
.overlay-prompt {
  color: #8dffdf;
  font-size: 18px;
}

.overlay-score {
  color: #d7fff5;
  font-size: clamp(22px, 4vw, 42px);
}

.score-form {
  display: grid;
  gap: 8px;
  min-width: min(360px, calc(100vw - 48px));
  justify-self: center;
  color: #8dffdf;
  text-align: left;
  text-shadow: 0 0 10px rgba(0, 255, 199, 0.55);
  pointer-events: auto;
}

.score-submit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

#scoreName,
#submitScore {
  min-height: 36px;
  border: 1px solid rgba(0, 255, 199, 0.42);
  background: rgba(3, 10, 12, 0.9);
  color: #d7fff5;
  font: inherit;
}

#scoreName {
  padding: 7px 9px;
  text-transform: uppercase;
}

#scoreName:disabled {
  border-color: rgba(215, 255, 245, 0.22);
  color: rgba(215, 255, 245, 0.58);
}

#submitScore {
  padding: 7px 12px;
  color: #8dffdf;
}

.score-submit-status,
.leaderboard {
  color: #d7fff5;
  font-size: 13px;
}

#highScoresList {
  max-height: min(56vh, 520px);
  overflow: auto;
}

.menu-actions {
  display: grid;
  gap: 10px;
  width: min(260px, calc(100vw - 48px));
  justify-self: center;
  pointer-events: auto;
}

.menu-actions.inline {
  width: min(360px, calc(100vw - 48px));
}

.menu-actions button {
  min-height: 38px;
  border: 1px solid rgba(0, 255, 199, 0.42);
  background: rgba(3, 10, 12, 0.9);
  color: #d7fff5;
  font: inherit;
}

.menu-actions button:hover {
  border-color: rgba(13, 255, 106, 0.72);
  color: #8dffdf;
}

.leaderboard {
  display: grid;
  gap: 6px;
  min-width: min(360px, calc(100vw - 48px));
  justify-self: center;
  padding: 10px 12px;
  border: 1px solid rgba(243, 38, 76, 0.34);
  background: rgba(3, 10, 12, 0.78);
  text-align: left;
}

.leaderboard-title {
  color: #f3264c;
  font-weight: 700;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  color: #d7fff5;
}

.lobby-panel {
  display: grid;
  gap: 12px;
  width: min(460px, calc(100vw - 48px));
  justify-self: center;
  padding: 14px;
  border: 1px solid rgba(0, 255, 199, 0.34);
  background: rgba(3, 10, 12, 0.82);
  box-shadow: 0 0 26px rgba(0, 255, 199, 0.12);
  text-align: left;
  pointer-events: auto;
}

.lobby-code {
  color: #f3264c;
  font-size: clamp(30px, 6vw, 54px);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0;
}

.lobby-roster {
  display: grid;
  gap: 8px;
}

.lobby-player {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid rgba(215, 255, 245, 0.18);
  background: rgba(5, 6, 8, 0.72);
  color: #d7fff5;
}

.lobby-player-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.lobby-player-role {
  color: #8dffdf;
  font-size: 12px;
}

.lobby-slot-empty {
  opacity: 0.56;
}

.lobby-join-form {
  display: grid;
  gap: 8px;
  color: #8dffdf;
  text-shadow: 0 0 10px rgba(0, 255, 199, 0.55);
}

.lobby-join-form[hidden] {
  display: none;
}

.lobby-join-form label {
  color: #f3264c;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.lobby-join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
}

#joinLobbyCode,
#joinLobbySubmit {
  min-height: 42px;
  border: 1px solid rgba(0, 255, 199, 0.52);
  background: linear-gradient(180deg, rgba(3, 10, 12, 0.96), rgba(5, 6, 8, 0.92));
  color: #d7fff5;
  font: inherit;
  box-shadow: inset 0 0 16px rgba(0, 255, 199, 0.08), 0 0 18px rgba(0, 255, 199, 0.1);
}

#joinLobbyCode {
  padding: 8px 12px;
  color: #f3264c;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0;
}

#joinLobbyCode::placeholder {
  color: rgba(215, 255, 245, 0.32);
}

#joinLobbyCode:focus,
#joinLobbySubmit:focus {
  outline: 2px solid rgba(13, 255, 106, 0.46);
  outline-offset: 2px;
  border-color: rgba(13, 255, 106, 0.86);
}

#joinLobbySubmit {
  color: #8dffdf;
  font-weight: 700;
  text-transform: uppercase;
}

#joinLobbySubmit:hover:not(:disabled) {
  border-color: rgba(13, 255, 106, 0.86);
  color: #d7fff5;
}

#joinLobbySubmit:disabled {
  color: rgba(215, 255, 245, 0.42);
  border-color: rgba(215, 255, 245, 0.18);
}

.manual-grid {
  display: grid;
  gap: 10px;
  min-width: min(520px, calc(100vw - 48px));
  padding: 18px;
  border: 1px solid rgba(0, 255, 199, 0.34);
  background: rgba(3, 10, 12, 0.82);
  box-shadow: 0 0 26px rgba(0, 255, 199, 0.12);
  text-align: left;
}

.manual-grid div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
}

.manual-key {
  color: #f3264c;
  font-weight: 700;
}

.manual-text {
  color: #d7fff5;
}
