:root {
  --bg: #0c0a13;
  --bg-soft: #120f1c;
  --surface: #191426;
  --surface-hover: #221b32;
  --border: #2c2440;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --lime: #c8ff4d;
  --coral: #ff6a4d;
  --text: #f4f2fb;
  --text-muted: #9a92b3;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1100px 550px at 85% -10%, #201a34 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px; /* deja lugar al reproductor fijo de abajo */
}

code {
  font-family: 'Space Grotesk', monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1em 0.45em;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  background: rgba(12, 10, 19, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.brand-mark .bar {
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--lime), var(--accent));
  animation: idle-bar 1.4s ease-in-out infinite;
}
.brand-mark .bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.brand-mark .bar:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.brand-mark .bar:nth-child(3) { height: 40%; animation-delay: 0.4s; }

@keyframes idle-bar {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.topbar-search { margin-left: auto; }
.topbar-search input {
  width: 240px;
  max-width: 50vw;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- sección ---------- */
.grid-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.grid-section h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  margin: 0 0 10px;
}

.section-sub { color: var(--text-muted); margin: 0 0 28px; }

/* ---------- cuadrícula ---------- */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.sound-btn {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  animation: btn-in 0.4s ease forwards;
  transition: border-color 0.15s ease;
}
.sound-btn:hover { border-color: var(--accent); }
.sound-btn.is-playing { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime) inset; }

@keyframes btn-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.play-area {
  width: 100%;
  height: 100%;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 14px 16px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}
.play-area:hover { background: var(--surface-hover); }

.btn-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.dl-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  z-index: 2;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.dl-icon:hover { border-color: var(--coral); background: var(--coral); transform: translateY(-1px); }

.format-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--bg);
  background: var(--lime);
  padding: 2px 7px;
  border-radius: 999px;
  z-index: 2;
}
.format-tag.wav { background: var(--coral); }

.board-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
}
.board-empty strong { color: var(--text); }

/* ---------- equalizer bars (compartido) ---------- */
.eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 24px; }
.eq i {
  width: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  height: 30%;
}
.eq-idle i { animation: idle-bar 1.6s ease-in-out infinite; background: var(--text-muted); }
.eq-idle i:nth-child(1) { animation-delay: 0s; }
.eq-idle i:nth-child(2) { animation-delay: 0.15s; }
.eq-idle i:nth-child(3) { animation-delay: 0.3s; }
.eq-idle i:nth-child(4) { animation-delay: 0.45s; }
.eq-idle i:nth-child(5) { animation-delay: 0.6s; }
.eq-playing i { background: linear-gradient(180deg, var(--lime), var(--accent)); }

/* ---------- reproductor fijo ---------- */
.now-playing {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 0 20px 40px -16px rgba(0,0,0,0.7);
  z-index: 50;
  min-width: 320px;
  max-width: 92vw;
  animation: rise-in 0.3s ease;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.now-info { flex: 1; min-width: 0; }
.now-name {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now-progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.now-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--lime)); }
.now-time { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-display); }
.now-stop {
  border: none;
  background: var(--bg-soft);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.now-stop:hover { background: var(--coral); }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .topbar { padding: 14px 18px; }
  .topbar-search input { width: 100%; max-width: none; }
  .sound-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
