/* ============================================
   MATRIX SQUAD GALAXY — Page-specific styles
   (loaded after styles.css)
   ============================================ */

body { overflow: hidden; }

.galaxy-wrap {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--footer-h);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(40,55,80,0.18), transparent 60%),
    radial-gradient(ellipse at 75% 70%, rgba(60,40,80,0.14), transparent 60%),
    #02040a;
}

#galaxyCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#galaxyCanvas.grabbing { cursor: grabbing; }

/* Grid overlay on top of canvas */
.galaxy-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 70px 70px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.85) 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.85) 30%, transparent 85%);
  z-index: 1;
}

/* === Title + search block (top-left, stacked) === */
.galaxy-title-block {
  position: absolute;
  top: 22px;
  left: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(420px, calc(100% - 48px));
}

.galaxy-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  pointer-events: none;
}
.galaxy-title .icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 14px rgba(255,255,255,0.3));
}
.galaxy-title h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 18px rgba(255,255,255,0.25);
}
.galaxy-title .sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* Search bar */
.galaxy-search-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(10,12,22,0.78);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.galaxy-search-wrap i.fa-search { color: var(--silver); }
.galaxy-search {
  flex: 1; min-width: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 8px;
  outline: none;
}
.galaxy-search::placeholder { color: var(--dim); }

/* Period toggle */
.period-toggle {
  display: flex; gap: 2px; padding: 4px;
  background: rgba(10,12,22,0.78);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
}
.period-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.25s ease;
}
.period-toggle button:hover { color: #fff; }
.period-toggle button.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid var(--border-2);
}

/* Bottom-left zoom controls */
.zoom-controls {
  position: absolute;
  bottom: 26px;
  left: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(10,12,22,0.78);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}
.zoom-controls button {
  width: 40px; height: 40px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.zoom-controls button:hover { background: rgba(255,255,255,0.07); color: #fff; }

/* Bottom-center legend */
.galaxy-legend {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex; gap: 16px;
  flex-wrap: wrap;
  background: rgba(10,12,22,0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 16px;
  backdrop-filter: blur(12px);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.galaxy-legend span { display: inline-flex; align-items: center; gap: 6px; }
.galaxy-legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.galaxy-legend .d-r { background: #ff3a55; box-shadow: 0 0 8px #ff3a55; }
.galaxy-legend .d-g { background: #2dffb0; box-shadow: 0 0 8px #2dffb0; }
.galaxy-legend .d-y { background: #ffd24a; box-shadow: 0 0 8px #ffd24a; }
.galaxy-legend .d-b { background: #8eb6d8; box-shadow: 0 0 8px #8eb6d8; }
.galaxy-legend .d-w { background: #e0e6f4; box-shadow: 0 0 8px #e0e6f4; }

.galaxy-legend .d-f {
  background: #ff5a8a;
  box-shadow: 0 0 8px #ff5a8a;
}


/* Tooltip */
.galaxy-tooltip {
  position: absolute;
  z-index: 60;
  background: rgba(5,7,15,0.95);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
}
.galaxy-tooltip.visible { opacity: 1; }
.galaxy-tooltip .name { color: #fff; font-weight: 700; }
.galaxy-tooltip .sub  { color: var(--muted); font-size: 0.72rem; margin-top: 2px; font-weight: 400; }

/* Side info panel (right) */
.info-panel {
  position: fixed;
  top: calc(var(--header-h) + 20px);
  right: 20px;
  width: min(320px, 92vw);
  background: rgba(10,12,22,0.95);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 18px 20px;
  z-index: 80;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.35s cubic-bezier(.22,.85,.36,1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
  max-height: calc(100vh - var(--header-h) - var(--footer-h) - 40px);
  overflow-y: auto;
}
.info-panel.open { transform: translateX(0); }
.info-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.info-head .star-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  color: #000;
}
.info-head h3 {
  flex: 1;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 1.5px;
  word-break: break-word;
}
.close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-2);
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.close-btn:hover { background: rgba(255,255,255,0.12); color: #fff; transform: rotate(90deg); }

.info-stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.info-stat-row:last-of-type { border-bottom: none; }
.info-stat-row .l { display: flex; align-items: center; gap: 10px; color: var(--text); }
.info-stat-row .l i {
  color: var(--silver);
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.info-stat-row .v {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}

.info-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.info-actions a {
  flex: 1; min-width: 110px;
  text-align: center;
  padding: 8px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-2);
  transition: all 0.2s ease;
}
.info-actions a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.info-actions a.twitch { color: var(--twitch); border-color: rgba(145,70,255,0.4); background: rgba(145,70,255,0.08); }
.info-actions a.twitch:hover { background: rgba(145,70,255,0.2); color: #fff; }

/* MOBILE */
@media (max-width: 960px) {
  .galaxy-title-block { width: calc(100% - 32px); left: 16px; top: 16px; }
  .galaxy-title h1 { font-size: 1.1rem; letter-spacing: 2px; }
  .galaxy-title .icon { font-size: 1.4rem; }
  .galaxy-title .sub { font-size: 0.78rem; }
  .zoom-controls { bottom: 12px; left: 12px; }
  .zoom-controls button { width: 36px; height: 36px; font-size: 14px; }
  .galaxy-legend { display: none; }
  .info-panel { right: 8px; left: 8px; width: auto; }
}
