/* ============================================================
   TOM'S SPY HQ — 3D (V2)  ·  high-end Nintendo-64-era theme
   Owns the menu/shell chrome. Each 3D game builds its own HUD
   overlay inside #stage; a few .s3d-* helpers are offered below.
   ============================================================ */

:root {
  --bg-0:   #07060f;
  --bg-1:   #120a2e;
  --bg-2:   #1a0b3d;
  --cyan:   #1ef0ff;
  --magenta:#ff3df0;
  --lime:   #b6ff3d;
  --gold:   #ffd23f;
  --violet: #8b5cff;
  --ink:    #eaf2ff;
  --dim:    #9aa7d6;
  --card:   #171233;
  --sans:   "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif;
  --mono:   "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, #2a1166 0%, var(--bg-1) 40%, var(--bg-0) 100%);
  color: var(--ink);
  font-family: var(--sans);
  display: flex;
  justify-content: center;
  padding: 22px 16px 46px;
  overflow-x: hidden;
}

/* moving aurora light blobs */
body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: 0; pointer-events: none;
  background:
    radial-gradient(420px 420px at 18% 25%, rgba(30,240,255,0.16), transparent 60%),
    radial-gradient(460px 460px at 82% 18%, rgba(255,61,240,0.16), transparent 60%),
    radial-gradient(520px 520px at 70% 85%, rgba(139,92,255,0.18), transparent 62%),
    radial-gradient(400px 400px at 25% 80%, rgba(182,255,61,0.10), transparent 60%);
  filter: blur(8px);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(-2%, 1.5%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -1.5%, 0) scale(1.02); }
}

/* the Three.js animated backdrop canvas (created by the menu script) */
#fxcanvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.85;
}

#hq {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ---------- top bar ---------- */
.topbar {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; letter-spacing: 2px; color: var(--dim);
}
.topbar .badge {
  border: 1px solid rgba(30,240,255,0.4); color: var(--cyan);
  border-radius: 999px; padding: 3px 12px; letter-spacing: 2px;
  box-shadow: 0 0 16px rgba(30,240,255,0.18) inset;
}
.classic-link {
  color: var(--gold); text-decoration: none; letter-spacing: 2px;
  border: 1px solid rgba(255,210,63,0.35); border-radius: 999px; padding: 4px 14px;
  transition: box-shadow .2s ease, transform .1s ease, background .2s ease;
}
.classic-link:hover { box-shadow: 0 0 18px rgba(255,210,63,0.4); transform: translateY(-1px); background: rgba(255,210,63,0.06); }

/* ---------- title ---------- */
header { text-align: center; }
.title {
  margin: 4px 0 2px;
  font-size: clamp(38px, 8vw, 84px);
  font-weight: 900;
  letter-spacing: 3px;
  font-style: italic;
  background: linear-gradient(180deg, #ffffff 0%, var(--cyan) 42%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--cyan);
  /* chunky extruded N64 drop */
  filter:
    drop-shadow(0 2px 0 #0a2740)
    drop-shadow(0 4px 0 #08203a)
    drop-shadow(0 10px 22px rgba(30,240,255,0.45))
    drop-shadow(0 0 42px rgba(139,92,255,0.45));
  animation: titlebob 4.5s ease-in-out infinite;
}
@keyframes titlebob { 0%,100% { transform: translateY(0) rotate(-0.4deg); } 50% { transform: translateY(-4px) rotate(0.4deg); } }
.subtitle {
  margin: 0; color: var(--magenta);
  font-size: clamp(11px, 2vw, 15px); letter-spacing: 5px; font-weight: 700;
  text-shadow: 0 0 14px rgba(255,61,240,0.55);
}

/* ---------- section labels ---------- */
.section-label {
  grid-column: 1 / -1;
  width: 100%; margin: 6px 0 -4px;
  display: flex; align-items: center; gap: 12px;
  color: var(--ink); font-weight: 800; letter-spacing: 3px; font-size: 13px;
}
.section-label::before, .section-label::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}
.section-label.remaster { color: var(--cyan); }
.section-label.newops   { color: var(--lime); }

/* ---------- menu grid ---------- */
#menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: 100%; }
@media (max-width: 980px) { #menu { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 740px) { #menu { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { #menu { grid-template-columns: 1fr; } }

.game-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  text-align: left; cursor: pointer;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background:
    linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%),
    linear-gradient(180deg, #1b1440, #110b29);
  color: var(--ink); font-family: var(--sans);
  box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform .12s ease, box-shadow .22s ease, border-color .22s ease;
}
.game-card .gc-ic {
  font-size: 30px; line-height: 1; filter: drop-shadow(0 0 10px currentColor);
}
.game-card .gc-name { font-size: 17px; font-weight: 800; letter-spacing: 0.6px; }
.game-card .gc-tag  { font-size: 11.5px; color: var(--dim); letter-spacing: 0.3px; line-height: 1.35; }
.game-card .gc-meta {
  margin-top: 2px; font-size: 9.5px; letter-spacing: 1.5px; color: var(--gold);
  border: 1px solid rgba(255,210,63,0.3); border-radius: 999px; padding: 2px 8px; align-self: flex-start;
}
.game-card::after { /* shine sweep */
  content: ""; position: absolute; top: -10%; left: -70%; width: 45%; height: 130%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-18deg); transition: left .55s ease;
}
.game-card:hover::after { left: 130%; }
.game-card:hover { transform: translateY(-5px) scale(1.015); border-color: rgba(255,255,255,0.28); box-shadow: 0 18px 40px rgba(0,0,0,0.5), 0 0 26px rgba(30,240,255,0.22); }
.game-card:active { transform: translateY(-2px) scale(1.0); }

/* category accents (top glow bar) */
.game-card .gc-ic { color: var(--cyan); }
.game-card[data-cat="remaster"] { box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 1px 0 rgba(30,240,255,0.18); }
.game-card[data-cat="remaster"] .gc-ic { color: var(--cyan); }
.game-card[data-cat="newops"] .gc-ic { color: var(--lime); }
.game-card[data-cat="newops"] { box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 1px 0 rgba(182,255,61,0.16); }
.game-card.active { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(30,240,255,0.5), 0 16px 40px rgba(30,240,255,0.25); }

/* ---------- play bar ---------- */
#playbar { display: none; align-items: center; gap: 14px; width: 100%; max-width: 1280px; }
#playbar.show { display: flex; }
#backBtn {
  background: linear-gradient(180deg, #2a0f3a, #1a0822);
  color: var(--magenta); border: 1px solid rgba(255,61,240,0.5);
  border-radius: 10px; padding: 10px 18px; font-family: var(--sans); font-weight: 800; letter-spacing: 1px;
  cursor: pointer; text-shadow: 0 0 8px rgba(255,61,240,0.5);
  transition: box-shadow .18s ease, transform .1s ease;
}
#backBtn:hover { box-shadow: 0 0 20px rgba(255,61,240,0.5); transform: translateY(-1px); }
#nowPlaying { font-weight: 800; letter-spacing: 2px; color: var(--cyan); text-shadow: 0 0 12px rgba(30,240,255,0.5); }
#playbar .hint { margin-left: auto; color: var(--dim); font-size: 12px; letter-spacing: 1px; }

/* ---------- the 3D screen / stage ---------- */
#stage {
  position: relative;
  width: min(1280px, 98vw);
  height: clamp(560px, 72vh, 820px);
  border-radius: 18px;
  background: #05040d;
  overflow: hidden;
  border: 2px solid rgba(30,240,255,0.35);
  box-shadow:
    0 0 40px rgba(30,240,255,0.22),
    0 0 120px rgba(139,92,255,0.14),
    inset 0 0 90px rgba(0,0,0,0.7);
}
#stage canvas { display: block; }
#stage::after { /* glossy bezel highlight + corner accents */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 18px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.10), inset 0 0 120px rgba(0,0,0,0.5);
}

footer { color: var(--dim); font-size: 12px; letter-spacing: 1px; text-align: center; }

/* ---------- briefing (shown before a game launches) ---------- */
.briefing {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 30px;
}
.briefing h2 {
  margin: 0; font-size: clamp(24px, 4.5vw, 40px); font-weight: 900; font-style: italic; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 20px rgba(30,240,255,0.4));
}
.briefing p { margin: 0; max-width: 660px; line-height: 1.7; color: var(--ink); }
.briefing .cta { margin-top: 6px; color: var(--gold); letter-spacing: 2px; font-weight: 800; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:.5;} 50%{opacity:1;} }

/* ---------- optional helpers a game may use for a consistent HUD ---------- */
.s3d-overlay {
  position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  text-align: center; background: rgba(6,5,16,0.74); backdrop-filter: blur(2px);
}
.s3d-overlay .big { font-size: clamp(28px, 6vw, 54px); font-weight: 900; font-style: italic; color: var(--cyan); text-shadow: 0 0 22px rgba(30,240,255,0.6); }
.s3d-overlay .sub { margin-top: 12px; font-size: 16px; color: var(--ink); }
.s3d-hud { position: absolute; top: 14px; left: 16px; z-index: 20; font-weight: 800; letter-spacing: 1px; color: var(--cyan); text-shadow: 0 0 10px rgba(30,240,255,0.5); pointer-events: none; }
.s3d-btn { background: linear-gradient(180deg, var(--cyan), #0bb6d6); color: #04121a; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 800; letter-spacing: 1px; cursor: pointer; }
