/* === BASE === */

.djf-piano-v3g {
position: relative;  
width: 100%;
  max-width: none !important;
  margin: 18px auto;
  font-family: Inter, Arial, sans-serif;
  color:#222;
}

.djf-piano-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:19px;
}

.djf-piano-header h2 {
  margin:0;
  font-size:18px;
}

.djf-piano-controls {
  display:flex;
  gap:8px;
  align-items:center;
}

.djf-btn {
  padding:8px 10px;
  border-radius:6px;
  border:1px solid #bbb;
  background:white;
  cursor:pointer;
}

/* Flechas ocultas en escritorio */
#djf-prev-oct,
#djf-next-oct {
  display:none;
}

.djf-piano-container {
  user-select:none;
  touch-action: manipulation;
  border-radius:8px;
  padding:12px;
  background: linear-gradient(180deg,#fbfbfb,#f3f6f9);
  box-shadow: 0 6px 18px rgba(20,30,50,0.06);
  display: flex;
}

/* Fila interna: transform por JS (M1) */
.djfp-row {
  display:flex;
  position:relative;
  align-items:flex-end;
  padding:6px 0;
  width:max-content;
  transform-origin:left center;
  transition:transform 0.25s ease;
}


/* === TECLAS === */

.djf-key {
  position:relative;
  box-sizing:border-box;
  border:1px solid #d6d6d6;
  background:#fff;
  height:160px;
  width:44px;
  margin:0;
  border-radius:6px;
  display:inline-flex;
  align-items:flex-end;
  justify-content:center;
  font-size:12px;
  color:#333;
  cursor:pointer;
  transition:transform .06s linear, box-shadow .06s linear, background .06s linear;
}

.djf-key.active {
  background:#f8d058 !important;
  transform: translateY(3px);
  box-shadow:none;
}

.djf-key.black {
  position:absolute;
  width:30px;
  height:100px;
  background:#111;
  color:#fff;
  border-radius:4px;
  top:0;
  left:30px;
  z-index:2;
  box-shadow:0 4px 8px rgba(0,0,0,0.35);
  transform-origin: bottom center;
}

.djf-key.black.active {
  background:#333 !important;
  box-shadow:0 0 10px #f8d058;
}

.djf-octave {
  display:flex;
  position:relative;
 /* margin-right: 1px; */
  margin-right: 0;
}

.djf-octave:last-child {
  margin-right: 0; /* ← sin gap después de la última octava */
}

.djf-octave .white-container {
  display:flex;
  gap:0;
  z-index:1;
}

.djf-feedback {
  margin-top:8px;
  font-size:13px;
  color:#444;
  min-height:18px;
}

/* Contenedor de navegación de octavas */
#djf-octave-nav {
  display: none; /* oculto por defecto */
  align-items: center;
  gap: 8px;
}

/* Flechas deshabilitadas */
.djf-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
}

/* Selección nombre notas */
.djf-select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #bbb;
  background: white;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #333;
}

.djf-select:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 1px;
}

/* Ocultar texto de teclas cuando está en modo "hidden" */
.djf-key.note-hidden {
  font-size: 0;
}

/* === Gap pantallas pequeñas === */
@media (max-width:1150px){
.djf-piano-header {
  margin-bottom:5px;
}
}

/* === CONTROL DE DESPLAZAMIENTO DE TECLADO === */

.djf-keyboard-shift {
  display: flex;
  align-items: center;
  gap: 6px;
}

.djf-btn-sm {
  padding: 6px 8px;
  min-width: 28px;
  font-size: 12px;
}

/* Ocultar en móvil (donde no hay teclado físico) */
@media (max-width: 800px) {
  .djf-keyboard-shift {
    display: none !important;
  }
}

/* Responsive: compactar en pantallas medianas */
@media (max-width: 1024px) {
  .djf-keyboard-shift span {
    font-size: 13px !important;
  }
  
  #djf-kbd-range {
    min-width: 45px !important;
    font-size: 12px !important;
  }
}

/* === MOBILE (M1) === */

@media (max-width:800px){
  .djf-piano-container {
    overflow: hidden;
    padding: 8px 0; /* reducir padding vertical */
    position: relative;
    border-radius: 4px;
  }

  .djfp-row {
    transform-origin: left center; /* mantener consistencia */
  }

  #djf-prev-oct,
  #djf-next-oct {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 6px 8px;
  }
  
  #djf-octave-nav {
    display: flex !important;
  }
}

/* === RESPONSIVE HEADER === */

/* Móvil vertical: apilar controles en 2 filas */
@media (max-width: 600px) {
  .djf-piano-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
  }
  
  .djf-piano-header h2 {
    font-size: 16px;
  }
  
  .djf-piano-controls {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }
  
  .djf-btn,
  .djf-select {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  /* Selector de notas más estrecho */
  .djf-select {
    max-width: 110px;
  }
  
  /* Botones de octavas más compactos */
  #djf-prev-oct,
  #djf-next-oct {
    min-width: 28px;
    padding: 5px 6px;
  }
}

/* Móvil muy estrecho: máxima compresión */
@media (max-width: 360px) {
  .djf-piano-header h2 {
    font-size: 15px;
    margin-bottom: 4px;
  }
  
  .djf-piano-controls {
    gap: 4px;
  }
  
  .djf-btn,
  .djf-select {
    font-size: 11px;
    padding: 5px 6px;
  }
  
  .djf-select {
    max-width: 100px;
  }
  
  /* Comprimir labels */
  .djf-piano-controls label {
    font-size: 12px !important;
  }
}

/* === LOADING OVERLAY === */

.djf-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 8px;
}

.djf-loading-content {
  text-align: center;
  max-width: 300px;
}

.djf-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4a90e2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.djf-loading-content p {
  margin: 0 0 15px;
  font-size: 16px;
  color: #333;
}

.djf-progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.djf-progress {
  height: 100%;
  background: linear-gradient(90deg, #4a90e2, #63b3ed);
  width: 0%;
  transition: width 0.3s ease;
}

#djf-loading-text {
  font-size: 14px;
  color: #666;
}

.djf-loading.hidden {
  display: none;
}

/* Overlay de activación solo móvil */
#djf-audio-unlock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

#djf-audio-unlock-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.djf-unlock-text {
  color: white;
  font-size: 20px;
  text-align: center;
  padding: 20px;
  user-select: none;
}

/* Mostrar solo en móvil */
@media (min-width: 801px) {
  #djf-audio-unlock-overlay {
    display: none !important;
  }
}


@media (max-width: 800px) and (orientation: portrait) {
  .djf-key.white {
    height: 250px;
  }
  
  .djf-key.black {
    height: 145px;
  }
  
  /* Forzar altura exacta del contenedor */
  .djf-piano-container {
    padding: 6px 0;
    min-height: 0; /* Eliminar altura mínima */
    height: auto; /* Ajuste automático */
  }
  
  /* Asegurar que la fila no añada espacio extra */
  .djfp-row {
    padding: 0; /* Eliminar padding vertical */
    margin: 0;
  }
}