:root {
  --vocal-bg: #090d16;
  --vocal-surface: #111827;
  --vocal-card: rgba(17, 24, 39, 0.85);
  --vocal-border: rgba(236, 72, 153, 0.2);
  --vocal-accent: #ec4899;
  --vocal-accent-glow: rgba(236, 72, 153, 0.35);
  --vocal-accent-purple: #a855f7;
  --vocal-text: #fdf2f8;
  --vocal-muted: #9ca3af;
}

[data-theme="light"] {
  --vocal-bg: #fdf4f8;
  --vocal-surface: #ffffff;
  --vocal-card: rgba(255, 255, 255, 0.95);
  --vocal-border: rgba(219, 39, 119, 0.2);
  --vocal-accent: #db2777;
  --vocal-accent-glow: rgba(219, 39, 119, 0.25);
  --vocal-accent-purple: #9333ea;
  --vocal-text: #1e293b;
  --vocal-muted: #64748b;
}

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

body {
  background-color: var(--vocal-bg);
  color: var(--vocal-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand-logo-box {
  background: linear-gradient(135deg, #ec4899, #a855f7);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vocal-app-layout {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem;
}

.vocal-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .vocal-grid {
    grid-template-columns: 1fr;
  }
}

/* Área Principal de Análisis y Espectrograma */
.vocal-stage {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Tarjeta de Tono en Vivo */
.pitch-hero-card {
  background: var(--vocal-surface);
  border: 1px solid var(--vocal-border);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 10px 25px -5px rgba(236, 72, 153, 0.1);
  position: relative;
  overflow: hidden;
}

.pitch-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pitch-note-large {
  font-size: 4rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, var(--vocal-accent), var(--vocal-accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.pitch-freq-badge {
  font-size: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--vocal-muted);
}

/* Afinador / Aguja de Desviación */
.tuner-gauge-wrap {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  position: relative;
  overflow: hidden;
}

.tuner-center-mark {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--vocal-accent);
  transform: translateX(-50%);
  z-index: 2;
}

.tuner-indicator-dot {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px var(--vocal-accent);
  left: 50%;
  transform: translateX(-50%);
  transition: left 0.08s ease-out;
}

/* Espectrograma en Cascada (Waterfall) */
.spectrogram-box {
  background: #030712;
  border: 1px solid var(--vocal-border);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spectrogram-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--vocal-muted);
}

#waterfall-canvas {
  width: 100%;
  height: 220px;
  background: #030712;
  border-radius: 10px;
}

/* Teclado de Piano Reactivo */
.piano-keyboard-wrap {
  background: var(--vocal-surface);
  border: 1px solid var(--vocal-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.piano-keys-container {
  display: flex;
  height: 110px;
  position: relative;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  user-select: none;
}

.piano-white-key {
  flex: 1;
  min-width: 24px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 5px 5px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 0.65rem;
  color: #64748b;
  transition: background 0.1s;
}

.piano-white-key.active {
  background: var(--vocal-accent) !important;
  color: #fff !important;
  box-shadow: 0 0 12px var(--vocal-accent);
}

.piano-white-key.in-range {
  background: rgba(236, 72, 153, 0.2);
}

.piano-black-key {
  position: absolute;
  width: 16px;
  height: 65px;
  background: #0f172a;
  border-radius: 0 0 4px 4px;
  z-index: 5;
  transition: background 0.1s;
}

.piano-black-key.active {
  background: var(--vocal-accent-purple) !important;
  box-shadow: 0 0 12px var(--vocal-accent-purple);
}

/* Barra Lateral de Resultados y Cantantes Famosos */
.vocal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.vocal-card {
  background: var(--vocal-surface);
  border: 1px solid var(--vocal-border);
  border-radius: 16px;
  padding: 1.25rem;
}

.vocal-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--vocal-accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

/* Rango y Tesitura */
.vocal-type-hero {
  text-align: center;
  padding: 1rem 0;
}

.vocal-type-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--vocal-accent);
}

.vocal-type-desc {
  font-size: 0.85rem;
  color: var(--vocal-muted);
  margin-top: 0.25rem;
}

.range-span-row {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
  border-top: 1px solid var(--vocal-border);
  padding-top: 0.85rem;
}

.range-node {
  text-align: center;
}

.range-node-val {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.range-node-label {
  font-size: 0.72rem;
  color: var(--vocal-muted);
}

/* Cantantes Famosos Parecidos */
.singers-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.singer-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--vocal-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.singer-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.singer-meta {
  font-size: 0.72rem;
  color: var(--vocal-muted);
}

.singer-match-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--vocal-accent);
  font-family: 'JetBrains Mono', monospace;
}

/* Botones de Control */
.btn-mic-toggle {
  width: 100%;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
  transition: opacity 0.2s, transform 0.1s;
}

.btn-mic-toggle:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-mic-toggle.listening {
  background: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Modal */
.vocal-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 1rem;
}

.vocal-modal.active {
  display: flex;
}

.vocal-modal-content {
  background: var(--vocal-surface);
  border: 1px solid var(--vocal-border);
  border-radius: 18px;
  max-width: 580px;
  width: 100%;
  padding: 1.5rem;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--vocal-muted);
  cursor: pointer;
}
