﻿/* ============================================================
   AIVORA · Game Effects Layer
   套用到全站,加強遊戲化視覺
   ============================================================ */

/* ============================================================
   1. CUSTOM CURSOR (瞄準鏡 + 拖尾) — 由 JS 透過 body.gx-use-cursor 啟用
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  body.gx-use-cursor { cursor: none; }
  body.gx-use-cursor a, body.gx-use-cursor button, body.gx-use-cursor input, body.gx-use-cursor textarea, body.gx-use-cursor select, body.gx-use-cursor summary, body.gx-use-cursor .svc-card, body.gx-use-cursor .op-card, body.gx-use-cursor .case-card, body.gx-use-cursor .squad, body.gx-use-cursor .tech-tile, body.gx-use-cursor .ind-chip, body.gx-use-cursor .value-card, body.gx-use-cursor .channel { cursor: none; }

  .gx-cursor-outer, .gx-cursor-inner {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
  }
  .gx-cursor-outer {
    width: 36px; height: 36px;
    transition: transform .15s cubic-bezier(.2,.7,.2,1), border-color .2s, opacity .2s;
  }
  .gx-cursor-outer::before, .gx-cursor-outer::after,
  .gx-cursor-outer span, .gx-cursor-outer span::before {
    content: ''; position: absolute;
    width: 10px; height: 10px;
    border: 2px solid var(--teal);
    transition: border-color .2s;
  }
  /* four corner brackets */
  .gx-cursor-outer::before { top: 0; left: 0; border-right: none; border-bottom: none; }
  .gx-cursor-outer::after  { top: 0; right: 0; border-left: none; border-bottom: none; }
  .gx-cursor-outer span { display:block; position:absolute; width:100%; height:100%; top:0; left:0; }
  .gx-cursor-outer span::before { bottom: -100%; left: 0; top: auto; border-right: none; border-top: none; }
  .gx-cursor-outer span::after {
    content: ''; position: absolute; bottom: 0; right: 0;
    width: 10px; height: 10px;
    border: 2px solid var(--teal); border-left: none; border-top: none;
  }
  .gx-cursor-inner {
    width: 6px; height: 6px;
    background: var(--teal);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--teal), 0 0 24px var(--teal);
    transition: transform .08s linear, background .2s;
  }
  body.gx-hover .gx-cursor-outer { transform: translate(-50%, -50%) scale(1.6); }
  body.gx-hover .gx-cursor-outer::before, body.gx-hover .gx-cursor-outer::after,
  body.gx-hover .gx-cursor-outer span::before, body.gx-hover .gx-cursor-outer span::after {
    border-color: var(--gundam-red);
  }
  body.gx-hover .gx-cursor-inner { background: var(--gundam-red); box-shadow: 0 0 12px var(--gundam-red), 0 0 24px var(--gundam-red); }

  body.gx-click .gx-cursor-outer { transform: translate(-50%, -50%) scale(0.6); }
}

/* ============================================================
   2. PARTICLE CANVAS BACKGROUND
   ============================================================ */
.gx-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
  mix-blend-mode: screen;
}

/* 招牌能量流場背景（WebGL fbm 流體光） */
.gx-energy {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  display: block;
}

/* ============================================================
   3. SCREEN HUD FRAME (4 corner brackets, top scan)
   ============================================================ */
.gx-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
.gx-hud .gx-corner {
  position: absolute;
  width: 36px; height: 36px;
  border: 2px solid rgba(57,197,187,0.5);
}
.gx-hud .gx-tl { top: 90px; left: 24px; border-right: none; border-bottom: none; }
.gx-hud .gx-tr { top: 90px; right: 24px; border-left: none; border-bottom: none; }
.gx-hud .gx-bl { bottom: 96px; left: 24px; border-right: none; border-top: none; }
.gx-hud .gx-br { bottom: 96px; right: 24px; border-left: none; border-top: none; }
.gx-hud .gx-corner::before {
  content: ''; position: absolute;
  width: 6px; height: 6px;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
  animation: cnr-pulse 2s ease-in-out infinite;
}
.gx-hud .gx-tl::before { top: -4px; left: -4px; }
.gx-hud .gx-tr::before { top: -4px; right: -4px; }
.gx-hud .gx-bl::before { bottom: -4px; left: -4px; }
.gx-hud .gx-br::before { bottom: -4px; right: -4px; }
@keyframes cnr-pulse { 50% { opacity: 0.3; transform: scale(0.7); } }

@media (max-width: 768px) {
  .gx-hud .gx-tl, .gx-hud .gx-tr { top: 76px; }
  .gx-hud .gx-corner { width: 24px; height: 24px; }
}

/* status readout (bottom left) */
.gx-status {
  position: fixed;
  bottom: 22px;
  left: 24px;
  pointer-events: none;
  z-index: 50;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(160,201,198,0.6);
  display: flex; flex-direction: column; gap: 4px;
}
.gx-status .row { display: flex; align-items: center; gap: 8px; }
.gx-status .row .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
  animation: pulse 1.4s ease-in-out infinite;
}
.gx-status .row .dot.red { background: var(--gundam-red); box-shadow: 0 0 6px var(--gundam-red); }
@media (max-width: 768px) { .gx-status { display: none; } }

/* version stamp (bottom right) */
.gx-stamp {
  position: fixed;
  bottom: 22px;
  right: 22px;
  pointer-events: none;
  z-index: 1;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: rgba(160,201,198,0.45);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: none; /* enabled per-page if wanted */
}
@media (min-width: 1100px) { .gx-stamp { display: block; bottom: 100px; right: 88px; } }

/* ============================================================
   4. HOLOGRAPHIC CARD SHIMMER
   ============================================================ */
.gx-holo {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.gx-holo::before {
  content: '';
  position: absolute; top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(57,197,187,0) 30%, rgba(57,197,187,0.18) 48%, rgba(22,214,196,0.22) 50%, rgba(57,197,187,0.18) 52%, transparent 70%);
  transform: skewX(-15deg);
  transition: left .8s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  z-index: 1;
}
.gx-holo:hover::before { left: 130%; }
.gx-holo > * { position: relative; z-index: 2; }

/* ============================================================
   5. GLITCH TEXT (subtle, for headings)
   ============================================================ */
.gx-glitch {
  position: relative;
  display: inline-block;
}
.gx-glitch::before, .gx-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  background: transparent;
  pointer-events: none;
  opacity: 0;
}
.gx-glitch:hover::before {
  color: var(--gundam-red);
  animation: glitch-1 .6s steps(2,end);
  opacity: 0.8;
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}
.gx-glitch:hover::after {
  color: var(--teal-2);
  animation: glitch-2 .6s steps(2,end);
  opacity: 0.8;
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}
@keyframes glitch-1 {
  0% { transform: translate(0,0); }
  20% { transform: translate(-3px,-1px); }
  40% { transform: translate(2px,1px); }
  60% { transform: translate(-2px,1px); }
  80% { transform: translate(1px,-1px); }
  100% { transform: translate(0,0); }
}
@keyframes glitch-2 {
  0% { transform: translate(0,0); }
  20% { transform: translate(2px,1px); }
  40% { transform: translate(-2px,-1px); }
  60% { transform: translate(2px,-1px); }
  80% { transform: translate(-1px,1px); }
  100% { transform: translate(0,0); }
}

/* ============================================================
   6. SCAN LINE OVERLAY (subtle CRT)
   ============================================================ */
.gx-scan {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 51;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 2px,
    rgba(57,197,187,0.025) 3px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

/* ============================================================
   7. BOOT SEQUENCE OVERLAY (first load)
   ============================================================ */
.gx-boot {
  position: fixed; inset: 0;
  z-index: 99999;
  background: var(--bold);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  font-family: var(--mono);
  color: var(--teal);
  letter-spacing: 0.18em;
  font-size: 12px;
  transition: opacity .6s ease, visibility .6s ease;
}
.gx-boot.hide { opacity: 0; visibility: hidden; }
.gx-boot .logo {
  font-family: var(--display); font-weight: 800;
  font-size: 42px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 28px;
  position: relative;
}
.gx-boot .logo::after {
  content: '';
  position: absolute; right: -18px; top: 12px;
  width: 10px; height: 10px;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal);
  animation: pulse 1s ease-in-out infinite;
}
.gx-boot .lines { width: 320px; max-width: 80vw; }
.gx-boot .lines div {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  opacity: 0;
  animation: boot-line .4s forwards;
}
.gx-boot .lines div .ok { color: var(--teal); }
.gx-boot .lines div:nth-child(1) { animation-delay: .15s; }
.gx-boot .lines div:nth-child(2) { animation-delay: .35s; }
.gx-boot .lines div:nth-child(3) { animation-delay: .55s; }
.gx-boot .lines div:nth-child(4) { animation-delay: .75s; }
.gx-boot .lines div:nth-child(5) { animation-delay: .95s; }
@keyframes boot-line { to { opacity: 1; } }

.gx-boot .progress {
  width: 320px; max-width: 80vw;
  height: 3px;
  background: rgba(57,197,187,0.18);
  margin-top: 18px;
  overflow: hidden;
  position: relative;
}
.gx-boot .progress::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--teal), var(--teal-2));
  box-shadow: 0 0 12px var(--teal);
  animation: boot-prog 1.4s ease-out forwards;
}
@keyframes boot-prog { from { transform: translateX(-100%); } to { transform: translateX(0%); } }

/* ============================================================
   8. SECTION CORNER BRACKETS (for important sections)
   ============================================================ */
.gx-bracket {
  position: relative;
}
.gx-bracket::before, .gx-bracket::after,
.gx-bracket > .bk-bl, .gx-bracket > .bk-br {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--teal);
  opacity: 0.6;
}
.gx-bracket::before { top: -8px; left: -8px; border-right: none; border-bottom: none; }
.gx-bracket::after { top: -8px; right: -8px; border-left: none; border-bottom: none; }
.gx-bracket > .bk-bl { bottom: -8px; left: -8px; border-right: none; border-top: none; }
.gx-bracket > .bk-br { bottom: -8px; right: -8px; border-left: none; border-top: none; }

/* ============================================================
   9. STAR RATING (Rarity rank stars)
   ============================================================ */
.gx-stars {
  display: inline-flex; gap: 3px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 1px;
  color: var(--yellow);
  text-shadow: 0 0 6px rgba(255,214,10,0.5);
}

/* ============================================================
   10. SECTION HEX PATTERN OVERLAY (subtle)
   ============================================================ */
.gx-hex-bg {
  position: relative;
}
.gx-hex-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'><polygon points='30,1 58,15 58,37 30,51 2,37 2,15' fill='none' stroke='rgba(57,197,187,0.08)' stroke-width='1'/></svg>");
  background-size: 60px 52px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}
.gx-hex-bg > * { position: relative; z-index: 1; }
