/* =============================================================
   MusicaLee — Design System
   Audiencia: 12 años, dark mode, moderno y accesible
   ============================================================= */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Colores base */
  --bg:          #0A0A18;
  --bg-card:     #13132B;
  --bg-card-2:   #1C1C3C;
  --bg-overlay:  rgba(10, 10, 24, 0.85);

  /* Paleta principal */
  --primary:        #8B5CF6;
  --primary-light:  #A78BFA;
  --primary-dark:   #6D28D9;
  --primary-glow:   rgba(139, 92, 246, 0.30);

  /* Acento y estados */
  --accent:   #06D6A0;
  --warning:  #F59E0B;
  --danger:   #EF4444;
  --success:  #10B981;

  /* Texto */
  --text:         #F1F5F9;
  --text-muted:   #94A3B8;
  --text-dimmed:  #64748B;

  /* Bordes */
  --border:        rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.18);

  /* Niveles */
  --level-0-a: #8B5CF6; --level-0-b: #C084FC;
  --level-1-a: #3B82F6; --level-1-b: #60A5FA;
  --level-2-a: #10B981; --level-2-b: #6EE7B7;
  --level-3-a: #F59E0B; --level-3-b: #FCD34D;
  --level-4-a: #EF4444; --level-4-b: #FCA5A5;
  --level-x-a: #06B6D4; --level-x-b: #06D6A0;

  /* Tipografía */
  --font:      'Nunito', 'Segoe UI', system-ui, sans-serif;
  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow:    0 24px 64px rgba(0,0,0,0.55);
  --shadow-sm: 0 8px 24px  rgba(0,0,0,0.35);
  --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── Tipografía ───────────────────────────────────────────── */
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; line-height: 1.15; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem);  font-weight: 700; }
h4 { font-size: 1.1rem; font-weight: 700; }
p  { color: var(--text-muted); font-size: 1rem; }

/* ── Gradiente de texto ───────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Botones ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 8px 24px var(--primary-glow);
}
.btn--primary:hover  { transform: translateY(-2px); box-shadow: 0 12px 32px var(--primary-glow); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border-bright);
}
.btn--ghost:hover { background: var(--bg-card-2); color: var(--text); border-color: var(--primary); }

.btn--success {
  background: linear-gradient(135deg, var(--success), #34D399);
  color: #fff;
  box-shadow: 0 8px 24px rgba(16,185,129,.35);
}
.btn--success:hover { transform: translateY(-2px); }

.btn--lg  { padding: 18px 40px; font-size: 1.15rem; }
.btn--sm  { padding: 10px 20px; font-size: 0.9rem; }
.btn--icon { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-bright); transform: translateY(-3px); box-shadow: var(--shadow-sm); }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge--soon   { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.badge--new    { background: rgba(139,92,246,.2);  color: var(--primary-light); border: 1px solid rgba(139,92,246,.3); }
.badge--done   { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border-bright);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ── Estrellas ────────────────────────────────────────────── */
.star { font-size: 1.25rem; opacity: 0.3; transition: var(--transition); }
.star--on { opacity: 1; }

/* ── Utilidades ───────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1  { margin-top: 4px;  }
.mt-2  { margin-top: 8px;  }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* ── Piano keyboard ──────────────────────────────────────────── */
.piano-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
}
.piano-keys {
  display: flex;
  gap: 3px;
  height: 120px;
  width: 100%;
}
.white-key {
  flex: 1;
  background: linear-gradient(to bottom, #f0f0f0, #ffffff);
  border: 1px solid #bbb;
  border-radius: 0 0 7px 7px;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  color: #333;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 800;
  transition: background 0.1s, transform 0.08s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  box-shadow: 0 4px 6px rgba(0,0,0,0.35);
}
.white-key:hover   { background: #e5d5ff; }
.white-key:active  { background: #c4b5fd; transform: translateY(2px); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.white-key--active  { background: #A78BFA !important; color: #fff !important; box-shadow: 0 4px 16px rgba(139,92,246,0.5) !important; }
.white-key--correct { background: #34D399 !important; color: #fff !important; }
.white-key--wrong   { background: #F87171 !important; color: #fff !important; }

.black-key {
  position: absolute;
  top: 0;
  width: 62%;
  max-width: 28px;
  height: 66%;
  background: linear-gradient(to bottom, #2a2a2a, #555);
  border-radius: 0 0 5px 5px;
  border: 1px solid #111;
  pointer-events: none;
  z-index: 2;
  transform: translateX(-50%);
  box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

/* ── Staff container ─────────────────────────────────────────── */
.staff-container {
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius);
  padding: 12px 8px;
  margin: 16px 0;
  overflow: visible;
}

/* ── Fondo animado (notas flotantes) ──────────────────────── */
.bg-notes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-notes span {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0;
  animation: floatNote linear infinite;
}
@keyframes floatNote {
  0%   { opacity: 0;    transform: translateY(100vh) rotate(0deg); }
  10%  { opacity: 0.08; }
  90%  { opacity: 0.08; }
  100% { opacity: 0;    transform: translateY(-20vh) rotate(360deg); }
}

/* ── Animaciones globales ─────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50%       { box-shadow: 0 0 0 12px transparent; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce {
  0%, 100% { transform: translateY(0);    animation-timing-function: cubic-bezier(0.8,0,1,1); }
  50%       { transform: translateY(-8px); animation-timing-function: cubic-bezier(0,0,0.2,1); }
}

.animate-fadeInUp  { animation: fadeInUp 0.5s ease forwards; }
.animate-pulse     { animation: pulse 2s ease-in-out infinite; }
.animate-bounce    { animation: bounce 1s ease infinite; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Responsive helpers ───────────────────────────────────── */
@media (max-width: 640px) {
  :root { font-size: 15px; }
  .btn--lg { padding: 16px 28px; font-size: 1rem; }
}
