* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Forzar tema claro para compatibilidad con embeds */
html {
    color-scheme: light !important;
    background: transparent !important;
}

/* Forzar colores específicos para elementos de texto en embeds */
.container * {
    color: inherit !important;
}

.container h1, 
.container h2, 
.container h3, 
.container h4, 
.container h5, 
.container h6 {
    color: #4a5568 !important;
}

.container label,
.container button,
.container input,
.container select {
    color: #2d3748 !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333 !important;
    margin: 0;
    padding: 0.5rem;
}

.container {
    background: #ffffff !important;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    margin: 0;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568 !important;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metronome {
    text-align: center;
}

.controls {
    margin-bottom: 2rem;
}

.controls-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    align-items: end;
}

.bpm-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.subdivision-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bpm-input-group label,
.subdivision-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 1.1rem;
}

#bpm-input {
    width: 100px;
    padding: 0.75rem 1rem;
    font-size: 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: #2d3748;
    transition: all 0.3s ease;
    background: white;
}

.subdivision-select {
    padding: 0.75rem 1rem;
    font-size: 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #2d3748;
    font-weight: 600;
    cursor: pointer;
    min-width: 130px;
    text-align: center;
}

#bpm-input:focus,
.subdivision-select:focus {
    outline: none;
    border-color: #1E1E20;
    box-shadow: 0 0 0 3px rgba(30, 30, 32, 0.1);
}

.beat-counter {
    margin: 1.5rem 0;
}

.beat-indicators {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.beat-dot {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    border: 3px solid transparent;
}

.beat-dot.active {
    background: #1E1E20;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(30, 30, 32, 0.3);
}

.beat-dot.accent {
    border-color: #f56565;
    background: linear-gradient(145deg, #f56565, #e53e3e);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(245, 101, 101, 0.4);
}

/* Subdivision Indicators */
.subdivision-indicators {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.subdivision-indicators > div {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
}

.subdivision-dot {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f7fafc;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 2px solid #e2e8f0;
}

.subdivision-dot.active {
    background: #1E1E20;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(30, 30, 32, 0.3);
}

.subdivision-dot.accent {
    border-color: #f56565;
    background: linear-gradient(145deg, #f56565, #e53e3e);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

.subdivision-dot.subdivision-beat {
    background: #e2e8f0;
    color: #4a5568;
    border-color: #cbd5e0;
}

/* Compound Time Indicators */
.compound-indicators {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.compound-indicators > div {
    position: relative;
    width: 100px;
    height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Primer círculo (pulso principal) centrado arriba */
.compound-indicators > div > .compound-dot:nth-child(1) {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Segundo círculo (subdivisión) abajo izquierda */
.compound-indicators > div > .compound-dot:nth-child(2) {
    position: absolute;
    top: 40px; /* 35px (altura círculo) + 0.3rem ≈ 5px = 40px */
    left: 15px;
}

/* Tercer círculo (subdivisión) abajo derecha */
.compound-indicators > div > .compound-dot:nth-child(3) {
    position: absolute;
    top: 40px; /* misma altura que el segundo */
    right: 15px;
}

.compound-dot {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f7fafc;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 2px solid #e2e8f0;
}

.compound-dot.active {
    background: #1E1E20;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(30, 30, 32, 0.3);
}

.compound-dot.accent {
    border-color: #f56565;
    background: linear-gradient(145deg, #f56565, #e53e3e);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

.compound-dot.beat {
    background: #e2e8f0;
    color: #4a5568;
    border-color: #cbd5e0;
    font-weight: 700;
}

/* Measure Sequence Styles */
.measure-sequence-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.measure-sequence-section h3 {
    text-align: center;
    color: #2d3748;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.measure-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.add-measure-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.time-signature-select {
    padding: 0.5rem;
    font-size: 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    background: white;
    color: #2d3748;
    font-weight: 600;
    cursor: pointer;
    min-width: 60px;
    text-align: center;
}

.measure-count-input {
    padding: 0.5rem;
    font-size: 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    background: white;
    color: #2d3748;
    font-weight: 600;
    width: 50px;
    text-align: center;
}

.add-measure-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.add-measure-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.clear-measures-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(145deg, #f56565, #e53e3e);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.clear-measures-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.measures-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.measure-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.3s ease;
    position: relative;
}

.measure-item.active {
    border-color: #1E1E20 !important;
    background: #1E1E20 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(30, 30, 32, 0.3);
}

.measure-item.active * {
    color: white !important;
}

.empty-measures-message {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 1rem;
    font-size: 0.9rem;
}

.measure-notation {
    font-size: 1rem;
}

.measure-count {
    font-size: 0.8rem;
    opacity: 0.8;
}

.remove-measure-btn {
    background: rgba(245, 101, 101, 0.1);
    color: #e53e3e;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
}

.remove-measure-btn:hover {
    background: #e53e3e;
    color: white;
}

.measure-item:first-child .remove-measure-btn {
    display: none;
}

.slider-container {
    margin-bottom: 2rem;
}

.bpm-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 1rem;
    cursor: pointer;
}

.bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #1E1E20;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(30, 30, 32, 0.3);
    transition: all 0.2s ease;
}

.bpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(30, 30, 32, 0.4);
}

.bpm-slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #1E1E20;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(30, 30, 32, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.play-controls {
    margin-bottom: 1rem;
}

#play-stop-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
    min-width: 150px;
}

#play-stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

#play-stop-btn:active {
    transform: translateY(0);
}

#play-stop-btn.stop-btn {
    background: linear-gradient(145deg, #f56565, #e53e3e);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

#play-stop-btn.stop-btn:hover {
    box-shadow: 0 6px 20px rgba(245, 101, 101, 0.4);
}

.beat-indicator {
    margin: 2rem 0;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

footer p {
    color: #718096;
    font-size: 0.9rem;
}

footer a {
    color: #1E1E20;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #2d3748;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        margin: 0.5rem;
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .bpm-input-group {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .subdivision-group {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    #bpm-input {
        width: 80px;
    }
    
    .subdivision-select {
        min-width: 110px;
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .beat-indicators {
        gap: 0.5rem;
    }
    
    .beat-dot {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .measure-sequence-section {
        padding: 1rem;
    }
    
    .measure-sequence-section h3 {
        font-size: 1.1rem;
    }
    
    .measure-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .add-measure-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .time-signature-select,
    .measure-count-input {
        font-size: 0.9rem;
        padding: 0.4rem;
    }
    
    .add-measure-btn,
    .clear-measures-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .measure-item {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .measure-notation {
        font-size: 0.9rem;
    }
    
    .remove-measure-btn {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    .subdivision-indicators {
        gap: 0.5rem;
    }
    
    .subdivision-indicators > div,
    .compound-indicators > div {
        width: 85px;
        height: 65px;
    }
    
    .subdivision-dot,
    .compound-dot {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .compound-indicators > div > .compound-dot:nth-child(2) {
        left: 10px;
        top: 37px; /* 32px (altura círculo responsivo) + 0.3rem ≈ 5px = 37px */
    }
    
    .compound-indicators > div > .compound-dot:nth-child(3) {
        right: 10px;
        top: 37px; /* misma altura que el segundo */
    }
    
    .compound-indicators {
        gap: 0.5rem;
    }
    
    #play-stop-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Estilos para Gestión de Secuencias */
.sequence-management-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid #dee2e6;
}

.sequence-management-section h3 {
    color: #2c3e50;
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    text-align: center;
}

.sequence-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.save-load-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.save-limit-indicator {
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    display: inline-block;
    transition: color 0.3s ease;
}

.save-sequence-btn,
.load-sequence-btn,
.share-sequence-btn,
.load-by-code-btn {
    padding: 0.6rem 1rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    background: white;
    color: #3498db;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.save-sequence-btn:hover,
.load-sequence-btn:hover,
.share-sequence-btn:hover,
.load-by-code-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

.save-sequence-btn {
    border-color: #27ae60;
    color: #27ae60;
}

.save-sequence-btn:hover {
    background: #27ae60;
}

.share-sequence-btn {
    border-color: #e74c3c;
    color: #e74c3c;
}

.share-sequence-btn:hover {
    background: #e74c3c;
}

.sequence-code-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.sequence-code-input {
    padding: 0.6rem;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 200px;
}

.sequence-code-input:focus {
    outline: none;
    border-color: #3498db;
}

.saved-sequences {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #dee2e6;
}

.saved-sequences h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1rem;
    text-align: center;
}

.sequences-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.sequence-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.sequence-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

/* Estilo para secuencias antiguas (más de 45 días) */
.sequence-item.sequence-old {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.sequence-item.sequence-old .sequence-details {
    color: #856404;
}

.sequence-item.sequence-old:hover {
    background: #ffeaa7;
    border-color: #fdcb6e;
}

.sequence-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.sequence-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.2rem;
}

.sequence-code,
.sequence-details {
    font-size: 0.8rem;
    color: #6c757d;
}

.sequence-actions {
    display: flex;
    gap: 0.3rem;
}

.load-sequence-item-btn,
.delete-sequence-btn,
.copy-code-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.load-sequence-item-btn {
    border-color: #3498db;
    color: #3498db;
}

.load-sequence-item-btn:hover {
    background: #3498db;
    color: white;
}

.copy-code-btn {
    border-color: #f39c12;
    color: #f39c12;
}

.copy-code-btn:hover {
    background: #f39c12;
    color: white;
}

.delete-sequence-btn {
    border-color: #e74c3c;
    color: #e74c3c;
}

.delete-sequence-btn:hover {
    background: #e74c3c;
    color: white;
}

/* Modal para guardar secuencias */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    text-align: center;
}

.modal-input-group {
    margin-bottom: 1rem;
}

.modal-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 600;
}

.modal-input-group input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-input-group input:focus {
    outline: none;
    border-color: #3498db;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.modal-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid;
    border-radius: 6px;
    background: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-primary {
    border-color: #27ae60;
    color: #27ae60;
}

.modal-btn-primary:hover {
    background: #27ae60;
    color: white;
}

.modal-btn-secondary {
    border-color: #bdc3c7;
    color: #7f8c8d;
}

.modal-btn-secondary:hover {
    background: #bdc3c7;
    color: white;
}

/* Responsivo para móviles */
@media (max-width: 480px) {
    .sequence-management-section {
        padding: 1rem;
    }
    
    .save-load-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .save-sequence-btn,
    .load-sequence-btn,
    .share-sequence-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .sequence-code-input {
        width: 100%;
    }
    
    .sequence-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .sequence-actions {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
}
