@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap");

:root {
  --neon-cyan: #00f5ff;
  --neon-magenta: #ff00aa;
  --neon-yellow: #ffee00;
  --neon-green: #00ff88;
  --bg-dark: #05020f;
  --ui-glass: rgba(0, 245, 255, 0.08);
  --ui-border: rgba(0, 245, 255, 0.25);
  --screen-strong: rgba(5, 2, 15, 0.98);
  --screen-soft: rgba(5, 2, 15, 0.75);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  overflow: hidden;
  font-family: "Orbitron", monospace;
  color: var(--neon-cyan);
}

#gameWrapper {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  touch-action: none;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(
    to bottom,
    rgba(5, 2, 15, 0.85) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 10;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-block-center {
  align-items: center;
}

.hud-block-end {
  align-items: flex-end;
}

.hud-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(0, 245, 255, 0.5);
  text-transform: uppercase;
}

.hud-value {
  font-family: "Share Tech Mono", monospace;
  font-size: 18px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}

.hud-coin {
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
}

.hud-health-small {
  font-size: 13px;
  margin-top: 2px;
}

#healthBar {
  width: 100px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 2px;
}

#healthFill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ff88, #00f5ff);
  border-radius: 5px;
  transition:
    width 0.2s,
    background 0.3s;
}

#ultimateBtn {
  position: absolute;
  right: 20px;
  bottom: 140px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(5, 2, 15, 0.8);
  border: 2px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all 0.3s;
  overflow: hidden;
}

#ultimateBtn.ready {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 20px var(--neon-magenta);
  animation: pulseUlt 1.5s infinite;
}

@keyframes pulseUlt {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px var(--neon-magenta);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--neon-magenta);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 10px var(--neon-magenta);
  }
}

.ult-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 0, 170, 0.4);
  transition: height 0.3s;
  z-index: 0;
  pointer-events: none;
}

.ult-icon {
  font-size: 24px;
  z-index: 1;
  text-shadow: 0 0 5px #000;
}

.ult-text {
  font-size: 10px;
  font-family: "Share Tech Mono", monospace;
  z-index: 1;
  font-weight: bold;
  color: #fff;
}

.ult-key {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #000;
  border: 1px solid var(--neon-magenta);
  color: var(--neon-magenta);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Share Tech Mono", monospace;
  z-index: 2;
}

#shop {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 15px 10px 20px;
  background: linear-gradient(
    to top,
    rgba(5, 2, 15, 0.95) 0%,
    rgba(5, 2, 15, 0.7) 70%,
    transparent 100%
  );
  z-index: 10;
}

.card {
  background: var(--ui-glass);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  width: 75px;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
}

.card.selected {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  box-shadow: 0 0 20px currentColor;
}

.card:hover:not(.disabled) {
  background: rgba(0, 245, 255, 0.15);
  transform: translateY(-5px);
}

.card:active:not(.disabled) {
  transform: scale(0.95);
}

.card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(100%);
}

.card-icon {
  font-size: 24px;
  text-shadow: 0 0 10px currentColor;
}

.card-name {
  font-size: 9px;
  text-align: center;
  line-height: 1.1;
  color: #fff;
  white-space: pre-wrap;
}

.card-price {
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  color: var(--neon-yellow);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--neon-yellow);
  display: flex;
  align-items: center;
  gap: 2px;
}

.shortcut {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #000;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Share Tech Mono", monospace;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 2, 15, 0.92);
  z-index: 20;
  gap: 20px;
  padding: 20px;
  text-align: center;
}

.screen-hidden {
  display: none;
}

.screen-overlay-strong {
  background: var(--screen-strong);
}

.screen-overlay-soft {
  background: var(--screen-soft);
}

.screen-scrollable {
  justify-content: flex-start;
  padding-top: 40px;
  overflow-y: auto;
}

.screen-top-layout {
  justify-content: flex-start;
  padding-top: 40px;
}

.screen-title {
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 0 20px var(--neon-cyan),
    0 0 40px rgba(0, 245, 255, 0.4);
  line-height: 1.1;
}

.screen-title-medium {
  font-size: 32px;
}

.screen-title-green {
  color: #00ff88;
  text-shadow: 0 0 20px #00ff88;
}

.screen-title-red {
  color: #ff3333;
  text-shadow: 0 0 20px #ff3333;
}

.screen-title-yellow {
  color: #ffee00;
  text-shadow: 0 0 20px #ffee00;
}

.screen-title-purple {
  color: #b026ff;
  text-shadow: 0 0 20px #b026ff;
}

.screen-sub {
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(11px, 2vw, 14px);
  color: rgba(0, 245, 255, 0.6);
  letter-spacing: 2px;
  max-width: 400px;
}

.screen-sub-white {
  color: #fff;
}

.screen-sub-magenta {
  color: var(--neon-magenta);
}

.screen-sub-yellow {
  color: var(--neon-yellow);
}

.screen-sub-muted {
  opacity: 0.5;
}

.screen-sub-bold {
  font-weight: bold;
}

.screen-sub-small {
  font-size: 10px;
}

.screen-sub-tiny {
  font-size: 10px;
}

.screen-sub-large {
  font-size: 16px;
}

.screen-sub-tight {
  margin-top: -15px;
}

.screen-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.screen-btn {
  font-family: "Orbitron", monospace;
  font-size: clamp(12px, 2.5vw, 16px);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 14px 40px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}

.screen-btn:hover:not(.disabled),
.screen-btn:active:not(.disabled) {
  background: rgba(0, 245, 255, 0.15);
  box-shadow: 0 0 25px rgba(0, 245, 255, 0.5);
  transform: scale(1.03);
}

.screen-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #555;
  color: #555;
  box-shadow: none;
}

.screen-btn-green {
  border-color: #00ff88;
  color: #00ff88;
}

.screen-btn-magenta {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
}

.screen-gap-top {
  margin-top: 15px;
}

.screen-gap-bottom {
  margin-bottom: 20px;
}

.screen-bottom-btn {
  margin-top: auto;
  margin-bottom: 40px;
}

.score-display {
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(13px, 3vw, 20px);
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
}

#powerupIndicator {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 2, 15, 0.85);
  border: 1px solid var(--neon-green);
  border-radius: 20px;
  padding: 4px 14px;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  color: var(--neon-green);
  text-shadow: 0 0 6px var(--neon-green);
  pointer-events: none;
  z-index: 10;
  display: none;
  white-space: nowrap;
}

#bossWarning {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(22px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: 6px;
  color: #ff3333;
  text-shadow: 0 0 20px #ff3333;
  z-index: 15;
  display: none;
  pointer-events: none;
  animation: bossFlash 0.4s infinite alternate;
}

@keyframes bossFlash {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.2;
  }
}

.stars-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.card-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.card-grid-wide {
  flex-wrap: wrap;
  max-width: 600px;
  margin: 5px 0;
}

.card-grid-bottom {
  margin: 5px 0 20px;
}

.card-grid-row {
  margin: 15px 0;
}

.market-instruction {
  min-height: 20px;
}

@media (max-width: 720px) {
  #shop {
    gap: 6px;
    padding: 12px 8px 18px;
  }

  .card {
    width: 68px;
    height: 96px;
  }

  .screen-actions {
    flex-direction: column;
    width: min(100%, 320px);
  }

  .screen-btn {
    width: 100%;
    padding-inline: 20px;
  }

  #powerupIndicator {
    top: 64px;
    max-width: calc(100vw - 24px);
    overflow-x: auto;
  }
}
