/* © DJFuturo Tools. Todos los derechos reservados. */
/* === BASE === */

.djf-xilofono-v4min {
  position: relative;  
  width: 100%;
  max-width: none !important;
  margin: 18px auto;
  color: #222;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.djf-xilofono-header h1 {
  margin: 0;
  font-size: 18px;
}

.djf-xilofono-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.djf-xilo-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  position: relative;
}

/* Separador solo después de reverb y nomenclatura */
.djf-xilo-control-group.has-separator::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: 1px;
  background: linear-gradient(180deg, transparent, #ddd 20%, #ddd 80%, transparent);
}

/* Primer grupo sin padding izquierdo */
.djf-xilo-control-group:first-child {
  padding-left: 0;
}

/* === BOTONES GENERALES === */

.djf-xilo-btn {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  background: linear-gradient(180deg, #ffffff, #f8f9fa);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  transition: all 0.15s ease;
  font-family: inherit;
}

.djf-xilo-btn:hover {
  background: linear-gradient(180deg, #fafbfc, #f1f3f5);
  border-color: #bbb;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 2px 4px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.djf-xilo-btn:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.15) inset;
  background: linear-gradient(180deg, #f1f3f5, #e9ecef);
}

.djf-xilo-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #999;
  box-shadow: none;
  transform: none;
}

.djf-xilo-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* === REVERB TOGGLE === */

.djf-xilo-reverb-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid #ddd;
  background: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.djf-xilo-reverb-toggle:hover {
  border-color: #bbb;
  background: #fafafa;
}

/* Estado activo con borde amarillo */
.djf-xilo-reverb-toggle.active {
  border: 2px solid #f8d058;
  box-shadow: 
    0 0 0 2px #f8d058,
    0 0 0 4px rgba(248, 208, 88, 0.15),
    0 2px 6px rgba(248, 208, 88, 0.2);
}

.djf-xilo-reverb-toggle input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #f8d058;
}

.djf-xilo-reverb-toggle span {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.djf-xilofono-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;
  overflow: visible;
}

/* Fila interna: transform por JS */
.djf-xilo-row {
  display: flex;
  position: relative;
  padding: 6px 0;
  width: max-content;
  transform-origin: left center;
  transition: transform 0.25s ease;
}

/* Glow botones */
.djf-xilo-reverb-toggle, .djf-xilo-select, .djf-xilo-btn {
  box-shadow: 0 0 0 3px rgba(248, 208, 88, 0.27);
}

/* === TECLAS XILÓFONO === */

/* Altura base y mínima controladas por variable inyectada por JS:
   --xilo-index: posición de 0 (grave) a N-1 (agudo)
   --xilo-total: total de notas (blancas)
   La altura decrece un 32% de grave a agudo */

.djf-xilo-key {
  position: relative;
  box-sizing: border-box;
  /* Madera oscura: gradiente horizontal con veta simulada */
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.10) 0%,
      transparent 40%,
      rgba(0,0,0,0.15) 100%
    ),
    linear-gradient(
      90deg,
      #5a2e0e 0%,
      #6b3a1a 20%,
      #4e2509 40%,
      #623318 60%,
      #4a2210 80%,
      #5e3015 100%
    ); 
  border: 1px solid #9a5420;
  box-shadow:
    0 1px 0 rgba(255,220,160,0.4) inset,
    0 2px 5px rgba(0,0,0,0.18),
    0 4px 8px rgba(0,0,0,0.1);
  /* Altura calculada: base 160px decrece hasta ~109px (32%) */
  height: calc(160px - (51px * var(--xilo-index, 0) / max(var(--xilo-total, 1) - 1, 1)));
  width: 40px;
  margin: 0;
  border-radius: 5px 5px 7px 7px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 220, 180, 0.7);
  cursor: pointer;
  transition: transform .06s linear, box-shadow .06s linear, filter .06s linear;
}

/* Separación entre barras blancas */
.djf-xilo-octave .white-container {
  display: flex;
  gap: 3px;
  z-index: 1;
}

.djf-xilo-key:hover {
  filter: brightness(1.12);
}

.djf-xilo-key.active {
  background: #f8d058 !important;
  filter: none;
  transform: translateY(3px);
  box-shadow: 0 0 8px rgba(248, 208, 88, 0.5);
  color: rgba(80, 40, 0, 0.85);
}

/* Negras: mismo gradiente madera pero más oscuro */
.djf-xilo-key.black {
  position: absolute;
  width: 39px;
  /* Altura: 58% de la barra blanca correspondiente, misma lógica decreciente */
  height: calc((160px - (51px * var(--xilo-index, 0) / max(var(--xilo-total, 1) - 1, 1))) * 0.58);
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.10) 0%,
      transparent 40%,
      rgba(0,0,0,0.15) 100%
    ),
    linear-gradient(
      90deg,
      #5a2e0e 0%,
      #6b3a1a 20%,
      #4e2509 40%,
      #623318 60%,
      #4a2210 80%,
      #5e3015 100%
    );
  border: 1px solid #3a1a06;
  color: rgba(255, 220, 180, 0.7);
  border-radius: 3px 3px 5px 5px;
  /* Solo el extremo inferior se superpone sobre las blancas */
  top: 0;
  z-index: 2;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  transform-origin: top center;
  padding-bottom: 4px;
  font-size: 10px;
}

.djf-xilo-key.black.active {
  background: #f8d058 !important;
  filter: none;
  box-shadow: 0 0 8px rgba(248, 208, 88, 0.5);
  color: rgba(80, 40, 0, 0.85);
}

.djf-xilo-octave {
  display: flex;
  position: relative;
  margin-right: 3px;
}

.djf-xilo-octave:last-child {
  margin-right: 0;
}

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

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

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

/* === SELECT MEJORADO === */

.djf-xilo-select {
  padding: 6px 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #f8f9fa);
  border: 1px solid #d0d0d0;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #333;
  font-weight: 500;
  transition: all 0.15s ease;
}

.djf-xilo-select:hover {
  border-color: #4a90e2;
  background: #fff;
}

.djf-xilo-select:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 
    0 0 0 3px rgba(74, 144, 226, 0.1),
    0 1px 3px rgba(0,0,0,0.08);
}

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

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

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

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

/* Botones pequeños */
.djf-xilo-btn-sm {
  padding: 5px 10px;
  min-width: 32px;
  font-size: 12px;
}

/* Ocultar en móvil */
@media (max-width: 800px) {
  .djf-xilo-keyboard-shift {
    display: none !important;
  }
}

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

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

@media (max-width: 800px) {
  .djf-xilofono-container:not(.simple-mode) {
    overflow: hidden;
    padding: 8px 0;
    position: relative;
    border-radius: 4px;
  }

  .djf-xilo-row {
    transform-origin: left center;
  }

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

/* === LABELS === */

.djf-xilofono-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

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

/* Móvil vertical: apilar controles en 2 filas */

@media (max-width: 1260px) {
  .djf-xilofono-header.header-simple {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
  }
  .djf-xilofono-header.header-simple .djf-xilofono-controls {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 1080px) {
  .djf-xilofono-header:not(.header-simple) {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
  }
  .djf-xilofono-header:not(.header-simple) .djf-xilofono-controls {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 960px) {
  .djf-xilofono-controls {
    gap: 8px;
  }
  
  .djf-xilo-control-group {
    padding: 0 8px;
  }
  
  .djf-xilo-control-group:first-child {
    padding-left: 0;
  }
  
  .djf-xilo-control-group:last-child {
    padding-right: 0;
  }
  
  .djf-xilo-btn,
  .djf-xilo-select {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  
  .djf-xilofono-controls label {
    font-size: 13px;
  }

  .djf-xilo-select {
    max-width: 110px;
  }
}


@media (max-width: 660px) {
  .djf-xilofono-controls {
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  .djf-xilo-control-group {
    padding: 0 5px;
  }

  .djf-xilo-reverb-toggle {
    padding: 3px 12px !important;
  }

  .djf-xilo-reverb-toggle span {
    font-size: 13px !important;
  }

  .djf-xilo-tab {
    padding: 3px 12px !important;
    font-size: 13px !important;
  }

  .djf-xilo-btn,
  .djf-xilo-select {
    font-size: 11px;
    padding: 4px 5px;
  }

  .djf-xilo-select {
    max-width: 88px;
  }

  .djf-xilofono-controls label {
    font-size: 11px;
  }

  #djf-xilo-skin-toggle {
    padding: 3px 12px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 669px) {
  .djf-xilofono-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
  }
  .djf-xilofono-controls {
    width: 100%;
    justify-content: center;
  }
  
  .djf-xilofono-header h1 {
    font-size: 16px;
  }
  
  .djf-xilofono-controls {
    gap: 8px;
  }
  
  .djf-xilo-control-group {
    padding: 0 8px;
  }
  
  .djf-xilo-control-group:first-child {
    padding-left: 0;
  }
  
  .djf-xilo-control-group:last-child {
    padding-right: 0;
  }

  
  .djf-xilo-btn,
  .djf-xilo-select {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  .djf-xilofono-controls label {
    font-size: 13px;
  }

  .djf-xilo-select {
    max-width: 110px;
  }
  
  #djf-xilo-prev-oct,
  #djf-xilo-next-oct {
    min-width: 28px;
    padding: 5px 6px;
  }
}

@media (max-width: 480px) {
  .djf-xilofono-controls {
    gap: 3px;
  }

  .djf-xilo-control-group {
    padding: 0 3px;
  }

  .djf-xilo-control-group:first-child {
    padding-left: 0;
  }

  .djf-xilo-control-group.has-separator::after {
    display: none;
  }

  .djf-xilo-reverb-toggle {
    padding: 2px 7px !important;
  }

  .djf-xilo-reverb-toggle span {
    font-size: 12px !important;
  }

.djf-xilo-reverb-toggle input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
}

  .djf-xilo-tab {
    padding: 2px 7px !important;
    font-size: 12px !important;
  }

  .djf-xilo-btn,
  .djf-xilo-select {
    font-size: 10px;
    padding: 3px 4px;
  }

  .djf-xilo-select {
    max-width: 78px;
  }

  .djf-xilofono-controls label {
    font-size: 12px !important;
  }

  #djf-xilo-skin-toggle {
    padding: 2px 7px !important;
    font-size: 12px !important;
  }
}

/* Móvil muy estrecho: máxima compresión */
@media (max-width: 360px) {
  .djf-xilofono-header h1 {
    font-size: 15px;
    margin-bottom: 4px;
  }
  
  .djf-xilofono-controls {
    gap: 1px;
  }
  
  .djf-xilo-btn,
  .djf-xilo-select {
    font-size: 11px;
    padding: 5px 6px;
  }
  
  .djf-xilo-select {
    max-width: 100px;
  }
 
.djf-xilo-control-group{
padding: 1px 1px;
}
}

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

.djf-xilo-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-xilo-loading-content {
  text-align: center;
  max-width: 300px;
}

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

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

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

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

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

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

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

/* Overlay de activación solo móvil */
#djf-xilo-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-xilo-audio-unlock-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.djf-xilo-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-xilo-audio-unlock-overlay {
    display: none !important;
  }
}

/* === BADGE === */

.djf-xilo-tool-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 2px 2px;
  background: linear-gradient(135deg, rgba(248, 208, 88, 0.5), transparent);
  border-radius: 30px;
}

.djf-xilo-tool-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd95a 0%, #f8c040 100%);
  border: 2px solid #f0b830;
  box-shadow: 
    0 2px 8px rgba(248, 208, 88, 0.25),
    0 0 0 3px rgba(248, 208, 88, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.djf-xilo-tool-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%; 
}

.djf-xilo-tool-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #1a1a1a;
}

/* Badge Responsive */

@media (max-width: 669px) {
  .djf-xilo-tool-badge {
    width: 36px;
    height: 36px;
  }
  
  .djf-xilo-tool-badge img {
    width: 100%;
    height: 100%;
  }
  
  .djf-xilo-tool-title h1 {
    font-size: 18px;
  }
}

@media (max-width: 360px) {
  .djf-xilo-tool-badge {
    width: 32px;
    height: 32px;
  }
  
  .djf-xilo-tool-badge img {
    width: 100%;
    height: 100%;
  }
  
  .djf-xilo-tool-title h1 {
    font-size: 16px;
  }
}

/* Toggle y separadores adapt */
@media (max-width: 400px) {
  .djf-xilo-control-group {
    padding: 0 6px;
  }
  
  .djf-xilo-control-group:first-child {
    padding-left: 0;
  }
 
  .djf-xilo-reverb-toggle span {
    font-size: 12px;
  }

  .djf-xilo-control-group.has-separator::after {
    display: none;
  }
}



@media (max-width: 800px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 135px;
  }
}

@media (max-width: 800px) and (max-height: 500px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 97px;
    padding-bottom: 18px !important;
  }
}

@media (max-width: 700px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 110px;
  }
}

@media (max-width: 650px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 93px;
  }
}

@media (max-width: 600px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 80px;
  }
}

@media (max-width: 550px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 64px;
  }
}

@media (max-width: 500px) {
  .djf-xilofono-container.simple-mode {
    padding-top: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 480px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 47px;
  }
}

@media (max-width: 420px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 25px;
  }
}

@media (max-width: 370px) {
  .djf-xilofono-container:not(.simple-mode) {
    padding-top: 10px;
  }
}


/* === TABS DE MODO === */

.djf-xilo-mode-tabs {
  gap: 0 !important;
  padding-left: 0;
}

.djf-xilo-tab {
  padding: 6px 14px;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 14px !important;
  font-weight: 500;
  font-family: inherit;
  color: #555;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 0 0 3px rgba(248, 208, 88, 0.27);
}

.djf-xilo-tab:first-child {
  border-radius: 20px 0 0 20px;
  border-right-width: 1px;
}

.djf-xilo-tab:last-child {
  border-radius: 0 20px 20px 0;
  border-left-width: 1px;
}

.djf-xilo-tab:hover {
  background: #fafafa;
  color: #333;
}

.djf-xilo-tab.active {
  border-color: #f8d058;
  background: #f8d058;
  color: #333;
  box-shadow: 0 0 0 3px rgba(248, 208, 88, 0.27);
  z-index: 1;
  position: relative;
}

/* Simple controls: ocultos por defecto, JS los muestra en modo Simple */
#djf-xilo-simple-controls, #djf-xilo-simple-controls-colors {
  display: none;
  align-items: center;
  gap: 8px;
}

#djf-xilo-skin-toggle {
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 0 0 3px rgba(248, 208, 88, 0.27);
}

#djf-xilo-skin-toggle:hover {
  border-color: #bbb;
  background: #fafafa;
}

#djf-xilo-simple-controls.visible {
  display: flex;
}

/* Skin colores: transición suave al cambiar */
.djf-xilo-key.white {
  transition: background 0.25s ease, border-color 0.25s ease, transform .06s linear, box-shadow .06s linear, filter .06s linear;
}

/* Skin colores: estado activo preserva feedback visual */
.djf-xilo-key.white.active {
  filter: brightness(1.15) !important;
  transform: translateY(3px);
}

/* Barras más anchas en modo simple */
.djf-xilo-key-simple {
  width: 44px !important;
}

.djf-xilo-octave-simple .white-container {
  gap: 4px;
}
