/* ============================================================
   TOM'S SPY HQ — shared neon-spy shell theme (v2: bigger + cinematic)
   The menu owns this. Games may use the .spy-* helpers, or draw
   everything on their own canvas.
   ============================================================ */

:root {
  --bg:      #060906;
  --bg-2:    #0a0e0a;
  --panel:   #0c130c;
  --green:   #39ff14;
  --green-d: #1f8a10;
  --amber:   #ffb000;
  --red:     #ff3b30;
  --ink:     #d4f6cd;
  --dim:     #6b8a62;
  --line:    rgba(57,255,20,0.10);
  --mono:    "Courier New", Courier, monospace;
}

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

body {
  position: relative;
  background:
    radial-gradient(circle at 50% -8%, #11260f 0%, var(--bg-2) 42%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--mono);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px 14px 44px;
  letter-spacing: 0.5px;
  overflow-x: hidden;
}

/* drifting neon grid floor behind everything */
body::before {
  content: "";
  position: fixed;
  inset: -40% -10% -10% -10%;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(420px) rotateX(58deg);
  transform-origin: 50% 100%;
  animation: griddrift 14s linear infinite;
  opacity: 0.55;
}
@keyframes griddrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 46px, 46px 0; }
}

/* faint CRT scanlines on top of the cabinet */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.15) 3px, rgba(0,0,0,0) 4px);
  opacity: 0.5;
}

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

/* ---------- header ---------- */
header { text-align: center; }

.title {
  margin: 2px 0 4px;
  font-size: clamp(34px, 7vw, 72px);
  font-weight: 700;
  letter-spacing: 7px;
  color: var(--green);
  text-shadow:
    0 0 6px var(--green),
    0 0 20px rgba(57,255,20,0.75),
    0 0 48px rgba(57,255,20,0.4),
    0 0 90px rgba(57,255,20,0.25);
  animation: flicker 5s infinite;
}
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.74; }
}

.subtitle {
  margin: 0;
  color: var(--amber);
  font-size: clamp(11px, 2vw, 15px);
  letter-spacing: 4px;
  text-shadow: 0 0 10px rgba(255,176,0,0.55);
}

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

.game-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: linear-gradient(180deg, #0f1a0f, #060b06);
  color: var(--green);
  border: 1px solid var(--green-d);
  border-radius: 10px;
  padding: 16px 16px;
  font-family: var(--mono);
  cursor: pointer;
  text-shadow: 0 0 6px rgba(57,255,20,0.55);
  box-shadow: inset 0 0 14px rgba(57,255,20,0.06);
  overflow: hidden;
  transition: transform .1s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease;
}
.game-btn .gb-ic { font-size: 26px; line-height: 1; flex: 0 0 auto; filter: drop-shadow(0 0 6px var(--green)); }
.game-btn .gb-text { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.game-btn .gb-name { font-size: 16px; font-weight: 700; letter-spacing: 1.5px; }
.game-btn .gb-tag  { font-size: 11px; letter-spacing: 1px; color: var(--dim); text-shadow: none; }
.game-btn .gb-lv {
  position: absolute; top: 8px; right: 10px;
  font-size: 9px; letter-spacing: 1px; color: var(--amber);
  border: 1px solid rgba(255,176,0,0.45); border-radius: 999px; padding: 1px 7px;
  text-shadow: none;
}
/* shine sweep on hover */
.game-btn::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(57,255,20,0.16), transparent);
  transform: skewX(-18deg); transition: left .5s ease;
}
.game-btn:hover::after { left: 130%; }
.game-btn:hover {
  border-color: var(--green);
  box-shadow: 0 0 18px rgba(57,255,20,0.42), inset 0 0 20px rgba(57,255,20,0.12);
  transform: translateY(-3px);
}
.game-btn:active { transform: translateY(-1px); }
.game-btn.active {
  color: #061006;
  background: linear-gradient(180deg, var(--green), #18c609);
  border-color: var(--green);
  text-shadow: none;
  box-shadow: 0 0 26px rgba(57,255,20,0.6);
}
.game-btn.active .gb-tag { color: #0a3a06; }
.game-btn.active .gb-ic { filter: none; }
.game-btn.active .gb-lv { color: #0a3a06; border-color: rgba(10,58,6,0.5); }

/* ---------- stop / now-playing bar ---------- */
#stopbar {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 1200px;
}
#backBtn {
  background: #170a0a; color: var(--red);
  border: 1px solid #7a1f1b; border-radius: 7px;
  padding: 9px 16px; font-family: var(--mono); font-weight: 700; letter-spacing: 1px;
  cursor: pointer; text-shadow: 0 0 6px rgba(255,59,48,0.6);
  transition: box-shadow .15s ease, border-color .15s ease, transform .1s ease;
}
#backBtn:hover { border-color: var(--red); box-shadow: 0 0 16px rgba(255,59,48,0.5); transform: translateY(-1px); }
#nowPlaying {
  color: var(--amber); letter-spacing: 2px; font-size: 15px; font-weight: 700;
  text-shadow: 0 0 9px rgba(255,176,0,0.55);
}
#hint { margin-left: auto; color: var(--dim); font-size: 12px; letter-spacing: 1px; }

/* ---------- the screen / stage where games mount ---------- */
#stage {
  position: relative;
  width: min(1200px, 97vw);
  height: clamp(540px, 70vh, 780px);
  background: #040804;
  border: 2px solid var(--green-d);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 32px rgba(57,255,20,0.22),
    0 0 90px rgba(57,255,20,0.08),
    inset 0 0 70px rgba(0,0,0,0.72);
}
#stage canvas { display: block; }
/* screen vignette + corner brackets for an arcade-bezel feel */
#stage::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none; border-radius: 14px;
  box-shadow: inset 0 0 140px rgba(0,0,0,0.66);
  background:
    linear-gradient(var(--green) 0 0) 10px 10px / 26px 2px no-repeat,
    linear-gradient(var(--green) 0 0) 10px 10px / 2px 26px no-repeat,
    linear-gradient(var(--green) 0 0) right 10px top 10px / 26px 2px no-repeat,
    linear-gradient(var(--green) 0 0) right 10px top 10px / 2px 26px no-repeat,
    linear-gradient(var(--green) 0 0) 10px bottom 10px / 26px 2px no-repeat,
    linear-gradient(var(--green) 0 0) 10px bottom 10px / 2px 26px no-repeat,
    linear-gradient(var(--green) 0 0) right 10px bottom 10px / 26px 2px no-repeat,
    linear-gradient(var(--green) 0 0) right 10px bottom 10px / 2px 26px no-repeat;
  opacity: 0.55;
}

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

/* ---------- briefing panel (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: 28px;
}
.briefing h2 {
  margin: 0; color: var(--green); letter-spacing: 5px;
  font-size: clamp(22px, 4.5vw, 36px);
  text-shadow: 0 0 14px rgba(57,255,20,0.6);
}
.briefing p { margin: 0; color: var(--ink); max-width: 620px; line-height: 1.65; }
.briefing .roster {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 30px;
  margin-top: 6px; text-align: left; color: var(--dim); font-size: 13px;
}
@media (max-width: 620px) { .briefing .roster { grid-template-columns: 1fr; } }
.briefing .roster b { color: var(--amber); letter-spacing: 1px; }
.briefing .cta {
  margin-top: 8px; color: var(--amber); letter-spacing: 2px; font-size: 15px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.45;} 50%{opacity:1;} }

/* ============================================================
   SHARED HELPERS games may use (.spy-*)
   ============================================================ */
.spy-overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(4, 8, 4, 0.78);
}
.spy-overlay .big {
  color: var(--green); font-size: clamp(28px, 6vw, 52px); font-weight: 700; letter-spacing: 4px;
  text-shadow: 0 0 18px rgba(57,255,20,0.7);
}
.spy-overlay .sub { margin-top: 12px; color: var(--ink); letter-spacing: 1px; font-size: 16px; }

.spy-hud {
  position: absolute; top: 14px; left: 16px; z-index: 20;
  color: var(--green); font-size: 15px; letter-spacing: 1px; line-height: 1.55;
  text-shadow: 0 0 9px rgba(57,255,20,0.5); pointer-events: none;
}
.spy-pill {
  display: inline-block; padding: 2px 11px; border: 1px solid var(--green-d);
  border-radius: 999px; color: var(--green); font-size: 12px; letter-spacing: 1px;
}
.spy-accent { color: var(--green); text-shadow: 0 0 9px rgba(57,255,20,0.5); }
