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

:root {
  --neon-green: #39ff50;
  --deep-blue: #0066dd;
  --pepsi-blue: #0099ff;
  --electric-cyan: #00d4ff;
  --chrome-light: #e8f4ff;
  --chrome-mid: #9cb8e0;
  --chrome-dark: #3d5a8c;
  --danger-red: #ff3344;
  --black: #0a1628;
  --panel-shadow: rgba(0, 0, 0, 0.45);
}

body {
  font-family: 'VT323', monospace;
  overflow: hidden;
  color: #f3f9ff;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.4), transparent 35%),
    radial-gradient(ellipse at 30% 0%, rgba(0, 212, 255, 0.6), transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(24, 88, 255, 0.5), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(59, 255, 79, 0.2), transparent 40%),
    linear-gradient(180deg, #0099ff 0%, #0066dd 50%, #003388 100%);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: 
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.2), transparent 20%),
    radial-gradient(circle at 75% 75%, rgba(0, 212, 255, 0.25), transparent 25%),
    radial-gradient(ellipse at 50% 100%, rgba(59, 255, 79, 0.15), transparent 30%);
  opacity: 0.7;
}

.retro-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 212, 255, 0.25) 0,
      transparent 2px,
      transparent 30px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 212, 255, 0.25) 0,
      transparent 2px,
      transparent 30px
    ),
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(0, 102, 221, 0.3) 100%),
    radial-gradient(ellipse 600px 300px at 50% 0%, rgba(255, 255, 255, 0.1), transparent);
  filter: saturate(1.4) brightness(1.1);
  animation: backdrop-glow 6s ease-in-out infinite alternate;
}

@keyframes backdrop-glow {
  0% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.95;
  }
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: 
    linear-gradient(
      45deg,
      transparent 0%,
      rgba(0, 212, 255, 0.1) 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.08) 75%,
      transparent 100%
    );
  background-size: 400% 400%;
  animation: holographic-sweep 12s ease-in-out infinite;
  opacity: 0.4;
}

@keyframes holographic-sweep {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.retro-header {
  position: fixed;
  top: 10px;
  left: 14px;
  right: 14px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(223, 233, 255, 0.95), rgba(98, 121, 177, 0.94));
  border: 3px solid #eaf2ff;
  box-shadow:
    inset 0 0 0 2px #3a4f7f,
    0 10px 24px var(--panel-shadow);
  clip-path: polygon(0 0, 99% 0, 100% 22%, 100% 100%, 1% 100%, 0 78%);
}

.retro-stamp {
  background: linear-gradient(90deg, #ef1d2f, #f54e32 52%, #ffce2b);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(10px, 0.95vw, 13px);
  letter-spacing: 0.8px;
  line-height: 1;
  padding: 10px 16px;
  text-shadow: 2px 2px 0 #000;
  border-bottom: 3px solid #0e1838;
}

.retro-ticker-wrap {
  overflow: hidden;
  border-top: 1px solid #ffffff;
  border-bottom: 2px solid #1b2950;
  background:
    linear-gradient(180deg, #0a2ca5 0%, #0f174f 100%);
}

.retro-ticker {
  display: inline-block;
  white-space: nowrap;
  color: #e9ff76;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(14px, 1.35vw, 18px);
  letter-spacing: 0.7px;
  padding: 2px 0 1px;
  text-shadow: 1px 1px 0 #000;
  animation: ticker 20s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 2;
  filter: brightness(1.05) saturate(1.1);
}

#ui-overlay {
  position: fixed;
  top: 96px;
  left: 18px;
  z-index: 15;
  width: min(360px, calc(100vw - 36px));
  color: #eef6ff;
  background: linear-gradient(160deg, rgba(15, 34, 85, 0.93), rgba(7, 16, 40, 0.94));
  border: 3px solid #d8e6ff;
  box-shadow:
    inset 0 0 0 2px #4f699d,
    0 8px 18px rgba(0, 0, 0, 0.5);
  clip-path: polygon(0 0, 97% 0, 100% 18%, 100% 100%, 3% 100%, 0 82%);
  padding: 8px 11px;
}

#ui-overlay p {
  font-family: 'VT323', monospace;
  font-size: clamp(12px, 1.25vw, 17px);
  line-height: 1.2;
  margin-top: 0;
  letter-spacing: 0.2px;
}

.blink {
  color: #ff7777;
  font-weight: 700;
  animation: blink 1s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.controls {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  z-index: 15;
  background: linear-gradient(180deg, rgba(199, 214, 245, 0.95), rgba(88, 109, 166, 0.95));
  border: 3px solid #e7f1ff;
  clip-path: polygon(3% 0, 97% 0, 100% 35%, 97% 100%, 3% 100%, 0 35%);
  box-shadow:
    inset 0 0 0 2px #2b3f6b,
    0 8px 20px rgba(0, 0, 0, 0.5);
}

.btn-link {
  text-decoration: none;
  display: inline-block;
}

button {
  background: linear-gradient(180deg, #f5fbff 0%, #9fb4df 100%);
  border: 2px solid #eaf3ff;
  color: #00112e;
  padding: 7px 15px;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(10px, 1.05vw, 14px);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow:
    inset 0 -3px 0 #506796,
    inset 0 2px 0 #ffffff,
    0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s ease, filter 0.16s ease;
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px) scale(0.99);
  box-shadow:
    inset 0 -2px 0 #43567e,
    inset 0 1px 0 #ffffff,
    0 1px 4px rgba(0, 0, 0, 0.25);
}

#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(59, 255, 79, 0.2) 0,
      rgba(59, 255, 79, 0.2) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(135deg, #07163b 0%, #02050d 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f5fdff;
  font-family: 'Press Start 2P', monospace;
  z-index: 100;
  transition: opacity 0.4s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-family: 'VT323', monospace;
  font-size: clamp(20px, 2.2vw, 28px);
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.loading-bar-container {
  width: 320px;
  max-width: 80vw;
  height: 32px;
  background: rgba(0, 0, 0, 0.6);
  border: 3px solid var(--neon-green);
  box-shadow: 
    inset 0 0 0 2px #0a1f28,
    0 0 12px rgba(59, 255, 79, 0.4);
  position: relative;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    var(--neon-green) 0%, 
    #2de6ff 50%, 
    var(--neon-green) 100%);
  background-size: 200% 100%;
  animation: loadingShimmer 1.5s linear infinite;
  box-shadow: 0 0 16px rgba(59, 255, 79, 0.6);
  transition: width 0.3s ease;
}

.loading-percent {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 1.6vw, 22px);
  margin-top: 18px;
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(59, 255, 79, 0.7);
}

@keyframes loadingShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.nokia-banner-ad {
  position: fixed;
  top: 84px;
  left: 50%;
  bottom: auto;
  transform: translateX(-50%) skewX(-8deg);
  z-index: 16;
  background: linear-gradient(160deg, rgba(225, 238, 255, 0.95), rgba(97, 119, 170, 0.95));
  border: 3px solid #e5efff;
  box-shadow:
    inset 0 0 0 2px #3f5788,
    0 8px 18px rgba(0, 0, 0, 0.45);
  padding: 6px;
}

.nokia-banner-ad img {
  display: block;
  max-width: clamp(360px, 34vw, 520px);
  height: auto;
  image-rendering: pixelated;
  transform: skewX(8deg);
}

/* Circular orbital layout */
.lore-orbit-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  z-index: 10;
  pointer-events: none;
}

.lore-center-title {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f13032 0%, #174fff 52%, #2be4ff 100%);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 3px solid #edf5ff;
  box-shadow:
    inset 0 0 0 2px #1b2950,
    0 10px 22px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  z-index: 20;
}

.lore-center-title h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(10px, 1.2vw, 14px);
  letter-spacing: 0.8px;
  text-shadow: 2px 2px 0 #000;
}

.lore-center-title .lore-blink {
  font-size: 16px;
  animation: blink 0.85s steps(2, jump-none) infinite;
}

/* Orbital positioning for each lore fact */
.orbital-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(240px, 18vw, 320px);
  pointer-events: auto;
}

/* Position each item in a circle using rotation and translation */
.orbital-item[data-position="1"] {
  transform: rotate(0deg) translateX(clamp(320px, 38vw, 520px)) rotate(0deg);
}

.orbital-item[data-position="2"] {
  transform: rotate(60deg) translateX(clamp(320px, 38vw, 520px)) rotate(-60deg);
}

.orbital-item[data-position="3"] {
  transform: rotate(120deg) translateX(clamp(320px, 38vw, 520px)) rotate(-120deg);
}

.orbital-item[data-position="4"] {
  transform: rotate(180deg) translateX(clamp(320px, 38vw, 520px)) rotate(-180deg);
}

.orbital-item[data-position="5"] {
  transform: rotate(240deg) translateX(clamp(320px, 38vw, 520px)) rotate(-240deg);
}

.orbital-item[data-position="6"] {
  transform: rotate(300deg) translateX(clamp(320px, 38vw, 520px)) rotate(-300deg);
}

.lore-fact {
  padding: 10px 12px;
  background: linear-gradient(170deg, rgba(6, 20, 52, 0.95), rgba(3, 10, 24, 0.96));
  color: #eaf4ff;
  border: 3px solid #e6f0ff;
  box-shadow:
    inset 0 0 0 2px #375484,
    0 8px 18px rgba(0, 0, 0, 0.5);
  font-size: clamp(13px, 1.35vw, 16px);
  line-height: 1.3;
  border-radius: 6px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lore-fact:hover {
  transform: scale(1.05);
  box-shadow:
    inset 0 0 0 2px #4a6aa0,
    0 12px 28px rgba(0, 0, 0, 0.7);
  z-index: 100;
}

/* Color coding based on position */
.orbital-item[data-position="1"],
.orbital-item[data-position="3"],
.orbital-item[data-position="5"] {
  border-left: 6px solid var(--danger-red);
}

.orbital-item[data-position="2"],
.orbital-item[data-position="4"],
.orbital-item[data-position="6"] {
  border-left: 6px solid var(--electric-cyan);
}

.lore-fact strong {
  color: #ffe470;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 0.75vw, 9px);
  display: block;
  margin-bottom: 6px;
  line-height: 1.4;
}

@media (max-width: 820px) {
  body {
    overflow-y: auto;
  }

  .retro-header {
    left: 8px;
    right: 8px;
    top: 8px;
  }

  .retro-stamp {
    font-size: 9px;
    padding: 9px 11px;
  }

  .retro-ticker {
    font-size: 15px;
  }

  #ui-overlay {
    top: 84px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 10px 11px;
  }

  .controls {
    width: calc(100vw - 20px);
    left: 10px;
    transform: none;
    justify-content: space-between;
    gap: 6px;
    padding: 8px;
  }

  button {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    font-size: 10px;
  }

  .nokia-banner-ad {
    top: 78px;
    left: 50%;
    bottom: auto;
    transform: translateX(-50%) skewX(-8deg);
  }

  .nokia-banner-ad img {
    max-width: min(420px, calc(100vw - 24px));
  }

  /* Stack orbital items vertically on mobile */
  .lore-orbit-container {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    margin: 10px auto;
    padding: 0 10px 80px;
  }

  .lore-center-title {
    position: static;
    transform: none;
    margin: 10px auto 16px;
    width: fit-content;
  }

  .orbital-item {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    margin-bottom: 12px;
  }

  .lore-fact {
    font-size: 14px;
  }

  .lore-fact strong {
    font-size: 8px;
  }
}

/* Gallery Modal */
.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  transition: opacity 0.3s ease;
}

.gallery-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.gallery-container {
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(15, 34, 85, 0.97), rgba(7, 16, 40, 0.98));
  border: 4px solid #d8e6ff;
  box-shadow:
    inset 0 0 0 3px #4f699d,
    0 12px 32px rgba(0, 0, 0, 0.7);
  padding: 18px;
  border-radius: 8px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 3px solid #3bff4f;
}

.gallery-header h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 1.8vw, 18px);
  color: #ffe470;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 1px;
  margin: 0;
}

.gallery-close {
  background: linear-gradient(180deg, #f5fbff 0%, #9fb4df 100%);
  border: 2px solid #eaf3ff;
  color: #00112e;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: 24px;
  line-height: 1;
  border-radius: 50%;
  box-shadow:
    inset 0 -3px 0 #506796,
    inset 0 2px 0 #ffffff,
    0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s ease, filter 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.gallery-close:hover {
  filter: brightness(1.08);
}

.gallery-close:active {
  transform: scale(0.95);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.4);
  border: 3px solid #3bff4f;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  image-rendering: auto;
}

.gallery-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(59, 255, 79, 0.4);
  border-color: #ffe470;
}

/* Lightbox Viewer */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.lightbox.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: linear-gradient(180deg, #f5fbff 0%, #9fb4df 100%);
  border: 2px solid #eaf3ff;
  color: #00112e;
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: 32px;
  line-height: 1;
  border-radius: 50%;
  box-shadow:
    inset 0 -3px 0 #506796,
    inset 0 2px 0 #ffffff,
    0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease, filter 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 301;
}

.lightbox-close:hover {
  filter: brightness(1.08);
}

.lightbox-close:active {
  transform: scale(0.95);
}

#lightbox-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border: 4px solid #3bff4f;
  box-shadow: 0 0 40px rgba(59, 255, 79, 0.3);
}

@media (max-width: 820px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .gallery-thumb {
    height: 150px;
  }

  .gallery-container {
    padding: 14px;
    max-height: 80vh;
  }

  .gallery-header h2 {
    font-size: 11px;
  }

  #lightbox-img {
    max-width: 95%;
    max-height: 95%;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    font-size: 28px;
  }
}
