/* =============================================================
   endgame.css — Fractured Sector / Challenge Runs / Mythic layer
   (PROMPT 12 — Endgame Architecture)
   Visual language: purple/black/deep-blue rift aesthetic, mirrors
   prestige.css borders, spacing, animation cadence.
   ============================================================= */

/* ─── GALAXY PANEL: FRACTURED SECTOR SECTION ───────────────── */

.eg-sector-section {
  border: 1px solid rgba(176, 112, 255, 0.30);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(176,112,255,0.08), rgba(20,10,40,0.30));
  box-shadow: inset 0 0 18px rgba(176,112,255,0.06);
}

.eg-sector-section .pp-tree-header {
  color: #b070ff;
  text-shadow: 0 0 8px #b070ff66;
}

/* ─── GALAXY PANEL: ENDGAME TEASER (Anticipation pass) ─────── */

.eg-teaser-section {
  border: 1px solid rgba(176, 112, 255, 0.18);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(176,112,255,0.04), rgba(20,10,40,0.20));
}

.eg-teaser-section .pp-tree-header {
  color: #8060a0;
  letter-spacing: 0.12em;
}

.eg-teaser-line {
  font-size: 11px;
  font-style: italic;
  color: #b090e0;
  margin-bottom: 4px;
}

.eg-teaser-sub {
  font-size: 10px;
  color: var(--text-dim, #9ab);
}

.eg-sector-sub {
  font-size: 10px;
  color: var(--text-dim, #9ab);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.eg-sector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim, #9ab);
  padding: 3px 0;
}

.eg-sector-row strong {
  color: #e0d0ff;
  font-weight: 700;
}

.eg-sector-mod strong {
  text-shadow: 0 0 6px currentColor;
}

.eg-sector-progress-label {
  font-size: 10px;
  color: var(--text-dim, #9ab);
  margin-top: 6px;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.eg-sector-enter-btn,
.eg-sector-exit-btn,
.eg-mythic-engage-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}

.eg-sector-enter-btn {
  background: linear-gradient(135deg, #6020a0, #2010a0);
  border: 1px solid rgba(176, 112, 255, 0.55);
  color: #f0e0ff;
  box-shadow: 0 0 14px rgba(176,112,255,0.35);
}
.eg-sector-enter-btn:hover { transform: translateY(-1px); box-shadow: 0 0 22px rgba(176,112,255,0.55); }

.eg-sector-exit-btn {
  background: rgba(255, 80, 80, 0.10);
  border: 1px solid rgba(255, 80, 80, 0.35);
  color: #ff8080;
}
.eg-sector-exit-btn:hover { background: rgba(255, 80, 80, 0.18); }

.eg-mythic-engage-btn {
  background: linear-gradient(135deg, #a02050, #501030);
  border: 1px solid rgba(255, 80, 120, 0.55);
  color: #ffd0e0;
  box-shadow: 0 0 14px rgba(255,64,96,0.35);
  animation: eg-mythic-pulse 1.6s infinite ease-in-out;
}
@keyframes eg-mythic-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255,64,96,0.30); }
  50%      { box-shadow: 0 0 22px rgba(255,64,96,0.65); }
}

/* ─── CHALLENGES BUTTON (Galaxy Panel, below Worlds Map) ───── */

.pp-challenges-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  background: rgba(255, 176, 112, 0.10);
  border: 1px solid rgba(255, 176, 112, 0.40);
  color: #ffb070;
  transition: background 0.15s, transform 0.12s;
}
.pp-challenges-btn:hover { background: rgba(255, 176, 112, 0.20); transform: translateY(-1px); }

/* ─── CHALLENGE BADGE (below header, left, persistent while active) ── */

.eg-challenge-badge {
  position: fixed;
  top: calc(var(--hdr-h, 62px) + 8px);
  left: 8px;
  z-index: 500;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 176, 112, 0.16);
  border: 1px solid rgba(255, 176, 112, 0.50);
  color: #ffb070;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,176,112,0.30);
  animation: eg-badge-pulse 2.4s infinite ease-in-out;
}
@keyframes eg-badge-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,176,112,0.25); }
  50%      { box-shadow: 0 0 16px rgba(255,176,112,0.55); }
}
/* Mobile/tablet: hide while a STATS/MISSIONS/ALIENS/UPGRADES drawer is
   open over the game view, so it can't overlap the drawer's content */
@media (max-width: 768px) {
  body:has(#panel-left.mob-visible) .eg-challenge-badge,
  body:has(#panel-right.mob-visible) .eg-challenge-badge {
    display: none;
  }
}
/* Desktop: clear the 210px left stats panel */
@media (min-width: 769px) {
  .eg-challenge-badge { left: 224px; }
}

/* ─── ENDGAME UNLOCK CINEMATIC (Ascension 5) ───────────────── */

.eg-unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(40,10,70,0.92), rgba(0,0,0,0.97));
  opacity: 0;
  transition: opacity 0.6s ease;
  overflow: hidden;
}
.eg-unlock-overlay.eg-unlock-visible { opacity: 1; }

.eg-unlock-rift {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(176,112,255,0.35), transparent 70%),
    radial-gradient(ellipse 70% 30% at 50% 50%, rgba(96,32,160,0.30), transparent 70%);
  animation: eg-rift-spin 18s linear infinite;
  filter: blur(2px);
}
@keyframes eg-rift-spin {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.15); }
  to   { transform: rotate(360deg) scale(1); }
}

.eg-unlock-stars-stop {
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 0 1px, transparent 1px 60px);
  opacity: 0.5;
}

.eg-unlock-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 480px;
  padding: 30px;
}

.eg-unlock-glyph {
  font-size: 48px;
  color: #d0a0ff;
  text-shadow: 0 0 30px #b070ffcc;
  animation: eg-glyph-float 3s ease-in-out infinite;
  margin-bottom: 14px;
}
@keyframes eg-glyph-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-8px) scale(1.08); }
}

.eg-unlock-line {
  font-size: 18px;
  font-style: italic;
  color: #f0e0ff;
  text-shadow: 0 0 14px #b070ff88;
  margin-bottom: 10px;
  line-height: 1.5;
}

.eg-unlock-sub {
  font-size: 12px;
  color: var(--text-dim, #9ab);
  margin-bottom: 22px;
}

.eg-unlock-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: linear-gradient(135deg, #7030c0, #2010a0);
  border: 1px solid rgba(208, 160, 255, 0.65);
  color: #f8f0ff;
  box-shadow: 0 0 24px rgba(176,112,255,0.55);
  transition: transform 0.15s, box-shadow 0.15s;
}
.eg-unlock-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 36px rgba(176,112,255,0.8); }

/* ─── SECTOR ENTRY OVERLAY ─────────────────────────────────── */

.eg-sector-entry-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 0, 15, 0.0);
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}
.eg-sector-entry-overlay.eg-visible {
  opacity: 1;
  background: rgba(5, 0, 15, 0.88);
}

.eg-rift-bg {
  position: absolute;
  inset: -30%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(96,32,160,0.35), transparent 70%);
  animation: eg-rift-spin 22s linear infinite;
}

.eg-sector-entry-card {
  position: relative;
  z-index: 1;
  width: min(420px, 90vw);
  padding: 22px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(40,16,72,0.92), rgba(8,4,20,0.96));
  border: 1px solid rgba(176, 112, 255, 0.45);
  box-shadow: 0 0 40px rgba(96,32,160,0.45);
  text-align: center;
}

.eg-sector-entry-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #d0a0ff;
  text-shadow: 0 0 16px #b070ffaa;
  margin-bottom: 12px;
}

.eg-sector-entry-mods {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.eg-mod-row {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  text-align: left;
  background: rgba(255,255,255,0.04);
}
.eg-mod-pos { color: #80ffb0; border-left: 3px solid #80ffb0; }
.eg-mod-neg { color: #ff8080; border-left: 3px solid #ff8080; }
.eg-mod-rare { color: #ffd060; border-left: 3px solid #ffd060; }

.eg-sector-entry-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim, #9ab);
  margin-bottom: 16px;
  text-align: left;
  padding: 0 6px;
}
.eg-sector-entry-stats strong { color: #e0d0ff; }

.eg-sector-entry-btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: linear-gradient(135deg, #7030c0, #2010a0);
  border: 1px solid rgba(208, 160, 255, 0.6);
  color: #f8f0ff;
  box-shadow: 0 0 18px rgba(176,112,255,0.45);
  margin-bottom: 8px;
  transition: transform 0.12s;
}
.eg-sector-entry-btn:hover { transform: translateY(-2px); }

.eg-sector-entry-cancel {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-dim, #9ab);
}
.eg-sector-entry-cancel:hover { background: rgba(255,255,255,0.06); }

/* ─── CHALLENGES MODAL ─────────────────────────────────────── */

.eg-chal-modal-box {
  width: min(720px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Single scroll owner for this modal — body scrolls, box does not
   (matches .ach-modal-box / .cos-modal-box pattern). */
#challenges-modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
}
#challenges-modal-body::-webkit-scrollbar { width: 4px; }
#challenges-modal-body::-webkit-scrollbar-thumb { background: rgba(80,200,255,0.20); border-radius: 2px; }
#challenges-modal-body::-webkit-scrollbar-track { background: transparent; }

.eg-chal-layout {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  gap: 12px;
  margin: 10px 0;
}
@media (max-width: 720px) {
  .eg-chal-layout { grid-template-columns: 1fr; }
}

.eg-chal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eg-chal-card {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.eg-chal-card:hover { background: rgba(255,255,255,0.07); }
.eg-chal-card.eg-chal-selected { border-color: rgba(176,112,255,0.55); background: rgba(176,112,255,0.10); }
.eg-chal-card.eg-chal-active { border-color: rgba(255,176,112,0.6); box-shadow: 0 0 10px rgba(255,176,112,0.25); }

.eg-chal-card-icon { font-size: 22px; }
.eg-chal-card-name { font-size: 12px; font-weight: 700; color: #e0d0ff; }
.eg-chal-card-meta { font-size: 10px; color: var(--text-dim, #9ab); }
.eg-chal-badge-active {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,176,112,0.25);
  color: #ffb070;
  margin-left: 6px;
  letter-spacing: 0.04em;
}

.eg-chal-detail {
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: rgba(176,112,255,0.06);
  border: 1px solid rgba(176,112,255,0.20);
}
.eg-chal-detail-icon { font-size: 36px; margin-bottom: 6px; }
.eg-chal-detail-name { font-size: 15px; font-weight: 800; color: #e0d0ff; }
.eg-chal-detail-diff { font-size: 10px; color: #ffb070; margin: 2px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.eg-chal-detail-desc { font-size: 11px; color: var(--text-dim, #9ab); line-height: 1.5; margin-bottom: 10px; }
.eg-chal-detail-goal { font-size: 11px; color: #80c0ff; }

.eg-chal-rewards {
  padding: 10px;
  border-radius: 10px;
  background: rgba(128,255,176,0.05);
  border: 1px solid rgba(128,255,176,0.20);
}
.eg-chal-rewards-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #80ffb0;
  margin-bottom: 8px;
}
.eg-chal-reward-row { font-size: 11px; color: var(--text-dim, #9ab); margin-bottom: 5px; }
.eg-chal-reward-row strong { color: #e0d0ff; }
.eg-chal-reward-current strong { color: #80ffb0; }
.eg-chal-reward-next strong { color: #ffd060; }

.eg-chal-bottom { display: flex; justify-content: center; }

.eg-chal-start-btn {
  width: 100%;
  max-width: 360px;
  padding: 12px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: linear-gradient(135deg, #ffb070, #d06030);
  border: 1px solid rgba(255, 176, 112, 0.6);
  color: #2a1200;
  box-shadow: 0 0 16px rgba(255,176,112,0.35);
  transition: transform 0.12s;
}
.eg-chal-start-btn:hover:not(:disabled) { transform: translateY(-2px); }
.eg-chal-start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim, #9ab);
}
.eg-chal-cancel-btn {
  background: rgba(255, 80, 80, 0.14);
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff8080;
  box-shadow: none;
}

/* =============================================================
   ENDGAME REWARD CELEBRATIONS (Prompt 12 — Reward Presentation)
   Mirrors .ach-celebrate (achievements.css, Prompt 11) and reuses its
   keyframes (achCelebrateIn/achTrophyPop/achCelebrateFade) for a
   consistent celebration "language" across the game. Two themes:
   challenge (amber, milestone tier) and boss (red/pink, world tier).
   ============================================================= */
.eg-celebrate {
  position: fixed;
  top: 14%;
  left: 50%;
  z-index: 9300;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 11px 14px;
  background: linear-gradient(135deg, rgba(20,18,6,0.95), rgba(10,12,30,0.95));
  border-radius: 14px;
  animation: achCelebrateIn 2.4s cubic-bezier(0.22,1,0.36,1) forwards;
}
.eg-celebrate-icon {
  font-size: 2rem;
  line-height: 1;
  animation: achTrophyPop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
}
.eg-celebrate-txt { display: flex; flex-direction: column; gap: 2px; }
.eg-celebrate-tag {
  font-family: var(--font-hd);
  font-size: 0.56rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.eg-celebrate-name {
  font-family: var(--font-hd);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}
.eg-celebrate-challenge {
  border: 1px solid rgba(255,208,96,0.55);
  box-shadow: 0 8px 34px rgba(0,0,0,0.5), 0 0 26px rgba(255,208,96,0.28);
}
.eg-celebrate-challenge .eg-celebrate-icon { filter: drop-shadow(0 0 12px rgba(255,208,96,0.8)); }
.eg-celebrate-challenge .eg-celebrate-tag { color: rgba(255,208,96,0.8); }
.eg-celebrate-challenge .eg-celebrate-name { text-shadow: 0 0 16px rgba(255,208,96,0.5); }
.eg-celebrate-boss {
  border: 1px solid rgba(255,128,192,0.7);
  box-shadow: 0 8px 38px rgba(0,0,0,0.55),
              0 0 36px rgba(255,80,140,0.45),
              0 0 70px rgba(255,64,96,0.25);
}
.eg-celebrate-boss .eg-celebrate-icon { filter: drop-shadow(0 0 12px rgba(255,128,192,0.85)); }
.eg-celebrate-boss .eg-celebrate-tag { color: #ffb0d8; }
.eg-celebrate-boss .eg-celebrate-name { text-shadow: 0 0 16px rgba(255,128,192,0.55); }
.reduced-motion .eg-celebrate { animation: achCelebrateFade 2.4s ease-out forwards; }
.reduced-motion .eg-celebrate-icon { animation: none; }
