/* Arcade-specific styles extending the main theme */

.emulator-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  box-shadow: none;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.welcome-screen {
  text-align: center;
  max-width: 600px;
}

.welcome-screen h1 {
  font-size: 44px;
  margin: 0 0 12px;
  background: linear-gradient(90deg, var(--accent), #a9fbdc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-screen .lead {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  text-decoration: none;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.2);
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent), #a9fbdc);
  color: #000;
  border: none;
  font-weight: 700;
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(127,255,212,0.3);
}

/* Game Modal Styles */
.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.game-modal-content {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 90vw;
  max-width: 1000px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header h2 {
  margin: 0;
  color: var(--accent);
  font-size: 24px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.search-container {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  gap: 12px;
}

#game-search {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}

#game-search:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

#system-filter {
  padding: 10px 14px;
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  min-width: 180px;
  backdrop-filter: blur(10px);
}

#system-filter:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(40, 40, 40, 0.95);
}

#system-filter option {
  background: rgba(30, 30, 30, 0.95);
  color: var(--text);
  padding: 8px;
}

.games-grid {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.game-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.game-card h3 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.game-card .system {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
}

.source-badge {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.source-badge.internet-archive {
  background: rgba(0, 123, 255, 0.2);
  color: #007bff;
  border: 1px solid rgba(0, 123, 255, 0.3);
}

.source-badge.myrient {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.game-card .description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.game-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.game-card .play-btn {
  background: linear-gradient(90deg, var(--accent), #a9fbdc);
  color: #000;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.game-card .play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(127,255,212,0.4);
}

.game-card .load-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.game-card .load-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  color: var(--text);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Emulator Styles */
#game {
  width: 100%;
  height: 600px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#game canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* System filter styles */
.links-list a[data-system] {
  position: relative;
}

.links-list a[data-system]:before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.links-list a[data-system]:hover:before {
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .emulator-container {
    width: 100%;
    max-width: 100%;
    padding: 3vh 4vw;
    min-height: auto;
  }
  
  .welcome-screen {
    padding: 4vh 5vw;
    max-width: 100%;
  }
  
  .welcome-screen h1 {
    font-size: 7vw;
    margin-bottom: 3vh;
  }
  
  .welcome-screen .lead {
    font-size: 4.2vw;
    margin-bottom: 5vh;
    line-height: 1.5;
  }
  
  .hero-cta {
    flex-direction: column;
    align-items: center;
    gap: 3vh;
    width: 100%;
  }
  
  .hero-cta .btn {
    width: 100%;
    max-width: 80vw;
    padding: 3vh 5vw;
    font-size: 4vw;
    border-radius: 2vw;
  }
  
  /* Game emulator mobile styles */
  #game {
    width: 100% !important;
    height: auto !important;
    max-width: calc(100vw - 8vw);
    aspect-ratio: 4/3;
    margin: 4vh auto;
    border-radius: 2vw;
    overflow: hidden;
  }
  
  #game canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 4/3;
    object-fit: contain;
    display: block;
    border: none;
    border-radius: 2vw;
  }
  
  #game iframe {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 4/3;
    border: none;
    border-radius: 2vw;
  }
  
  /* EmulatorJS specific mobile fixes */
  .ejs_container {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 4/3 !important;
  }
  
  .ejs_gameContainer {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4/3 !important;
  }
  
  /* Game modal mobile */
  .game-modal-content {
    width: 95vw;
    height: 90vh;
    margin: 2vh auto;
    max-height: calc(100vh - 4vh);
  }
  
  .games-grid {
    grid-template-columns: 1fr;
    padding: 3vh 4vw;
    gap: 2vh;
  }
  
  .game-card {
    padding: 3vh 4vw;
  }
  
  .search-container {
    flex-direction: column;
    gap: 2vh;
    padding: 3vh 4vw;
  }
  
  #game-search, #system-filter {
    width: 100%;
    min-width: auto;
    padding: 2vh 3vw;
    font-size: 4vw;
  }
  
  .modal-header h2 {
    font-size: 5vw;
  }
}

/* Portrait mobile optimization */
@media (max-width: 480px) and (orientation: portrait) {
  #game {
    aspect-ratio: 3/4;
    max-width: calc(100vw - 6vw);
  }
  
  #game canvas, #game iframe, .ejs_container, .ejs_gameContainer {
    aspect-ratio: 3/4 !important;
  }
  
  .welcome-screen h1 {
    font-size: 6vw;
  }
  
  .hero-cta .btn {
    max-width: 75vw;
  }
}

@media (max-width: 1000px) and (min-width: 769px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
