/* Nexus Lab — interactive particle physics playground */
:root {
  --nx-cyan: #3ba5f7;
  --nx-violet: #9d4edd;
  --nx-magenta: #ff4dd2;
  --nx-gold: #f5c542;
  --nx-red: #ff5566;
  --nx-deep: #02010a;
}

.nexus-page {
  background: var(--nx-deep);
  color: #fff;
  overflow: hidden;
}

/* Hide site chrome when this page is active */
body.nexus-active {
  background: var(--nx-deep);
  overflow: hidden;
}

body.nexus-active .header-top-news,
body.nexus-active .rainbow-header,
body.nexus-active .header-default,
body.nexus-active .my_switcher,
body.nexus-active .rainbow-footer,
body.nexus-active .copyright-area,
body.nexus-active .rbt-progress-parent,
body.nexus-active .popup-mobile-menu {
  display: none !important;
}

body.nexus-active .page-wrapper {
  background: var(--nx-deep);
  padding: 0;
  margin: 0;
}

/* Canvas fills viewport */
.nexus-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(157, 78, 221, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(59, 165, 247, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(245, 197, 66, 0.08), transparent 50%),
    var(--nx-deep);
}

#nexus-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: none;
  touch-action: none;
}

/* Custom cursor */
.nexus-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 50;
  transition: width 0.18s ease, height 0.18s ease, opacity 0.25s ease;
  mix-blend-mode: screen;
  color: var(--nx-gold);
}

.nexus-cursor::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

.nexus-cursor.is-hidden {
  opacity: 0;
}

.nexus-cursor.is-active {
  width: 44px;
  height: 44px;
}

/* Top bar */
.nexus-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 1, 10, 0.6), transparent);
}

.nexus-topbar > * {
  pointer-events: auto;
}

.nexus-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.nexus-back:hover {
  background: rgba(245, 197, 66, 0.12);
  border-color: rgba(245, 197, 66, 0.4);
  color: var(--nx-gold);
}

.nexus-brand {
  text-align: center;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.45em;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

.nexus-brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.32em;
  background: linear-gradient(90deg, var(--nx-gold), var(--nx-magenta), var(--nx-violet), var(--nx-cyan));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: nx-shimmer 5s linear infinite;
  font-weight: 800;
}

@keyframes nx-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.nexus-counter {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.45);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 110px;
  text-align: center;
}

/* Side help */
.nexus-help {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  max-width: 220px;
  transition: opacity 0.5s ease;
}

.nexus-help.is-dim {
  opacity: 0.25;
}

.nexus-help .row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nexus-help kbd {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

/* Bottom toolbar */
.nexus-toolbar {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(15, 10, 25, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}

.nexus-tool {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 14px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  justify-content: center;
}

.nexus-tool .ico {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.nexus-tool:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nexus-tool.is-active {
  color: #fff;
  background: rgba(245, 197, 66, 0.14);
  border-color: rgba(245, 197, 66, 0.4);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.2), 0 0 20px rgba(245, 197, 66, 0.25);
}

.nexus-tool[data-tool="star"].is-active .ico {
  background: rgba(245, 197, 66, 0.3);
  color: var(--nx-gold);
}

.nexus-tool[data-tool="blackhole"].is-active .ico {
  background: rgba(157, 78, 221, 0.3);
  color: var(--nx-violet);
}

.nexus-tool[data-tool="comet"].is-active .ico {
  background: rgba(255, 77, 210, 0.3);
  color: var(--nx-magenta);
}

.nexus-toolbar .divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

.nexus-tool[data-action="clear"] {
  color: rgba(255, 255, 255, 0.5);
}

.nexus-tool[data-action="clear"]:hover {
  color: var(--nx-red);
}

.nexus-tool .shortcut {
  font-size: 10px;
  font-family: 'Courier New', monospace;
  color: rgba(255, 255, 255, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  margin-left: 4px;
}

/* Audio toggle */
.nexus-audio {
  position: fixed;
  right: 24px;
  bottom: 26px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 10, 25, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.nexus-audio:hover {
  color: var(--nx-gold);
  border-color: rgba(245, 197, 66, 0.35);
}

.nexus-audio.is-on {
  color: var(--nx-gold);
  border-color: rgba(245, 197, 66, 0.45);
}

/* Loading overlay */
.nexus-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--nx-deep);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.nexus-loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nexus-loading .spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(245, 197, 66, 0.15);
  border-top-color: var(--nx-gold);
  border-radius: 50%;
  animation: nx-spin 0.8s linear infinite;
}

.nexus-loading .label {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.45);
}

@keyframes nx-spin {
  to { transform: rotate(360deg); }
}

/* Intro reveal */
.nexus-intro {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 26;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 32px;
}

.nexus-intro.is-hidden {
  opacity: 0;
  transform: translate(-50%, calc(-50% - 24px));
}

.nexus-intro h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--nx-gold) 0%, var(--nx-magenta) 50%, var(--nx-violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px rgba(245, 197, 66, 0.3);
}

.nexus-intro p {
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 18px;
  max-width: 560px;
  line-height: 1.55;
}

.nexus-intro .nexus-intro-tip {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: nx-pulse 2.5s ease-in-out infinite;
}

@keyframes nx-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Mobile tuning */
@media (max-width: 767px) {
  .nexus-topbar {
    padding: 14px 14px;
  }
  .nexus-help {
    display: none;
  }
  .nexus-toolbar {
    bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 6px;
    gap: 4px;
    max-width: calc(100vw - 32px);
  }
  .nexus-tool {
    min-width: auto;
    padding: 8px 10px;
    font-size: 11px;
  }
  .nexus-tool .shortcut {
    display: none;
  }
  .nexus-audio {
    right: 16px;
    bottom: 90px;
  }
  .nexus-cursor {
    display: none;
  }
  #nexus-canvas {
    cursor: default;
  }
}
