@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --bg-color: #0b0816;
  --panel-bg: #130f26;
  --crt-tint: rgba(18, 16, 30, 0.15);
  
  --neon-pink: #ff007f;
  --neon-cyan: #00f0ff;
  --neon-purple: #bd00ff;
  --neon-green: #39ff14;
  --neon-amber: #ffbd00;
  --neon-red: #ff3333;
  
  --glow-pink: 0 0 10px rgba(255, 0, 127, 0.6), 0 0 20px rgba(255, 0, 127, 0.3);
  --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.6), 0 0 20px rgba(0, 240, 255, 0.3);
  --glow-purple: 0 0 10px rgba(189, 0, 255, 0.6), 0 0 20px rgba(189, 0, 255, 0.3);
  --glow-green: 0 0 10px rgba(57, 255, 20, 0.6), 0 0 20px rgba(57, 255, 20, 0.3);
  
  --font-display: 'Orbitron', sans-serif;
  --font-text: 'Rajdhani', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 50% 20%, #1c103a 0%, transparent 50%),
    radial-gradient(circle at 10% 80%, #081e35 0%, transparent 40%);
  color: #e2e8f0;
  font-family: var(--font-text);
  font-size: 1.1rem;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  padding: 20px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--neon-purple);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-pink);
}

/* Header & Setup Details */
header {
  text-align: center;
  margin-bottom: 25px;
  width: 100%;
  max-width: 1200px;
  position: relative;
}

.title-container {
  display: inline-block;
  position: relative;
}

h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: var(--glow-pink);
  margin-bottom: 5px;
  animation: titlePulse 2s infinite alternate;
}

h1 span {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.subtitle {
  font-size: 1.2rem;
  color: #a0aec0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Controls Panel */
.global-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--neon-purple);
  color: #fff;
  padding: 8px 15px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon:hover {
  background: var(--neon-purple);
  box-shadow: var(--glow-purple);
  transform: translateY(-2px);
}

/* Arcade Cabinet Container */
.cabinet-wrapper {
  background: linear-gradient(180deg, #1f1a3a 0%, #0c0818 100%);
  border: 4px solid #3d2f75;
  border-radius: 20px;
  padding: 15px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(189, 0, 255, 0.15);
  width: 100%;
  max-width: 1000px;
  position: relative;
}

.cabinet-header {
  height: 30px;
  background: #231c42;
  border-bottom: 2px solid #3d2f75;
  margin: -15px -15px 15px -15px;
  border-radius: 15px 15px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.cabinet-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-red);
}
.dot:nth-child(2) { background: var(--neon-amber); }
.dot:nth-child(3) { background: var(--neon-green); }

.marquee-text {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 1px;
}

/* Screen Wrapper (CRT effect) */
.screen-wrapper {
  position: relative;
  background-color: #05020a;
  border: 10px solid #1a162b;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,1);
}

/* CRT Screen Scanline Overlay */
.screen-wrapper::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.04));
  z-index: 10;
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
}

.screen-wrapper::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: radial-gradient(circle, transparent 65%, rgba(0,0,0,0.5) 100%);
  z-index: 9;
  pointer-events: none;
}

/* Main Dashboard / Selector Screen */
.game-screen {
  min-height: 550px;
  padding: 30px;
  display: none; /* Controlled by JS */
  position: relative;
}

.game-screen.active {
  display: flex;
  flex-direction: column;
}

/* Dashboard Home */
#screen-dashboard {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.welcome-msg {
  margin-bottom: 40px;
}

.welcome-msg h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.welcome-msg p {
  color: #a0aec0;
  max-width: 600px;
  margin: 0 auto;
}

.game-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  width: 100%;
  max-width: 900px;
}

.game-card {
  background: var(--panel-bg);
  border: 2px solid var(--neon-purple);
  border-radius: 12px;
  padding: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 4px;
  background: var(--neon-purple);
  transition: all 0.3s ease;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(189, 0, 255, 0.2);
  border-color: var(--neon-cyan);
}

.game-card:hover::before {
  background: var(--neon-cyan);
}

.game-card-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  animation: float 3s ease-in-out infinite;
}

.game-card:nth-child(2) .game-card-icon { animation-delay: 0.5s; }
.game-card:nth-child(3) .game-card-icon { animation-delay: 1s; }

.game-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: #fff;
}

.game-card p {
  font-size: 0.95rem;
  color: #cbd5e1;
  flex-grow: 1;
}

.btn-play {
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: var(--font-display);
  padding: 8px 20px;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-card:hover .btn-play {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: var(--glow-cyan);
}

/* Common Game Overlays / Interfaces */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.btn-back {
  background: transparent;
  border: 1px solid #a0aec0;
  color: #a0aec0;
  font-family: var(--font-display);
  padding: 6px 15px;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back:hover {
  border-color: #fff;
  color: #fff;
}

.game-stats {
  display: flex;
  gap: 20px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.stat-item span {
  color: var(--neon-cyan);
  font-weight: bold;
}

/* GAME 1: PROTOCOL DEFENDER (SHOOTER) */
#defender-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.prompt-bar {
  background: rgba(189, 0, 255, 0.15);
  border: 1px dashed var(--neon-purple);
  border-radius: 8px;
  padding: 12px 20px;
  width: 100%;
  max-width: 800px;
  text-align: center;
  margin-bottom: 15px;
  box-shadow: inset 0 0 10px rgba(189, 0, 255, 0.2);
}

.prompt-bar span {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--neon-pink);
  letter-spacing: 2px;
  font-family: var(--font-display);
}

.prompt-text {
  font-size: 1.4rem;
  color: #fff;
  font-weight: 700;
  margin-top: 5px;
}

#defender-canvas {
  background: #04010a;
  border: 2px solid #231c42;
  border-radius: 8px;
  max-width: 100%;
  display: block;
}

.canvas-instructions {
  color: #a0aec0;
  font-size: 0.9rem;
  margin-top: 10px;
  text-align: center;
}

/* GAME 2: NETMATCH */
.match-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
  margin-top: 15px;
}

.match-card {
  height: 120px;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}

.match-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  font-weight: bold;
}

.card-front {
  background: linear-gradient(135deg, #181333 0%, #0c081e 100%);
  border: 2px solid var(--neon-purple);
  color: var(--neon-purple);
  box-shadow: inset 0 0 15px rgba(189, 0, 255, 0.2);
}

.card-front::after {
  content: "?";
  font-family: var(--font-display);
  font-size: 2rem;
  text-shadow: var(--glow-purple);
}

.card-back {
  background: #19143a;
  border: 2px solid var(--neon-cyan);
  color: #fff;
  transform: rotateY(180deg);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--glow-cyan);
}

.match-card.matched .card-back {
  border-color: var(--neon-green);
  color: var(--neon-green);
  box-shadow: var(--glow-green);
  opacity: 0.6;
}

/* GAME 3: PORT SPEEDRUN */
.speedrun-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.speedrun-timer-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.speedrun-timer-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: var(--glow-cyan);
  transition: width 0.1s linear;
}

.speedrun-question-card {
  background: var(--panel-bg);
  border: 2px solid var(--neon-purple);
  border-radius: 12px;
  padding: 40px 30px;
  text-align: center;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-bottom: 30px;
  position: relative;
}

.speedrun-question-label {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--neon-purple);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 4px 15px;
  border-radius: 15px;
  letter-spacing: 1px;
}

.speedrun-question {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.speedrun-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
}

.option-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid #3d2f75;
  color: #fff;
  padding: 18px 20px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-text);
  text-align: center;
}

.option-btn:hover {
  background: rgba(189, 0, 255, 0.15);
  border-color: var(--neon-purple);
  transform: translateY(-2px);
}

.option-btn.correct {
  background: rgba(57, 255, 20, 0.25) !important;
  border-color: var(--neon-green) !important;
  color: var(--neon-green);
  box-shadow: var(--glow-green);
}

.option-btn.wrong {
  background: rgba(255, 51, 83, 0.25) !important;
  border-color: var(--neon-red) !important;
  color: #ff8080;
}

/* Modals & Dialogs */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 2, 10, 0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: linear-gradient(135deg, #1a1435 0%, #0d0822 100%);
  border: 3px solid var(--neon-pink);
  box-shadow: var(--glow-pink);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: modalScale 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-content h3 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.modal-score {
  font-family: var(--font-display);
  font-size: 2.8rem;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  margin: 15px 0;
}

.modal-content p {
  color: #cbd5e1;
  margin-bottom: 25px;
}

.btn-arcade {
  background: var(--neon-pink);
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-arcade:hover {
  background: #ff3399;
  box-shadow: var(--glow-pink);
  transform: scale(1.05);
}

/* Animations */
@keyframes titlePulse {
  0% {
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.5), 0 0 20px rgba(255, 0, 127, 0.2);
  }
  100% {
    text-shadow: 0 0 15px rgba(255, 0, 127, 0.8), 0 0 30px rgba(255, 0, 127, 0.4), 0 0 40px rgba(255, 0, 127, 0.2);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes modalScale {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Responsive adjust */
@media(max-width: 768px) {
  h1 { font-size: 2rem; }
  .match-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .speedrun-options {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 480px) {
  .match-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
