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

:root {
  --neon-pink: #ff2a6d;
  --neon-cyan: #05d9e8;
  --neon-yellow: #f9f002;
  --neon-purple: #d300c5;
  --bg-dark: #0a0a12;
  --panel: rgba(10, 10, 24, 0.92);
  --border: #05d9e8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Share Tech Mono', monospace;
  color: #e8e8f0;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(211, 0, 197, 0.15), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(5, 217, 232, 0.12), transparent 50%),
    #05050c;
}

#game-wrap {
  position: relative;
  box-shadow:
    0 0 0 2px var(--neon-cyan),
    0 0 40px rgba(5, 217, 232, 0.25),
    0 0 80px rgba(255, 42, 109, 0.15);
}

#game {
  display: block;
  background: #0d0d1a;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0,0,0,0.65), transparent);
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-stat {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-shadow: 0 0 8px currentColor;
}

.hud-stat .label {
  color: var(--neon-cyan);
  opacity: 0.8;
}

.hud-stat .value {
  color: var(--neon-yellow);
}

.hud-stat.hp .value { color: var(--neon-pink); }
.hud-stat.tera .value { color: #00ff9d; }

.panel-hint {
  font-size: 11px !important;
  color: #888 !important;
  margin-bottom: 14px !important;
  line-height: 1.45 !important;
}

.topup-amount {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: #00ff9d;
}

.shop-item.topup {
  border-color: rgba(0, 255, 157, 0.35);
  background: rgba(0, 255, 157, 0.04);
}

.shop-item.topup:hover {
  border-color: #00ff9d;
}

#menu-btns {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 10;
  pointer-events: auto;
}

.btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 8px 12px;
  border: 1px solid var(--neon-cyan);
  background: rgba(5, 217, 232, 0.1);
  color: var(--neon-cyan);
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s;
}

.btn:hover {
  background: rgba(5, 217, 232, 0.3);
  box-shadow: 0 0 12px rgba(5, 217, 232, 0.5);
}

.btn.pink {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  background: rgba(255, 42, 109, 0.1);
}

.btn.pink:hover {
  background: rgba(255, 42, 109, 0.3);
  box-shadow: 0 0 12px rgba(255, 42, 109, 0.5);
}

.btn.yellow {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: rgba(249, 240, 2, 0.08);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 12, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(4px);
}

.overlay.open {
  display: flex;
}

.panel {
  width: min(520px, 92%);
  max-height: 85%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--neon-cyan);
  box-shadow:
    0 0 30px rgba(5, 217, 232, 0.2),
    inset 0 0 40px rgba(211, 0, 197, 0.05);
  padding: 20px;
}

.panel h1, .panel h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--neon-pink);
  text-shadow: 0 0 16px rgba(255, 42, 109, 0.6);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.panel h1 {
  font-size: 22px;
  text-align: center;
}

.panel h2 {
  font-size: 16px;
  border-bottom: 1px solid rgba(5, 217, 232, 0.3);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.panel p {
  font-size: 13px;
  line-height: 1.5;
  color: #b8b8c8;
  margin-bottom: 10px;
}

.panel .subtitle {
  text-align: center;
  color: var(--neon-cyan);
  font-size: 12px;
  margin-bottom: 18px;
  letter-spacing: 2px;
}

.controls-list {
  font-size: 12px;
  color: #aaa;
  margin: 12px 0 18px;
  line-height: 1.8;
}

.controls-list kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 11px;
  margin-right: 4px;
}

.center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

/* Market */
.market-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.35);
  font-size: 13px;
}

.market-balance strong {
  color: #00ff9d;
  font-family: 'Orbitron', sans-serif;
}

.shop-grid {
  display: grid;
  gap: 10px;
}

.shop-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(5, 217, 232, 0.25);
  background: rgba(5, 217, 232, 0.04);
  transition: border-color 0.15s;
}

.shop-item:hover {
  border-color: var(--neon-cyan);
}

.shop-item.nft {
  border-color: rgba(249, 240, 2, 0.4);
  background: rgba(249, 240, 2, 0.05);
}

.shop-item.owned {
  border-color: rgba(0, 255, 157, 0.5);
  opacity: 0.85;
}

.shop-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-info h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: var(--neon-cyan);
  margin-bottom: 2px;
}

.shop-item.nft .shop-info h3 {
  color: var(--neon-yellow);
}

.shop-info p {
  font-size: 11px;
  margin: 0;
  color: #888;
}

.shop-info .tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 1px 5px;
  margin-top: 4px;
  border: 1px solid var(--neon-yellow);
  color: var(--neon-yellow);
}

.shop-buy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.price {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  color: #00ff9d;
}

.price.nft-price {
  color: var(--neon-yellow);
  font-size: 10px;
}

/* Toast */
#toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 10, 24, 0.95);
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  padding: 10px 18px;
  font-size: 12px;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.25s, transform 0.25s;
  max-width: 90%;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.success {
  border-color: #00ff9d;
  color: #00ff9d;
}

/* Mobile controls */
#mobile-controls {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  padding: 0 16px;
  justify-content: space-between;
  z-index: 8;
  pointer-events: none;
}

.d-pad, .action-pad {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--neon-cyan);
  background: rgba(5, 217, 232, 0.15);
  color: var(--neon-cyan);
  font-size: 18px;
  font-family: 'Orbitron', sans-serif;
  touch-action: none;
}

.ctrl-btn:active {
  background: rgba(5, 217, 232, 0.4);
}

@media (max-width: 900px), (pointer: coarse) {
  #mobile-controls {
    display: flex;
  }
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  opacity: 0.4;
}
