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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, #14213b 0%, transparent 45%),
    #070b14;
  color: #f1f5ff;
  font-family: "Inter", sans-serif;
  padding: 30px 18px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.game-wrapper {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.logo {
  font-family: "Orbitron", sans-serif;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
}

.logo span {
  color: #00eaff;
}

.stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 45px;
}

.stat-label {
  color: #75849f;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
}

.stat strong {
  font-family: "Orbitron", sans-serif;
  font-size: 18px;
  color: #00eaff;
}

.game-panel {
  background: #0b1220;
  border: 1px solid #1b2b43;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 70px #00000055;
}

.game-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.game-heading h1 {
  font-family: "Orbitron", sans-serif;
  font-size: 21px;
  letter-spacing: 2px;
}

.game-heading p {
  color: #8290a8;
  font-size: 12px;
  margin-top: 6px;
}

.small-button {
  border: 1px solid #29415b;
  background: #101d30;
  color: #a9bfd4;
  padding: 10px 13px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: 0.2s;
}

.small-button:hover {
  border-color: #00eaff;
  color: #00eaff;
}

.enemy-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 13px;
  color: #9baec7;
  font-size: 11px;
}

.enemy-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.wanderer {
  background: #ff3c91;
  box-shadow: 0 0 9px #ff3c91;
}

.legend-dot.chaser {
  background: #ff554d;
  box-shadow: 0 0 9px #ff554d;
}

.legend-dot.speedster {
  background: #b46aff;
  box-shadow: 0 0 9px #b46aff;
}

.powerup-status {
  color: #9baec7;
  font-size: 12px;
  margin-bottom: 12px;
  min-height: 16px;
}

.canvas-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #1c3852;
  background: #070d18;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: #080f1c;
  visibility: hidden;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #050a14df;
  backdrop-filter: blur(7px);
}

.overlay-content {
  width: 100%;
  max-width: 440px;
  text-align: center;
  padding: 35px 25px;
  background: #101a2a;
  border: 1px solid #24415d;
  border-radius: 15px;
  box-shadow: 0 0 45px #00d9ff16;
}

.overlay-tag {
  color: #00eaff;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 18px;
}

.overlay-content h2 {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(20px, 4vw, 29px);
  margin-bottom: 14px;
}

.overlay-content p {
  color: #a3b1c6;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-line;
  margin-bottom: 24px;
}

.primary-button,
.secondary-button {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  transition: 0.2s;
}

.primary-button {
  border: 0;
  color: #041018;
  background: #00eaff;
  box-shadow: 0 0 22px #00eaff35;
}

.primary-button:hover {
  background: #72f5ff;
  transform: translateY(-2px);
}

.secondary-button {
  margin-top: 10px;
  background: transparent;
  border: 1px solid #36516d;
  color: #c2d1e5;
}

.secondary-button:hover {
  border-color: #00eaff;
  color: #00eaff;
}

/* Mobile joystick and pause controls */
.mobile-controls {
  display: none;
}

.game-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 15px;
  color: #65758e;
  font-size: 10px;
  letter-spacing: 1px;
}

#status {
  color: #00eaff;
  font-weight: 700;
}

.page-footer {
  text-align: center;
  margin-top: 24px;
  color: #53627a;
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
}

.page-footer span {
  color: #00eaff;
  padding: 0 5px;
}

@media (max-width: 650px), (pointer: coarse) {
  body {
    padding: 18px 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .stats {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .game-panel {
    padding: 12px;
  }

  .game-heading h1 {
    font-size: 17px;
  }

  .game-footer {
    font-size: 9px;
  }

  .overlay-content {
    padding: 25px 18px;
  }

  .mobile-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 8px 8px;
    min-height: 150px;
    user-select: none;
    -webkit-user-select: none;
  }

  .joystick-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
  }

  .control-caption {
    color: #75849f;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 2px;
  }

  .joystick-base {
    width: 116px;
    height: 116px;
    border: 2px solid #24506b;
    border-radius: 50%;
    background:
      radial-gradient(circle, #17304a 0%, #0c1b2d 68%, #091321 100%);
    box-shadow:
      inset 0 0 18px #00eaff18,
      0 0 18px #00eaff12;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    position: relative;
  }

  .joystick-base::before,
  .joystick-base::after {
    content: "";
    position: absolute;
    background: #29445d;
    opacity: 0.65;
  }

  .joystick-base::before {
    width: 1px;
    height: 76%;
  }

  .joystick-base::after {
    width: 76%;
    height: 1px;
  }

  .joystick-thumb {
    width: 48px;
    height: 48px;
    border: 2px solid #7af5ff;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4df3ff, #008ba9);
    box-shadow: 0 0 18px #00eaff88;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
  }

  .mobile-pause-button {
    min-width: 92px;
    min-height: 48px;
    border: 1px solid #24506b;
    border-radius: 9px;
    background: #10243a;
    color: #9defff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 0 16px #00eaff16;
    touch-action: manipulation;
  }

  .mobile-pause-button:active {
    background: #173b55;
    border-color: #00eaff;
  }
}

@media (max-width: 380px) {
  .stats {
    gap: 8px;
  }

  .stat strong {
    font-size: 15px;
  }

  .mobile-controls {
    gap: 10px;
  }

  .joystick-base {
    width: 104px;
    height: 104px;
  }
}
