:root {
  --cyan: #00f0ff;
  --magenta: #ff2d95;
  --gold: #ffe44d;
  --bg-deep: #050510;
  --bg-dark: #0a0a1a;
  --bg-panel: #0d0d24;
  --bg-card: #1a1a2e;
  --text: #e0e0e0;
  --text-muted: #6a6a8a;
}

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

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline overlay */
.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  z-index: 2;
}

/* Glitch animation */
@keyframes glitch {
  0%, 90%, 100% { text-shadow: 0 0 10px var(--cyan), 0 0 40px var(--cyan); transform: translate(0); }
  92% { text-shadow: 2px 0 10px var(--magenta), -2px 0 40px var(--cyan); transform: translate(-2px, 1px); }
  94% { text-shadow: -2px 0 10px var(--cyan), 2px 0 40px var(--magenta); transform: translate(2px, -1px); }
  96% { text-shadow: 0 2px 10px var(--magenta), 0 -2px 40px var(--cyan); transform: translate(1px, 2px); }
  98% { text-shadow: -1px -1px 10px var(--cyan), 1px 1px 40px var(--magenta); transform: translate(-1px, -1px); }
}

.glitch-text {
  animation: glitch 4s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 5px var(--cyan), inset 0 0 5px rgba(0, 240, 255, 0.1); }
  50% { box-shadow: 0 0 15px var(--cyan), inset 0 0 10px rgba(0, 240, 255, 0.2); }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 8px var(--gold), inset 0 0 4px rgba(255, 228, 77, 0.15); }
  50% { box-shadow: 0 0 20px var(--gold), inset 0 0 10px rgba(255, 228, 77, 0.3); }
}

@keyframes pulse-magenta {
  0%, 100% { box-shadow: 0 0 5px var(--magenta), inset 0 0 5px rgba(255, 45, 149, 0.1); }
  50% { box-shadow: 0 0 15px var(--magenta), inset 0 0 10px rgba(255, 45, 149, 0.2); }
}

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.6; }
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes particleBurst {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.7; }
  100% { transform: scale(2); opacity: 0; }
}

@keyframes scanline-move {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.animate-slide-in {
  animation: slideIn 0.4s ease-out forwards;
}

.flicker {
  animation: flicker 3s infinite;
}

.neon-btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.05);
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.neon-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 20px rgba(0, 240, 255, 0.1);
  color: #fff;
}

.neon-btn:disabled {
  border-color: #333;
  color: #444;
  background: transparent;
  cursor: not-allowed;
  box-shadow: none;
}

.neon-btn-magenta {
  border-color: var(--magenta);
  color: var(--magenta);
  background: rgba(255, 45, 149, 0.05);
}

.neon-btn-magenta:hover {
  background: rgba(255, 45, 149, 0.15);
  box-shadow: 0 0 20px rgba(255, 45, 149, 0.3), inset 0 0 20px rgba(255, 45, 149, 0.1);
  color: #fff;
}

.neon-btn-gold {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 228, 77, 0.05);
}

.neon-btn-gold:hover {
  background: rgba(255, 228, 77, 0.15);
  box-shadow: 0 0 20px rgba(255, 228, 77, 0.3), inset 0 0 20px rgba(255, 228, 77, 0.1);
  color: #fff;
}

/* Grid cell styles */
.grid-cell {
  position: relative;
  border: 1px solid rgba(0, 240, 255, 0.15);
  background: var(--bg-dark);
  transition: all 0.15s ease;
  cursor: pointer;
  aspect-ratio: 1;
}

.grid-cell:hover {
  border-color: rgba(0, 240, 255, 0.5);
  background: rgba(0, 240, 255, 0.03);
}

.grid-cell.wall {
  background: rgba(255, 45, 149, 0.08);
  border-color: rgba(255, 45, 149, 0.4);
  cursor: default;
}

.grid-cell.objective {
  animation: pulse-gold 2s ease-in-out infinite;
}

.grid-cell.move-range {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.4);
}

.grid-cell.attack-range {
  background: rgba(255, 45, 149, 0.12);
  border-color: rgba(255, 45, 149, 0.4);
}

.grid-cell.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.15);
}

/* Unit sprites */
.unit-sprite {
  image-rendering: pixelated;
  width: 70%;
  height: 70%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  transition: all 0.3s ease;
}

/* HP bars */
.hp-bar-container {
  position: absolute;
  bottom: 2px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 4;
  border-radius: 1px;
}

.hp-bar {
  height: 100%;
  border-radius: 1px;
  transition: width 0.3s ease;
}

/* Damage flash */
@keyframes damage-flash {
  0%, 100% { filter: brightness(1); }
  25% { filter: brightness(3) hue-rotate(90deg); }
  50% { filter: brightness(0.5); }
  75% { filter: brightness(2) hue-rotate(-90deg); }
}

.damage-flash {
  animation: damage-flash 0.4s ease;
}

/* Turn indicator */
.turn-indicator {
  position: relative;
  overflow: hidden;
}

.turn-indicator::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: scanline-move 2s linear infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, 0.5); }

/* Mobile bottom sheet */
@media (max-width: 768px) {
  .game-layout {
    flex-direction: column !important;
  }
  .side-panel {
    max-height: 40vh;
    overflow-y: auto;
  }
}