/* === Design Tokens === */
:root {
  --space-black: #0a0e17;
  --deep-void: #0d1321;
  --nebula-blue: #1a2744;
  --plasma-cyan: #00d4ff;
  --laser-blue: #4dabf7;
  --shell-orange: #ff6b35;
  --claw-red: #e63946;
  --bio-green: #2dd4bf;
  --star-white: #e8f4f8;
  --chrome-silver: #a8c5d6;
  --hull-grey: #6b8fa3;
  --warning-yellow: #ffd93d;
  --void-purple: #9b59b6;
  --dim-grey: #2a3a4a;

  --glow-cyan: 0 0 30px rgba(0, 212, 255, 0.5);
  --glow-orange: 0 0 30px rgba(255, 107, 53, 0.5);
}

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

html {
  scroll-behavior: auto;
}

body {
  font-family: var(--font-space-grotesk), 'Space Grotesk', sans-serif;
  background: var(--space-black);
  color: var(--star-white);
  overflow-x: hidden;
  line-height: 1.6;
}

/* === Shared Navigation === */
nav.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(10, 14, 23, 0.95) 0%, rgba(10, 14, 23, 0) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100vw;
  box-sizing: border-box;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-logo img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--plasma-cyan);
  box-shadow: var(--glow-cyan);
}

.nav-logo span {
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--plasma-cyan), var(--shell-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  min-width: 0;
  flex-shrink: 1;
}

.nav-links li {
  flex-shrink: 0;
}

.nav-links a,
.nav-links button {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--chrome-silver);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--plasma-cyan);
  border-color: var(--plasma-cyan);
  box-shadow: var(--glow-cyan);
}

.nav-links a.active {
  color: var(--plasma-cyan);
  border-bottom-color: var(--plasma-cyan);
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.nav-links a.highlight,
.nav-links button.highlight {
  background: linear-gradient(135deg, var(--shell-orange), var(--claw-red));
  color: var(--star-white);
  border-radius: 4px;
  white-space: nowrap;
}

.nav-links a.highlight:hover,
.nav-links button.highlight:hover {
  box-shadow: var(--glow-orange);
  border-color: var(--shell-orange);
}

/* === Nav Dropdown === */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-dropdown-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-dropdown-open > button .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  background: rgba(13, 19, 33, 0.96);
  border: 1px solid var(--hull-grey);
  border-radius: 8px;
  padding: 0.5rem 0;
  list-style: none;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 1001;
}

.nav-dropdown-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu li {
  padding: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.55rem 1.25rem !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
  border: none !important;
  transition: background 0.15s ease, color 0.15s ease !important;
}

.nav-dropdown-menu a:hover {
  background: rgba(0, 212, 255, 0.08);
  box-shadow: none !important;
  border: none !important;
}

.nav-dropdown-menu a.active {
  color: var(--plasma-cyan);
  background: rgba(0, 212, 255, 0.06);
  border: none !important;
  box-shadow: none !important;
}

/* === Hamburger Button (hidden on desktop) === */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1003;
  transition: border-color 0.3s ease;
}

.hamburger-btn:hover {
  border-color: var(--plasma-cyan);
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--chrome-silver);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

.hamburger-btn:hover .hamburger-line {
  background: var(--plasma-cyan);
}

/* Animate to X when open */
.hamburger-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === Mobile Overlay === */
.mobile-overlay {
  display: none;
}

/* === Mobile Slide-in Menu === */
.mobile-menu {
  display: none;
}

/* Nav i18n: slightly smaller text on narrower desktops */
@media (max-width: 1400px) {
  .nav-links {
    gap: 1rem;
  }
  .nav-links a,
  .nav-links button {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    letter-spacing: 0.04em;
  }
}

/* Nav medium screen */
@media (max-width: 1100px) {
  .nav-links {
    gap: 0.6rem;
  }
  .nav-links a,
  .nav-links button {
    font-size: 0.72rem;
    padding: 0.35rem 0.5rem;
    letter-spacing: 0.02em;
  }
}

/* === Buttons === */
.btn {
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 2.5rem;
  border: 2px solid;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--shell-orange), var(--claw-red));
  border-color: var(--shell-orange);
  color: var(--star-white);
}

.btn-primary:hover {
  box-shadow: var(--glow-orange), inset 0 0 20px rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--plasma-cyan);
  color: var(--plasma-cyan);
}

.btn-secondary:hover {
  background: rgba(0, 212, 255, 0.1);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.btn-discord {
  background: linear-gradient(135deg, #5865F2, #4752C4);
  border-color: #5865F2;
  color: var(--star-white);
}

.btn-discord:hover {
  box-shadow: 0 0 30px rgba(88, 101, 242, 0.5);
  transform: translateY(-2px);
}

/* === Section Styling === */
section {
  padding: 6rem 2rem;
  position: relative;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-header .subtitle {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  color: var(--chrome-silver);
  font-size: 1rem;
}

/* === Footer === */
footer {
  background: var(--deep-void);
  border-top: 1px solid var(--hull-grey);
  padding: 3rem 2rem 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(61, 90, 108, 0.4);
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.footer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.footer-brand span {
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-weight: 600;
  color: var(--chrome-silver);
}

.footer-description {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #6b8a9e;
  line-height: 1.6;
  max-width: 300px;
}

.footer-links-col {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col-title {
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--shell-orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.footer-links-col a {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--chrome-silver);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links-col a:hover {
  color: var(--plasma-cyan);
}

.footer-newsletter {
  display: flex;
  justify-content: center;
  padding: 1.75rem 0 0.5rem;
  border-bottom: 1px solid rgba(61, 90, 108, 0.4);
}

.footer-bottom {
  display: flex;
  justify-content: center;
  padding-top: 1.5rem;
}

.footer-tagline {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #6b8a9e;
}

/* === Stats Bar === */
.stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(13, 19, 33, 0.95), rgba(10, 14, 23, 0.98));
  border-top: 1px solid var(--hull-grey);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: center;
  gap: 3rem;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.stat-label {
  color: var(--chrome-silver);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  color: var(--plasma-cyan);
  font-weight: 600;
}

.stat-value.online {
  color: var(--bio-green);
}

.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.server-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hull-grey);
  transition: background 0.3s;
}

.server-status-dot.online {
  background: var(--bio-green);
  box-shadow: 0 0 8px var(--bio-green);
  animation: pulse-server 2s infinite;
}

.server-status-dot.offline {
  background: var(--claw-red);
}

.server-status-text {
  color: var(--chrome-silver);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.server-status-text.online {
  color: var(--bio-green);
}

.server-status-text.offline {
  color: var(--claw-red);
}

/* === Starfield Background === */
.starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.starfield canvas {
  width: 100%;
  height: 100%;
}

/* === CSS Stars (for pages without canvas starfield) === */
.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 20px 30px, var(--star-white), transparent),
    radial-gradient(2px 2px at 40px 70px, var(--chrome-silver), transparent),
    radial-gradient(1px 1px at 90px 40px, var(--star-white), transparent),
    radial-gradient(1px 1px at 130px 80px, var(--plasma-cyan), transparent),
    radial-gradient(2px 2px at 160px 30px, var(--star-white), transparent);
  background-size: 200px 100px;
  animation: twinkle 4s ease-in-out infinite alternate;
}

.stars-2 {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(1px 1px at 50px 50px, var(--star-white), transparent),
    radial-gradient(1px 1px at 100px 120px, var(--chrome-silver), transparent),
    radial-gradient(2px 2px at 170px 60px, var(--star-white), transparent),
    radial-gradient(1px 1px at 60px 90px, var(--plasma-cyan), transparent);
  background-size: 250px 150px;
  animation: twinkle 6s ease-in-out infinite alternate-reverse;
}

/* === Animations === */
@keyframes twinkle {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-server {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* === Responsive (Shared) === */
@media (max-width: 768px) {
  nav.site-nav {
    padding: 0.75rem 1rem;
  }

  .nav-logo img {
    width: 40px;
    height: 40px;
  }

  .nav-logo span {
    font-size: 1.25rem;
  }

  /* Hide desktop nav links on mobile */
  .nav-links {
    display: none;
  }

  /* Show hamburger on mobile */
  .hamburger-btn {
    display: flex;
  }

  /* Mobile overlay background */
  .mobile-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-overlay-visible {
    opacity: 1;
    visibility: visible;
  }

  /* Mobile slide-in panel */
  .mobile-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: rgba(13, 19, 33, 0.97);
    border-left: 1px solid var(--hull-grey);
    backdrop-filter: blur(20px);
    z-index: 1002;
    padding: 5rem 1.5rem 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-menu-open {
    transform: translateX(0);
  }

  /* Explore section label */
  .mobile-menu-label {
    font-family: var(--font-orbitron), 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--shell-orange);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0 0.75rem;
    margin-bottom: 0.25rem;
    display: block;
  }

  .mobile-menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .mobile-menu-divider {
    height: 1px;
    background: rgba(61, 90, 108, 0.4);
    margin: 0.75rem 0;
  }

  /* Mobile menu links */
  .mobile-menu-link {
    font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--chrome-silver);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    display: block;
  }

  .mobile-menu-link:hover,
  .mobile-menu-link:active {
    color: var(--plasma-cyan);
    background: rgba(0, 212, 255, 0.08);
  }

  .mobile-menu-link.active {
    color: var(--plasma-cyan);
    background: rgba(0, 212, 255, 0.06);
    border-left: 2px solid var(--plasma-cyan);
  }

  /* Explore sub-links indented */
  .mobile-menu-section .mobile-menu-link {
    padding-left: 1.5rem;
    font-size: 0.85rem;
  }

  /* CTA button area */
  .mobile-menu-cta {
    padding: 0.5rem 0;
  }

  .mobile-menu-cta .highlight {
    display: block;
    width: 100%;
    text-align: center;
    font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, var(--shell-orange), var(--claw-red));
    color: var(--star-white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow 0.3s ease;
  }

  .mobile-menu-cta .highlight:hover {
    box-shadow: var(--glow-orange);
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
    align-items: center;
    text-align: center;
  }

  .footer-description {
    max-width: none;
  }

  .footer-links-col {
    align-items: center;
    text-align: center;
  }

  .footer-tagline {
    word-break: break-word;
  }

  .stats-bar {
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stat-item {
    font-size: 0.7rem;
    gap: 0.25rem;
  }
}

/* Ensure page content isn't hidden behind fixed stats bar */
body {
  padding-bottom: 60px;
}

/* === Map Page Overrides === */
/* The map page adds .map-page to <body> to hide shared layout elements */
body.map-page {
  overflow: hidden !important;
}

body.map-page > footer,
body.map-page .patreon-banner-wrapper {
  display: none !important;
}

/* === Play Page Overrides === */
/* The play page adds .play-page to <body> to hide shared layout elements */
body.play-page {
  overflow: hidden !important;
  padding-bottom: 0 !important;
}

body.play-page > nav,
body.play-page > footer,
body.play-page > .mobile-overlay,
body.play-page > .mobile-menu,
body.play-page > .stats-bar,
body.play-page > .live-feed-popup,
body.play-page .patreon-banner-wrapper {
  display: none !important;
}
