* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a1220;
  font-family: "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

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

.hidden { display: none !important; }
.dim { color: #8ba3c7; font-size: 13px; }
.center { text-align: center; }

/* ===== Menu ===== */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(ellipse at 50% 30%, #1d3a5f 0%, #0a1220 75%);
}

.menu-box {
  width: min(440px, 92vw);
  background: rgba(10, 20, 38, .85);
  border: 1px solid #2b4a75;
  border-radius: 16px;
  padding: 28px 30px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  color: #dce8f8;
}

.title {
  text-align: center; font-size: 46px; letter-spacing: 6px; color: #ffd75e;
  text-shadow: 0 3px 0 #a3541c, 0 6px 18px rgba(0,0,0,.6);
  margin-bottom: 18px;
}
.title-worm { font-size: 34px; margin-left: 6px; }

.menu-screen { display: flex; flex-direction: column; gap: 12px; }
.menu-screen h2 { text-align: center; color: #ffd75e; font-size: 20px; margin-bottom: 4px; }

input {
  background: #0d1930; border: 1px solid #2b4a75; border-radius: 8px;
  color: #eaf2ff; font-size: 16px; padding: 10px 14px; outline: none; text-align: center;
}
input:focus { border-color: #4f8fdc; }

.btn {
  background: linear-gradient(#3d6ea8, #2b5183);
  border: 1px solid #5a92cf; border-radius: 10px;
  color: #fff; font-size: 16px; font-weight: 600;
  padding: 11px 16px; cursor: pointer; transition: transform .06s, filter .12s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn.big { font-size: 18px; padding: 13px 16px; }
.btn.back { background: none; border-color: #2b4a75; color: #8ba3c7; font-weight: 400; }
.btn:disabled { opacity: .45; cursor: default; }

.row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.seg { display: flex; border: 1px solid #2b4a75; border-radius: 8px; overflow: hidden; }
.seg button {
  background: #0d1930; border: none; color: #8ba3c7; padding: 7px 14px;
  font-size: 14px; cursor: pointer;
}
.seg button.on { background: #3d6ea8; color: #fff; }

.hint { text-align: center; color: #5f7ba3; font-size: 12px; line-height: 1.6; margin-top: 6px; }
.credits { margin-top: 14px; color: #4a6288; font-size: 12px; }

.lobby-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #aac2e4; }
.lobby-list {
  min-height: 120px; max-height: 240px; overflow-y: auto;
  border: 1px solid #22406b; border-radius: 10px; background: #0b1526;
  display: flex; flex-direction: column; padding: 6px; gap: 6px;
}
.lobby-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #12233d; border: 1px solid #27466f; border-radius: 8px; padding: 9px 12px;
  cursor: pointer; transition: filter .1s;
}
.lobby-item:hover { filter: brightness(1.25); }
.lobby-item .l-name { font-weight: 600; color: #eaf2ff; }
.lobby-item .l-info { font-size: 12px; color: #8ba3c7; }

.spinner {
  width: 42px; height: 42px; margin: 10px auto;
  border: 4px solid #22406b; border-top-color: #ffd75e; border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== HUD ===== */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; color: #fff; }

#hud-top {
  position: absolute; top: 10px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 22px;
}
.team-hp { width: 220px; }
.team-hp .team-name { font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.team-hp .bar { height: 12px; background: rgba(0,0,0,.55); border-radius: 6px; overflow: hidden; margin-top: 3px; border: 1px solid rgba(255,255,255,.25); }
.team-hp .fill { height: 100%; width: 100%; border-radius: 6px; transition: width .5s; }
.team-hp.right { text-align: right; }
.team-hp.right .fill { margin-left: auto; }

#turn-timer {
  min-width: 66px; text-align: center;
  font-size: 30px; font-weight: 800; color: #ffd75e;
  text-shadow: 0 2px 0 #7c3f12, 0 4px 12px rgba(0,0,0,.7);
}
#turn-timer.low { color: #ff5e5e; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }

#wind-box {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
}
.wind-label { font-size: 11px; font-weight: 700; color: #cfe0f5; text-shadow: 0 1px 3px #000; }
#wind-bar {
  width: 160px; height: 10px; background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.25); border-radius: 5px; position: relative; overflow: hidden;
}
#wind-fill { position: absolute; top: 0; bottom: 0; left: 50%; background: #6fd3ff; }

#weapon-bar {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; pointer-events: auto;
}
.wpn {
  width: 52px; height: 52px; border-radius: 10px;
  background: rgba(8, 16, 30, .8); border: 2px solid #33567f;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-size: 22px; position: relative; transition: transform .08s;
}
.wpn:hover { transform: translateY(-3px); }
.wpn.sel { border-color: #ffd75e; box-shadow: 0 0 12px rgba(255, 215, 94, .5); }
.wpn.empty { opacity: .35; cursor: default; }
.wpn .key { position: absolute; top: 1px; left: 4px; font-size: 9px; color: #7d9cc4; }
.wpn .ammo { position: absolute; bottom: 1px; right: 4px; font-size: 10px; font-weight: 700; color: #ffd75e; }

#banner {
  position: absolute; top: 34%; left: 0; right: 0; text-align: center;
  font-size: 44px; font-weight: 900; color: #ffd75e; letter-spacing: 2px;
  text-shadow: 0 3px 0 #7c3f12, 0 8px 24px rgba(0,0,0,.8);
  animation: bannerIn .35s ease-out;
}
#banner .sub { display: block; font-size: 18px; font-weight: 600; color: #eaf2ff; margin-top: 6px; letter-spacing: 1px; }
@keyframes bannerIn { from { transform: scale(.6); opacity: 0; } }

#net-status {
  position: absolute; bottom: 12px; right: 14px;
  font-size: 12px; color: #8ba3c7; text-shadow: 0 1px 3px #000;
}
