body {
  opacity: 0;
  animation: pageFadeIn 0.35s ease forwards;
}

body.has-fixed-header {
  padding-top: var(--fixed-header-h, 84px);
}

body.is-page-leaving {
  opacity: 0;
  transition: opacity 0.28s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scroll-top-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1300;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 10, 12, 0.84);
  color: #f5f7fb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease;
}

.scroll-top-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-bubble:hover {
  background: rgba(230, 75, 255, 0.22);
}

/* Unified header shell across pages */
header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 80 !important;
  background: rgba(6, 6, 7, 0.66) !important;
  backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
body.mobile-menu-open header {
  z-index: 130 !important;
}
header .nav {
  height: auto !important;
  min-height: 84px !important;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
header .brand img {
  height: 28px !important;
  width: auto !important;
  display: block !important;
}
.burger-btn {
  display: none;
}
.nav-links,
.links {
  display: flex;
  gap: 18px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(245, 247, 251, 0.75);
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  flex-wrap: wrap;
}
.nav-links a,
.links a {
  color: inherit;
  text-decoration: none;
}
.nav-links a:hover,
.links a:hover {
  color: #fff;
}


@media (min-width: 901px) {
  header .nav {
    flex-wrap: nowrap !important;
  }
  .nav-links,
  .links {
    flex-wrap: nowrap !important;
    gap: clamp(12px, 1.15vw, 18px) !important;
    font-size: clamp(12px, 0.82vw, 13px) !important;
    letter-spacing: 0.09em !important;
  }
}

@media (max-width: 900px) {
  .burger-btn {
    display: inline-flex !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    background: rgba(10, 10, 12, 0.8) !important;
    color: #fff !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 0 !important;
    cursor: pointer !important;
    z-index: 121 !important;
  }
  .burger-btn span {
    display: block !important;
    width: 20px !important;
    height: 2.5px !important;
    background: #fff !important;
    border-radius: 2px !important;
    transform-origin: center !important;
    transition: transform 0.22s ease, opacity 0.2s ease !important;
  }
  .nav.is-open .burger-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg) !important; }
  .nav.is-open .burger-btn span:nth-child(2) { opacity: 0 !important; }
  .nav.is-open .burger-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg) !important; }

  .nav-links,
  .links {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: min(84vw, 360px) !important;
    height: 100dvh !important;
    display: flex !important;
    justify-content: flex-start !important;
    flex-direction: column !important;
    gap: 16px !important;
    margin-top: 0 !important;
    padding: calc(var(--mobile-header-h, 84px) + 20px) 22px 24px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.16) !important;
    font-size: 19px !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    font-weight: 600 !important;
    background: rgba(5, 6, 11, 0.82) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: -30px 0 48px rgba(0, 0, 0, 0.42) !important;
    transform: translateX(100%) !important;
    transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.25, 1) !important;
    z-index: 120 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .nav.is-open .nav-links,
  .nav.is-open .links {
    transform: translateX(0) !important;
  }
}

body.space-invader-open {
  overflow: hidden;
}

.invader-launcher {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1295;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.74;
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.invader-launcher:hover {
  transform: translateY(-1px) scale(1.04);
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.38));
}

.invader-launcher-icon {
  position: relative;
  width: 2px;
  height: 2px;
  background: #fff;
  box-shadow:
    -6px 0 #fff, 6px 0 #fff,
    -8px 2px #fff, -6px 2px #fff, 6px 2px #fff, 8px 2px #fff,
    -8px 4px #fff, -4px 4px #fff, 0 4px #fff, 4px 4px #fff, 8px 4px #fff,
    -8px 6px #fff, -6px 6px #fff, -4px 6px #fff, -2px 6px #fff, 0 6px #fff, 2px 6px #fff, 4px 6px #fff, 6px 6px #fff, 8px 6px #fff,
    -8px 8px #fff, -6px 8px #fff, -2px 8px #fff, 2px 8px #fff, 6px 8px #fff, 8px 8px #fff,
    -6px 10px #fff, -4px 10px #fff, 4px 10px #fff, 6px 10px #fff;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.6));
}

.invader-launcher.is-hidden {
  display: none;
}

.invader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 8, 0.74);
  backdrop-filter: blur(5px);
  padding: 18px;
}

.invader-overlay.is-open {
  display: flex;
}

.invader-panel {
  width: min(980px, 94vw);
  max-height: 92vh;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(8, 9, 14, 0.94);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.invader-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(230, 75, 255, 0.16), rgba(75, 91, 255, 0.14));
}

.invader-title {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f5f7fb;
}

.invader-stats {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(245, 247, 251, 0.86);
}

.invader-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 6, 11, 0.72);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.invader-canvas-wrap {
  padding: 14px;
  position: relative;
}

.invader-canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 12px;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0px,
    rgba(0, 0, 0, 0.3) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 3px
  );
  opacity: 0.24;
}

.invader-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid rgba(138, 123, 255, 0.28);
  border-radius: 12px;
  background: #05050a;
  box-shadow:
    inset 0 0 50px rgba(138, 123, 255, 0.12),
    0 0 28px rgba(138, 123, 255, 0.09);
}

.invader-help {
  padding: 0 14px 14px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(203, 210, 220, 0.9);
}

.invader-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 0 14px 12px;
}

.invader-board {
  padding: 0 14px 14px;
}

.invader-board-title {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(226, 232, 247, 0.92);
}

.invader-board-wrap {
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(6, 7, 12, 0.84);
}

.invader-board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.invader-board-table th,
.invader-board-table td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(235, 238, 247, 0.92);
}

.invader-board-table th {
  position: sticky;
  top: 0;
  background: rgba(19, 18, 31, 0.95);
  z-index: 1;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(203, 210, 220, 0.9);
}

.invader-board-table tbody tr:last-child td {
  border-bottom: 0;
}

.invader-board-empty {
  text-align: center !important;
  color: rgba(203, 210, 220, 0.92) !important;
}

@media (max-width: 900px) {
  .invader-launcher {
    display: none !important;
  }
  .invader-overlay {
    display: none !important;
  }
}
