* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 10%, rgba(20, 100, 255, .22), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(255, 70, 30, .18), transparent 30%),
    #070d19;
  font-family: Arial, Helvetica, sans-serif;
  color: #dbeaff;
  overflow-x: hidden;
}
body { touch-action: none; }

.game-shell {
  width: min(1500px, 100vw);
  margin: 0 auto;
  padding: 26px 20px 28px;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  margin-bottom: 16px;
}
h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 76px);
  line-height: .9;
  letter-spacing: 5px;
  text-align: center;
  color: #ffb02e;
  text-shadow: 0 0 15px #ff3c21, 0 0 30px rgba(255, 60, 33, .7);
}
h1 span {
  color: #80e8ff;
  text-shadow: 0 0 14px #00b7ff, 0 0 30px rgba(0, 183, 255, .7);
}
.topbar p {
  margin: 14px 0 0;
  text-align: center;
  color: #bcd7ff;
}
.server-pill {
  position: absolute;
  right: 0;
  top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(78, 157, 255, .38);
  border-radius: 10px;
  padding: 12px 16px;
  background: rgba(5, 12, 25, .76);
  box-shadow: inset 0 0 20px rgba(0, 120, 255, .12);
}
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #45ff63;
  box-shadow: 0 0 12px #45ff63;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(540px, 1fr) 280px;
  gap: 18px;
  align-items: start;
}
.panel { display: flex; flex-direction: column; gap: 18px; }

.card {
  border: 1px solid rgba(65, 150, 255, .38);
  background: linear-gradient(180deg, rgba(9, 25, 49, .88), rgba(3, 8, 17, .88));
  box-shadow: 0 0 25px rgba(0, 102, 255, .1), inset 0 0 25px rgba(0, 102, 255, .08);
  border-radius: 12px;
  padding: 18px;
}
.card h3 {
  margin: 0 0 18px;
  color: #5de9ff;
  font-size: 15px;
  letter-spacing: 1px;
}
.profile-row { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 54px; height: 54px;
  background: #2d96ff;
  border: 3px solid #8ccfff;
  box-shadow: 0 0 18px rgba(45,150,255,.7);
}
.player-name { font-size: 28px; font-weight: 800; color: white; }
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 16px;
  margin-top: 14px;
  border-top: 1px solid rgba(150, 200, 255, .12);
  color: #9fb7d9;
}
.hp-bars { display: flex; gap: 8px; }
.hp-bar {
  width: 28px; height: 16px;
  border-radius: 4px;
  background: #ff334c;
  box-shadow: 0 0 10px rgba(255, 51, 76, .75);
}
.keys {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 8px;
  justify-content: center;
  margin: 12px 0 20px;
}
.wasd { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
kbd {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid rgba(155, 205, 255, .45);
  border-radius: 6px;
  background: rgba(13, 33, 61, .82);
  color: #dff4ff;
  font-size: 20px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
}
.shoot-label {
  border: 1px solid rgba(255, 70, 70, .45);
  background: rgba(255, 40, 40, .12);
  color: #ff6a5d;
  font-weight: 800;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
}
.info-line {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(150, 200, 255, .1);
}
.info-line b { text-align: right; color: white; }

.arena-wrap { position: relative; }
canvas {
  width: 100%;
  display: block;
  border-radius: 18px;
  border: 2px solid rgba(80, 160, 255, .35);
  background: #121b31;
  touch-action: none;
  cursor: crosshair;
  box-shadow:
    0 0 0 2px rgba(0,0,0,.45),
    0 0 38px rgba(0, 130, 255, .25),
    0 0 35px rgba(255, 70, 30, .18);
}
.bottom-status {
  text-align: center;
  padding: 14px 0;
  color: #b9d8ff;
  font-size: 18px;
}
.bottom-status span { margin: 0 14px; }

.leaderboard ol { padding-left: 0; margin: 0; list-style-position: inside; }
.leaderboard li {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  padding: 11px 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,125,255,.75), rgba(0,70,160,.35));
  color: white;
}
.messages { min-height: 330px; display: flex; flex-direction: column; }
#messages {
  flex: 1;
  border: 1px solid rgba(100, 170, 255, .25);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0,0,0,.24);
  color: #aebfde;
  overflow: hidden;
}
.msg { margin-bottom: 10px; }
.msg b { color: #64ff6f; }
.message-input { display: flex; gap: 8px; margin-top: 10px; }
.message-input input {
  flex: 1; min-width: 0;
  border: 1px solid rgba(100, 170, 255, .25);
  background: rgba(0,0,0,.28);
  color: white;
  border-radius: 8px;
  padding: 12px;
}
.message-input button {
  border: 0; border-radius: 8px;
  background: #0b86ff; color: white; padding: 0 14px;
}
.connection.error {
  border-color: rgba(255, 80, 60, .75);
  box-shadow: 0 0 28px rgba(255, 70, 45, .28);
  color: #ff6159;
  text-align: center;
}
.connection small { display: block; margin-top: 10px; color: #ff948e; }

#mobileControls { display: none; }

@media (max-width: 1050px) {
  .game-shell { padding: 14px; }
  .layout { grid-template-columns: 1fr; }
  .left, .right { display: none; }
  .server-pill { position: static; margin-left: 12px; }
  .topbar { justify-content: space-between; }
  h1 { text-align: left; font-size: 34px; }
  .topbar p { text-align: left; font-size: 13px; }
  canvas { height: auto; }
  #mobileControls {
    display: block;
    position: fixed;
    inset: auto 0 18px 0;
    pointer-events: none;
    z-index: 20;
  }
  #joy {
    position: fixed;
    left: 24px; bottom: 26px;
    width: 118px; height: 118px;
    border-radius: 50%;
    background: rgba(15, 40, 75, .72);
    border: 1px solid rgba(130, 205, 255, .45);
    box-shadow: 0 0 24px rgba(0, 140, 255, .22);
    pointer-events: auto;
  }
  #stick {
    position: absolute;
    left: 34px; top: 34px;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(105, 210, 255, .95);
    box-shadow: 0 0 20px rgba(105, 210, 255, .85);
  }
  #shootBtn {
    position: fixed;
    right: 24px; bottom: 42px;
    width: 126px; height: 76px;
    border: 1px solid rgba(255, 95, 70, .8);
    border-radius: 18px;
    background: rgba(255, 55, 45, .82);
    color: white;
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow: 0 0 28px rgba(255, 55, 45, .5);
    pointer-events: auto;
  }
}
