:root {
  color-scheme: dark;
  background: #12131a;
  color: #edf2ff;
}
* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1f2937 0%, #0f172a 100%);
}
#gameArea {
  width: min(100%, 900px);
  max-width: 900px;
  aspect-ratio: 3 / 2;
  border: 2px solid #475569;
  border-radius: 20px;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 35%), radial-gradient(circle at bottom right, rgba(248, 113, 28, 0.12), transparent 30%), #0f172a;
  overflow: hidden;
  position: relative;
  touch-action: none;
}
#gameArea::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}
.hidden {
  display: none !important;
}
.login-panel {
  width: min(100%, 900px);
  max-width: 900px;
  padding: 24px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.35);
  margin-bottom: 14px;
}
.login-panel h1 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}
.login-panel p {
  margin: 0 0 18px;
  color: #cbd5e1;
}
.login-panel label {
  display: block;
  margin-bottom: 14px;
  color: #e2e8f0;
  font-size: 0.95rem;
}
.login-panel input {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
}
.login-panel input::placeholder {
  color: rgba(241, 245, 249, 0.5);
}
.login-panel button {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.login-message {
  margin-top: 12px;
  color: #f8fafc;
  min-height: 22px;
}
.entity {
  position: absolute;
  transform: translate(-50%, -50%);
}
.player,
.player-self {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #93c5fd;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}
.player {
  background: #60a5fa;
}
.player-self {
  background: #38bdf8;
  border-color: #7dd3fc;
}
.player-dead {
  background: #475569;
  border-color: #334155;
  opacity: 0.72;
  filter: grayscale(0.4);
}
.enemy {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fb923c;
  border: 2px solid #f97316;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.35);
}
.bullet {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fde047;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.45);
}
.label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.player-hp-bar {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.player-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  width: 100%;
  transition: width 0.1s;
}

#ui {
  width: min(100%, 900px);
  margin: 16px 0 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.status, .stats {
  background: rgba(15, 23, 42, 0.8);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.stats {
  display: flex;
  gap: 16px;
}
#controls {
  width: min(100%, 900px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.lobby-panel {
  width: min(100%, 900px);
  max-width: 900px;
  padding: 24px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.3);
  margin-bottom: 14px;
}
.lobby-panel h2 {
  margin: 0 0 12px;
}
.lobby-panel label {
  display: block;
  margin-bottom: 16px;
  color: #e2e8f0;
}
.lobby-panel input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
}
.room-actions,
.room-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel {
  width: min(100%, 900px);
  max-width: 900px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.12);
  margin-bottom: 12px;
}

.list-item {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148,163,184,0.06);
  display:flex;
  justify-content:space-between;
}
.lobby-panel button {
  padding: 14px 16px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  cursor: pointer;
}
.lobby-panel button.hidden {
  display: none !important;
}
.room-info {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  margin-bottom: 14px;
}
.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.player-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.player-card strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
}
.player-card span {
  color: #cbd5e1;
}
.control-area {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  touch-action: none;
}
#stick {
  position: absolute;
  width: 70px;
  height: 70px;
  left: calc(50% - 35px);
  top: calc(50% - 35px);
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.45);
}
#shootButton {
  flex: 1;
  min-height: 170px;
  border: none;
  border-radius: 24px;
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.18);
}
#shootButton:active {
  transform: scale(0.98);
}

.team-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 2px solid rgba(56, 189, 248, 0.4);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  z-index: 100;
  max-height: 60px;
}

.team-bar.hidden {
  display: none;
}

.team-member {
  background: rgba(30, 58, 138, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 140px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-member-name {
  font-weight: bold;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-member-status {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #cbd5e1;
}

.team-member-hp {
  background: rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  overflow: hidden;
  height: 4px;
  width: 100%;
}

.team-member-hp-fill {
  background: #22c55e;
  height: 100%;
  transition: width 0.1s;
}

.item {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #16a34a;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

@media (max-width: 640px) {
  #controls {
    flex-direction: column;
  }
  #shootButton {
    min-height: 90px;
  }
}
