/* ==========================================================================
   ECOSISTEMA DE JUEGOS Y HERRAMIENTAS MUSICALES INTERACTIVAS
   ========================================================================== */

/* --- 0. Estructura base unificada para todas las herramientas --- */
.herramienta-section {
    padding: 0.5rem 0 2rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-description {
    color: #64748b;
    line-height: 1.7;
}

/* --- 1. Contenedor Base y Estructura de la Aplicación --- */
.motor-container { 
    font-family: system-ui, -apple-system, sans-serif; 
    color: #1e293b; 
}

/* --- 2. Bloques de Entrada de Datos e Inputs (Selectores) --- */
.input-block { 
    background: white; 
    padding: 1rem; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
}

.input-block select { 
    padding: 0.7rem; 
    border-radius: 6px; 
    border: 2px solid #cbd5e0; 
    font-size: 1.1rem; 
    background: white; 
    font-weight: 700; 
    color: #334155; 
}

/* --- 3. Componentes del Flujo Vertical Táctil (Accordion / Tarjetas) --- */
.cabecera-click:hover { 
    background: #f8fafc !important; 
}

.badge-romano-movil { 
    font-family: monospace; 
    font-size: 1.1rem; 
    font-weight: 800; 
    color: #4a5568; 
    background: #f1f5f9; 
    padding: 0.2rem 0.5rem; 
    border-radius: 4px; 
    min-width: 35px; 
    text-align: center; 
    display: inline-block; 
}

.badge-acorde-movil { 
    font-size: 1.4rem; 
    font-weight: 800; 
    color: #c9a052; 
}

.badge-tipo-movil { 
    font-family: monospace; 
    font-size: 0.85rem; 
    font-weight: 800; 
    padding: 0.2rem 0.5rem; 
    border-radius: 4px; 
    min-width: 45px; 
    text-align: center; 
    display: inline-block; 
    text-transform: uppercase; 
}

/* --- 4. Encabezados de Mecanismos Armónicos --- */
.titulo-mecanismo-movil { 
    display: block; 
    font-size: 0.95rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    margin-bottom: 0.4rem; 
}

/* Variaciones de color para títulos de mecanismos */
.mec-m-m        { color: #166534; }
.mec-m-M        { color: #943a12; }
.mec-v          { color: #1e40af; }
.mec-iv         { color: #6b21a8; }
.mec-iii        { color: #b45309; }
.mec-vi         { color: #0f766e; }
.mec-cromatica  { color: #ef4444; }
.mec-3m         { color: #0284c7; }

/* --- 5. Contenedores y Etiquetas de Destinos (Tags) --- */
.contenedor-tags { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.4rem; 
}

.tag-destino { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    padding: 0.4rem 0.8rem; 
    border-radius: 6px; 
    font-size: 1rem; 
    font-weight: 700; 
    border: 1px solid transparent; 
}

/* Paleta de colores semánticos para enlaces y enarmonías */
.tag-m-m  { background: #e8f5e9; color: #1b5e20; border-color: #c8e6c9; } /* Verde - Diatónica M a m */
.tag-m-M  { background: #fff3e0; color: #e65100; border-color: #ffe0b2; } /* Naranja - Diatónica m a M */
.tag-v    { background: #e3f2fd; color: #0d47a1; border-color: #bbdefb; } /* Azul - Relación de Quinta */
.tag-iv   { background: #f3e5f5; color: #4a148c; border-color: #e1bee7; } /* Púrpura - Relación de Cuarta */
.tag-iii  { background: #fef3c7; color: #92400e; border-color: #fde68a; } /* Ámbar - Relación de Tercera */
.tag-vi   { background: #ccfbf1; color: #115e59; border-color: #99f6e4; } /* Teja/Cian - Relación de Sexta */
.tag-crom { background: #fdf2f8; color: #db2777; border-color: #fce7f3; } /* Rosa - Salto Cromático */

.tag-funcion { 
    font-family: monospace; 
    font-size: 0.85rem; 
    background: rgba(255, 255, 255, 0.6); 
    padding: 0.05rem 0.25rem; 
    border-radius: 3px; 
    color: #475569; 
    font-weight: 600; 
}

/* --- 6. Estados Generales del DOM y Alertas --- */
.txt-ninguno { 
    font-size: 1rem; 
    color: #94a3b8; 
    font-style: italic; 
}

[x-cloak] { 
    display: none !important; 
}
/* --- 7. Menú Horizontal de Herramientas (Responsive) --- */
.nav-herramientas-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: stretch;
}

.card-link-tool {
    flex: 0 1 auto;
    min-width: 140px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .nav-herramientas-cards {
        gap: 0.4rem;
    }
    .card-link-tool {
        min-width: 0;
        flex: 1 1 calc(50% - 0.4rem);
        padding: 0.5rem 0.8rem;
    }
    .card-tool-svg {
        width: 22px;
        height: 22px;
    }
    .card-tool-title {
        font-size: 1rem;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .card-link-tool {
        flex: 1 1 100%;
    }
}
/* --- 8. Componentes del Modulador Diatónico (Estructura de Secciones y Listas) --- */

.label-origen {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    text-align: center;
}

.flex-center-gap {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.select-origen {
    flex: 1;
    max-width: 150px;
}

.lista-grados-vertical {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tarjeta-grado {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.cabecera-click {
    padding: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: #ffffff;
    user-select: none;
}

.flex-align-center-gap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flex-align-center-gap-small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.txt-destinos-contador {
    font-size: 0.95rem;
    color: #94a3b8;
    font-weight: 600;
}

.icono-flecha-desplegable {
    font-size: 1.2rem;
    font-weight: bold;
    color: #64748b;
    transition: transform 0.2s;
}

.cuerpo-desplegable {
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    padding: 1.2rem;
}

.txt-ninguno-md {
    text-align: center;
    padding: 0.5rem 0;
}

.flex-column-gap-large {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
/* --- 9. Componentes del Círculo de Quintas (Matriz Armónica y Estructura) --- */
.controles-panel-cq {
    display: flex; 
    gap: 2rem; 
    margin-bottom: 2rem;
}

.control-group-cq {
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    flex: 1;
}

.control-group-cq label {
    font-weight: 600; 
    color: #4a5568; 
    font-size: 1.1rem;
}

.control-group-cq select {
    padding: 0.9rem; 
    border-radius: 6px; 
    border: 2px solid #cbd5e0; 
    font-size: 1.2rem; 
    background: white; 
    color: #333;
}

.separador-cq {
    border: 0; 
    height: 1px; 
    background: #e2e8f0; 
    margin: 2rem 0;
}

.matriz-titulo-cq {
    margin-bottom: 0.5rem; 
    font-size: 1.4rem;
}

.matriz-titulo-cq span {
    color: #c9a052;
}

.banner-relativo-cq {
    margin-bottom: 1.5rem; 
    font-size: 1.15rem; 
    font-weight: 600; 
    color: #4a5568;
}

.banner-relativo-cq span {
    color: #c9a052; 
    font-weight: 700;
}

.tabla-responsiva-cq {
    overflow-x: auto; 
    border-radius: 8px; 
    background: white; 
    border: 1px solid #e2e8f0;
}

.tabla-armonica-cq {
    width: 100%; 
    border-collapse: collapse; 
    text-align: center; 
    min-width: 950px;
}

.tabla-armonica-cq th {
    background: #1a2332; 
    color: #c9a052; 
    padding: 1rem; 
    font-size: 1.2rem; 
    font-weight: 700;
}

.tabla-armonica-cq th.col-analisis-cq {
    background: #0d1420; 
    text-align: left; 
    width: 240px;
    color: #c9a052;
}

.tabla-armonica-cq td {
    padding: 1.25rem 0.75rem; 
    border-bottom: 1px solid #e2e8f0; 
    font-size: 1.15rem; 
    font-weight: 600; 
    vertical-align: middle;
}

.encabezado-fila-cq {
    background: #f7fafc; 
    text-align: left !important; 
    font-weight: 700 !important; 
    color: #4a5568; 
    border-right: 2px solid #e2e8f0;
}

.sub-label-cq {
    display: block; 
    font-size: 0.85rem; 
    color: #718096; 
    font-weight: 400; 
    margin-top: 0.15rem;
}

.celda-acorde-cq {
    display: inline-block; 
    background: #fef7e6; 
    padding: 0.5rem 0.75rem; 
    border-radius: 6px; 
    border: 1px solid #f0d78c;
}

.nota-txt-cq {
    font-size: 1.6rem; 
    font-weight: 800; 
    color: #1a2332;
}

.extension-txt-cq {
    font-size: 1.1rem; 
    font-weight: 700; 
    color: #c9a052;
}

.celda-relativo-cq {
    color: #2d3748; 
    font-weight: 700; 
    font-size: 1.2rem;
}

.celda-dominante-cq {
    color: #dd6b20; 
    font-size: 1.3rem; 
    font-weight: 700;
}

.celda-sustituto-cq {
    color: #9b2c2c; 
    font-size: 1.3rem; 
    font-weight: 700;
}

.tabla-armonica-cq tr:hover td:not(.encabezado-fila-cq) {
    background: #f8fafc;
}
/* --- 10. Componentes del Cifrador de Acordes y Piano Virtual --- */
.piano-container {
    max-width: 800px;
    margin: 0 auto;
}

.cifrador-top-bar {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.cifrador-actions-left {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.btn-cifrador {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(201,160,82,0.5);
    color: #c9a052;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    text-decoration: none;
}
.btn-cifrador:hover {
    background: #c9a052;
    color: #1a2332;
    border-color: #c9a052;
}
.btn-cifrador .btn-icon {
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
}

.badge-midi-cifrador {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    background: #1a2332;
    color: #c9a052;
    border: 1px solid rgba(201,160,82,0.3);
}

.display-chord-cifrador {
    width: 100%;
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 15px;
}

.label-chord-cifrador {
    font-size: 0.85em;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    font-family: sans-serif;
    font-weight: 600;
}

.chord-name-cifrador {
    font-size: 1.6em;
    font-weight: 800;
    color: #0f172a;
    font-family: 'Lato', sans-serif;
}

.pentagrama-holder {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.canvas-notation {
    width: 100%;
    max-width: 600px;
}

.piano-keyboard-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    background: #1a2332;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
    user-select: none;
}

.piano-keys-row {
    position: relative;
    display: flex;
    background: #1a2332;
}

.key-white {
    width: 38px;
    height: 150px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 4px 4px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.1s;
}

.key-white:active, .key-white.active {
    background: #cbd5e1;
}

.key-black {
    width: 24px;
    height: 90px;
    background: #0f172a;
    position: absolute;
    cursor: pointer;
    z-index: 10;
    border-radius: 0 0 3px 3px;
    box-sizing: border-box;
    transition: background 0.1s;
}

.key-black:active, .key-black.active {
    background: #475569;
}

/* --- 11. Botón y Modal de Ayuda --- */
.help-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #c9a052;
    color: #1a2332;
    font-size: 24px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
    line-height: 1;
}
.help-btn:hover {
    background: #1a2332;
    color: #c9a052;
    transform: scale(1.1);
}

.help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.help-overlay.help-open {
    display: flex;
}

.help-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 3px solid #1a2332;
}

.help-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    line-height: 1;
}
.help-close:hover {
    color: #1a2332;
}

.help-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 1.5rem;
    padding-right: 30px;
    text-decoration: underline;
}

.help-body {
    font-size: 1.4rem;
    line-height: 1.9;
    color: #444;
}
.help-body p {
    margin-bottom: 1.2rem;
}
.help-body ul, .help-body ol {
    margin: 0.5rem 0 1.2rem 2rem;
}
.help-body li {
    margin-bottom: 0.5rem;
}
.help-body strong {
    color: #1a2332;
}