/* ============================================
   BASE STYLES
   ============================================ */
body {
  font-family: "Orbitron", sans-serif;
  background-color: #0c0a1a;
  color: #00f6ff;
  overflow: hidden;
  letter-spacing: 0.1em;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

canvas {
  background: radial-gradient(circle, #1a1a3a, #0c0a1a);
  display: block;
}

.hidden {
  display: none !important;
}

.text-glow {
  text-shadow: 0 0 1px #00f6ff, 0 0 2px #00f6ff, 0 0 3px #ff00ff;
}

/* ============================================
   UI CONTAINER
   ============================================ */
#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  pointer-events: none;
  overflow-y: auto;
}

/* ============================================
   UI PANEL (Base)
   ============================================ */
.ui-panel {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  border-radius: 1.5rem;
  box-shadow: 0 0 30px rgba(128, 0, 128, 0.5);
  max-height: 90vh;
  overflow-y: auto;
  margin: 1rem;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   START SCREEN
   ============================================ */
.start-screen {
  max-width: 550px;
  width: 90%;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(20, 10, 40, 0.85) 100%);
  border: 2px solid rgba(128, 0, 255, 0.6);
  box-shadow: 0 0 40px rgba(128, 0, 255, 0.4), inset 0 0 20px rgba(0, 246, 255, 0.1);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.start-screen-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(128, 0, 255, 0.4);
  flex-shrink: 0;
}

.start-screen-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, #00f6ff 0%, #ff00ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.15em;
  white-space: nowrap;
  line-height: 1.2;
}

.start-screen-subtitle {
  font-size: 0.75rem;
  color: rgba(0, 246, 255, 0.7);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.start-screen-content {
  width: 100%;
  margin-bottom: 1.5rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.start-screen-content::-webkit-scrollbar {
  display: none;
}

.start-screen-section {
  margin-bottom: 1.5rem;
}

.start-screen-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ff00ff;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 0, 255, 0.3);
}

.section-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(0, 246, 255, 0.9);
  text-align: center;
  margin-bottom: 0;
}

.section-text .highlight {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.start-screen-footer {
  width: 100%;
  text-align: center;
  padding-top: 1rem;
  border-top: 2px solid rgba(128, 0, 255, 0.4);
  flex-shrink: 0;
}

/* ============================================
   CONTROLS SHOWCASE
   ============================================ */
.controls-showcase {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  width: 100%;
}

.control-showcase-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.keyboard-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.keyboard-row {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.key {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.4) 0%, rgba(255, 0, 255, 0.4) 100%);
  border: 2px solid rgba(255, 0, 255, 0.7);
  border-radius: 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.arrow-keys-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.arrow-keys-row {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.arrow-key {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.4) 0%, rgba(255, 0, 255, 0.4) 100%);
  border: 2px solid rgba(255, 0, 255, 0.7);
  border-radius: 0.4rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.control-separator {
  color: rgba(0, 246, 255, 0.7);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0;
}

.space-key {
  min-width: 200px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.4) 0%, rgba(255, 0, 255, 0.4) 100%);
  border: 2px solid rgba(255, 0, 255, 0.7);
  border-radius: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  letter-spacing: 0.1em;
}

.control-description {
  color: rgba(0, 246, 255, 0.9);
  font-size: 0.85rem;
  text-align: center;
  font-weight: 500;
}

/* ============================================
   BUTTONS
   ============================================ */
.start-button {
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.8) 0%, rgba(255, 0, 255, 0.8) 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.85rem 2.5rem;
  border: 2px solid rgba(255, 0, 255, 0.8);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.1);
  pointer-events: all;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.start-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(128, 0, 255, 1) 0%, rgba(255, 0, 255, 1) 100%);
}

.start-button:active {
  transform: scale(0.98);
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.1);
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */
.game-over-screen {
  border: 2px solid rgba(255, 0, 0, 0.6);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 0, 0, 0.9) 100%);
  box-shadow: 0 0 50px rgba(255, 0, 0, 0.5), inset 0 0 30px rgba(255, 0, 0, 0.1);
  padding: 2rem 2rem;
  min-width: 400px;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.game-over-title {
  font-size: 3.75rem;
  font-weight: 700;
  margin: 0;
  padding: 0;
  color: #ff0000;
  text-align: center;
  line-height: 1.2;
}

.game-over-score {
  font-size: 1.875rem;
  margin: 0;
  padding: 0;
  color: rgba(0, 246, 255, 0.9);
  text-align: center;
}

.final-score-value {
  color: #ffffff;
  font-weight: 700;
  display: inline-block;
  margin-left: 0.5rem;
}

/* ============================================
   IN-GAME UI DISPLAYS
   ============================================ */
.game-ui-container {
  position: absolute;
  top: 0.75rem;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  pointer-events: none;
  z-index: 100;
}

.game-ui-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
}

.game-ui-home {
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.6) 0%, rgba(255, 0, 255, 0.6) 100%);
  border: 2px solid rgba(255, 0, 255, 0.8);
  border-radius: 0.4rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.1);
  pointer-events: all;
  padding: 0;
  margin: 0;
  color: #ffffff;
  flex-shrink: 0;
}

.game-ui-home svg {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

.game-ui-home:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(255, 0, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(128, 0, 255, 0.8) 0%, rgba(255, 0, 255, 0.8) 100%);
}

.game-ui-home:active {
  transform: scale(0.95);
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.1);
}

.game-ui-score {
  font-size: 1.25rem;
  font-weight: 700;
  text-shadow: 0 0 1px #00f6ff;
  color: #00f6ff;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.game-ui-lives {
  font-size: 1.25rem;
  font-weight: 700;
  text-shadow: 0 0 1px #00f6ff;
  color: #00f6ff;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* ============================================
   MOBILE CONTROLLER
   ============================================ */
.mobile-controller {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  z-index: 1000;
  display: none;
}

.controller-outer {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.3),
    rgba(233, 175, 81, 0.1)
  );
  border: 2px solid rgba(233, 175, 81, 0.6);
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(233, 175, 81, 0.4),
    inset 0 0 20px rgba(233, 175, 81, 0.1);
}

.controller-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.8),
    rgba(233, 175, 81, 0.4)
  );
  border: 2px solid rgba(233, 175, 81, 0.9);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: all 0.1s ease;
  box-shadow: 0 0 15px rgba(233, 175, 81, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.controller-inner:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 0 25px rgba(233, 175, 81, 0.8),
    inset 0 0 15px rgba(255, 255, 255, 0.3);
}

.controller-inner.active {
  box-shadow: 0 0 30px rgba(233, 175, 81, 0.9),
    inset 0 0 20px rgba(255, 255, 255, 0.4);
  animation: controllerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes controllerPulse {
  0% {
    box-shadow: 0 0 30px rgba(233, 175, 81, 0.9),
      inset 0 0 20px rgba(255, 255, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 40px rgba(233, 175, 81, 1),
      inset 0 0 25px rgba(255, 255, 255, 0.6);
  }
}

.controller-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* ============================================
   FIRE BUTTON
   ============================================ */
.fire-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 255, 0.6),
    rgba(255, 0, 255, 0.3)
  );
  border: 2px solid rgba(255, 0, 255, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4),
    inset 0 0 15px rgba(255, 255, 255, 0.1);
  transition: all 0.1s ease;
}

.fire-button:active {
  transform: scale(0.95);
  box-shadow: 0 0 25px rgba(255, 0, 255, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.fire-button::before {
  content: "🔥";
  font-size: 24px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .mobile-controller,
  .fire-button {
    display: block;
  }

  .ui-panel {
    padding: 1.5rem;
    font-size: 0.9rem;
  }

  .start-screen {
    padding: 1.5rem 1.25rem;
    max-width: 95%;
  }

  .start-screen-title {
    font-size: 1.5rem;
  }

  .start-screen-subtitle {
    font-size: 0.65rem;
  }

  .section-title {
    font-size: 0.85rem;
  }

  .section-text {
    font-size: 0.8rem;
  }

  .key,
  .arrow-key {
    width: 35px;
    height: 35px;
    font-size: 0.85rem;
  }

  .arrow-key {
    font-size: 1rem;
  }

  .space-key {
    min-width: 150px;
    height: 40px;
    font-size: 0.75rem;
  }

  .control-description {
    font-size: 0.75rem;
  }

  .start-button {
    font-size: 0.9rem;
    padding: 0.65rem 1.75rem;
  }

  .game-over-screen {
    padding: 1.5rem 1.25rem;
    min-width: 90%;
    max-width: 95%;
    gap: 1rem;
  }

  .game-over-title {
    font-size: 2.5rem;
  }

  .game-over-score {
    font-size: 1.5rem;
  }
}
