@font-face {
  font-family: 'GothNerd'; 
  src: url('../fonts/ScienceGothic.ttf') format('truetype'); 
}

@font-face {
  font-family: 'SpaceLetters'; 
  src: url('../fonts/Orbitron-Bold.ttf') format('truetype'); 
}


#stars {
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            z-index: -10;
        }
.star {
            position: absolute;
            background: #fff;
            border-radius: 50%;
            box-shadow: 0 0 10px #fff;
            animation: twinkle 4s infinite;
        }
@keyframes twinkle {
            0%,100% { opacity: 0.4; transform: scale(1); }
            50%     { opacity: 1; transform: scale(1.4); }
        }

body { 
  margin: 0; 
  background: #000; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  min-height: 100vh; 
  font-family: 'SpaceLetters', sans-serif; 
}

canvas { 
  border: 5px solid transparent;
  border-image: linear-gradient(45deg, var(--AquaAura),var(--NuclearFuscia)) 1;
  box-shadow: 0 10px 60px var(--PlasmaGlow3);
  cursor: pointer;
  max-width: 100%;
  height: auto !important;
  display: block;
  flex-shrink: 0;
  margin: 0 auto;
}

body.has-tester-open {
  padding-bottom: 120px;
}

#toggleTester {
  position: fixed;
  bottom: 15px;
  right: 20px;
  background: #000;
  color: #00ffff;
  border: 2px solid #00ffff;
  padding: 5px 10px;
  font-family: 'SpaceLetters', sans-serif;
  font-size: 14px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 0 20px #00ffff;
  transition: all 0.3s;
  border-radius: 8px;
}

#toggleTester:hover { 
  background: #00ffff; 
  color: #000;
  transform: scale(1.05);
}

#spriteTester {
  background: rgba(10, 10, 30, 0.95);
  border: 3px solid #00ffff;
  box-shadow: 0 0 30px #00ffff;
  padding: 20px;
  margin: 20px auto;
  margin-top:50px;
  width: 90%;
  max-width: 600px;
  color: #00ffff;
  border-radius: 8px;
  display: none;
  z-index: 99;
}

#spriteTester h1 {
  text-align: center;
  font-family: 'GothNerd', sans-serif;
  color: var(--NuclearFuscia);
  text-shadow: 0 0 30px var(--ParticlePink);
  font-size: 50px;
  font-weight: 900;
}

#spriteTester h2 {
  text-align: center;
  margin-top: 20px;
  font-family: 'GothNerd', sans-serif;
  color: #ffffff;
  text-shadow: 0 0 10px #0ff;
}

#spriteTester label {
  display: block;
  margin: 20px 0 4px;
  font-family: 'GothNerd', sans-serif;
  color: #00ffff;
}

#spriteTester input, 
#spriteTester select {
  width: 100%;
  padding: 10px;
  background: #111;
  border: 2px solid #00ffff;
  color: #0ff;
  font-family: 'GothNerd', sans-serif;
  border-radius: 6px;
  margin-top: 4px;
}

#buttonContainer {
  font-family: 'GothNerd', sans-serif;
  border-radius: 20px;
  align-items:center !important;
  text-align: center !important;
  padding-bottom: 20px;
}

#buttonContainer button {
  width: 50%;
  padding: 20px;
  background: #000;
  cursor: pointer;
  transition: 0.3s;
  color: var(--AlphaAqua);
  font-family: 'SpaceLetters';
  font-size: 20px;
  border-radius: 20px;
  border: 2px solid var(--AlphaAqua);
  box-shadow: 0 0 10px var(--AtomicAqua);
}

#buttonContainer button:hover {
  background: #67FEBD;
  color: #000;
  box-shadow: 0 0 30px var(--AtomicAqua);
}

#container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0 4px;
  padding: 20px;
  font-family: 'SpaceLetters';
  color: var(--NuclearFuscia);
  border: 2px solid var(--NuclearFuscia);
  box-shadow: 0 0 15px var(--NuclearFuscia);
  border-radius: 30px;
  text-align: center;
  min-height: 200px; 
}

#container h1 {
  color: var(--NuclearFuscia); 
  font-size: 25px; 
  margin-top: 10px; 
  text-align: center !important;
  font-family: 'SpaceLetters';
}

#status { 
  color: var(--AtomicAqua); 
  font-size: 20px; 
  margin-top: 10px; 
  text-align: center; 
  font-family: 'SpaceLetters', sans-serif;
}

#error { 
  color: #ff4444; 
  font-size: 16px; 
  margin-top: 10px; 
  text-align: center; 
  display: none;
  font-family: 'GothNerd', sans-serif;
  padding: 10px;
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid #ff4444;
  border-radius: 6px;
}

#mobileControls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 30, 0.95);
  border-top: 3px solid #00ffff;
  padding: 15px;
  z-index: 200;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-height: 40vh;
  overflow-y: auto;
}

.mobile-btn {
  background: #000;
  color: #00ffff;
  border: 2px solid #00ffff;
  padding: 12px 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 10px #00ffff;
  transition: all 0.2s;
  min-width: 80px;
  text-align: center;
  border-radius: 6px;
}

.mobile-btn:active {
  background: #00ffff;
  color: #000;
  transform: scale(0.95);
}

.mobile-btn.custom {
  background: #000;
  color: #67FEBD;
  border-color: #67FEBD;
  box-shadow: 0 0 10px #67FEBD;
}

.mobile-btn.custom:active {
  background: #67FEBD;
  color: #000;
}

#mobileControlsToggle {
  bottom: 20px;
  right: 20px;
  background: #000;
  color: var(--NuclearFuscia);
  border: 3px solid var(--NuclearFuscia);
  box-shadow: 0 0 30px var(--NuclearFuscia);
  z-index: 201;
}

#Ufo {
  width: 120px !important;
  height: auto;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto 15px auto; 
}

.JS-page {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.Game-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
  z-index: 10;
}

@media (min-width: 769px) {
  canvas {
    width: 800px !important;
    height: 400px !important;
  }
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  canvas {
    width: auto !important;  
    height: auto !important;
    max-width: 100vw;  
    max-height: 60vh;
    border: 3px solid #00ffff;
    margin: 0 auto;
  }

  .Game-content {
    margin-top: 150px;
    width: 100%;
    padding: 0;
  }

  .JS-page {
    width: 100vw;
    padding: 0;
    margin: 0;
  }
}

#mobileControls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 30, 0.98);
  border-top: 3px solid #00ffff;
  padding: 12px 8px;
  z-index: 200;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-height: 35vh;
  overflow-y: auto;
  box-shadow: 0 -5px 20px rgba(0, 255, 255, 0.3);
}

.mobile-btn {
  background: #000;
  color: #00ffff;
  border: 2px solid #00ffff;
  padding: 10px 14px;
  font-family: 'Orbitron', 'SpaceLetters', sans-serif;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 10px #00ffff;
  transition: all 0.2s;
  min-width: 70px;
  text-align: center;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-btn:active {
  background: #00ffff;
  color: #000;
  transform: scale(0.92);
  box-shadow: 0 0 20px #00ffff;
}

.mobile-btn.custom {
  background: #000;
  color: #67FEBD;
  border-color: #67FEBD;
  box-shadow: 0 0 10px #67FEBD;
  font-weight: 900;
}

.mobile-btn.custom:active {
  background: #67FEBD;
  color: #000;
  box-shadow: 0 0 20px #67FEBD;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  #mobileControls {
    display: flex;
  }
}

@media (max-width: 768px) {
  #toggleTester {
    display: none !important;
  }
  #spriteTester {
    display: none !important;
  }
  body.has-tester-open {
    padding-bottom: 0;
  }
  #toggleTester {
    position: fixed;
    bottom: auto;
    top: 70px;
    right: 10px;
    font-size: 12px;
    padding: 8px 12px;
    z-index: 150;
  }
  #spriteTester {
    width: 95%;
    padding: 15px;
    margin: 10px auto;
  }
  #spriteTester h1 {
    font-size: 32px;
  }
  #spriteTester h2 {
    font-size: 18px;
  }
  #container {
    padding: 15px;
    min-height: 150px;
  }
  #Ufo {
    width: 80px !important;
  }
  .floating-back-to-top {
    bottom: 140px;
    right: 15px;
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  button, .mobile-btn {
    touch-action: manipulation;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  canvas {
    width: auto !important; 
    height: auto !important;
    max-width: 100vw; 
    max-height: 60vh;  
    margin: 0 auto;
  }
  #mobileControls {
    max-height: 30vh;
    padding: 8px 6px;
  }
  .mobile-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 60px;
  }
}

.desktop-controls-wrapper {
  display: none;
  margin: auto;
  margin-top: 0px;
  max-width: 1200px;
  padding: 0 10px;
  pointer-events: none; 
}

.controls-column {
  width: 200px;
  background: rgba(10, 10, 30, 0.92);
  border: 2px solid var(--AquaAura);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 
    0 0 25px var(--AuraGlow3),
    inset 0 0 15px rgba(0, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  font-family: 'GothNerd', sans-serif;
  pointer-events: auto; 
  margin-top:50px;
}

.controls-column h3 {
  margin: 0 0 14px 0;
  font-size: 20px;
  text-align: center;
  background: linear-gradient(90deg, var(--NuclearFuscia), var(--AlphaAqua));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px var(--ParticlePink);
  font-family: 'SpaceLetters';
}

.left-column   { float: left;  }
.right-column  { float: right; }

.ctrl-item {
  background: rgba(0, 255, 255, 0.07);
  padding: 0px 0px;
  margin: 5px 0;
  font-size: 16px;
  font-family: Arial, Helvetica, sans-serif;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ctrl-item:hover {
  background: rgba(103, 254, 189, 0.25);
  border-color: var(--AlphaAqua);
  box-shadow: 0 0 20px var(--AlphaGlow2);
}

.ctrl-item kbd {
  background: #000;
  color: var(--NuclearFuscia);
  border: 0.5px solid var(--NuclearFuscia);
  padding: 3px 3px;
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  min-width: 28px;
  text-align: center;
  box-shadow: 0 0 12px var(--NuclearGlow2);
}

.desktop-controls-wrapper::after {
  content: "";
  display: table;
  clear: both;
}

@media (min-width: 769px) {
  .desktop-controls-wrapper {
    display: block;
  }
}

@media (max-width: 768px) {
  .desktop-controls-wrapper {
    display: none !important;
  }
}


#desktopMobileToggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #000;
  color: var(--NuclearFuscia);
  border: 3px solid var(--NuclearFuscia);
  padding: 12px 18px;
  font-family: 'GothNerd', sans-serif;
  font-size: 14px;
  cursor: pointer;
  z-index: 201;
  box-shadow: 0 0 30px var(--NuclearFuscia);
  border-radius: 50px;
  display: none;
  transition: all 0.3s;
}

#desktopMobileToggle:hover {
  background: var(--NuclearFuscia);
  color: #000;
  transform: scale(1.05);
}

@media (min-width: 769px) {
  #mobileControls.visible-on-desktop ~ #desktopMobileToggle {
    display: block;
  }
}