* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 540px;
  height: 960px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 38, 196, 0.18), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 220, 255, 0.16), transparent 55%),
    linear-gradient(180deg, #050008 0%, #02000a 60%, #000 100%);
  border: 1px solid #1a0a2a;
  border-radius: 12px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.85),
    inset 0 0 80px rgba(255, 30, 200, 0.08),
    inset 0 0 30px rgba(0, 220, 255, 0.08);
  overflow: hidden;
}

/* Holographic HUD grid behind the canvas */
.hud-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(0deg,
      rgba(0, 220, 255, 0.045) 0px,
      rgba(0, 220, 255, 0.045) 1px,
      transparent 1px,
      transparent 44px),
    repeating-linear-gradient(90deg,
      rgba(255, 38, 196, 0.04) 0px,
      rgba(255, 38, 196, 0.04) 1px,
      transparent 1px,
      transparent 44px);
  mix-blend-mode: screen;
  animation: hud-drift 18s linear infinite;
}

@keyframes hud-drift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 0 44px, 44px 0; }
}

#scoreboard {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.75), rgba(0,0,0,0));
  z-index: 10;
  pointer-events: none;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.team .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 4px;
  opacity: 0.95;
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
}

.team .score {
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  margin-top: 4px;
  transition: transform 0.15s ease, filter 0.12s ease;
}

/* Hot magenta = red node */
.team.red .label, .team.red .score {
  color: #ff26c4;
  text-shadow:
    0 0 12px rgba(255, 38, 196, 0.95),
    0 0 26px rgba(255, 38, 196, 0.55),
    0 0 2px rgba(255, 200, 240, 0.95);
}

/* Electric cyan = blue node */
.team.blue .label, .team.blue .score {
  color: #00e8ff;
  text-shadow:
    0 0 12px rgba(0, 220, 255, 0.95),
    0 0 26px rgba(0, 220, 255, 0.55),
    0 0 2px rgba(180, 245, 255, 0.95);
}

/* Glitch-distortion flash on score change */
.score.bump {
  transform: scale(1.35) skewX(-6deg);
  filter: hue-rotate(40deg) saturate(1.6) brightness(1.3);
  animation: glitch-flash 0.32s steps(4, end);
}

@keyframes glitch-flash {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0, 0) scale(1.35); }
  20%  { clip-path: inset(20% 0 30% 0); transform: translate(-3px, 1px) scale(1.32); }
  40%  { clip-path: inset(45% 0 10% 0); transform: translate(2px, -2px) scale(1.35); }
  60%  { clip-path: inset(10% 0 50% 0); transform: translate(-2px, 2px) scale(1.33); }
  80%  { clip-path: inset(35% 0 25% 0); transform: translate(1px, -1px) scale(1.34); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0, 0) scale(1); }
}

.meta {
  text-align: center;
}

.meta .title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 5px;
  opacity: 0.95;
  color: #ffe600;
  text-shadow:
    0 0 10px rgba(255, 230, 0, 0.7),
    0 0 22px rgba(255, 230, 0, 0.35);
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
}

.meta .subtitle {
  font-size: 10px;
  letter-spacing: 4px;
  opacity: 0.55;
  margin-top: 5px;
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
  color: #9cf6ff;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

.ticker {
  position: absolute;
  left: 0; right: 0;
  bottom: 6px;
  text-align: center;
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.6;
  pointer-events: none;
  color: #9cf6ff;
  text-shadow: 0 0 6px rgba(0, 220, 255, 0.5);
  z-index: 11;
}

/* "Earthquake" is reframed as a SIGNAL SURGE — magenta neon flicker. */
@keyframes surge {
  0%   { transform: translate(0, 0); filter: hue-rotate(0deg); }
  15%  { transform: translate(-3px, 1px); filter: hue-rotate(-30deg) saturate(1.4); }
  30%  { transform: translate(4px, -2px); filter: hue-rotate(20deg) saturate(1.5); }
  45%  { transform: translate(-2px, 2px); filter: hue-rotate(-40deg) saturate(1.6); }
  60%  { transform: translate(3px, -1px); filter: hue-rotate(15deg) saturate(1.4); }
  75%  { transform: translate(-3px, -1px); filter: hue-rotate(-20deg) saturate(1.3); }
  90%  { transform: translate(2px, 2px); filter: hue-rotate(10deg) saturate(1.2); }
  100% { transform: translate(0, 0); filter: hue-rotate(0deg); }
}

#stage.shaking {
  animation: surge 0.34s linear infinite;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.85),
    inset 0 0 80px rgba(255, 30, 200, 0.25),
    inset 0 0 30px rgba(0, 220, 255, 0.2),
    0 0 50px rgba(255, 38, 196, 0.6);
}
