/* ═══════════════════════════════════════════════════════════════════
   MMOCodeX — Sticky Table of Contents Sidebar (mcx-toc.css)
   Universal: used across all game detail pages
   ═══════════════════════════════════════════════════════════════════ */

/* ─── TOC SIDEBAR ─────────────────────────────────────────────────── */
.mcx-toc {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  pointer-events: none;
}

/* ─── TOGGLE BUTTON ───────────────────────────────────────────────── */
.mcx-toc-toggle {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(104, 220, 173, .28);
  border-radius: 999px;
  background: rgba(3, 14, 9, .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #68dcad;
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .45);
  margin-bottom: 8px;
  align-self: flex-end;
}
.mcx-toc-toggle:hover {
  border-color: rgba(104, 220, 173, .55);
  background: rgba(4, 22, 14, .95);
  box-shadow: 0 4px 32px rgba(104, 220, 173, .14);
}
.mcx-toc-toggle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform .22s ease;
}
.mcx-toc.is-open .mcx-toc-toggle svg {
  transform: rotate(180deg);
}

/* ─── PANEL ───────────────────────────────────────────────────────── */
.mcx-toc-panel {
  pointer-events: all;
  min-width: 200px;
  max-width: 240px;
  padding: 6px 4px;
  border: 1px solid rgba(104, 220, 173, .2);
  border-radius: 18px;
  background: rgba(3, 12, 8, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, .55), 0 0 0 1px rgba(104, 220, 173, .06);
  opacity: 0;
  transform: translateX(12px) scale(.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(104, 220, 173, .2) transparent;
}
.mcx-toc-panel::-webkit-scrollbar       { width: 3px; }
.mcx-toc-panel::-webkit-scrollbar-track { background: transparent; }
.mcx-toc-panel::-webkit-scrollbar-thumb { background: rgba(104, 220, 173, .2); border-radius: 99px; }

.mcx-toc.is-open .mcx-toc-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
}

/* ─── PANEL HEADER ────────────────────────────────────────────────── */
.mcx-toc-label {
  display: block;
  padding: 8px 14px 6px;
  color: rgba(239, 255, 248, .35);
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(104, 220, 173, .1);
  margin-bottom: 4px;
}

/* ─── NAV ITEMS ───────────────────────────────────────────────────── */
.mcx-toc-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 4px;
}
.mcx-toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 11px;
  color: rgba(239, 255, 248, .65);
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.mcx-toc-item:hover {
  background: rgba(104, 220, 173, .1);
  color: #effff8;
}
.mcx-toc-item.is-active {
  background: rgba(104, 220, 173, .13);
  color: #68dcad;
}
.mcx-toc-item.is-active .mcx-toc-dot {
  background: #68dcad;
  box-shadow: 0 0 8px rgba(104, 220, 173, .6);
}

/* ─── DOT INDICATOR ──────────────────────────────────────────────── */
.mcx-toc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(104, 220, 173, .28);
  flex-shrink: 0;
  transition: background .14s ease, box-shadow .14s ease;
}

/* ─── PROGRESS BAR ────────────────────────────────────────────────── */
.mcx-toc-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #68dcad, rgba(104, 220, 173, .4));
  z-index: 1000;
  transition: width .1s linear;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ─── BACK TO TOP ─────────────────────────────────────────────────── */
.mcx-toc-top {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  margin-top: 2px;
  border-radius: 11px;
  border: none;
  border-top: 1px solid rgba(104, 220, 173, .1);
  background: transparent;
  color: rgba(239, 255, 248, .38);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
  text-align: left;
}
.mcx-toc-top:hover {
  background: rgba(104, 220, 173, .08);
  color: rgba(239, 255, 248, .72);
}

/* ─── ACCENT OVERRIDE PER PAGE ────────────────────────────────────── */
/* Picks up --accent CSS var from mcx-game-stage if available */
.mcx-toc-toggle,
.mcx-toc-panel {
  border-color: rgba(var(--toc-accent, 104, 220, 173), .22);
}

/* ─── HIDE ON MOBILE & NARROW VIEWPORTS ───────────────────────────── */
@media (max-width: 1280px) {
  .mcx-toc {
    right: 12px;
  }
  .mcx-toc-panel {
    max-width: 210px;
  }
}
@media (max-width: 1100px) {
  /* On narrower screens collapse toggle to icon-only */
  .mcx-toc-toggle-label {
    display: none;
  }
  .mcx-toc-toggle {
    padding: 9px 11px;
  }
}
@media (max-width: 860px) {
  /* Move to bottom-right corner on tablet/mobile */
  .mcx-toc {
    top: auto;
    bottom: 20px;
    right: 14px;
    transform: none;
    align-items: flex-end;
  }
  .mcx-toc-panel {
    max-height: 55vh;
    transform-origin: bottom right;
  }
  .mcx-toc.is-open .mcx-toc-panel {
    transform: translateX(0) scale(1);
  }
  .mcx-toc-panel:not(.is-open) {
    transform: translateX(10px) scale(.96);
  }
}
@media (max-width: 480px) {
  .mcx-toc-panel {
    max-width: 88vw;
  }
}
