/* Arcade Cabinet Styles */
:root {
  --arcade-red: #ff0040;
  --arcade-blue: #0080ff;
  --arcade-yellow: #ffff00;
  --arcade-green: #00ff00;
  --arcade-dark: #1a1a1a;
  --arcade-screen: #000000;
  --arcade-bezel: #2a2a2a;
  --cabinet-wood: #8b4513;
}

.arcade-container {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  text-align: center;
  min-height: calc(100vh - 200px);
}

.arcade-title {
  color: var(--arcade-yellow);
  font-size: 3rem;
  margin-bottom: 10px;
  text-shadow: 3px 3px 0 var(--arcade-red), 6px 6px 0 var(--arcade-blue);
  font-family: 'Simpson Font', 'Comic Sans MS', cursive;
  letter-spacing: 3px;
  animation: arcade-glow 2s ease-in-out infinite alternate;
}

@keyframes arcade-glow {
  from {
    text-shadow: 3px 3px 0 var(--arcade-red), 6px 6px 0 var(--arcade-blue), 0 0 20px var(--arcade-yellow);
  }
  to {
    text-shadow: 3px 3px 0 var(--arcade-red), 6px 6px 0 var(--arcade-blue), 0 0 40px var(--arcade-yellow);
  }
}

.arcade-subtitle {
  color: white;
  font-size: 1.2rem;
  margin-bottom: 30px;
  font-family: 'Comic Sans MS', cursive;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* Arcade Cabinet */
.arcade-cabinet {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-radius: 20px 20px 10px 10px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  margin: 0 auto 40px;
  max-width: 600px;
  border: 3px solid #1a1a1a;
}

/* Screen Frame */
.arcade-screen-frame {
  background: var(--arcade-bezel);
  padding: 20px;
  border-radius: 15px;
  box-shadow: inset 0 5px 15px rgba(0,0,0,0.8);
  margin-bottom: 30px;
}

/* Screen with CRT Effect */
.arcade-screen {
  width: 100%;
  height: 400px;
  background: var(--arcade-screen);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 
    inset 0 0 40px rgba(0,255,0,0.2),
    0 0 20px rgba(0,255,0,0.1);
  border: 2px solid #111;
}

/* CRT Scanlines Effect */
.arcade-screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    transparent 50%,
    rgba(0, 255, 0, 0.03) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

/* CRT Curve Effect */
.arcade-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 70%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
}

/* Screen Placeholder */
.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--arcade-green);
  font-family: 'Courier New', monospace;
  text-align: center;
  z-index: 1;
  position: relative;
}

.placeholder-logo {
  width: 150px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px var(--arcade-green));
}

.screen-placeholder p {
  font-size: 1.5rem;
  margin: 10px 0;
  text-shadow: 0 0 10px currentColor;
}

.insert-coin {
  font-size: 1.2rem;
  animation: blink 1s infinite;
}

/* Control Panel */
.control-panel {
  background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
  border-radius: 10px;
  padding: 30px 20px;
  box-shadow: 
    inset 0 2px 5px rgba(255,255,255,0.2),
    inset 0 -2px 5px rgba(0,0,0,0.5);
  border: 2px solid #2a2a2a;
}

.controls-wrapper {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 30px;
}

/* Joystick */
.joystick-container {
  position: relative;
}

.joystick-base {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #5a5a5a 0%, #3a3a3a 100%);
  border-radius: 50%;
  position: relative;
  box-shadow: 
    inset 0 5px 10px rgba(0,0,0,0.5),
    0 5px 20px rgba(0,0,0,0.8);
  border: 3px solid #2a2a2a;
  overflow: hidden; /* Prevent joystick from going outside */
  user-select: none; /* Prevent text selection */
}

.joystick-stick {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #ff0040 0%, #8b0020 100%);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 
    0 5px 15px rgba(0,0,0,0.5),
    inset 0 -3px 10px rgba(0,0,0,0.3);
  cursor: grab;
  border: 2px solid #5a0010;
  will-change: top, left, transform; /* Optimize for position changes */
  user-select: none; /* Prevent text selection */
  pointer-events: auto; /* Ensure it receives events */
  z-index: 10; /* Above base */
}

.joystick-stick:hover {
  box-shadow: 
    0 7px 20px rgba(0,0,0,0.6),
    inset 0 -3px 10px rgba(0,0,0,0.3);
}

.joystick-stick:active {
  cursor: grabbing;
}

/* Arcade Buttons */
.buttons-container {
  display: flex;
  gap: 20px;
}

.arcade-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  position: relative;
  cursor: pointer;
  transition: all 0.1s ease;
  font-weight: bold;
  font-size: 1.5rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 
    0 8px 0 rgba(0,0,0,0.5),
    0 10px 20px rgba(0,0,0,0.3);
}

.button-a {
  background: linear-gradient(135deg, var(--arcade-red) 0%, #cc0030 100%);
  border: 3px solid #990020;
}

.button-b {
  background: linear-gradient(135deg, var(--arcade-blue) 0%, #0060cc 100%);
  border: 3px solid #004099;
}

.arcade-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 10px 0 rgba(0,0,0,0.5),
    0 12px 25px rgba(0,0,0,0.4);
}

.arcade-button:active {
  transform: translateY(4px);
  box-shadow: 
    0 4px 0 rgba(0,0,0,0.5),
    0 5px 10px rgba(0,0,0,0.3);
}

/* Token Slots */
.token-slots {
  margin: 20px 0;
  text-align: center;
}

.token-slots h3 {
  color: var(--arcade-yellow);
  font-family: 'Comic Sans MS', cursive;
  font-size: 1rem;
  margin-bottom: 15px;
  text-shadow: 0 0 10px var(--arcade-yellow);
}

.slot-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  max-width: 400px;
  margin: 0 auto;
}

.token-slot {
  padding: 20px 15px;
  border: 4px solid #333;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Comic Sans MS', cursive;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 
    0 6px 12px rgba(0,0,0,0.4),
    inset 0 2px 4px rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}

.slot-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.character-name {
  font-size: 1.1rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.marge-slot {
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
  border-color: #4169E1;
  color: #000;
}

.homer-slot {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  border-color: #FF8C00;
  color: #000;
}

.bart-slot {
  background: linear-gradient(135deg, #FF6347 0%, #DC143C 100%);
  border-color: #B22222;
  color: #fff;
}

.lisa-slot {
  background: linear-gradient(135deg, #FFA500 0%, #FF7F50 100%);
  border-color: #FF4500;
  color: #000;
}

.token-slot:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 16px rgba(0,0,0,0.5),
    inset 0 2px 4px rgba(255,255,255,0.2);
  border-color: var(--arcade-yellow);
}

.token-slot:active {
  transform: translateY(1px);
  box-shadow: 
    0 3px 6px rgba(0,0,0,0.3),
    inset 0 1px 2px rgba(255,255,255,0.1);
}

.token-slot.active {
  box-shadow: 
    0 0 25px currentColor,
    inset 0 2px 4px rgba(255,255,255,0.3);
  border-color: var(--arcade-green);
  animation: token-glow 1s ease-in-out;
}

@keyframes token-glow {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}


/* System Buttons */
.system-buttons {
  display: flex;
  flex-direction: row;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.system-button {
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.1s ease;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 
    0 4px 0 rgba(0,0,0,0.5),
    0 6px 15px rgba(0,0,0,0.3);
}


.system-button:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 5px 0 rgba(0,0,0,0.5),
    0 7px 20px rgba(0,0,0,0.4);
}

.system-button:active {
  transform: translateY(2px);
  box-shadow: 
    0 2px 0 rgba(0,0,0,0.5),
    0 3px 10px rgba(0,0,0,0.3);
}

/* Instructions Panel */
.instructions-panel {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-top: 40px;
  border: 3px solid #000;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.5);
}

.instructions-panel h2 {
  color: var(--arcade-red);
  font-family: 'Simpson Font', 'Comic Sans MS', cursive;
  margin-bottom: 15px;
  font-size: 1.8rem;
}

.instructions-panel ul {
  list-style: none;
  padding: 0;
  text-align: left;
  max-width: 300px;
  margin: 0 auto;
}

.instructions-panel li {
  margin: 10px 0;
  font-family: 'Comic Sans MS', cursive;
  font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .arcade-title {
    font-size: 2rem;
  }
  
  .arcade-screen {
    height: 300px;
  }
  
  .controls-wrapper {
    flex-direction: column;
    gap: 20px;
  }
  
  .buttons-container {
    order: -1;
  }
  
  .system-buttons {
    flex-direction: row;
    justify-content: center;
    width: 100%;
  }
}

/* Loading State */
.loading-game {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--arcade-green);
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

