:root {
  --bg-dark: #07090e;
  --panel-bg: #0d121c;
  --panel-border: #1e293b;
  --accent-cyan: #00f0ff;
  --accent-red: #ff0055;
  --accent-gold: #ffb703;
  --light-polarity: #ffffff;
  --dark-polarity: #ff2a5f;
  --dark-glow: #8b00ff;
  --crt-curve: radial-gradient(circle at center, rgba(0,0,0,0) 60%, rgba(0,0,0,0.65) 100%);
}

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

body {
  background-color: var(--bg-dark);
  color: #f1f5f9;
  font-family: 'Share Tech Mono', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  background-image: 
    radial-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 0),
    radial-gradient(rgba(255, 0, 85, 0.05) 1px, transparent 0);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
}

#game-wrapper {
  display: flex;
  gap: 24px;
  background: rgba(13, 18, 28, 0.85);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.15);
  backdrop-filter: blur(10px);
  max-width: 95vw;
  max-height: 96vh;
}

#canvas-container {
  position: relative;
  width: 600px;
  height: 800px;
  background: #020408;
  border: 2px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* CRT and Scanlines overlay */
#crt-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background: var(--crt-curve);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.8);
}

#scanlines {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.35) 50%
  );
  background-size: 100% 4px;
  opacity: 0.7;
}

#goth-vignette {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background: 
    radial-gradient(circle at center, rgba(168, 85, 247, 0.15) 10%, rgba(136, 19, 55, 0.4) 60%, rgba(15, 3, 25, 0.92) 90%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0px, rgba(0, 0, 0, 0.5) 2px, transparent 2px, transparent 6px);
  mix-blend-mode: hard-light;
  animation: spectralPulse 2.5s ease-in-out infinite alternate;
  box-shadow: inset 0 0 120px #881337, inset 0 0 60px #581c87;
  transition: opacity 0.4s ease;
  border: 4px solid rgba(192, 132, 252, 0.3);
}

.goth-mode-indicator {
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(88, 28, 135, 0.6);
  border: 1px solid #c084fc;
  border-radius: 4px;
  color: #f5d0fe;
  font-family: 'Pirata One', 'Cinzel', cursive;
  font-size: 14px;
  letter-spacing: 1px;
  text-shadow: 0 0 8px #a855f7, 0 0 15px #e11d48;
  animation: gothGlow 1.8s infinite alternate;
}

@keyframes gothGlow {
  0% { box-shadow: 0 0 8px rgba(168, 85, 247, 0.5); }
  100% { box-shadow: 0 0 20px rgba(225, 29, 72, 0.8), 0 0 10px rgba(192, 132, 252, 0.8); }
}

@keyframes spectralPulse {
  0% { opacity: 0.85; filter: hue-rotate(0deg) contrast(1.4); }
  100% { opacity: 1; filter: hue-rotate(25deg) contrast(1.8); }
}

body.goth-active {
  background-color: #020004;
  filter: contrast(1.2) brightness(0.92);
}

body.goth-active #game-wrapper {
  border-color: #991b1b;
  box-shadow: 0 0 50px rgba(225, 29, 72, 0.5), 0 0 100px rgba(88, 28, 135, 0.4);
}

body.goth-active .glitch-title {
  font-family: 'Pirata One', 'Cinzel', cursive;
  color: #f43f5e;
  text-shadow: 0 0 12px #f43f5e, 0 0 25px #881337, 0 0 40px #581c87;
}

body.goth-active .hud-box {
  background: rgba(24, 9, 38, 0.88);
  border-color: #701a75;
}

.hidden {
  display: none !important;
}

/* Arcade Bezel & Sidebar */
#arcade-bezel {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-panel {
  text-align: center;
  border-bottom: 2px solid var(--panel-border);
  padding-bottom: 10px;
}

.glitch-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-red);
}

.subtitle {
  font-size: 11px;
  letter-spacing: 2px;
  color: #94a3b8;
  margin-top: 2px;
}

.hud-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px 14px;
  position: relative;
}

.hud-label {
  font-size: 10px;
  color: #64748b;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.polarity-tag {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 4px;
  text-align: center;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}

.polarity-tag.light-mode {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.polarity-tag.dark-mode {
  background: rgba(255, 0, 85, 0.2);
  color: #ff3366;
  border: 1px solid #ff0055;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
}

.chain-indicator {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}

.chain-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #334155;
  background: transparent;
  transition: all 0.2s;
}

.chain-dot.active-light {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 8px #ffffff;
}

.chain-dot.active-dark {
  background: #ff0055;
  border-color: #ff0055;
  box-shadow: 0 0 8px #ff0055;
}

.hud-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
}

.score-val {
  font-size: 22px;
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.hud-bonus-val {
  font-size: 12px;
  color: var(--accent-gold);
}

.hud-sub-val {
  font-size: 13px;
  color: #94a3b8;
}

.energy-meter-track {
  width: 100%;
  height: 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}

.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #ff0055);
  box-shadow: 0 0 10px #00f0ff;
  transition: width 0.15s ease-out;
}

.lives-container {
  display: flex;
  gap: 8px;
  font-size: 18px;
  color: var(--accent-cyan);
}

.life-icon {
  text-shadow: 0 0 8px var(--accent-cyan);
}

.controls-guide {
  margin-top: auto;
  font-size: 11px;
  background: rgba(10, 15, 25, 0.9);
  padding: 10px;
  border-radius: 6px;
  border: 1px dashed #334155;
}

.guide-title {
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.key-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: #94a3b8;
}

kbd {
  background: #1e293b;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: #f8fafc;
  border: 1px solid #475569;
}

.mt-2 {
  margin-top: 8px;
}
