:root {
  --neon-gold: #ffb700;
  --neon-blue: #00d2ff;
  --neon-red: #ff2a5f;
  --neon-cyan: #00f3ff;
  --neon-green: #39ff14;
  --neon-yellow: #fff700;
  --neon-purple: #bd00ff;
  --bg-dark: #070714;
  --cabinet-color: #12131c;
  --arcade-border: #232533;
}

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

body {
  background-color: var(--bg-dark);
  font-family: 'Press Start 2P', monospace;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Cabinet Shell */
.cabinet {
  background: linear-gradient(145deg, #181922, #0c0d12);
  border: 4px solid var(--arcade-border);
  border-radius: 20px;
  box-shadow: 0 0 40px rgba(0, 210, 255, 0.2), inset 0 0 15px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  max-width: 100%;
  width: 640px;
}

.cabinet-header {
  width: 100%;
  padding: 10px 0 15px 0;
  text-align: center;
}

.marquee {
  font-size: 28px;
  font-weight: bold;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 5px #fff, 0 0 10px var(--neon-gold), 0 0 20px var(--neon-gold), 0 0 40px var(--neon-gold);
  animation: marquee-pulse 2s infinite alternate;
}

@keyframes marquee-pulse {
  0% {
    text-shadow: 0 0 5px #fff, 0 0 10px var(--neon-gold), 0 0 20px var(--neon-gold), 0 0 40px var(--neon-gold);
  }
  100% {
    text-shadow: 0 0 5px #fff, 0 0 5px var(--neon-gold), 0 0 10px var(--neon-gold), 0 0 20px var(--neon-gold);
  }
}

/* Screen Wrapper */
.screen-wrapper {
  position: relative;
  width: 600px;
  height: 800px;
  background-color: #000;
  border: 10px solid #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
}

.screen-frame {
  position: relative;
  width: 100%;
  height: 100%;
}

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

/* CRT Screen Effects */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.05));
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 10;
}

.crt-glass-reflection {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 60%), radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 11;
  border-radius: 10px;
}

/* HUD System */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 1px;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-hud {
  margin-top: 5px;
  font-size: 10px;
}

.hud-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-cell.text-center {
  align-items: center;
}

.hud-cell.text-right {
  align-items: flex-end;
}

.hud .label {
  color: #888;
  font-size: 9px;
  margin-bottom: 2px;
}

.hud .value {
  font-weight: bold;
  text-shadow: 0 0 4px currentColor;
}

/* Shield Progress Bar */
.shield-bar-bg {
  width: 100px;
  height: 10px;
  background-color: #222;
  border: 1px solid #444;
  border-radius: 2px;
  overflow: hidden;
}

.shield-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-cyan));
  box-shadow: 0 0 8px var(--neon-blue);
  transition: width 0.1s ease;
}

/* Overlays */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(7, 7, 20, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 8;
  text-align: center;
}

.screen-overlay.hidden {
  display: none !important;
}

/* Typography styles */
.neon-text-gold {
  color: var(--neon-gold);
  text-shadow: 0 0 10px rgba(255, 183, 0, 0.5), 0 0 20px var(--neon-gold);
  font-size: 40px;
  margin-bottom: 15px;
}

.neon-text-blue {
  color: var(--neon-blue);
  text-shadow: 0 0 10px var(--neon-blue);
  margin-bottom: 25px;
}

.neon-text-red {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--neon-red);
  margin-bottom: 15px;
}

.neon-text-cyan {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

.text-green { color: var(--neon-green); }
.text-cyan { color: var(--neon-cyan); }
.text-red { color: var(--neon-red); }
.text-yellow { color: var(--neon-yellow); }

.text-small {
  font-size: 10px;
  line-height: 1.5;
}

.text-large {
  font-size: 28px;
}

/* Blinking & Animation */
.blink {
  animation: blink-anim 1s infinite steps(2, start);
}

@keyframes blink-anim {
  to { visibility: hidden; }
}

.animate-bounce {
  animation: bounce-anim 2s infinite ease-in-out alternate;
}

@keyframes bounce-anim {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

/* Game Info Rules */
.game-info {
  width: 100%;
  max-width: 460px;
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

.info-section {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 15px;
  border-radius: 8px;
}

.info-section h2 {
  font-size: 11px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.info-section p {
  font-size: 9px;
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 5px;
}

.control-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 9px;
}

.control-table div {
  display: flex;
  justify-content: space-between;
}

.control-table span:first-child {
  color: var(--neon-cyan);
}

.control-table span:last-child {
  color: #fff;
}

/* Buttons */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 15px 30px;
  border: 3px solid currentColor;
  background-color: transparent;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.btn-green {
  color: var(--neon-green);
  text-shadow: 0 0 5px var(--neon-green);
  box-shadow: inset 0 0 8px rgba(57, 255, 20, 0.2), 0 0 15px rgba(57, 255, 20, 0.1);
}

.btn-green:hover {
  background-color: var(--neon-green);
  color: #000;
  text-shadow: none;
  box-shadow: 0 0 25px var(--neon-green);
  transform: scale(1.05);
}

.btn-red {
  color: var(--neon-red);
  text-shadow: 0 0 5px var(--neon-red);
  box-shadow: inset 0 0 8px rgba(255, 42, 95, 0.2), 0 0 15px rgba(255, 42, 95, 0.1);
}

.btn-red:hover {
  background-color: var(--neon-red);
  color: #000;
  text-shadow: none;
  box-shadow: 0 0 25px var(--neon-red);
  transform: scale(1.05);
}

/* Stats Panel (Game Over) */
.stats-panel {
  margin: 30px 0;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-size: 11px;
  text-align: left;
  min-width: 280px;
}

/* Arcade Controls Panel for Mobile */
.arcade-controls {
  display: none; /* Hidden on desktop */
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding: 10px;
  background-color: #0b0c10;
  border: 2px solid #1a1b24;
  border-radius: 12px;
}

.joystick-side, .button-side {
  display: flex;
  gap: 15px;
}

.arcade-pad-btn, .arcade-action-btn {
  font-family: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  cursor: pointer;
  outline: none;
  font-weight: bold;
  box-shadow: 0 5px 0 #000;
  transition: all 0.05s ease;
}

.arcade-pad-btn {
  width: 65px;
  height: 65px;
  background: radial-gradient(circle, #3a3b45, #1f2026);
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  border: 2px solid #555;
}

.arcade-pad-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #000;
}

.arcade-action-btn {
  height: 60px;
  padding: 0 15px;
  border-radius: 30px;
  font-size: 9px;
  text-shadow: 0 0 2px #fff;
  color: #fff;
}

.arcade-action-btn.red {
  background: radial-gradient(circle, #ff5e7e, #b8002d);
  border: 2px solid #ff2a5f;
  min-width: 75px;
}

.arcade-action-btn.blue {
  background: radial-gradient(circle, #5ed7ff, #007bb8);
  border: 2px solid #00d2ff;
  min-width: 75px;
}

.arcade-action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #000;
}

/* Mobile Responsiveness Media Queries */
@media (max-width: 768px) {
  body {
    padding: 0;
    align-items: flex-start;
  }

  .cabinet {
    border: none;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    padding: 10px 5px;
    justify-content: space-between;
  }

  .cabinet-header {
    padding: 2px 0;
  }
  
  .marquee {
    font-size: 18px;
    letter-spacing: 2px;
  }

  .screen-wrapper {
    width: 100%;
    height: 0;
    padding-bottom: 125%; /* 3:4 aspect ratio */
    flex-grow: 1;
    border-width: 4px;
    border-radius: 6px;
  }

  .screen-frame {
    position: absolute;
    top: 0;
    left: 0;
  }

  .arcade-controls {
    display: flex; /* Show touch controls on mobile */
    margin-top: 10px;
    padding: 8px;
    height: 90px;
  }

  /* Shrink overlay menus for mobile screens */
  .screen-overlay {
    padding: 15px;
  }
  
  .neon-text-gold {
    font-size: 26px;
    margin-bottom: 5px;
  }
  
  .neon-text-blue {
    margin-bottom: 10px;
  }
  
  .game-info {
    margin: 10px 0;
    gap: 8px;
  }
  
  .info-section {
    padding: 8px;
  }
  
  .info-section h2 {
    font-size: 9px;
    margin-bottom: 5px;
  }
  
  .info-section p, .control-table {
    font-size: 8px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 10px;
  }
  
  .hud {
    padding: 8px 10px;
    font-size: 8px;
    gap: 4px;
  }
  
  .hud .label {
    font-size: 7px;
  }
  
  .sub-hud {
    font-size: 7px;
  }

  .shield-bar-bg {
    width: 70px;
    height: 8px;
  }
}

/* Portrait Mobile Optimization - extra small devices */
@media (max-width: 380px) {
  .marquee {
    font-size: 16px;
  }
  
  .arcade-controls {
    height: 80px;
    padding: 4px;
  }
  
  .arcade-pad-btn {
    width: 50px;
    height: 50px;
    font-size: 16px;
  }
  
  .arcade-action-btn {
    height: 48px;
    font-size: 8px;
    padding: 0 10px;
  }
}
