:root {
  --flag-green: #165d31;
  --map-fill: #1f7a42;
  --gold: #e8c872;
  --gold-intensity: 0.85;
  --overlay: 0.65;
  --shimmer-speed: 1;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--flag-green);
  cursor: none;
}

body.preview {
  cursor: default;
}

body.idle:not(.preview) {
  cursor: none;
}

#viewport {
  position: relative;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.05), transparent 36%),
    radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.18), transparent 42%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.015) 0 8px,
      transparent 8px 18px
    ),
    var(--flag-green);
}

body.empty #viewport {
  animation: empty-glow 7s ease-in-out infinite;
}

body.no-ambient.empty #viewport {
  animation: none;
}

#stage {
  position: absolute;
  inset: 0;
}

#mosaic {
  position: absolute;
  inset: 0;
  background: var(--flag-green);
}

.tile {
  position: absolute;
  overflow: hidden;
  padding: 0;
  border: 0;
  appearance: none;
  transform-origin: top left;
  background: var(--flag-green);
  cursor: pointer;
}

body.preview .tile {
  cursor: pointer;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  background: #0a2816;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 30%,
    color-mix(in srgb, var(--gold) 45%, transparent) 50%,
    transparent 70%
  );
  background-size: 220% 100%;
  animation: seam-shine calc(3.6s / var(--shimmer-speed)) linear infinite;
  opacity: calc(var(--gold-intensity) * 0.42);
  mix-blend-mode: screen;
}

body.no-shimmer .tile::after {
  animation: none;
  opacity: 0.15;
}

#spotlight {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
}

#spotlight.active {
  pointer-events: auto;
  opacity: 1;
}

#veil {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--overlay));
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 280ms ease;
}

#spotlight.active #veil {
  opacity: 1;
}

#spot-img {
  position: absolute;
  left: 20%;
  top: 20%;
  width: 60%;
  height: 60%;
  object-fit: contain;
  background: transparent;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--gold) 55%, transparent);
  opacity: 0;
  pointer-events: none;
}

@keyframes seam-shine {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

@keyframes empty-glow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}
