/* Atari 1980 Red Baron 3D Vector Arcade Styling */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;700&family=Press+Start+2P&family=Share+Tech+Mono&display=swap');

:root {
  --bg-dark: #05070a;
  --cabinet-bezel: #12161f;
  --cabinet-border: #242c3d;
  --vector-cyan: #00f3ff;
  --vector-cyan-glow: rgba(0, 243, 255, 0.7);
  --vector-red: #ff2a2a;
  --vector-red-glow: rgba(255, 42, 42, 0.7);
  --vector-green: #00ff66;
  --vector-green-glow: rgba(0, 255, 102, 0.7);
  --vector-amber: #ffb700;
  --vector-white: #ffffff;
  --text-gold: #ffd700;
  --font-retro: 'Press Start 2P', monospace;
  --font-led: 'Share Tech Mono', monospace;
  --font-tech: 'Chakra Petch', sans-serif;
}

* {
  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%, #0d121c 0%, #030407 100%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.4) 2px, rgba(0,0,0,0.4) 4px);
  color: #fff;
  font-family: var(--font-tech);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 10px;
}

/* Outer Arcade Cabinet Frame */
.arcade-cabinet {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: linear-gradient(180deg, #1c222e 0%, #0f131a 100%);
  border: 4px solid var(--cabinet-border);
  border-radius: 16px;
  box-shadow: 
    0 0 35px rgba(0, 243, 255, 0.15),
    0 0 30px rgba(0, 0, 0, 0.9),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Marquee Header */
.cabinet-marquee {
  background: linear-gradient(180deg, #0d1117 0%, #05070a 100%);
  border: 3px solid #2a3345;
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
}

.marquee-title h1 {
  font-family: var(--font-retro);
  font-size: 1.5rem;
  color: var(--vector-red);
  text-shadow: 
    0 0 5px #ff0000,
    0 0 12px var(--vector-red-glow),
    2px 2px 0px #000;
  letter-spacing: 2px;
}

.marquee-subtitle {
  font-family: var(--font-led);
  font-size: 0.85rem;
  color: var(--vector-cyan);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--vector-cyan-glow);
}

/* Cabinet Digital Vector Scoreboard */
.led-scoreboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  background: #080b10;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #1a2230;
}

.led-panel {
  background: #030508;
  border: 2px solid #141b26;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9);
}

.led-label {
  font-family: var(--font-retro);
  font-size: 0.55rem;
  color: #61738a;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.led-value {
  font-family: var(--font-led);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.led-value.cyan {
  color: var(--vector-cyan);
  text-shadow: 0 0 10px var(--vector-cyan-glow);
}

.led-value.red {
  color: var(--vector-red);
  text-shadow: 0 0 10px var(--vector-red-glow);
}

.led-value.amber {
  color: var(--vector-amber);
  text-shadow: 0 0 10px rgba(255, 183, 0, 0.7);
}

.led-value.green {
  color: var(--vector-green);
  text-shadow: 0 0 10px var(--vector-green-glow);
}

/* Armor Slide Bar Indicator */
.armor-bar-container {
  width: 100%;
  height: 10px;
  background: #101620;
  border: 1px solid #233045;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.armor-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff2a2a 0%, #ffb700 45%, #00ff66 100%);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.7);
  transition: width 0.15s ease;
}

/* Throttle Power Meter Bar */
.throttle-bar-container {
  width: 100%;
  height: 10px;
  background: #101620;
  border: 1px solid #233045;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.throttle-bar-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #00ff66 0%, #ffb700 70%, #ff2a2a 100%);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.6);
  transition: width 0.1s ease;
}

/* Screen Viewport & Vector Monitor Container */
.screen-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000000;
  border: 6px solid #0d121c;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 
    0 0 25px rgba(0, 243, 255, 0.1),
    0 0 20px rgba(0, 0, 0, 0.9),
    inset 0 0 20px rgba(0, 0, 0, 0.9);
}

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

/* CRT CRT Overlay & Vector Glow Filter */
.crt-overlay {
  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.3) 50%),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03), rgba(0, 255, 102, 0.01), rgba(255, 42, 42, 0.03));
  background-size: 100% 4px, 6px 100%;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
  z-index: 10;
}

.vector-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 100px 30px rgba(0, 10, 20, 0.85);
  z-index: 11;
  transition: opacity 0.3s ease;
}

.vector-mask.disabled {
  opacity: 0;
}

/* Cabinet Controls Bar */
.cabinet-controls {
  background: linear-gradient(180deg, #141924 0%, #0a0d13 100%);
  border: 2px solid #232c3d;
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}

.control-instructions {
  font-family: var(--font-led);
  font-size: 0.85rem;
  color: #7b8eab;
  display: flex;
  gap: 15px;
  align-items: center;
}

.key-badge {
  background: #1c2433;
  border: 1px solid #3d4f6e;
  color: var(--vector-cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
  box-shadow: 0 2px 0 #0d121c;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.arcade-btn {
  font-family: var(--font-retro);
  font-size: 0.65rem;
  padding: 10px 16px;
  border: 2px solid #fff;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}

.arcade-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.btn-primary {
  background: linear-gradient(180deg, #ff3333 0%, #b30000 100%);
  border-color: #ff9999;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ff5555 0%, #d60000 100%);
  box-shadow: 0 0 14px var(--vector-red-glow);
}

.btn-secondary {
  background: linear-gradient(180deg, #273347 0%, #151d2a 100%);
  border-color: #4a5d7e;
  color: var(--vector-cyan);
  text-shadow: 0 1px 2px #000;
}

.btn-secondary:hover {
  background: linear-gradient(180deg, #35445e 0%, #202b3e 100%);
  box-shadow: 0 0 12px var(--vector-cyan-glow);
}

/* Modals & Overlay Screens */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 4, 8, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: linear-gradient(180deg, #0e141f 0%, #06090e 100%);
  border: 3px solid var(--vector-cyan);
  box-shadow: 0 0 35px var(--vector-cyan-glow), inset 0 0 15px rgba(0, 0, 0, 0.8);
  border-radius: 12px;
  padding: 30px 40px;
  max-width: 540px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.modal-card h2 {
  font-family: var(--font-retro);
  font-size: 1.4rem;
  color: var(--vector-cyan);
  text-shadow: 0 0 12px var(--vector-cyan-glow);
  letter-spacing: 2px;
}

.modal-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #b0c2de;
}

.arcade-blink {
  animation: arcade-flash 1s infinite alternate;
  font-family: var(--font-retro);
  font-size: 0.8rem;
  color: var(--vector-red);
  margin-top: 10px;
}

@keyframes arcade-flash {
  0% { opacity: 0.2; }
  100% { opacity: 1; text-shadow: 0 0 8px var(--vector-red); }
}

.score-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  width: 100%;
  background: #040609;
  border: 1px solid #1c2738;
  padding: 12px 18px;
  border-radius: 6px;
  font-family: var(--font-led);
  font-size: 1.1rem;
}

.score-summary-grid .label {
  color: #7b8eab;
  text-align: left;
}

.score-summary-grid .val {
  color: var(--vector-amber);
  text-align: right;
  font-weight: bold;
}

/* High Score Table */
.initials-input-container {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
}

.initial-box {
  width: 45px;
  height: 50px;
  background: #030508;
  border: 2px solid var(--vector-cyan);
  border-radius: 6px;
  color: var(--vector-cyan);
  font-family: var(--font-retro);
  font-size: 1.4rem;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  box-shadow: 0 0 10px var(--vector-cyan-glow);
}

.initial-box:focus {
  border-color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.high-scores-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #030508;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #162030;
  font-family: var(--font-led);
  font-size: 1rem;
}

.high-score-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  border-bottom: 1px dashed #162030;
}

.high-score-row:last-child {
  border-bottom: none;
}

.high-score-row .rank { color: #526580; }
.high-score-row .name { color: var(--text-gold); font-weight: bold; }
.high-score-row .score { color: var(--vector-green); }

/* Responsive adjustments */
@media (max-width: 768px) {
  .arcade-cabinet {
    padding: 10px;
    gap: 10px;
  }
  .marquee-title h1 {
    font-size: 1.1rem;
  }
  .led-scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }
  .led-value {
    font-size: 1.4rem;
  }
  .control-instructions {
    font-size: 0.75rem;
    flex-wrap: wrap;
  }
  .arcade-btn {
    font-size: 0.55rem;
    padding: 8px 12px;
  }
}
