:root {
  color-scheme: dark;
  --panel: rgba(7, 12, 18, 0.84);
  --line: rgba(142, 185, 220, 0.22);
  --cyan: #61d7ff;
  --green: #73e39a;
  --orange: #ffb65c;
  --danger: #ff646c;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #071019;
  color: #eef7ff;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
}

body.cursor-released #game {
  cursor: default;
}

#top-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(5, 11, 17, 0.92), rgba(10, 20, 30, 0.78));
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 19px;
  letter-spacing: 0.08em;
}

.eyebrow {
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0.2em;
}

#cycle {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#cycle #phase {
  color: var(--orange);
  font-weight: 800;
}

#cycle #timer {
  min-width: 62px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

#network {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: #aec2d2;
  font-size: 12px;
}

#network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 10px currentColor;
}

#network.online #network-dot { background: var(--green); }
#network.offline #network-dot { background: var(--danger); }

.panel {
  position: fixed;
  z-index: 4;
  width: 250px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.panel h2 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  color: #dcecff;
  font-size: 14px;
}

.panel h2 b { color: var(--orange); }

#survivor-panel {
  top: 92px;
  left: 14px;
}

#bunker-panel {
  top: 92px;
  right: 14px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: #aebfcd;
  font-size: 11px;
}

.meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #31bb6b, #85efa9);
  transition: width 180ms ease;
}

.meter.bunker i {
  background: linear-gradient(90deg, #e78836, #ffc36f);
}

.inventory {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  color: #b9cad7;
  font-size: 12px;
}

.inventory strong {
  color: var(--cyan);
  font-size: 22px;
}

.panel p {
  margin: 9px 0 0;
  color: #91a7b8;
  font-size: 11px;
  line-height: 1.5;
}

#weapon-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  pointer-events: none;
}

#weapon-slot {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(97, 215, 255, 0.5);
  border-radius: 8px;
  color: var(--cyan);
  font-weight: 800;
}

#weapon-panel div {
  display: flex;
  flex-direction: column;
}

#weapon-panel small {
  margin-top: 2px;
  color: #8fa5b5;
}

#controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 4;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #b8c8d4;
  background: rgba(5, 10, 15, 0.74);
  font-size: 11px;
  transform: translateX(-50%);
  pointer-events: none;
}

#event-feed {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  width: 290px;
  color: #d4e5f1;
  font-size: 12px;
  text-align: right;
  pointer-events: none;
}

#event-feed p {
  margin: 5px 0;
  opacity: 0;
  animation: feed 4s ease forwards;
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.95);
  transform: translate(-50%, -50%);
}

#crosshair::before {
  width: 2px;
  height: 22px;
}

#crosshair::after {
  width: 22px;
  height: 2px;
}

#hit-marker {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 7;
  width: 34px;
  height: 34px;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}

#hit-marker::before,
#hit-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: var(--danger);
  transform: translate(-50%, -50%);
}

#hit-marker::after { transform: translate(-50%, -50%) rotate(90deg); }
#hit-marker.show { animation: hit 180ms ease-out; }

#muzzle-flash {
  position: fixed;
  inset: 0;
  z-index: 3;
  opacity: 0;
  background: radial-gradient(circle at 65% 62%, rgba(255, 221, 128, 0.46), transparent 19%);
  pointer-events: none;
}

#muzzle-flash.show { animation: flash 90ms ease-out; }

#loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 9px;
  background: radial-gradient(circle at 50% 42%, #18344b, #060b10 70%);
  text-align: center;
  transition: opacity 300ms ease;
}

#loading strong {
  font-size: 27px;
  letter-spacing: 0.08em;
}

#loading span {
  color: #91a9bb;
  font-size: 13px;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#game-over {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: radial-gradient(circle, rgba(74, 5, 9, 0.46), rgba(2, 5, 8, 0.94) 68%);
  text-align: center;
  transition: opacity 240ms ease;
}

#game-over.hidden {
  opacity: 0;
  pointer-events: none;
}

#game-over-kicker {
  color: #e5a0a4;
  font-size: 12px;
  letter-spacing: 0.3em;
}

#game-over-title {
  color: #ff5963;
  font-size: clamp(56px, 11vw, 132px);
  line-height: 0.95;
  letter-spacing: 0.08em;
  text-shadow: 0 0 32px rgba(255, 39, 52, 0.42);
}

#game-over.victory {
  background: radial-gradient(circle, rgba(8, 75, 56, 0.42), rgba(2, 8, 9, 0.94) 68%);
}

#game-over.victory #game-over-title {
  color: #73e39a;
  text-shadow: 0 0 32px rgba(67, 255, 154, 0.35);
}

#game-over p {
  max-width: 480px;
  margin: 8px 20px 14px;
  color: #b8c4cd;
  font-size: 14px;
}

#restart-button {
  min-width: 180px;
  padding: 12px 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  background: #a8242d;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
}

#restart-button:hover {
  background: #cf303b;
}

#restart-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

#game-status {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

@keyframes hit {
  from { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1.35); }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(0.75); }
}

@keyframes flash {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes feed {
  0% { opacity: 0; transform: translateY(5px); }
  12%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; }
}

@media (max-width: 760px) {
  #top-bar { grid-template-columns: 1fr auto; }
  #network { display: none; }
  #survivor-panel { top: 84px; }
  #bunker-panel { top: 84px; right: 10px; width: 205px; }
  .panel { width: 205px; padding: 11px 12px; }
  #controls { display: none; }
  #event-feed { display: none; }
}
