:root {
  --neon-red: #ff3366;
  --neon-blue: #00f0ff;
  --neon-yellow: #ffea00;
  --neon-green: #39ff14;
  --neon-purple: #bd00ff;
  --neon-white: #ffffff;
  --bg-dark: #070714;
  --panel-bg: rgba(13, 13, 35, 0.75);
  --panel-border: rgba(255, 255, 255, 0.1);
  --modal-overlay: rgba(5, 5, 15, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: 'Rajdhani', sans-serif;
}

body, html {
  background-color: var(--bg-dark);
  color: #fff;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: -webkit-fill-available;
}

.hidden {
  display: none !important;
}

/* Play Cover */
#play-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #14143a 0%, #070714 100%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}

#play-cover.hidden {
  opacity: 0;
  pointer-events: none;
}

.cover-content {
  text-align: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(15px);
  padding: 50px;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo-badge {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 3px;
  color: var(--neon-blue);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  border: 1px solid var(--neon-blue);
  padding: 4px 12px;
  border-radius: 20px;
}

#play-cover h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(to right, var(--neon-red), var(--neon-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  letter-spacing: 1px;
}

.main-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  margin-top: 10px;
}

.play-cover-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(45deg, var(--neon-red), var(--neon-blue));
  border: none;
  border-radius: 30px;
  padding: 14px 40px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 2px;
}

.play-cover-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 35px rgba(255, 51, 102, 0.5);
}

.play-cover-btn.sec-play {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.play-cover-btn.sec-play:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.cover-extra-btns {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

/* Game Canvas container */
#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* HUD Overlay */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 90px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  pointer-events: none;
}

.player-hud {
  display: flex;
  flex-direction: column;
  width: 220px;
  padding: 10px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  border-radius: 12px;
}

.p1-hud {
  border-left: 4px solid var(--neon-red);
}

.p2-hud {
  border-right: 4px solid var(--neon-blue);
  align-items: flex-end;
  text-align: right;
}

.player-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.red-glow {
  color: var(--neon-red);
  text-shadow: 0 0 8px rgba(255, 51, 102, 0.8);
}

.blue-glow {
  color: var(--neon-blue);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}

.score-container {
  margin-top: 3px;
  font-size: 1rem;
  font-weight: 700;
}

.score-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  margin-left: 4px;
}

.p1-hud .score-value { color: var(--neon-red); }
.p2-hud .score-value { color: var(--neon-blue); }

.powerup-badge-container {
  height: 22px;
  margin-top: 4px;
  display: flex;
  align-items: center;
}

.p2-hud .powerup-badge-container {
  justify-content: flex-end;
}

.powerup-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.powerup-badge.hidden {
  display: none;
}

.powerup-badge.growth { background: rgba(255, 234, 0, 0.2); border: 1px solid var(--neon-yellow); color: var(--neon-yellow); }
.powerup-badge.speed { background: rgba(57, 255, 20, 0.2); border: 1px solid var(--neon-green); color: var(--neon-green); }
.powerup-badge.push { background: rgba(189, 0, 255, 0.2); border: 1px solid var(--neon-purple); color: var(--neon-purple); }
.powerup-badge.shield { background: rgba(255, 255, 255, 0.2); border: 1px solid var(--neon-white); color: var(--neon-white); }
.powerup-badge.shockwave { background: rgba(255, 128, 0, 0.2); border: 1px solid #ff8000; color: #ff8000; }
.powerup-badge.tackle { background: rgba(255, 51, 102, 0.2); border: 1px solid #ff3366; color: #ff3366; }
.powerup-badge.anchor { background: rgba(0, 240, 255, 0.2); border: 1px solid #00f0ff; color: #00f0ff; }

/* VS Banner & Timer HUD */
.vs-banner-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.5);
  padding: 8px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

.vs-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--neon-red), var(--neon-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.level-badge {
  font-size: 0.9rem;
  color: var(--neon-yellow);
  font-weight: 700;
  letter-spacing: 1px;
}

.level-timer {
  font-size: 0.85rem;
  opacity: 0.8;
  font-weight: 700;
}

/* UI Action Button Layer */
#ui-layer {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 0 20px;
  pointer-events: none;
}

.input-badge {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-right: auto;
}

.ui-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(5px);
  pointer-events: auto;
  transition: background 0.2s, border 0.2s;
}

.ui-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.cover-sub-btn {
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: 20px;
}

/* Modals styling */
#save-modal, #settings-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  z-index: 1500;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.25s ease;
}

#save-modal.hidden, #settings-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.settings-card {
  background: rgba(13, 13, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  width: 90%;
  max-width: 550px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

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

.settings-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 1px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #fff;
}

.settings-body {
  padding: 25px;
  overflow-y: auto;
  max-height: 400px;
}

.save-status-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.save-status-box h3 {
  font-size: 1.05rem;
  opacity: 0.7;
}

.save-status-box p {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-green);
}

.pri-btn {
  background: var(--neon-blue);
  color: #070714;
  font-weight: 900;
  font-size: 1rem;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.pri-btn:hover {
  box-shadow: 0 0 15px var(--neon-blue);
}

.modal-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 20px 0;
}

.save-file-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.save-file-actions h3 {
  font-size: 1.05rem;
  opacity: 0.7;
}

.action-buttons-row {
  display: flex;
  gap: 12px;
}

.sec-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 15px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.sec-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.file-label {
  cursor: pointer;
}

.hidden-input {
  display: none;
}

/* Device Selectors */
.device-selectors {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selector-row label {
  font-weight: 700;
  font-size: 1rem;
}

.selector-row select {
  background: #0f0f2a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 250px;
}

.swap-btn-icon {
  align-self: center;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--neon-blue);
  padding: 6px 16px;
  border-radius: 15px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 5px;
}

.swap-btn-icon:hover {
  background: rgba(0, 240, 255, 0.1);
}

/* Remapping Grid */
.remapping-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.remapping-grid h3 {
  font-size: 1.05rem;
  color: var(--neon-red);
  margin-top: 10px;
}

.remapping-grid h3.p2-bind-header {
  color: var(--neon-blue);
}

.remap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remap-row span {
  font-weight: 500;
}

.key-bind-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  min-width: 100px;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.key-bind-btn.waiting {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  animation: keybind-flash 0.8s infinite alternate;
}

.settings-footer {
  padding: 15px 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

/* AD OVERLAY */
#ad-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}

.ad-modal {
  width: 90%;
  max-width: 800px;
  height: 80%;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.ad-badge {
  font-size: 0.85rem;
  letter-spacing: 2px;
  opacity: 0.6;
  text-transform: uppercase;
}

.ad-close-btn {
  background: var(--neon-blue);
  color: black;
  border: none;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.ad-close-btn:disabled {
  background: #333;
  color: #777;
  cursor: not-allowed;
}

.ad-body {
  flex: 1;
}

.ad-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Round overlays and transitions */
#round-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.15);
  pointer-events: none;
}

#round-announcement {
  font-family: 'Orbitron', sans-serif;
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  animation: pop 0.4s ease forwards;
}

/* Game over modal */
#game-over-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5,5,15,0.92);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-over-modal.hidden {
  display: none;
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(15px);
  padding: 50px;
  border-radius: 24px;
  text-align: center;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#winner-announcement {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.final-score-text {
  font-size: 1.1rem;
  opacity: 0.7;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

@keyframes keybind-flash {
  from { border-color: rgba(255, 255, 255, 0.1); }
  to { border-color: var(--neon-yellow); }
}

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Virtual Joysticks for Mobile */
#joysticks-container {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 100%;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 50;
}

.joystick-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.joystick-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.8;
  text-shadow: 0 0 5px currentColor;
}

.joystick-label.p1-label { color: var(--neon-red); }
.joystick-label.p2-label { color: var(--neon-blue); }

.joystick-outer {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  position: relative;
  touch-action: none;
}

.joystick-handle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 15px currentColor;
  transition: transform 0.05s ease;
}

#handle-p1 {
  background: radial-gradient(circle at center, #ff8da6 0%, var(--neon-red) 100%);
  color: var(--neon-red);
}

#handle-p2 {
  background: radial-gradient(circle at center, #8df6ff 0%, var(--neon-blue) 100%);
  color: var(--neon-blue);
}

/* Mobile & Small Screen Responsive Overrides */
@media (max-width: 1024px) {
  #hud {
    padding: 0 15px;
    height: 80px;
  }
  .player-hud {
    width: 160px;
    padding: 8px 12px;
  }
  .player-name {
    font-size: 0.95rem;
  }
  .score-container {
    font-size: 0.85rem;
  }
  .vs-text {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  #play-cover h1 {
    font-size: 2.2rem;
  }
  .subtitle {
    font-size: 0.95rem;
  }
  .cover-content {
    padding: 30px 20px;
    gap: 15px;
  }
  .play-cover-btn {
    font-size: 1.1rem;
    padding: 12px 30px;
  }
  .instructions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .instruction-card {
    padding: 12px;
  }
  .powerups-list {
    font-size: 0.8rem;
    justify-content: center;
  }

  /* HUD layout adjustment */
  #hud {
    padding: 10px;
    height: auto;
    align-items: flex-start;
  }
  .vs-banner-hud {
    padding: 4px 10px;
  }
  .vs-text {
    font-size: 1.1rem;
  }
  .level-badge, .level-timer {
    font-size: 0.75rem;
  }

  /* Lower UI button layer */
  #ui-layer {
    display: none !important;
  }
  .input-badge {
    display: none; /* Hide device status text on small mobile screens */
  }
  .ui-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  /* Joystick responsive placement */
  #joysticks-container {
    bottom: 65px;
    padding: 0 20px;
  }
  .joystick-outer {
    width: 90px;
    height: 90px;
  }
  .joystick-handle {
    width: 38px;
    height: 38px;
  }
  
  /* Modals sizing */
  .settings-card {
    width: 95%;
    max-height: 90%;
  }
  .settings-body {
    padding: 15px;
  }
  .remapping-grid {
    font-size: 0.9rem;
  }
}

/* Mobile Landscape Compact UI fixes */
@media (max-height: 480px) and (orientation: landscape) {
  #hud {
    height: 44px;
    padding: 2px 10px;
    top: 5px;
    align-items: center;
  }
  
  .player-hud {
    width: 120px;
    padding: 4px 10px;
    border-radius: 8px;
  }
  
  .player-name {
    font-size: 0.8rem;
  }
  
  .score-container {
    font-size: 0.75rem;
    margin-top: 0;
  }
  
  .vs-banner-hud {
    padding: 2px 8px;
    gap: 0;
  }
  
  .vs-text {
    font-size: 0.95rem;
  }
  
  .level-badge, .level-timer {
    font-size: 0.65rem;
  }
  
  .powerup-badge-container {
    display: none; /* Hide powerup badge in HUD on landscape to save space */
  }



  /* Compact Joysticks */
  #joysticks-container {
    bottom: 12px;
    padding: 0 15px;
  }
  
  .joystick-outer {
    width: 75px;
    height: 75px;
  }
  
  .joystick-handle {
    width: 30px;
    height: 30px;
  }
  
  .joystick-label {
    font-size: 0.65rem;
    letter-spacing: 1px;
  }
  
  /* Modal optimization for landscape */
  .settings-card {
    max-height: 95%;
    width: 90%;
  }
  
  .settings-body {
    padding: 10px 20px;
    max-height: 200px;
  }
}

/* Powerups Supplement Guide on Cover */
.powerups-guide {
  margin-top: 25px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  width: 100%;
  max-width: 580px;
}

.powerups-guide h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 2px;
  margin-bottom: 12px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 234, 0, 0.4);
}

.powerups-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
}

.powerup-desc {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.dot.yellow { color: var(--neon-yellow); background: var(--neon-yellow); }
.dot.green { color: var(--neon-green); background: var(--neon-green); }
.dot.purple { color: var(--neon-purple); background: var(--neon-purple); }
.dot.white { color: var(--neon-white); background: var(--neon-white); }
.dot.orange { color: #ff8000; background: #ff8000; }
.dot.red { color: #ff3366; background: #ff3366; }
.dot.cyan { color: #00f0ff; background: #00f0ff; }



