:root {
  --bg-dark: #030712;
  --cyan-glow: #00f0ff;
  --magenta-glow: #ff007b;
  --purple-glow: #8a2be2;
  --amber-glow: #ffaa00;
  --green-glow: #00ff88;
  --text-main: #f0f4ff;
  --text-muted: #94a3b8;
  --hud-bg: rgba(9, 13, 26, 0.76);
  --card-bg: rgba(10, 14, 28, 0.90);
  --card-border: rgba(0, 240, 255, 0.28);
  --font-display: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text-main);
}

/* Background Atmosphere Layers */
.stars-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 15%, #0d1527 0%, #050811 60%, #010206 100%);
  z-index: -4;
}

.nebula-glow {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 240, 255, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(255, 0, 123, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(138, 43, 226, 0.06) 0%, transparent 50%);
  filter: blur(50px);
  z-index: -3;
  pointer-events: none;
}

.vignette-overlay {
  display: none;
}

.crt-scanline {
  display: none;
}

/* True Fullscreen Game Stage */
.game-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

/* Floating Ultra-Glass HUD Overlay */
.hud-overlay {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 1360px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--hud-bg);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 14px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 
    0 12px 35px rgba(0, 0, 0, 0.65),
    0 0 25px rgba(0, 240, 255, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
  z-index: 20;
  pointer-events: auto;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 1.5px;
  font-size: 1.1rem;
}

.brand-icon {
  color: #ffcc00;
  text-shadow: 0 0 12px rgba(255, 204, 0, 0.9);
  font-size: 1.25rem;
}

.accent-text {
  color: var(--cyan-glow);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.8);
}

.badge-pill {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff007b, #8a2be2);
  color: #fff;
  font-weight: 800;
  letter-spacing: 1.2px;
  box-shadow: 0 0 10px rgba(255, 0, 123, 0.6);
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 28px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  font-weight: 700;
  font-family: var(--font-display);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: #fff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
}

.level-stat-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.level-subname {
  font-size: 0.68rem;
  font-family: var(--font-display);
  color: var(--cyan-glow);
  letter-spacing: 1px;
  font-weight: 700;
}

.orbs-val {
  color: #00ff88;
  text-shadow: 0 0 12px rgba(0, 255, 136, 0.7);
}

.combo-val {
  color: #ffaa00;
  text-shadow: 0 0 14px rgba(255, 170, 0, 0.85);
}

.lives-hearts {
  display: flex;
  gap: 4px;
  font-size: 1rem;
}

.lives-hearts .heart {
  opacity: 0.15;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lives-hearts .heart.active {
  opacity: 1;
  filter: drop-shadow(0 0 8px #ff0055);
  transform: scale(1.1);
}

.header-controls {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
  transform: translateY(-2px);
}

/* Powerup Tray */
.powerup-tray {
  position: absolute;
  bottom: 20px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.powerup-pill-active {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  background: rgba(10, 15, 30, 0.88);
  border: 1px solid rgba(0, 240, 255, 0.4);
  backdrop-filter: blur(10px);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  animation: fadeInTray 0.3s ease;
}

@keyframes fadeInTray {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Overlay Glass Screens */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 15, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s;
}

.overlay-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.glass-card {
  width: 90%;
  max-width: 520px;
  padding: 36px 32px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.85),
    0 0 35px rgba(0, 240, 255, 0.2),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand-pill-mini {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--cyan-glow);
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.logo-hero {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 0 25px rgba(0, 240, 255, 0.9);
}

.accent-title {
  color: var(--cyan-glow);
}

.victory-title {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 900;
  color: #00ff88;
  text-shadow: 0 0 25px rgba(0, 255, 136, 0.8);
  margin-bottom: 8px;
}

.danger-title {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  color: #ff3366;
  text-shadow: 0 0 30px rgba(255, 51, 102, 0.9);
  margin-bottom: 20px;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.control-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 30px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 600;
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 14px;
  width: 100%;
  margin-bottom: 28px;
}

.final-stat {
  background: rgba(0, 0, 0, 0.45);
  padding: 14px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.final-stat span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 1px;
}

.final-stat strong {
  font-size: 1.5rem;
  font-family: var(--font-display);
  color: var(--cyan-glow);
}

.btn-primary {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  color: #fff;
  background: linear-gradient(135deg, #00f0ff 0%, #0066ff 50%, #ff007b 100%);
  border: none;
  border-radius: 14px;
  padding: 16px 44px;
  cursor: pointer;
  box-shadow: 
    0 10px 30px rgba(0, 150, 255, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 100%;
  max-width: 340px;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 
    0 14px 40px rgba(0, 240, 255, 0.8),
    inset 0 1px 3px rgba(255, 255, 255, 0.8);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.pulse-btn {
  animation: pulse-glow 2.2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 10px 30px rgba(0, 150, 255, 0.45);
  }
  50% {
    box-shadow: 0 10px 45px rgba(0, 240, 255, 0.95);
  }
}

/* Rules Drawer */
.rules-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 88vw;
  height: 100%;
  background: rgba(8, 12, 26, 0.96);
  border-left: 1px solid rgba(0, 240, 255, 0.28);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.85);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.rules-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 1px;
}

.close-icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-icon-btn:hover {
  color: var(--cyan-glow);
}

.drawer-content {
  padding: 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.manual-section h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cyan-glow);
  margin-bottom: 8px;
}

.manual-section p, .manual-section ul {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.manual-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-section ul strong {
  color: #fff;
}

.powerup-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-green { background: #00cc66; }
.pill-cyan { background: #00a2ff; }
.pill-gold { background: #ffaa00; }
.pill-red { background: #ee2244; }
.pill-fire { background: linear-gradient(45deg, #ff4500, #ff8c00); }
.pill-silver { background: #94a3b8; color: #000; }
.pill-dark { background: #334155; }

/* Mobile Optimizations */
@media (max-width: 840px) {
  .hud-overlay {
    top: 6px;
    height: 52px;
    padding: 0 12px;
    width: calc(100% - 12px);
  }
  .stats-bar {
    gap: 14px;
  }
  .stat-value {
    font-size: 1rem;
  }
  .level-subname {
    display: none;
  }
  .brand-badge {
    font-size: 0.9rem;
  }
  .badge-pill {
    display: none;
  }
  .logo-hero {
    font-size: 2rem;
  }
  .powerup-tray {
    bottom: 12px;
    left: 12px;
  }
}
