:root {
  --bg-dark: #070913;
  --panel-bg: rgba(14, 18, 36, 0.85);
  --border-neon: #00ffcc;
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff0055;
  --accent-yellow: #ffe600;
  --accent-green: #39ff14;
  --font-pixel: 'Press Start 2P', monospace;
  --font-retro: 'VT323', monospace;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(0, 240, 255, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(255, 0, 85, 0.06) 0%, transparent 50%);
  color: #ffffff;
  font-family: var(--font-pixel);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Cabinet Container */
.game-container,
.arcade-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1020px;
  padding: 10px;
}

.cabinet-frame {
  position: relative;
  width: 960px;
  height: 540px;
  border: 4px solid #1e294b;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 240, 255, 0.2);
  background: #070913;
}

/* Header */
.game-header {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(10, 14, 28, 0.9);
  border: 3px solid #1e294b;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 240, 255, 0.15);
}

.logo-title {
  display: flex;
  flex-direction: column;
}

.glow-text {
  font-size: 20px;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.8), 0 0 20px rgba(0, 240, 255, 0.4);
  letter-spacing: 2px;
}

.sub-title {
  font-size: 10px;
  color: var(--accent-magenta);
  letter-spacing: 1px;
  margin-top: 4px;
}

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

/* Buttons */
.retro-btn {
  font-family: var(--font-pixel);
  font-size: 12px;
  padding: 12px 24px;
  background: #12182b;
  color: #fff;
  border: 3px solid var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--accent-cyan), 0 0 15px rgba(0, 240, 255, 0.3);
  transition: all 0.1s ease;
  outline: none;
  text-transform: uppercase;
}

.retro-btn:hover,
.retro-btn:focus,
.retro-btn:focus-visible {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 4px 0 #00b3b3, 0 0 25px rgba(0, 240, 255, 0.8);
  transform: translateY(-2px);
  outline: 3px solid var(--accent-yellow) !important;
  outline-offset: 3px;
}

.retro-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #00b3b3;
}

.btn-small {
  font-size: 10px;
  padding: 6px 12px;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--accent-cyan);
}

.btn-primary {
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 4px 0 var(--accent-green), 0 0 15px rgba(57, 255, 20, 0.4);
}

.btn-primary:hover {
  background: var(--accent-green);
  color: #000;
  box-shadow: 0 4px 0 #28bd0e;
}

.btn-secondary {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
  box-shadow: 0 4px 0 var(--accent-yellow);
}

.btn-secondary:hover {
  background: var(--accent-yellow);
  color: #000;
}

/* Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 960px;
  height: 540px;
  border: 4px solid #1e294b;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 240, 255, 0.2);
  background: #000;
}

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

/* Scanlines overlay */
.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.25) 50%
  );
  background-size: 100% 4px;
  z-index: 10;
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 24px;
}

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

.hud-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(8, 12, 24, 0.6);
  padding: 6px 14px;
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.hud-label {
  font-size: 9px;
  color: #8a99ad;
}

.hud-value {
  font-size: 14px;
}

.glow-green { color: var(--accent-green); text-shadow: 0 0 8px var(--accent-green); }
.glow-yellow { color: var(--accent-yellow); text-shadow: 0 0 8px var(--accent-yellow); }
.glow-blue { color: var(--accent-cyan); text-shadow: 0 0 8px var(--accent-cyan); }
.glow-red { color: var(--accent-magenta); text-shadow: 0 0 8px var(--accent-magenta); }

/* Lives Display */
.lives-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8, 12, 24, 0.6);
  padding: 6px 14px;
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
}

.lives-icons {
  display: flex;
  gap: 6px;
}

.life-icon {
  width: 20px;
  height: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  display: inline-block;
  image-rendering: pixelated;
}

/* Boss Health Bar HUD */
.boss-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 300px;
}

.boss-name {
  font-size: 10px;
  color: var(--accent-magenta);
  animation: pulse-warn 1s infinite alternate;
}

@keyframes pulse-warn {
  from { opacity: 0.7; }
  to { opacity: 1; text-shadow: 0 0 10px var(--accent-magenta); }
}

.boss-hp-bg {
  width: 100%;
  height: 12px;
  background: rgba(40, 0, 10, 0.8);
  border: 2px solid var(--accent-magenta);
  border-radius: 4px;
  overflow: hidden;
}

.boss-hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #ff6600);
  transition: width 0.1s ease;
}

.weapon-badge {
  font-size: 11px;
  color: var(--accent-yellow);
  background: rgba(8, 12, 24, 0.6);
  padding: 6px 12px;
  border: 2px solid var(--accent-yellow);
  border-radius: 6px;
}

.ammo-badge {
  font-size: 11px;
  color: var(--accent-green);
  background: rgba(8, 12, 24, 0.6);
  padding: 6px 12px;
  border: 2px solid var(--accent-green);
  border-radius: 6px;
}

/* Menu Overlays */
.menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: rgba(4, 6, 14, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.menu-card {
  background: rgba(12, 16, 32, 0.95);
  border: 3px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  max-width: 580px;
  max-height: 480px;
  overflow-y: auto;
  width: 90%;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.menu-card.danger {
  border-color: var(--accent-magenta);
  box-shadow: 0 0 30px rgba(255, 0, 85, 0.4);
}

.title-main {
  font-size: 26px;
  text-align: center;
  line-height: 1.3;
  color: var(--accent-cyan);
  text-shadow: 3px 3px 0 #005580, 0 0 20px var(--accent-cyan);
}

.tagline {
  font-size: 10px;
  color: #a0b0cb;
}

.ship-preview-box {
  width: 120px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: 2px dashed rgba(0, 240, 255, 0.4);
  border-radius: 8px;
}

.menu-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.features-list {
  display: flex;
  gap: 16px;
  font-size: 9px;
  color: #7d93b3;
  margin-top: 10px;
}

.btn-store {
  background: linear-gradient(180deg, #ffe600, #ff8800);
  border-color: #ffe600;
  color: #0b1020;
  box-shadow: 0 4px 0 #b35900;
}

.btn-store:hover {
  background: linear-gradient(180deg, #ffff33, #ffaa00);
  box-shadow: 0 6px 15px rgba(255, 230, 0, 0.5);
}

.coins-badge-bar {
  font-size: 10px;
  color: var(--accent-yellow);
  background: rgba(255, 230, 0, 0.1);
  border: 1px dashed var(--accent-yellow);
  padding: 8px 16px;
  border-radius: 6px;
}

.equipped-label {
  font-size: 8px;
  color: var(--accent-cyan);
  margin-top: 4px;
}

/* Difficulty Selector Box */
.difficulty-selector-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(8, 12, 24, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
}

.difficulty-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.diff-btn {
  flex: 1;
  font-size: 8px;
  font-family: 'Press Start 2P', monospace;
  padding: 8px 4px;
  background: rgba(18, 24, 48, 0.9);
  border: 2px solid #2d3752;
  color: #a0b0cb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.diff-btn:hover,
.diff-btn:focus,
.diff-btn:focus-visible {
  border-color: var(--accent-yellow);
  color: #fff;
  outline: 2px solid var(--accent-yellow) !important;
  outline-offset: 2px;
  box-shadow: 0 0 12px var(--accent-yellow);
}

.diff-btn.active {
  background: linear-gradient(180deg, #0055ff, #002b80);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.diff-btn.active#diff-easy {
  background: linear-gradient(180deg, #00b33c, #00591f);
  border-color: var(--accent-green);
}

.diff-btn.active#diff-hard {
  background: linear-gradient(180deg, #ff8800, #995200);
  border-color: var(--accent-orange);
}

.diff-btn.active#diff-nightmare {
  background: linear-gradient(180deg, #ff0055, #990033);
  border-color: var(--accent-red);
}

.diff-desc-text {
  font-size: 8px;
  color: var(--accent-yellow);
}

/* Store Modal Overlay */
.store-card {
  width: 900px !important;
  max-width: 94% !important;
  max-height: 480px !important;
  overflow-y: auto !important;
  gap: 14px !important;
  padding: 18px 24px !important;
}

.store-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-cyan);
  padding-bottom: 10px;
}

.store-header h2 {
  font-size: 16px;
  color: var(--accent-cyan);
  margin: 0;
}

.store-coins-badge {
  font-size: 12px;
  color: var(--accent-yellow);
  background: rgba(8, 12, 24, 0.8);
  padding: 6px 14px;
  border: 2px solid var(--accent-yellow);
  border-radius: 6px;
}

.store-sections-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.section-title {
  font-size: 12px;
  color: var(--accent-yellow);
  margin-bottom: 8px;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}

.store-item-card {
  background: rgba(18, 24, 48, 0.85);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.store-item-card.equipped {
  border-color: var(--accent-green);
  background: rgba(57, 255, 20, 0.1);
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  font-size: 11px;
  color: #fff;
}

.item-desc {
  font-size: 8px;
  color: #a0b0cb;
}

.item-cost {
  font-size: 10px;
  color: var(--accent-yellow);
  font-weight: bold;
}

.item-action-btn {
  font-size: 9px;
  padding: 8px 12px;
  min-width: 90px;
}

/* Controls Grid */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
  margin: 10px 0;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}

.key-cap {
  background: #1e2846;
  border: 2px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 6px 10px;
  border-radius: 4px;
  box-shadow: 0 3px 0 #0b1020;
  font-weight: bold;
}

.key-cap.wide {
  padding: 6px 16px;
}

.control-desc {
  color: #cfd9e8;
}

.hint-text {
  font-size: 9px;
  color: var(--accent-yellow);
}

/* Score Breakdown */
.score-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
}

.score-row {
  display: flex;
  justify-content: space-between;
}

.new-high-badge {
  color: var(--accent-yellow);
  font-size: 11px;
  margin-top: 8px;
  animation: bounce 0.8s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

/* Touch Controls - Only visible on touch devices */
.touch-overlay {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  padding: 0 20px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 25;
}

@media (hover: none) and (pointer: coarse) {
  .touch-overlay {
    display: flex;
  }
}

.touch-overlay button,
.dpad-btn,
.action-btn,
.touch-btn {
  pointer-events: auto;
}

.dpad {
  position: relative;
  width: 120px;
  height: 120px;
}

.touch-btn {
  position: absolute;
  width: 38px;
  height: 38px;
  background: rgba(0, 240, 255, 0.25);
  border: 2px solid var(--accent-cyan);
  color: #fff;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  touch-action: manipulation;
}

.dpad-up { top: 0; left: 41px; }
.dpad-down { bottom: 0; left: 41px; }
.dpad-left { top: 41px; left: 0; }
.dpad-right { top: 41px; right: 0; }

.action-btns {
  display: flex;
  gap: 12px;
  align-items: center;
}

.fire-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 0, 85, 0.35);
  border-color: var(--accent-magenta);
  font-size: 10px;
}

.bomb-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(57, 255, 20, 0.35);
  border-color: var(--accent-green);
  font-size: 10px;
}

.slow-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(176, 38, 255, 0.35);
  border-color: var(--accent-purple);
  font-size: 10px;
}

/* Time Slow Gauge */
.time-box {
  width: 130px;
}

.time-meter-bg {
  width: 100%;
  height: 10px;
  background: rgba(20, 0, 40, 0.8);
  border: 1px solid var(--accent-purple);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.time-meter-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b026ff, #00f0ff);
  transition: width 0.05s linear;
}

.hidden {
  display: none !important;
}

/* Cabinet Footer */
.game-footer {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 8px;
  color: #556785;
}

@media (max-width: 980px) {
  .arcade-container { width: 100%; padding: 0; }
  .canvas-wrapper { width: 100vw; height: calc(100vw * 9 / 16); max-height: 90vh; }
  .game-header { width: 100vw; }
  .game-footer { display: none; }
}
