html, body { height: 100%; margin: 0; overflow: hidden; background: #000; }

#viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
}

#world {
  position: absolute;
  width: 3000px;
  height: 3000px;
  background: 
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  will-change: transform;
  z-index: 1;
}

#player {
  position: absolute;
  width: 32px;
  height: 32px;
  background: #076c94;
  border-radius: 6px;
  z-index: 10;
}

.hostile {
  position: absolute;
  width: 32px;
  height: 32px;
  background: #e90909;
  border-radius: 6px;
  z-index: 5;
}

.entitySprite {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  image-rendering: pixelated;
}


.hostile--grunt { background: #e90909; }
.hostile--runner { background: #ff3b3b; border-radius: 999px; }
.hostile--tank { background: #b90000; border: 2px solid #ff7070; }
.hostile--shooter { background: #ff8c00; box-shadow: 0 0 10px rgba(255,140,0,0.6); }
.hostile--aoe { background: #b000ff; box-shadow: 0 0 10px rgba(176,0,255,0.6); }

.enemyBullet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffb000;
  z-index: 14;
  box-shadow: 0 0 8px rgba(255,176,0,0.8);
}

.aoeRing {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 2px solid rgba(176, 0, 255, 0.9);
  animation: aoePulse 0.38s ease-out forwards;
  pointer-events: none;
  z-index: 6;
}

@keyframes aoePulse {
  from { width: 10px; height: 10px; opacity: 0.85; }
  to { width: calc(var(--aoe-radius) * 2); height: calc(var(--aoe-radius) * 2); opacity: 0; }
}

.bullet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  z-index: 15;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 0;
  color: white;
  font-family: 'Courier New', Courier, monospace;
  z-index: 100;
}

#positionsGroup {
  position: absolute;
  top: 20px;
  left: 20px;

  display: flex;
  flex-direction: column;
  gap: 4px;
}

#statsGroup {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

#weaponGroup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}

.hudWeapon {
  font-size: 13px;
  opacity: 0.95;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.45);
  border-radius: 10px;
  min-width: 210px;
  text-align: center;
  letter-spacing: 0.1px;
}

.hudWeaponActive {
  border-color: rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.62);
}

.hudWeaponSub {
  opacity: 0.75;
}

#bottomGroup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
}

.hudMetric {
  font-size: 14px;
  opacity: 0.95;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.hudMetricLeft {
  min-width: 150px;
  text-align: right;
}

.hudMetricRight {
  min-width: 150px;
  text-align: left;
}

#bottomGroup #healthContainer {
  width: min(360px, 44vw);
  height: 14px;
}

#healthContainer {
  width: 200px;
  height: 12px;
  background: #333;
  border: 2px solid #555;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: inset 0 0 5px #000;
}

#healthBar {
  width: 100%;
  height: 100%;
  transition: width 0.3s ease-out;
}

#informationGroup {
  position: absolute;
  left: 20px;
  bottom: 20px;

  display: flex;
  flex-direction: column;
  gap: 4px;
}

#statusMessage {
  position: absolute;
  left: 50%;
  top: 75%;
  transform: translateX(-50%);

  display: none;

  pointer-events: none;

  color: #067ee7cb;
  text-shadow: #1d8bac 1px 0 10px;

  background: rgba(0, 0, 0, 0.35);
  padding: 10px 14px;
  border-radius: 6px;

  max-width: min(720px, 90vw);
  text-align: center;
  line-height: 1.2;
}

.uiBtn {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.uiBtn:hover { background: rgba(0,0,0,0.65); }
.uiBtn:active { transform: translateY(1px); }
.uiBtn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.uiBtnDanger { border-color: rgba(255, 90, 90, 0.35); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  color: #fff;
}

.overlay.hidden { display: none; }

.panel {
  width: min(980px, 92vw);
  max-height: min(760px, 88vh);
  background: rgba(0,0,0,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.panelHeaderLeft { display: flex; flex-direction: column; gap: 6px; }
.panelTitle { font-size: 18px; letter-spacing: 0.5px; }
.panelSub { opacity: 0.85; font-size: 14px; }

.panelFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

.panelFooter .hint { opacity: 0.85; font-size: 14px; }

.endPanel {
  width: min(720px, 92vw);
  max-height: min(640px, 88vh);
}

.endBody {
  padding: 18px 16px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.endStats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.endStat {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.endKey { opacity: 0.85; font-size: 13px; letter-spacing: 0.2px; }
.endVal { font-size: 18px; font-weight: 700; }


.endLoadout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.endLoadoutCol {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px;
  background: rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endLoadoutTitle {
  opacity: 0.9;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.endLoadoutWeapon {
  font-weight: 800;
  font-size: 15px;
}

.endLoadoutNodes {
  opacity: 0.88;
  font-size: 13px;
  line-height: 1.25;
}

.endLoadoutNodes ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.endLoadoutNodes li { margin: 3px 0; }

@media (max-width: 820px) {
  .endLoadout { grid-template-columns: 1fr; }
}

.endActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.endHint {
  opacity: 0.85;
  font-size: 14px;
}

.shopGrid {
  padding: 16px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 820px) {
  .shopGrid { grid-template-columns: 1fr; }
}

.shopItem {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shopItemTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.shopItemName { font-size: 15px; }
.shopItemDesc { opacity: 0.85; font-size: 13px; line-height: 1.25; }
.shopItemMeta { opacity: 0.9; font-size: 13px; }
.shopItemActions { display: flex; gap: 8px; justify-content: flex-end; }

.tag {
  font-size: 12px;
  opacity: 0.9;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
}

.tagOwned { border-color: rgba(100,255,160,0.25); }
.tagLocked { border-color: rgba(255,210,100,0.25); }

.skin-neon { box-shadow: 0 0 18px rgba(0, 255, 255, 0.25); background: #00c7ff !important; }

#hudThreat, #hudKills { opacity: 0.9; font-size: 14px; }

#crosshair {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  transform: translate(-9999px, -9999px);
  pointer-events: none;
  z-index: 180;
  opacity: 0.95;
}

.crosshair--dot { border: 2px solid rgba(255,255,255,0.85); border-radius: 999px; }
.crosshair--plus { border: none; }
.crosshair--plus::before, .crosshair--plus::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}
.crosshair--plus::after { width: 2px; height: 18px; }

.crosshair--circle { border: 2px solid rgba(255,255,255,0.7); border-radius: 999px; box-shadow: 0 0 10px rgba(255,255,255,0.22); }
.crosshair--x::before, .crosshair--x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 2px;
  background: rgba(255,255,255,0.9);
  transform: translate(-50%, -50%) rotate(45deg);
}
.crosshair--x::after { transform: translate(-50%, -50%) rotate(-45deg); }

.crosshair--diamond { border: 2px solid rgba(255,255,255,0.75); transform: translate(-9999px, -9999px) rotate(45deg); }

.panelTabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0 16px;
}

.tabBtn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.88);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.tabBtn:hover { background: rgba(255,255,255,0.06); }
.tabBtn.isActive { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.22); }

.panelToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 0 16px;
}

.toolbarLeft { display: flex; gap: 10px; align-items: center; }
.toolbarRight { display: flex; gap: 10px; align-items: center; }

.uiInput {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  width: min(420px, 46vw);
}

.uiInput::placeholder { opacity: 0.55; }

.pill {
  font-size: 12px;
  opacity: 0.85;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
}

.skin-neon { box-shadow: 0 0 18px rgba(0, 255, 255, 0.25); background: #00c7ff !important; }
.skin-crimson { background: #d8132a !important; box-shadow: 0 0 16px rgba(255, 60, 60, 0.18); }
.skin-azure { background: #1f6feb !important; box-shadow: 0 0 16px rgba(50, 140, 255, 0.18); }
.skin-gold { background: #e0b64b !important; box-shadow: 0 0 18px rgba(255, 210, 120, 0.18); }
.skin-void { background: #5b2b82 !important; box-shadow: 0 0 18px rgba(176, 0, 255, 0.14); }
.skin-lime { background: #2bd66c !important; box-shadow: 0 0 18px rgba(80, 255, 160, 0.14); }
.skin-frost { background: #9fe7ff !important; box-shadow: 0 0 18px rgba(160, 230, 255, 0.16); }
.skin-sunset { background: #ff6a00 !important; box-shadow: 0 0 18px rgba(255, 140, 0, 0.18); }
.skin-pink { background: #ff3aa2 !important; box-shadow: 0 0 18px rgba(255, 80, 190, 0.18); }
.skin-slate { background: #7c8595 !important; box-shadow: 0 0 18px rgba(180, 190, 210, 0.14); }

.bullet--laser { background: #ffffff; box-shadow: 0 0 10px rgba(255,255,255,0.9); }
.bullet--plasma { background: #00c7ff; box-shadow: 0 0 10px rgba(0,199,255,0.8); }
.bullet--spark { background: #ffd700; box-shadow: 0 0 10px rgba(255,215,0,0.85); }
.bullet--ink { background: #a45eff; box-shadow: 0 0 10px rgba(164,94,255,0.7); }
.bullet--frost { background: #9fe7ff; box-shadow: 0 0 10px rgba(159,231,255,0.75); }

.bullet--trail-comet { box-shadow: 0 0 14px rgba(255,255,255,0.55), 0 0 26px rgba(255,255,255,0.18); }
.bullet--trail-pixel { box-shadow: 0 0 10px rgba(255,255,255,0.55); filter: contrast(1.35); }
.bullet--trail-flame { box-shadow: 0 0 16px rgba(255,120,0,0.55), 0 0 26px rgba(255,90,0,0.18); }

.hostile--sniper { background: #ff7f50; border: 2px solid rgba(255, 255, 255, 0.18); }
.hostile--bomber { background: #ffb000; box-shadow: 0 0 10px rgba(255,176,0,0.45); }
.hostile--charger { background: #ff3b3b; box-shadow: 0 0 14px rgba(255,80,80,0.35); }
.hostile--splitter { background: #ff0055; border-radius: 10px; }
.hostile--mini { background: #ff4d7d; border-radius: 999px; }
.hostile--shielded { background: #b90000; border: 2px solid rgba(120, 200, 255, 0.55); box-shadow: 0 0 16px rgba(120,200,255,0.18); }
.hostile--leech { background: #b000ff; box-shadow: 0 0 16px rgba(176,0,255,0.18); }
.hostile--medic { background: #2bd66c; box-shadow: 0 0 16px rgba(80,255,160,0.18); }
.hostile--summoner { background: #6b6bff; box-shadow: 0 0 16px rgba(120,120,255,0.18); }

.enemyBullet--sniper { background: #ff7f50; box-shadow: 0 0 10px rgba(255, 127, 80, 0.85); }
.enemyBullet--bomb {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffb000;
  box-shadow: 0 0 14px rgba(255,176,0,0.75);
}

.explosionRing {
  position: absolute;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 2px solid rgba(255,176,0,0.85);
  animation: boom 0.45s ease-out forwards;
  pointer-events: none;
  z-index: 7;
}

@keyframes boom {
  from { width: 10px; height: 10px; opacity: 0.85; }
  to { width: calc(var(--boom-radius) * 2); height: calc(var(--boom-radius) * 2); opacity: 0; }
}

#hudThreat, #hudKills { opacity: 0.9; font-size: 14px; }

.panelTools {
  display: flex;
  gap: 10px;
  padding: 0 16px 12px 16px;
  align-items: center;
}

@media (max-width: 640px) {
  .panelTools { flex-direction: column; align-items: stretch; }
}

.hostile--pulsar { background: #b000ff; box-shadow: 0 0 10px rgba(176,0,255,0.6); }
.hostile--hit { filter: brightness(1.6); }

.panelHint {
  padding: 0 16px 8px 16px;
  opacity: 0.85;
  font-size: 13px;
}

.startPanel {
  width: min(980px, 94vw);
  color: #ffffff;
}

.startBody {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #ffffff;
}

.startColumns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  color: #ffffff;
}

.startSectionTitle {
  font-weight: 700;
  margin: 6px 0 8px;
  color: #ffffff;
}

.choiceGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  color: #ffffff;
}

.choiceCard {
  text-align: left;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  transition: transform 0.06s ease, border-color 0.06s ease;
  color: #ffffff;
}

.choiceCard:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.38);
}

.choiceCard.isSelected {
  border-color: rgba(120,220,255,0.95);
  box-shadow: 0 0 0 2px rgba(120,220,255,0.22) inset;
}

.choiceName {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.choiceDesc {
  opacity: 0.88;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.2;
}

.choiceMeta {
  opacity: 0.8;
  margin-top: 8px;
  font-size: 12px;
}

.startFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workshopWrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.workshopTopLine {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.workshopSection {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}

.workshopSectionTitle {
  font-weight: 800;
  margin-bottom: 8px;
}

.workshopRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.workshopGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.workshopCard {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.25);
}

.workshopCardTop {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.workshopCardName { font-weight: 800; }
.workshopCardDesc { opacity: 0.86; font-size: 13px; margin-top: 6px; line-height: 1.2; }
.workshopCardMeta { opacity: 0.78; font-size: 12px; margin-top: 8px; }

.workshopTreeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.workshopTierTitle {
  margin-top: 10px;
  font-weight: 800;
  opacity: 0.92;
}

.workshopNode {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
}

.workshopNode.isUnlocked {
  border-color: rgba(120,220,255,0.40);
  background: rgba(120,220,255,0.06);
}

.workshopNodeTitle { font-weight: 800; }
.workshopNodeDesc { opacity: 0.86; font-size: 13px; margin-top: 6px; line-height: 1.2; }
.workshopNodeMeta { opacity: 0.78; font-size: 12px; margin-top: 8px; }

.workshopSelect {
  background: rgba(0,0,0,0.40);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 6px 8px;
}

@media (max-width: 900px) {
  .startColumns { grid-template-columns: 1fr; }
  .choiceGrid { grid-template-columns: 1fr; }
  .workshopGrid, .workshopTreeGrid { grid-template-columns: 1fr; }
}

.fxCone {
  position: absolute;
  transform-origin: 0 50%;
  pointer-events: none;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  z-index: 14;
}

.fxCone--flame {
  background: radial-gradient(circle at 0% 50%,
    rgba(255, 235, 210, 0.50) 0%,
    rgba(255, 170, 90, 0.24) 35%,
    rgba(255, 130, 40, 0.00) 75%);
  mix-blend-mode: screen;
  filter: blur(0.35px);
}

.uiBtnDanger.isArmed { border-color: rgba(255,120,120,0.55); box-shadow: 0 0 0 2px rgba(255,120,120,0.15); }
