/* ============================================================
   abc-Musica — Estilos de Interfaz Ciberpunk y Neon
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Inter:wght@300;400;600;700&display=swap');

:root {
  --radius: 16px;
  --panel-radius: 24px;
  
  /* Paleta Neon Ciberpunk */
  --bg-deep: #080310;
  --bg-panel: rgba(20, 10, 36, 0.75);
  --border-glow: rgba(255, 255, 255, 0.08);
  
  --neon-cyan: #00ffff;
  --neon-pink: #ff00ff;
  --neon-yellow: #ffff00;
  --neon-red: #ff3333;
  --ink-light: #f3ecff;
  --on-primary: #000;
  
  --font-title: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  
  --shadow-neon-pink: 0 0 15px rgba(255, 0, 255, 0.6);
  --shadow-neon-cyan: 0 0 15px rgba(0, 255, 255, 0.6);
  --glass: rgba(32, 16, 56, 0.55);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 50% 30%, #1c0e35 0%, var(--bg-deep) 75%);
  color: var(--ink-light);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Barra Superior (Topbar) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(8, 3, 16, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 0, 255, 0.15);
}

.topbar .title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
}

.btn-cyber {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 0, 255, 0.35);
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-cyber:hover {
  background: var(--neon-pink);
  color: var(--on-primary);
  border-color: #fff;
  box-shadow: var(--shadow-neon-pink);
  transform: translateY(-2px);
}

.btn-cyber:active {
  transform: translateY(0);
}

.btn-cyber.cyan {
  border-color: rgba(0, 255, 255, 0.35);
}

.btn-cyber.cyan:hover {
  background: var(--neon-cyan);
  color: var(--on-primary);
  box-shadow: var(--shadow-neon-cyan);
}

.btn-cyber.is-off {
  opacity: 0.4;
  background: rgba(255, 255, 255, 0.02);
  color: #888;
  border-color: #444;
  box-shadow: none;
}

/* ---------- Menú Principal ---------- */
main {
  padding: 30px 16px 60px;
  max-width: 1000px;
  margin: 0 auto;
}

.setup-card {
  background: var(--bg-panel);
  border-radius: var(--panel-radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 0, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 40px 30px;
  max-width: 650px;
  margin: 20px auto;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.setup-card::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(135deg, var(--neon-pink), transparent, var(--neon-cyan));
  z-index: -1;
  border-radius: calc(var(--panel-radius) + 2px);
  opacity: 0.15;
}

.setup-title {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.setup-sub {
  margin: 0 0 30px;
  color: #a595c5;
  font-size: 1.05rem;
  line-height: 1.5;
}

.input-container {
  margin-bottom: 24px;
}

.setup-label {
  margin: 0 0 10px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-name {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid rgba(255, 0, 255, 0.3);
  border-radius: var(--radius);
  padding: 14px 20px;
  width: min(360px, 100%);
  outline: none;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
}

.input-name:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.25), inset 0 2px 8px rgba(0,0,0,0.5);
}

/* ---------- Selección de Pistas ---------- */
.track-selection {
  margin-top: 35px;
  text-align: left;
}

.track-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 15px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.track-list::-webkit-scrollbar {
  width: 6px;
}
.track-list::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}
.track-list::-webkit-scrollbar-thumb {
  background: rgba(255,0,255,0.25);
  border-radius: 3px;
}
.track-list::-webkit-scrollbar-thumb:hover {
  background: var(--neon-pink);
}

.track-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.track-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 255, 255, 0.3);
  transform: translateX(3px);
}

.track-item.selected {
  background: rgba(255, 0, 255, 0.08);
  border-color: var(--neon-pink);
  box-shadow: 0 0 10px rgba(255,0,255,0.15);
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-title {
  font-weight: 600;
  color: #fff;
  font-size: 1.05rem;
}

.track-meta {
  font-size: 0.85rem;
  color: #8c7aa8;
}

.track-bpm {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--neon-cyan);
}

.track-play-btn {
  background: var(--neon-pink);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.track-item:hover .track-play-btn, .track-item.selected .track-play-btn {
  opacity: 1;
}

.track-play-btn:hover {
  transform: scale(1.1);
}

/* ---------- Carga de MP3 (File Upload) ---------- */
.upload-container {
  border: 2px dashed rgba(0, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 30px 20px;
  margin-top: 20px;
  background: rgba(0, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-container:hover {
  border-color: var(--neon-cyan);
  background: rgba(0, 255, 255, 0.05);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}

.upload-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: block;
}

.upload-text {
  font-size: 0.95rem;
  color: #a595c5;
}

.upload-text b {
  color: var(--neon-cyan);
}

.file-status {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--neon-yellow);
}

/* ---------- Controles y Preferencias ---------- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 35px;
  text-align: left;
}

.option-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 20px;
}

.option-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  color: var(--neon-cyan);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.btn-toggle {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  color: #aaa;
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.btn-toggle.active {
  background: var(--neon-pink);
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255,0,255,0.3);
}

/* Sliders */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.slider-container label {
  font-size: 0.9rem;
  color: #a595c5;
}
.cyber-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #251c38;
  outline: none;
}
.cyber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.cyber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Botón Jugar */
.play-action {
  margin-top: 40px;
}

.btn-play {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--neon-pink) 0%, #bb00ff 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 18px 50px;
  box-shadow: var(--shadow-neon-pink);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.btn-play:hover {
  transform: scale(1.04);
  box-shadow: 0 0 25px rgba(255, 0, 255, 0.9), 0 0 5px #fff;
}

.btn-play:active {
  transform: scale(0.98);
}

.btn-play.small {
  font-size: 1.05rem;
  padding: 12px 28px;
  box-shadow: 0 0 10px rgba(255,0,255,0.4);
}

/* ---------- Sección de Clasificación (High Scores) ---------- */
.scores-section {
  margin-top: 45px;
}

.scores-section h3 {
  font-family: var(--font-title);
  font-weight: 700;
  color: #fff;
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.scores-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 480px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 8px;
}

.score-item.header {
  background: none;
  border: none;
  color: var(--neon-cyan);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.score-item .pos {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--neon-pink);
  width: 25px;
}
.score-item .name {
  flex: 1;
  font-weight: 600;
  text-align: left;
}
.score-item .details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.score-item .pts {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--neon-cyan);
  font-size: 1.05rem;
}
.score-item .acc {
  font-size: 0.75rem;
  color: #8c7aa8;
}

/* Empty Score state */
.score-empty {
  text-align: center;
  padding: 24px;
  color: #8c7aa8;
  font-style: italic;
}

/* ============================================================
   PANTALLA DE JUEGO
   ============================================================ */
.game-body {
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #06020c;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(10, 5, 20, 0.8);
  border-bottom: 1px solid rgba(0, 255, 255, 0.15);
}

.hud-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-pill b {
  color: var(--neon-cyan);
}

.hud-pill.urgent {
  border-color: var(--neon-red);
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.3);
  animation: pulse-red 1s infinite alternate;
}

.hud-pill.score-pill b {
  color: var(--neon-pink);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.05rem;
}

.canvas-wrap {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px;
}

.game-canvas {
  background: #000;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 1px rgba(0,255,255,0.4);
  max-width: 100%;
  max-height: 100%;
}

/* Countdown Grande en el Canvas */
.countdown-big {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 8rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px var(--neon-cyan);
  pointer-events: none;
  z-index: 10;
}

@keyframes count-pulse {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

/* Overlays */
.pause-overlay, .end-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 20, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 20px;
}

.end-card {
  background: rgba(25, 12, 48, 0.95);
  border: 1px solid rgba(255, 0, 255, 0.25);
  border-radius: var(--panel-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), var(--shadow-neon-pink);
  padding: 35px 30px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}

.end-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2.2rem;
  margin: 0 0 10px;
  color: var(--neon-pink);
  text-shadow: 0 0 15px rgba(255,0,255,0.4);
}

.end-title.win {
  color: var(--neon-cyan);
  text-shadow: 0 0 15px rgba(0,255,255,0.4);
}

.end-sub {
  color: #a595c5;
  font-size: 1.05rem;
  margin: 0 0 24px;
}

.end-stats {
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.end-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
.end-stat-row label {
  color: #8c7aa8;
}
.end-stat-row value {
  font-weight: 600;
  color: #fff;
}
.end-stat-row.highlight value {
  color: var(--neon-cyan);
  font-family: var(--font-title);
  font-weight: 800;
}

.end-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
}

/* Animations */
@keyframes pulse-red {
  from { box-shadow: 0 0 6px rgba(255, 51, 51, 0.2); }
  to { box-shadow: 0 0 16px rgba(255, 51, 51, 0.7); }
}
