/* Custom Synthwave & Tactical Styles */

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

body {
  background-color: #080c14;
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 240, 255, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(255, 0, 119, 0.08) 0px, transparent 50%);
}

/* Custom Scrollbar for campaign level selection */
.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(14, 22, 38, 0.5);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #1d2c48;
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #00f0ff;
}

/* Board & Grid layout fixes */
#board-container {
  width: min(86vw, 340px);
  height: min(86vw, 340px);
  max-width: 340px;
  max-height: 340px;
  aspect-ratio: 1 / 1;
  background: #0d1527 !important;
  border: 2px solid #00f0ff !important;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 15px rgba(0, 240, 255, 0.1) !important;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#game-grid {
  width: 100%;
  height: 100%;
  display: grid;
}

/* Grid Tile Styling with High Contrast & Visual Depth */
.grid-tile {
  background: #121d33;
  border: 2px solid #243c68;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
}

/* Empty reticle marker in each square so it's impossible to see a blank void */
.tile-empty-reticle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.25);
  border: 1px solid rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
  transition: all 0.2s ease;
  pointer-events: none;
}

.grid-tile:active {
  transform: scale(0.92);
}

.grid-tile.tile-hoverable:hover {
  border-color: #00f0ff;
  background: #182847;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.2);
  transform: translateY(-2px);
}

.grid-tile.tile-hoverable:hover .tile-empty-reticle {
  transform: scale(2.2);
  background: #00f0ff;
  box-shadow: 0 0 12px #00f0ff;
}

.hazard-label {
  font-size: 8px;
  font-family: 'Orbitron', sans-serif;
  color: #ff3366;
  letter-spacing: 1px;
  font-weight: 800;
  margin-top: 1px;
}

/* Token X (Cyan) & O (Pink) */
.token-x {
  color: #00f0ff;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.8), 0 0 30px rgba(0, 240, 255, 0.4);
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  animation: tokenSpawn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.token-o {
  color: #ff0077;
  text-shadow: 0 0 15px rgba(255, 0, 119, 0.8), 0 0 30px rgba(255, 0, 119, 0.4);
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  animation: tokenSpawn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes tokenSpawn {
  0% {
    transform: scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.15) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Dying / Fading Mark (Phantom Mod) */
.token-dying {
  opacity: 0.35 !important;
  animation: dyingPulse 1s infinite alternate ease-in-out !important;
}

@keyframes dyingPulse {
  0% {
    opacity: 0.2;
    transform: scale(0.85);
  }
  100% {
    opacity: 0.55;
    transform: scale(0.95);
  }
}

/* Blocked Hazard Tile */
.tile-hazard {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 51, 102, 0.15),
    rgba(255, 51, 102, 0.15) 10px,
    rgba(255, 51, 102, 0.05) 10px,
    rgba(255, 51, 102, 0.05) 20px
  ) !important;
  border-color: rgba(255, 51, 102, 0.5) !important;
  cursor: not-allowed !important;
}

/* Active Highlight of Choice Options in PVP */
.active-option {
  border-color: #00f0ff !important;
  background-color: rgba(0, 240, 255, 0.1) !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Modals Overlay Base */
.modal-overlay {
  display: none;
}
.modal-overlay.active {
  display: flex;
}

/* Scanline Overlay effect for retro synth feel */
#app-container::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  z-index: 100;
  pointer-events: none;
  opacity: 0.3;
}