:root {
  --bg: #050811;
  --bg-card: rgba(12, 18, 34, 0.72);
  --border: rgba(0, 240, 255, 0.18);
  --border-strong: rgba(0, 240, 255, 0.42);
  --cyan: #00f0ff;
  --magenta: #ff0055;
  --gold: #ffb800;
  --green: #00ff9d;
  --text: #e8f1ff;
  --muted: #8ea3c2;
  --font-display: 'Orbitron', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 30%, black 20%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  top: -160px;
  left: -120px;
  background: var(--cyan);
}

.bg-glow-2 {
  bottom: -180px;
  right: -120px;
  background: var(--magenta);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(5, 8, 17, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.brand .accent {
  color: var(--cyan);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.25);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--green);
  letter-spacing: 0.06em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 10px;
  height: 34px;
  min-width: 36px;
  padding: 0 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

/* Hero */
.hero-header {
  text-align: center;
  margin-bottom: 20px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--cyan);
  margin-bottom: 8px;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.2vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.gradient-text {
  background: linear-gradient(90deg, var(--cyan), #7c5cff, var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto;
  font-size: 0.96rem;
  line-height: 1.5;
}

/* Game Shell */
.game-section {
  margin-bottom: 28px;
}

.game-shell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(0, 240, 255, 0.08);
  backdrop-filter: blur(12px);
}

.game-shell:fullscreen {
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: var(--bg);
}

.game-shell:fullscreen .canvas-wrap {
  flex: 1;
  height: auto;
}

/* HUD */
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(5, 8, 17, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.accent-cyan { color: var(--cyan); }
.accent-gold { color: var(--gold); }

.hp-bars {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.hp-pip {
  width: 16px;
  height: 8px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}

.hp-pip.active {
  background: var(--green);
  box-shadow: 0 0 8px rgba(0, 255, 157, 0.6);
}

.hp-pip.low {
  background: var(--magenta);
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.7);
}

.emp-hud {
  min-width: 78px;
}

.emp-track {
  width: 78px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 3px;
}

.emp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  transition: width 0.15s linear;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.hud-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Canvas Area */
.canvas-wrap {
  position: relative;
  width: 100%;
  height: min(68vh, 580px);
  min-height: 400px;
  background: radial-gradient(circle at 50% 60%, #0b132b 0%, #050811 85%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Boss Bar */
.boss-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, 84%);
  background: rgba(5, 8, 17, 0.82);
  border: 1px solid rgba(255, 0, 85, 0.5);
  border-radius: 10px;
  padding: 6px 10px;
  pointer-events: none;
  z-index: 5;
}

.boss-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--magenta);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  text-align: center;
}

.boss-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--magenta), var(--gold));
  transition: width 0.12s linear;
}

/* Powerup Badge */
.powerup-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
  z-index: 5;
}

/* Mobile EMP Button */
.emp-trigger {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 8, 17, 0.78);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.78rem;
  cursor: pointer;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.emp-trigger.ready {
  border-color: var(--cyan);
  color: #fff;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.35), rgba(255, 0, 85, 0.35));
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.55);
  animation: pulse 1.2s infinite;
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.76);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
  transition: opacity 0.22s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: 100%;
  max-width: 440px;
  text-align: center;
  background: rgba(11, 17, 34, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.overlay-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.28);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.overlay-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
}

.stat-val {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  padding: 14px 22px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), #3b82f6);
  color: #030712;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 240, 255, 0.32);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(0, 240, 255, 0.48);
}

.btn-primary:active {
  transform: translateY(0);
}

.controls-hint {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-icon {
  font-size: 1.2rem;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.badge-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.feature-list strong {
  color: var(--text);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ach-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0.55;
  transition: all 0.25s ease;
}

.ach-item.unlocked {
  opacity: 1;
  color: var(--text);
  border-color: rgba(255, 184, 0, 0.45);
  background: rgba(255, 184, 0, 0.08);
}

.card-text {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--cyan);
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer .sep {
  margin: 0 8px;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 10px 14px;
  }
  .status-pill {
    display: none;
  }
  .container {
    padding: 14px 10px 36px;
  }
  .hud-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .hud-group {
    gap: 12px;
  }
  .hud-value {
    font-size: 0.92rem;
  }
  .canvas-wrap {
    height: 64vh;
    min-height: 360px;
  }
}
