/* Global visual upgrade layer for all pages and games */
:root {
  --fx-glow: rgba(123, 236, 255, 0.25);
  --fx-deep: rgba(3, 11, 22, 0.55);
  --fx-card: rgba(14, 32, 54, 0.72);
  --fx-border: rgba(176, 230, 255, 0.38);
  --fx-shadow-lg: 0 14px 30px rgba(0, 0, 0, 0.34);
  --fx-shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.24);
}

* {
  text-rendering: geometricPrecision;
}

body {
  position: relative;
  overflow-x: hidden;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: -10% -10%;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(circle at 12% 18%, rgba(126, 245, 255, 0.16), transparent 40%),
    radial-gradient(circle at 83% 12%, rgba(130, 255, 181, 0.14), transparent 44%),
    radial-gradient(circle at 70% 86%, rgba(255, 198, 120, 0.11), transparent 35%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(var(--fx-deep), var(--fx-deep)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 7px
    );
  mix-blend-mode: soft-light;
}

main,
.shell,
.hub {
  backdrop-filter: blur(2px);
}

.hero,
.about,
.card,
.shell > div,
#game,
#world,
#map,
#sea,
#grid,
.board,
canvas,
#gameCanvas,
#startMenu,
#tutorialOverlay .tutorial-card {
  box-shadow:
    var(--fx-shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 20px var(--fx-glow);
}

button,
a,
select {
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

button,
select,
a {
  outline: none;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  box-shadow:
    0 0 0 2px rgba(8, 20, 34, 0.8),
    0 0 0 4px rgba(137, 232, 255, 0.65),
    var(--fx-shadow-sm);
}

button:hover,
a:hover,
select:hover {
  filter: brightness(1.08);
}

button:active,
a:active {
  transform: translateY(1px);
}

button,
select {
  box-shadow:
    var(--fx-shadow-sm),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

canvas,
#game,
#world,
#map,
#sea {
  border: 1px solid var(--fx-border) !important;
  border-radius: 12px;
  background-blend-mode: soft-light;
}

.card,
.about,
.hero,
.board,
#startMenu,
.tutorial-card {
  backdrop-filter: blur(2.5px) saturate(110%);
}

.card:hover,
.about:hover,
.hero:hover {
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 24px rgba(149, 235, 255, 0.3);
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 0 rgba(123, 236, 255, 0.1); }
  50% { box-shadow: 0 0 24px rgba(123, 236, 255, 0.22); }
  100% { box-shadow: 0 0 0 rgba(123, 236, 255, 0.1); }
}

.hero {
  animation: glowPulse 4.8s ease-in-out infinite;
}

@media (max-width: 640px) {
  .hero,
  .about,
  .card,
  #startMenu,
  #game,
  #world,
  #map,
  #sea,
  #grid,
  canvas,
  #gameCanvas {
    border-radius: 10px !important;
    box-shadow:
      0 10px 20px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 255, 255, 0.03) inset,
      0 0 14px rgba(123, 236, 255, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero {
    animation: none;
  }

  button,
  a,
  select {
    transition: none;
  }
}
