/* Cyber-Neon Game Theme */

:root {
  --primary: #ff007f;     /* Hot Pink */
  --secondary: #00f0ff;   /* Neon Cyan */
  --success: #00ff88;     /* Neon Green */
  --bg-dark: #0b071a;     /* Deep Space Blue */
  --bg-panel: rgba(18, 12, 38, 0.75);
  --border-neon: rgba(0, 240, 255, 0.4);
  --shadow-neon: 0 0 15px rgba(0, 240, 255, 0.5);
  --text-light: #f5f2ff;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Rajdhani', 'Orbitron', 'Segoe UI', sans-serif;
  color: var(--text-light);
}

/* Play Cover Page */
#play-cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1b0a33 0%, #06020c 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.5s ease;
}

.cover-content {
  text-align: center;
  max-width: 600px;
  padding: 30px;
  background: var(--bg-panel);
  border: 1px solid var(--border-neon);
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.25), inset 0 0 15px rgba(0, 240, 255, 0.1);
  backdrop-filter: blur(10px);
}

.logo-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #8a00ff);
  color: #fff;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 50px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 3px;
  text-shadow: 0 0 10px var(--primary), 0 0 20px rgba(255, 0, 127, 0.5);
  margin-bottom: 10px;
  background: linear-gradient(to right, #ff007f, #00f0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: #b0a4d4;
  margin-bottom: 30px;
  letter-spacing: 1px;
}

.main-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 25px;
}

.play-cover-btn {
  background: linear-gradient(95deg, var(--primary) 0%, #aa00ff 100%);
  border: none;
  color: white;
  padding: 16px 36px;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.play-cover-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.7);
  filter: brightness(1.1);
}

.play-cover-btn.sec-play {
  background: linear-gradient(95deg, #1b1236 0%, #2f1d5e 100%);
  border: 1px solid var(--border-neon);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

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

.cover-extra-btns {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
}

/* Guide / Info Section */
.powerups-guide {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  margin-top: 20px;
}

.powerups-guide h3 {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--secondary);
  margin-bottom: 15px;
}

.powerups-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
}

.powerup-desc {
  font-size: 0.95rem;
  color: #b0a4d4;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.dot.yellow { color: #ffe600; background-color: #ffe600; }
.dot.green { color: #00ff88; background-color: #00ff88; }
.dot.cyan { color: #00f0ff; background-color: #00f0ff; }
.dot.pink { color: #ff007f; background-color: #ff007f; }

/* Main Game Layout */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Cyber HUD Overlay */
#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.player-hud {
  background: var(--bg-panel);
  border: 1px solid var(--border-neon);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: var(--shadow-neon);
  backdrop-filter: blur(8px);
  min-width: 160px;
}

.p1-hud { border-left: 4px solid var(--primary); }
.p2-hud { border-left: 4px solid var(--secondary); }

.player-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.red-glow {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary);
}

.blue-glow {
  color: var(--secondary);
  text-shadow: 0 0 8px var(--secondary);
}

.score-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}

.score-label {
  color: #8c82ab;
}

.score-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
}

.vs-banner-hud {
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 24px;
  border-radius: 30px;
  min-width: 180px;
}

.vs-text {
  font-size: 0.9rem;
  letter-spacing: 3px;
  color: #ff007f;
  font-weight: 900;
}

.level-badge {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--success);
  text-shadow: 0 0 10px var(--success);
  margin: 2px 0;
}

.level-timer {
  font-size: 1.1rem;
  color: #fff;
  font-weight: bold;
}

.level-timer.low-time {
  color: #ff003c;
  text-shadow: 0 0 8px #ff003c;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* UI Overlay Control buttons */
#ui-layer {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
  z-index: 10;
}

.ui-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-neon);
  color: var(--text-light);
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-btn:hover {
  background: var(--secondary);
  color: var(--bg-dark);
  box-shadow: var(--shadow-neon);
  transform: translateY(-2px);
}

.input-badge {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(18, 12, 38, 0.8);
  border: 1px solid #00b4ff;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 180, 255, 0.2);
  pointer-events: none;
}

/* Modals */
#settings-modal, #save-modal, #ad-overlay, #game-over-modal, #round-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 2, 10, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.hidden {
  display: none !important;
}

.settings-card, .save-card, .ad-modal, .glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-neon);
  box-shadow: var(--shadow-neon);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
}

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

.settings-header h2, .save-header h2 {
  font-size: 1.3rem;
  color: var(--secondary);
  font-weight: 700;
}

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

.modal-close-btn:hover {
  color: var(--primary);
}

.settings-body, .save-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.device-selectors {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

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

.selector-row label {
  color: #b0a4d4;
  font-weight: 600;
}

.selector-row select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-neon);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  width: 60%;
  outline: none;
}

.swap-btn-icon {
  background: transparent;
  border: 1px dashed var(--border-neon);
  color: var(--secondary);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
  font-weight: bold;
}

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

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

.remapping-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.remapping-grid h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-top: 10px;
  margin-bottom: 5px;
}

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

.remap-row span {
  color: #b0a4d4;
}

.key-bind-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e0d8ff;
  padding: 6px 14px;
  border-radius: 4px;
  width: 120px;
  cursor: pointer;
  transition: all 0.2s;
}

.key-bind-btn:hover {
  border-color: var(--secondary);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.key-bind-btn.waiting-key {
  background: var(--primary);
  color: white;
  border-color: white;
  animation: keypulse 0.8s infinite alternate;
}

@keyframes keypulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.settings-footer, .save-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.sec-btn, .pri-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.sec-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #b0a4d4;
}

.sec-btn:hover {
  border-color: white;
  color: white;
}

.pri-btn {
  background: var(--secondary);
  border: none;
  color: var(--bg-dark);
}

.pri-btn:hover {
  box-shadow: var(--shadow-neon);
  filter: brightness(1.1);
}

/* Save Data Card Details */
.save-preview-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.save-preview-card p {
  color: #b0a4d4;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.save-preview-card strong {
  color: white;
}

.file-input-wrapper {
  margin-top: 15px;
}

.file-input-wrapper label {
  display: block;
  text-align: center;
  background: rgba(0, 240, 255, 0.1);
  border: 1px dashed var(--secondary);
  color: var(--secondary);
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.file-input-wrapper label:hover {
  background: var(--secondary);
  color: var(--bg-dark);
}

.file-input-wrapper input {
  display: none;
}

/* Ad System */
.ad-badge {
  background: #ffe600;
  color: black;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  border-radius: 4px;
}

.ad-close-btn {
  background: #333;
  color: #888;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
}

.ad-close-btn:not(:disabled) {
  background: var(--success);
  color: black;
  cursor: pointer;
}

.ad-body {
  height: 250px;
}

.ad-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0 0 16px 16px;
}

/* Round / Level Announcements */
#round-overlay {
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#round-announcement {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 5px;
  text-shadow: 0 0 20px var(--primary);
  color: white;
  animation: announce 0.8s ease-out;
}

@keyframes announce {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* Game Over Overlay styles */
#game-over-modal .glass-panel {
  padding: 40px;
  text-align: center;
  max-width: 440px;
}

#winner-announcement {
  font-size: 2.2rem;
  font-weight: 900;
  text-shadow: 0 0 12px var(--primary);
  margin-bottom: 10px;
  color: var(--primary);
}

.final-score-text {
  color: #b0a4d4;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

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

/* Mobile Touch Controls Overlay */
/* Mobile Touch Controls Overlay */
#mobile-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  display: none !important; /* Hide by default on desktop */
}

/* Show on touch devices or smaller screens */
@media (pointer: coarse), (max-width: 1024px) {
  #mobile-controls {
    display: block !important;
  }
}

#joystick-zone {
  position: absolute;
  bottom: 40px;
  left: 40px;
  width: 150px;
  height: 150px;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

#joystick-base {
  width: 110px;
  height: 110px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px dashed rgba(0, 240, 255, 0.5);
  border-radius: 50%;
  position: relative;
}

#joystick-knob {
  width: 46px;
  height: 46px;
  background: radial-gradient(circle, var(--secondary) 0%, #0099ff 100%);
  border-radius: 50%;
  position: absolute;
  top: 32px;
  left: 32px;
  box-shadow: 0 0 12px var(--secondary);
}

#touch-camera-zone {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.12);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#mobile-run-btn {
  position: absolute;
  bottom: 50px;
  right: 40px;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary) 0%, #aa00ff 100%);
  border-radius: 50%;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 1px;
  box-shadow: 0 0 15px rgba(255,0,127,0.5);
  color: white;
}
